@kinotic-ai/kinotic-cli 1.0.0 → 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/README.md
CHANGED
|
@@ -12,7 +12,7 @@ $ npm install -g @kinotic-ai/kinotic-cli
|
|
|
12
12
|
$ kinotic COMMAND
|
|
13
13
|
running command...
|
|
14
14
|
$ kinotic (--version)
|
|
15
|
-
@kinotic-ai/kinotic-cli/1.0.
|
|
15
|
+
@kinotic-ai/kinotic-cli/1.0.2 darwin-arm64 node-v22.13.1
|
|
16
16
|
$ kinotic --help [COMMAND]
|
|
17
17
|
USAGE
|
|
18
18
|
$ kinotic COMMAND
|
|
@@ -122,7 +122,7 @@ EXAMPLES
|
|
|
122
122
|
$ kinotic gen -v
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
_See code: [src/commands/generate.ts](https://github.com/kinotic-ai/kinotic/blob/v1.0.
|
|
125
|
+
_See code: [src/commands/generate.ts](https://github.com/kinotic-ai/kinotic/blob/v1.0.2/src/commands/generate.ts)_
|
|
126
126
|
|
|
127
127
|
## `kinotic help [COMMAND]`
|
|
128
128
|
|
|
@@ -198,7 +198,7 @@ EXAMPLES
|
|
|
198
198
|
$ kinotic init -a my.app -e path/to/entities -g path/to/services
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
_See code: [src/commands/initialize.ts](https://github.com/kinotic-ai/kinotic/blob/v1.0.
|
|
201
|
+
_See code: [src/commands/initialize.ts](https://github.com/kinotic-ai/kinotic/blob/v1.0.2/src/commands/initialize.ts)_
|
|
202
202
|
|
|
203
203
|
## `kinotic plugins`
|
|
204
204
|
|
|
@@ -552,7 +552,7 @@ EXAMPLES
|
|
|
552
552
|
$ kinotic sync -p -v -s http://localhost:9090
|
|
553
553
|
```
|
|
554
554
|
|
|
555
|
-
_See code: [src/commands/synchronize.ts](https://github.com/kinotic-ai/kinotic/blob/v1.0.
|
|
555
|
+
_See code: [src/commands/synchronize.ts](https://github.com/kinotic-ai/kinotic/blob/v1.0.2/src/commands/synchronize.ts)_
|
|
556
556
|
|
|
557
557
|
## `kinotic update [CHANNEL]`
|
|
558
558
|
|
|
@@ -57,9 +57,9 @@ export class Synchronize extends Command {
|
|
|
57
57
|
namedQueries.push(...serviceInfo.namedQueries);
|
|
58
58
|
}
|
|
59
59
|
// We sync named queries first since currently the backend cache eviction logic is a little dumb
|
|
60
|
-
// i.e. The cache eviction for the
|
|
60
|
+
// i.e. The cache eviction for the EntityDefinition deletes the GraphQL schema
|
|
61
61
|
// This will evict the named query execution plan cache
|
|
62
|
-
// We want to make sure the GraphQL schema is updated after both these are updated and the
|
|
62
|
+
// We want to make sure the GraphQL schema is updated after both these are updated and the EntityDefinition below
|
|
63
63
|
if (!flags.dryRun && namedQueries.length > 0) {
|
|
64
64
|
await this.synchronizeNamedQueries(project.id, entityInfo.entity, namedQueries);
|
|
65
65
|
}
|
|
@@ -103,47 +103,47 @@ export class Synchronize extends Command {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
async synchronizeEntity(projectId,
|
|
106
|
+
async synchronizeEntity(projectId, entitySchema, publish, verbose) {
|
|
107
107
|
const entityDefinitionService = Kinotic.entityDefinitions;
|
|
108
|
-
const application =
|
|
109
|
-
const name =
|
|
110
|
-
const
|
|
108
|
+
const application = entitySchema.namespace;
|
|
109
|
+
const name = entitySchema.name;
|
|
110
|
+
const entityDefinitionId = (application + '.' + name).toLowerCase();
|
|
111
111
|
this.log(`Synchronizing Entity: ${application}.${name}`);
|
|
112
112
|
try {
|
|
113
|
-
let
|
|
114
|
-
if (
|
|
115
|
-
if (
|
|
113
|
+
let entityDefinition = await entityDefinitionService.findById(entityDefinitionId);
|
|
114
|
+
if (entityDefinition) {
|
|
115
|
+
if (entityDefinition.published) {
|
|
116
116
|
this.log(chalk.bold(`Entity ${chalk.blue(application + '.' + name)} is Published. ${chalk.yellow('(Supported Modifications: New Fields. Un-Publish for all other changes.)')}`));
|
|
117
117
|
}
|
|
118
118
|
// update existing entity
|
|
119
|
-
|
|
119
|
+
entityDefinition.schema = entitySchema;
|
|
120
120
|
this.logVerbose(`Updating Entity: ${application}.${name}`, verbose);
|
|
121
|
-
|
|
121
|
+
entityDefinition = await entityDefinitionService.save(entityDefinition);
|
|
122
122
|
}
|
|
123
123
|
else {
|
|
124
|
-
|
|
124
|
+
entityDefinition = new EntityDefinition(application, projectId, name, entitySchema);
|
|
125
125
|
this.logVerbose(`Creating Entity: ${application}.${name}`, verbose);
|
|
126
|
-
|
|
126
|
+
entityDefinition = await entityDefinitionService.create(entityDefinition);
|
|
127
127
|
}
|
|
128
128
|
// publish if we need to
|
|
129
|
-
if (!
|
|
129
|
+
if (!entityDefinition.published && publish && entityDefinition?.id) {
|
|
130
130
|
this.logVerbose(`Publishing Entity: ${application}.${name}`, verbose);
|
|
131
|
-
await entityDefinitionService.publish(
|
|
131
|
+
await entityDefinitionService.publish(entityDefinition.id);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
catch (e) {
|
|
135
135
|
const message = e?.message || e;
|
|
136
|
-
this.log(chalk.red('Error') + ` Synchronizing Entity: ${
|
|
136
|
+
this.log(chalk.red('Error') + ` Synchronizing Entity: ${entityDefinitionId}, Exception: ${message}`);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
async synchronizeNamedQueries(projectId,
|
|
139
|
+
async synchronizeNamedQueries(projectId, entitySchema, namedQueries) {
|
|
140
140
|
const namedQueriesService = Kinotic.namedQueriesDefinitions;
|
|
141
|
-
const application =
|
|
142
|
-
const
|
|
143
|
-
const id = (application + '.' +
|
|
144
|
-
this.log(`Synchronizing Named Queries for Entity: ${application}.${
|
|
141
|
+
const application = entitySchema.namespace;
|
|
142
|
+
const entityDefinitionName = entitySchema.name;
|
|
143
|
+
const id = (application + '.' + entityDefinitionName).toLowerCase();
|
|
144
|
+
this.log(`Synchronizing Named Queries for Entity: ${application}.${entityDefinitionName}`);
|
|
145
145
|
try {
|
|
146
|
-
const namedQueriesDefinition = new NamedQueriesDefinition(id, application, projectId,
|
|
146
|
+
const namedQueriesDefinition = new NamedQueriesDefinition(id, application, projectId, entityDefinitionName, namedQueries);
|
|
147
147
|
await namedQueriesService.save(namedQueriesDefinition);
|
|
148
148
|
}
|
|
149
149
|
catch (e) {
|
|
@@ -52,7 +52,7 @@ export class CodeGenerationService {
|
|
|
52
52
|
const convertedEntities = convertAllEntities(config);
|
|
53
53
|
if (convertedEntities.length > 0) {
|
|
54
54
|
for (const entityInfo of convertedEntities) {
|
|
55
|
-
this.logger.logVerbose(`Generated
|
|
55
|
+
this.logger.logVerbose(`Generated Persistence Mapping for ${entityInfo.entity.namespace}.${entityInfo.entity.name}`, config.verbose);
|
|
56
56
|
const generatedServices = [];
|
|
57
57
|
generatedServices.push(await this.generateEntityService(false, entityInfo, projectConfig));
|
|
58
58
|
if (entityInfo.multiTenantSelectionEnabled) {
|
|
@@ -142,7 +142,7 @@ export class CodeGenerationService {
|
|
|
142
142
|
const serviceClass = entityServiceSource.getClass(entityServiceName);
|
|
143
143
|
if (serviceClass) {
|
|
144
144
|
// Convert all methods that have a @Query decorator to a C3 FunctionDefinition
|
|
145
|
-
// These will be used to define the named queries for the
|
|
145
|
+
// These will be used to define the named queries for the EntityDefinition
|
|
146
146
|
for (const method of serviceClass?.getInstanceMethods()) {
|
|
147
147
|
const queryDecorator = method.getDecorator('Query');
|
|
148
148
|
if (queryDecorator) {
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kinotic-ai/kinotic-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Kinotic CLI provides the ability to interact with the Kinotic Server",
|
|
5
5
|
"author": "Kinotic Developers",
|
|
6
6
|
"bin": {
|
|
@@ -19,10 +19,10 @@
|
|
|
19
19
|
],
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@inquirer/prompts": "^8.3.2",
|
|
22
|
-
"@kinotic-ai/core": "^1.0.
|
|
23
|
-
"@kinotic-ai/idl": "^1.0.
|
|
24
|
-
"@kinotic-ai/os-api": "^1.0.
|
|
25
|
-
"@kinotic-ai/persistence": "^1.0.
|
|
22
|
+
"@kinotic-ai/core": "^1.0.8",
|
|
23
|
+
"@kinotic-ai/idl": "^1.0.8",
|
|
24
|
+
"@kinotic-ai/os-api": "^1.0.8",
|
|
25
|
+
"@kinotic-ai/persistence": "^1.0.8",
|
|
26
26
|
"@oclif/core": "^4.9.0",
|
|
27
27
|
"@oclif/plugin-autocomplete": "^3.2.41",
|
|
28
28
|
"@oclif/plugin-help": "^6",
|