@ingenyus/swarm-wasp 0.2.6 → 0.2.7
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/.tsbuildinfo +1 -1
- package/dist/generators/action/action-generator.js +15 -13
- package/dist/generators/action/index.js +15 -13
- package/dist/generators/api/api-generator.d.ts.map +1 -1
- package/dist/generators/api/api-generator.js +17 -11
- package/dist/generators/api/index.js +17 -11
- package/dist/generators/api-namespace/api-namespace-generator.d.ts.map +1 -1
- package/dist/generators/api-namespace/api-namespace-generator.js +36 -26
- package/dist/generators/api-namespace/index.js +36 -26
- package/dist/generators/api-namespace/templates/config/api-namespace.eta +1 -1
- package/dist/generators/base/component-generator.base.d.ts.map +1 -1
- package/dist/generators/base/component-generator.base.js +12 -10
- package/dist/generators/base/index.js +15 -13
- package/dist/generators/base/operation-generator.base.d.ts +1 -1
- package/dist/generators/base/operation-generator.base.js +15 -13
- package/dist/generators/crud/crud-generator.js +15 -13
- package/dist/generators/crud/index.js +15 -13
- package/dist/generators/index.js +30 -18
- package/dist/generators/job/index.js +12 -10
- package/dist/generators/job/job-generator.js +12 -10
- package/dist/generators/query/index.js +15 -13
- package/dist/generators/query/query-generator.js +15 -13
- package/dist/generators/route/index.js +12 -10
- package/dist/generators/route/route-generator.js +12 -10
- package/dist/generators/{api-namespace/templates → shared/templates/middleware}/middleware.eta +1 -6
- package/dist/index.js +32 -20
- package/dist/wasp-config/app.d.ts +1 -1
- package/dist/wasp-config/app.d.ts.map +1 -1
- package/dist/wasp-config/app.js +2 -2
- package/dist/wasp-config/index.js +2 -2
- package/package.json +2 -2
- package/dist/generators/operation/templates/config/operation.eta +0 -6
- /package/dist/generators/{operation/templates → shared/templates/operations}/create.eta +0 -0
- /package/dist/generators/{operation/templates → shared/templates/operations}/delete.eta +0 -0
- /package/dist/generators/{operation/templates → shared/templates/operations}/get.eta +0 -0
- /package/dist/generators/{operation/templates → shared/templates/operations}/getAll.eta +0 -0
- /package/dist/generators/{operation/templates → shared/templates/operations}/getFiltered.eta +0 -0
- /package/dist/generators/{operation/templates → shared/templates/operations}/update.eta +0 -0
|
@@ -205,7 +205,6 @@ var TemplateUtility = class {
|
|
|
205
205
|
import {
|
|
206
206
|
GeneratorRuntime,
|
|
207
207
|
hasHelperMethodCall,
|
|
208
|
-
toCamelCase,
|
|
209
208
|
toKebabCase as toKebabCase2,
|
|
210
209
|
validateFeaturePath as validateFeaturePath3
|
|
211
210
|
} from "@ingenyus/swarm";
|
|
@@ -932,17 +931,20 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
|
|
|
932
931
|
* Generate middleware file for API or API namespace
|
|
933
932
|
*/
|
|
934
933
|
async generateMiddlewareFile(targetFile, name, force) {
|
|
935
|
-
const
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
replacements,
|
|
934
|
+
const templatePath = this.templateUtility.resolveTemplatePath(
|
|
935
|
+
"middleware/middleware.eta",
|
|
936
|
+
"shared",
|
|
937
|
+
import.meta.url
|
|
938
|
+
);
|
|
939
|
+
const fileExists = this.checkFileExists(
|
|
942
940
|
targetFile,
|
|
943
|
-
|
|
944
|
-
|
|
941
|
+
force,
|
|
942
|
+
"Middleware file"
|
|
945
943
|
);
|
|
944
|
+
const content = this.templateUtility.processTemplate(templatePath, {
|
|
945
|
+
name
|
|
946
|
+
});
|
|
947
|
+
this.writeFile(targetFile, content, "Middleware file", fileExists);
|
|
946
948
|
}
|
|
947
949
|
};
|
|
948
950
|
|
|
@@ -999,7 +1001,11 @@ var ApiGenerator = class extends ComponentGeneratorBase {
|
|
|
999
1001
|
const targetFile = `${apiTargetDirectory}/${fileName}`;
|
|
1000
1002
|
await this.generateApiFile(targetFile, apiName, args);
|
|
1001
1003
|
if (args.customMiddleware) {
|
|
1002
|
-
const
|
|
1004
|
+
const middlewareTargetDirectory = this.path.join(
|
|
1005
|
+
apiTargetDirectory,
|
|
1006
|
+
"middleware"
|
|
1007
|
+
);
|
|
1008
|
+
ensureDirectoryExists(this.fileSystem, middlewareTargetDirectory);
|
|
1003
1009
|
const middlewareFile = `${middlewareTargetDirectory}/${apiName}.ts`;
|
|
1004
1010
|
this.generateMiddlewareFile(
|
|
1005
1011
|
middlewareFile,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-namespace-generator.d.ts","sourceRoot":"","sources":["../../../src/generators/api-namespace/api-namespace-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAe,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"api-namespace-generator.d.ts","sourceRoot":"","sources":["../../../src/generators/api-namespace/api-namespace-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAe,MAAM,iBAAiB,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,qBAAa,qBAAsB,SAAQ,sBAAsB,CAC/D,OAAO,MAAM,EACb,OAAO,YAAY,CAAC,aAAa,CAClC;IACC,SAAS,KAAK,aAAa,mBAE1B;IAED,WAAW,SAAoC;IAC/C,MAAM;;;;;qCAAU;IAEV,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;YAuCzC,gBAAgB;IAyB9B;;OAEG;IACG,aAAa,CACjB,aAAa,EAAE,MAAM,EACrB,oBAAoB,EAAE,MAAM,EAC5B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC;CAanB"}
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import { toCamelCase as toCamelCase2 } from "@ingenyus/swarm";
|
|
3
3
|
import path7 from "path";
|
|
4
4
|
|
|
5
|
+
// src/common/filesystem.ts
|
|
6
|
+
import { toPascalCase, validateFeaturePath } from "@ingenyus/swarm";
|
|
7
|
+
import fs from "fs";
|
|
8
|
+
import path from "path";
|
|
9
|
+
|
|
5
10
|
// src/types/constants.ts
|
|
6
11
|
var PLUGIN_NAME = "wasp";
|
|
7
12
|
var TYPE_DIRECTORIES = {
|
|
@@ -28,20 +33,7 @@ var CONFIG_TYPES = {
|
|
|
28
33
|
CRUD: "Crud"
|
|
29
34
|
};
|
|
30
35
|
|
|
31
|
-
// src/generators/base/component-generator.base.ts
|
|
32
|
-
import {
|
|
33
|
-
GeneratorRuntime,
|
|
34
|
-
hasHelperMethodCall,
|
|
35
|
-
toCamelCase,
|
|
36
|
-
toKebabCase as toKebabCase2,
|
|
37
|
-
validateFeaturePath as validateFeaturePath3
|
|
38
|
-
} from "@ingenyus/swarm";
|
|
39
|
-
import path6 from "path";
|
|
40
|
-
|
|
41
36
|
// src/common/filesystem.ts
|
|
42
|
-
import { toPascalCase, validateFeaturePath } from "@ingenyus/swarm";
|
|
43
|
-
import fs from "fs";
|
|
44
|
-
import path from "path";
|
|
45
37
|
var realFileSystem = {
|
|
46
38
|
readFileSync: fs.readFileSync,
|
|
47
39
|
writeFileSync: fs.writeFileSync,
|
|
@@ -199,6 +191,15 @@ var TemplateUtility = class {
|
|
|
199
191
|
}
|
|
200
192
|
};
|
|
201
193
|
|
|
194
|
+
// src/generators/base/component-generator.base.ts
|
|
195
|
+
import {
|
|
196
|
+
GeneratorRuntime,
|
|
197
|
+
hasHelperMethodCall,
|
|
198
|
+
toKebabCase as toKebabCase2,
|
|
199
|
+
validateFeaturePath as validateFeaturePath3
|
|
200
|
+
} from "@ingenyus/swarm";
|
|
201
|
+
import path6 from "path";
|
|
202
|
+
|
|
202
203
|
// src/generators/feature/feature-generator.ts
|
|
203
204
|
import { handleFatalError as handleFatalError2, validateFeaturePath as validateFeaturePath2 } from "@ingenyus/swarm";
|
|
204
205
|
import path5 from "path";
|
|
@@ -920,17 +921,20 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
|
|
|
920
921
|
* Generate middleware file for API or API namespace
|
|
921
922
|
*/
|
|
922
923
|
async generateMiddlewareFile(targetFile, name, force) {
|
|
923
|
-
const
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
replacements,
|
|
924
|
+
const templatePath = this.templateUtility.resolveTemplatePath(
|
|
925
|
+
"middleware/middleware.eta",
|
|
926
|
+
"shared",
|
|
927
|
+
import.meta.url
|
|
928
|
+
);
|
|
929
|
+
const fileExists = this.checkFileExists(
|
|
930
930
|
targetFile,
|
|
931
|
-
|
|
932
|
-
|
|
931
|
+
force,
|
|
932
|
+
"Middleware file"
|
|
933
933
|
);
|
|
934
|
+
const content = this.templateUtility.processTemplate(templatePath, {
|
|
935
|
+
name
|
|
936
|
+
});
|
|
937
|
+
this.writeFile(targetFile, content, "Middleware file", fileExists);
|
|
934
938
|
}
|
|
935
939
|
};
|
|
936
940
|
|
|
@@ -966,11 +970,17 @@ var ApiNamespaceGenerator = class extends ComponentGeneratorBase {
|
|
|
966
970
|
namespaceName,
|
|
967
971
|
async () => {
|
|
968
972
|
const configPath = this.validateFeatureConfig(feature);
|
|
969
|
-
const {
|
|
970
|
-
|
|
973
|
+
const {
|
|
974
|
+
targetDirectory: apiTargetDirectory,
|
|
975
|
+
importDirectory: apiImportDirectory
|
|
976
|
+
} = this.ensureTargetDirectory(feature, "api");
|
|
977
|
+
const middlewareTargetDirectory = path7.join(
|
|
978
|
+
apiTargetDirectory,
|
|
971
979
|
"middleware"
|
|
972
980
|
);
|
|
973
|
-
|
|
981
|
+
ensureDirectoryExists(this.fileSystem, middlewareTargetDirectory);
|
|
982
|
+
const importDirectory = `${apiImportDirectory}/middleware`;
|
|
983
|
+
const targetFile = `${middlewareTargetDirectory}/${namespaceName}.ts`;
|
|
974
984
|
await this.generateMiddlewareFile(
|
|
975
985
|
targetFile,
|
|
976
986
|
namespaceName,
|
|
@@ -988,7 +998,7 @@ var ApiNamespaceGenerator = class extends ComponentGeneratorBase {
|
|
|
988
998
|
}
|
|
989
999
|
async updateConfigFile(namespaceName, importDirectory, namespacePath, args, configFilePath) {
|
|
990
1000
|
const { force = false } = args;
|
|
991
|
-
const importPath =
|
|
1001
|
+
const importPath = `${importDirectory}/${namespaceName}`;
|
|
992
1002
|
const definition = await this.getDefinition(
|
|
993
1003
|
namespaceName,
|
|
994
1004
|
importPath,
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
import { toCamelCase as toCamelCase2 } from "@ingenyus/swarm";
|
|
3
3
|
import path7 from "path";
|
|
4
4
|
|
|
5
|
+
// src/common/filesystem.ts
|
|
6
|
+
import { toPascalCase, validateFeaturePath } from "@ingenyus/swarm";
|
|
7
|
+
import fs from "fs";
|
|
8
|
+
import path from "path";
|
|
9
|
+
|
|
5
10
|
// src/types/constants.ts
|
|
6
11
|
var PLUGIN_NAME = "wasp";
|
|
7
12
|
var TYPE_DIRECTORIES = {
|
|
@@ -28,20 +33,7 @@ var CONFIG_TYPES = {
|
|
|
28
33
|
CRUD: "Crud"
|
|
29
34
|
};
|
|
30
35
|
|
|
31
|
-
// src/generators/base/component-generator.base.ts
|
|
32
|
-
import {
|
|
33
|
-
GeneratorRuntime,
|
|
34
|
-
hasHelperMethodCall,
|
|
35
|
-
toCamelCase,
|
|
36
|
-
toKebabCase as toKebabCase2,
|
|
37
|
-
validateFeaturePath as validateFeaturePath3
|
|
38
|
-
} from "@ingenyus/swarm";
|
|
39
|
-
import path6 from "path";
|
|
40
|
-
|
|
41
36
|
// src/common/filesystem.ts
|
|
42
|
-
import { toPascalCase, validateFeaturePath } from "@ingenyus/swarm";
|
|
43
|
-
import fs from "fs";
|
|
44
|
-
import path from "path";
|
|
45
37
|
var realFileSystem = {
|
|
46
38
|
readFileSync: fs.readFileSync,
|
|
47
39
|
writeFileSync: fs.writeFileSync,
|
|
@@ -199,6 +191,15 @@ var TemplateUtility = class {
|
|
|
199
191
|
}
|
|
200
192
|
};
|
|
201
193
|
|
|
194
|
+
// src/generators/base/component-generator.base.ts
|
|
195
|
+
import {
|
|
196
|
+
GeneratorRuntime,
|
|
197
|
+
hasHelperMethodCall,
|
|
198
|
+
toKebabCase as toKebabCase2,
|
|
199
|
+
validateFeaturePath as validateFeaturePath3
|
|
200
|
+
} from "@ingenyus/swarm";
|
|
201
|
+
import path6 from "path";
|
|
202
|
+
|
|
202
203
|
// src/generators/feature/feature-generator.ts
|
|
203
204
|
import { handleFatalError as handleFatalError2, validateFeaturePath as validateFeaturePath2 } from "@ingenyus/swarm";
|
|
204
205
|
import path5 from "path";
|
|
@@ -920,17 +921,20 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
|
|
|
920
921
|
* Generate middleware file for API or API namespace
|
|
921
922
|
*/
|
|
922
923
|
async generateMiddlewareFile(targetFile, name, force) {
|
|
923
|
-
const
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
replacements,
|
|
924
|
+
const templatePath = this.templateUtility.resolveTemplatePath(
|
|
925
|
+
"middleware/middleware.eta",
|
|
926
|
+
"shared",
|
|
927
|
+
import.meta.url
|
|
928
|
+
);
|
|
929
|
+
const fileExists = this.checkFileExists(
|
|
930
930
|
targetFile,
|
|
931
|
-
|
|
932
|
-
|
|
931
|
+
force,
|
|
932
|
+
"Middleware file"
|
|
933
933
|
);
|
|
934
|
+
const content = this.templateUtility.processTemplate(templatePath, {
|
|
935
|
+
name
|
|
936
|
+
});
|
|
937
|
+
this.writeFile(targetFile, content, "Middleware file", fileExists);
|
|
934
938
|
}
|
|
935
939
|
};
|
|
936
940
|
|
|
@@ -966,11 +970,17 @@ var ApiNamespaceGenerator = class extends ComponentGeneratorBase {
|
|
|
966
970
|
namespaceName,
|
|
967
971
|
async () => {
|
|
968
972
|
const configPath = this.validateFeatureConfig(feature);
|
|
969
|
-
const {
|
|
970
|
-
|
|
973
|
+
const {
|
|
974
|
+
targetDirectory: apiTargetDirectory,
|
|
975
|
+
importDirectory: apiImportDirectory
|
|
976
|
+
} = this.ensureTargetDirectory(feature, "api");
|
|
977
|
+
const middlewareTargetDirectory = path7.join(
|
|
978
|
+
apiTargetDirectory,
|
|
971
979
|
"middleware"
|
|
972
980
|
);
|
|
973
|
-
|
|
981
|
+
ensureDirectoryExists(this.fileSystem, middlewareTargetDirectory);
|
|
982
|
+
const importDirectory = `${apiImportDirectory}/middleware`;
|
|
983
|
+
const targetFile = `${middlewareTargetDirectory}/${namespaceName}.ts`;
|
|
974
984
|
await this.generateMiddlewareFile(
|
|
975
985
|
targetFile,
|
|
976
986
|
namespaceName,
|
|
@@ -988,7 +998,7 @@ var ApiNamespaceGenerator = class extends ComponentGeneratorBase {
|
|
|
988
998
|
}
|
|
989
999
|
async updateConfigFile(namespaceName, importDirectory, namespacePath, args, configFilePath) {
|
|
990
1000
|
const { force = false } = args;
|
|
991
|
-
const importPath =
|
|
1001
|
+
const importPath = `${importDirectory}/${namespaceName}`;
|
|
992
1002
|
const definition = await this.getDefinition(
|
|
993
1003
|
namespaceName,
|
|
994
1004
|
importPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-generator.base.d.ts","sourceRoot":"","sources":["../../../src/generators/base/component-generator.base.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EAIf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAM9B,OAAO,EAAE,UAAU,EAAoB,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;GAEG;AACH,8BAAsB,sBAAsB,CAC1C,CAAC,SAAS,OAAO,EACjB,OAAO,SAAS,UAAU,CAC1B,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IAC5B,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAE1C,SAAS,CAAC,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAQ9D,SAAS,CAAC,yBAAyB,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC;;IAmB1E,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,SAAS,CAAC,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IA4B5D;;OAEG;IACH,SAAS,CAAC,iBAAiB,CACzB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,GACb,OAAO;IAgBV;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAC3B,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,OAAO,EACrB,UAAU,EAAE,MAAM,GACjB,IAAI;IAOP;;;OAGG;IACH,SAAS,CAAC,qBAAqB,CAC7B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,OAAO,GACb,IAAI;IAmBP;;;;;OAKG;IACH,SAAS,CAAC,mBAAmB,CAC3B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,GACX;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE;IAavD;;OAEG;IACH,SAAS,CAAC,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;;;;IAWjE;;OAEG;cACa,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"component-generator.base.d.ts","sourceRoot":"","sources":["../../../src/generators/base/component-generator.base.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,cAAc,EAIf,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAM9B,OAAO,EAAE,UAAU,EAAoB,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,MAAM,IAAI,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D;;GAEG;AACH,8BAAsB,sBAAsB,CAC1C,CAAC,SAAS,OAAO,EACjB,OAAO,SAAS,UAAU,CAC1B,SAAQ,iBAAiB,CAAC,CAAC,CAAC;IAC5B,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAE1C,SAAS,CAAC,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM;IAQ9D,SAAS,CAAC,yBAAyB,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,CAAC;;IAmB1E,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;OAEG;IACH,SAAS,CAAC,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM;IA4B5D;;OAEG;IACH,SAAS,CAAC,iBAAiB,CACzB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,GACb,OAAO;IAgBV;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAC3B,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,YAAY,EAAE,OAAO,EACrB,UAAU,EAAE,MAAM,GACjB,IAAI;IAOP;;;OAGG;IACH,SAAS,CAAC,qBAAqB,CAC7B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,OAAO,GACb,IAAI;IAmBP;;;;;OAKG;IACH,SAAS,CAAC,mBAAmB,CAC3B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,GACX;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE;IAavD;;OAEG;IACH,SAAS,CAAC,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;;;;IAWjE;;OAEG;cACa,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,IAAI,CAAC;CAmBjB"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import {
|
|
3
3
|
GeneratorRuntime,
|
|
4
4
|
hasHelperMethodCall,
|
|
5
|
-
toCamelCase,
|
|
6
5
|
toKebabCase as toKebabCase2,
|
|
7
6
|
validateFeaturePath as validateFeaturePath3
|
|
8
7
|
} from "@ingenyus/swarm";
|
|
@@ -909,17 +908,20 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
|
|
|
909
908
|
* Generate middleware file for API or API namespace
|
|
910
909
|
*/
|
|
911
910
|
async generateMiddlewareFile(targetFile, name, force) {
|
|
912
|
-
const
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
replacements,
|
|
911
|
+
const templatePath = this.templateUtility.resolveTemplatePath(
|
|
912
|
+
"middleware/middleware.eta",
|
|
913
|
+
"shared",
|
|
914
|
+
import.meta.url
|
|
915
|
+
);
|
|
916
|
+
const fileExists = this.checkFileExists(
|
|
919
917
|
targetFile,
|
|
920
|
-
|
|
921
|
-
|
|
918
|
+
force,
|
|
919
|
+
"Middleware file"
|
|
922
920
|
);
|
|
921
|
+
const content = this.templateUtility.processTemplate(templatePath, {
|
|
922
|
+
name
|
|
923
|
+
});
|
|
924
|
+
this.writeFile(targetFile, content, "Middleware file", fileExists);
|
|
923
925
|
}
|
|
924
926
|
};
|
|
925
927
|
export {
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import {
|
|
3
3
|
GeneratorRuntime,
|
|
4
4
|
hasHelperMethodCall,
|
|
5
|
-
toCamelCase,
|
|
6
5
|
toKebabCase as toKebabCase2,
|
|
7
6
|
validateFeaturePath as validateFeaturePath3
|
|
8
7
|
} from "@ingenyus/swarm";
|
|
@@ -1058,17 +1057,20 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
|
|
|
1058
1057
|
* Generate middleware file for API or API namespace
|
|
1059
1058
|
*/
|
|
1060
1059
|
async generateMiddlewareFile(targetFile, name, force) {
|
|
1061
|
-
const
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
replacements,
|
|
1060
|
+
const templatePath = this.templateUtility.resolveTemplatePath(
|
|
1061
|
+
"middleware/middleware.eta",
|
|
1062
|
+
"shared",
|
|
1063
|
+
import.meta.url
|
|
1064
|
+
);
|
|
1065
|
+
const fileExists = this.checkFileExists(
|
|
1068
1066
|
targetFile,
|
|
1069
|
-
|
|
1070
|
-
|
|
1067
|
+
force,
|
|
1068
|
+
"Middleware file"
|
|
1071
1069
|
);
|
|
1070
|
+
const content = this.templateUtility.processTemplate(templatePath, {
|
|
1071
|
+
name
|
|
1072
|
+
});
|
|
1073
|
+
this.writeFile(targetFile, content, "Middleware file", fileExists);
|
|
1072
1074
|
}
|
|
1073
1075
|
};
|
|
1074
1076
|
|
|
@@ -1098,13 +1100,13 @@ var OperationGeneratorBase = class extends ComponentGeneratorBase {
|
|
|
1098
1100
|
}
|
|
1099
1101
|
/**
|
|
1100
1102
|
* Gets the template path for operation templates.
|
|
1101
|
-
* This method resolves operation templates to the
|
|
1103
|
+
* This method resolves operation templates to the shared templates directory
|
|
1102
1104
|
* instead of the current generator's directory.
|
|
1103
1105
|
*/
|
|
1104
1106
|
getOperationTemplatePath(templateName) {
|
|
1105
1107
|
return this.templateUtility.resolveTemplatePath(
|
|
1106
|
-
templateName
|
|
1107
|
-
"
|
|
1108
|
+
`operations/${templateName}`,
|
|
1109
|
+
"shared",
|
|
1108
1110
|
import.meta.url
|
|
1109
1111
|
);
|
|
1110
1112
|
}
|
|
@@ -21,7 +21,7 @@ export declare abstract class OperationGeneratorBase<S extends ZodType, TConfig
|
|
|
21
21
|
getOperationName(operation: ActionOperation | QueryOperation, modelName: string, customName?: string): string;
|
|
22
22
|
/**
|
|
23
23
|
* Gets the template path for operation templates.
|
|
24
|
-
* This method resolves operation templates to the
|
|
24
|
+
* This method resolves operation templates to the shared templates directory
|
|
25
25
|
* instead of the current generator's directory.
|
|
26
26
|
*/
|
|
27
27
|
protected getOperationTemplatePath(templateName: string): string;
|
|
@@ -339,7 +339,6 @@ var TemplateUtility = class {
|
|
|
339
339
|
import {
|
|
340
340
|
GeneratorRuntime,
|
|
341
341
|
hasHelperMethodCall,
|
|
342
|
-
toCamelCase,
|
|
343
342
|
toKebabCase as toKebabCase2,
|
|
344
343
|
validateFeaturePath as validateFeaturePath3
|
|
345
344
|
} from "@ingenyus/swarm";
|
|
@@ -1066,17 +1065,20 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
|
|
|
1066
1065
|
* Generate middleware file for API or API namespace
|
|
1067
1066
|
*/
|
|
1068
1067
|
async generateMiddlewareFile(targetFile, name, force) {
|
|
1069
|
-
const
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
replacements,
|
|
1068
|
+
const templatePath = this.templateUtility.resolveTemplatePath(
|
|
1069
|
+
"middleware/middleware.eta",
|
|
1070
|
+
"shared",
|
|
1071
|
+
import.meta.url
|
|
1072
|
+
);
|
|
1073
|
+
const fileExists = this.checkFileExists(
|
|
1076
1074
|
targetFile,
|
|
1077
|
-
|
|
1078
|
-
|
|
1075
|
+
force,
|
|
1076
|
+
"Middleware file"
|
|
1079
1077
|
);
|
|
1078
|
+
const content = this.templateUtility.processTemplate(templatePath, {
|
|
1079
|
+
name
|
|
1080
|
+
});
|
|
1081
|
+
this.writeFile(targetFile, content, "Middleware file", fileExists);
|
|
1080
1082
|
}
|
|
1081
1083
|
};
|
|
1082
1084
|
|
|
@@ -1100,13 +1102,13 @@ var OperationGeneratorBase = class extends ComponentGeneratorBase {
|
|
|
1100
1102
|
}
|
|
1101
1103
|
/**
|
|
1102
1104
|
* Gets the template path for operation templates.
|
|
1103
|
-
* This method resolves operation templates to the
|
|
1105
|
+
* This method resolves operation templates to the shared templates directory
|
|
1104
1106
|
* instead of the current generator's directory.
|
|
1105
1107
|
*/
|
|
1106
1108
|
getOperationTemplatePath(templateName) {
|
|
1107
1109
|
return this.templateUtility.resolveTemplatePath(
|
|
1108
|
-
templateName
|
|
1109
|
-
"
|
|
1110
|
+
`operations/${templateName}`,
|
|
1111
|
+
"shared",
|
|
1110
1112
|
import.meta.url
|
|
1111
1113
|
);
|
|
1112
1114
|
}
|
|
@@ -350,7 +350,6 @@ var TemplateUtility = class {
|
|
|
350
350
|
import {
|
|
351
351
|
GeneratorRuntime,
|
|
352
352
|
hasHelperMethodCall,
|
|
353
|
-
toCamelCase,
|
|
354
353
|
toKebabCase as toKebabCase2,
|
|
355
354
|
validateFeaturePath as validateFeaturePath3
|
|
356
355
|
} from "@ingenyus/swarm";
|
|
@@ -1077,17 +1076,20 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
|
|
|
1077
1076
|
* Generate middleware file for API or API namespace
|
|
1078
1077
|
*/
|
|
1079
1078
|
async generateMiddlewareFile(targetFile, name, force) {
|
|
1080
|
-
const
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
replacements,
|
|
1079
|
+
const templatePath = this.templateUtility.resolveTemplatePath(
|
|
1080
|
+
"middleware/middleware.eta",
|
|
1081
|
+
"shared",
|
|
1082
|
+
import.meta.url
|
|
1083
|
+
);
|
|
1084
|
+
const fileExists = this.checkFileExists(
|
|
1087
1085
|
targetFile,
|
|
1088
|
-
|
|
1089
|
-
|
|
1086
|
+
force,
|
|
1087
|
+
"Middleware file"
|
|
1090
1088
|
);
|
|
1089
|
+
const content = this.templateUtility.processTemplate(templatePath, {
|
|
1090
|
+
name
|
|
1091
|
+
});
|
|
1092
|
+
this.writeFile(targetFile, content, "Middleware file", fileExists);
|
|
1091
1093
|
}
|
|
1092
1094
|
};
|
|
1093
1095
|
|
|
@@ -1117,13 +1119,13 @@ var OperationGeneratorBase = class extends ComponentGeneratorBase {
|
|
|
1117
1119
|
}
|
|
1118
1120
|
/**
|
|
1119
1121
|
* Gets the template path for operation templates.
|
|
1120
|
-
* This method resolves operation templates to the
|
|
1122
|
+
* This method resolves operation templates to the shared templates directory
|
|
1121
1123
|
* instead of the current generator's directory.
|
|
1122
1124
|
*/
|
|
1123
1125
|
getOperationTemplatePath(templateName) {
|
|
1124
1126
|
return this.templateUtility.resolveTemplatePath(
|
|
1125
|
-
templateName
|
|
1126
|
-
"
|
|
1127
|
+
`operations/${templateName}`,
|
|
1128
|
+
"shared",
|
|
1127
1129
|
import.meta.url
|
|
1128
1130
|
);
|
|
1129
1131
|
}
|
|
@@ -350,7 +350,6 @@ var TemplateUtility = class {
|
|
|
350
350
|
import {
|
|
351
351
|
GeneratorRuntime,
|
|
352
352
|
hasHelperMethodCall,
|
|
353
|
-
toCamelCase,
|
|
354
353
|
toKebabCase as toKebabCase2,
|
|
355
354
|
validateFeaturePath as validateFeaturePath3
|
|
356
355
|
} from "@ingenyus/swarm";
|
|
@@ -1077,17 +1076,20 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
|
|
|
1077
1076
|
* Generate middleware file for API or API namespace
|
|
1078
1077
|
*/
|
|
1079
1078
|
async generateMiddlewareFile(targetFile, name, force) {
|
|
1080
|
-
const
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
replacements,
|
|
1079
|
+
const templatePath = this.templateUtility.resolveTemplatePath(
|
|
1080
|
+
"middleware/middleware.eta",
|
|
1081
|
+
"shared",
|
|
1082
|
+
import.meta.url
|
|
1083
|
+
);
|
|
1084
|
+
const fileExists = this.checkFileExists(
|
|
1087
1085
|
targetFile,
|
|
1088
|
-
|
|
1089
|
-
|
|
1086
|
+
force,
|
|
1087
|
+
"Middleware file"
|
|
1090
1088
|
);
|
|
1089
|
+
const content = this.templateUtility.processTemplate(templatePath, {
|
|
1090
|
+
name
|
|
1091
|
+
});
|
|
1092
|
+
this.writeFile(targetFile, content, "Middleware file", fileExists);
|
|
1091
1093
|
}
|
|
1092
1094
|
};
|
|
1093
1095
|
|
|
@@ -1117,13 +1119,13 @@ var OperationGeneratorBase = class extends ComponentGeneratorBase {
|
|
|
1117
1119
|
}
|
|
1118
1120
|
/**
|
|
1119
1121
|
* Gets the template path for operation templates.
|
|
1120
|
-
* This method resolves operation templates to the
|
|
1122
|
+
* This method resolves operation templates to the shared templates directory
|
|
1121
1123
|
* instead of the current generator's directory.
|
|
1122
1124
|
*/
|
|
1123
1125
|
getOperationTemplatePath(templateName) {
|
|
1124
1126
|
return this.templateUtility.resolveTemplatePath(
|
|
1125
|
-
templateName
|
|
1126
|
-
"
|
|
1127
|
+
`operations/${templateName}`,
|
|
1128
|
+
"shared",
|
|
1127
1129
|
import.meta.url
|
|
1128
1130
|
);
|
|
1129
1131
|
}
|
package/dist/generators/index.js
CHANGED
|
@@ -61,7 +61,6 @@ var CONFIG_TYPES = {
|
|
|
61
61
|
import {
|
|
62
62
|
GeneratorRuntime,
|
|
63
63
|
hasHelperMethodCall,
|
|
64
|
-
toCamelCase,
|
|
65
64
|
toKebabCase as toKebabCase2,
|
|
66
65
|
validateFeaturePath as validateFeaturePath3
|
|
67
66
|
} from "@ingenyus/swarm";
|
|
@@ -1094,17 +1093,20 @@ var ComponentGeneratorBase = class extends WaspGeneratorBase {
|
|
|
1094
1093
|
* Generate middleware file for API or API namespace
|
|
1095
1094
|
*/
|
|
1096
1095
|
async generateMiddlewareFile(targetFile, name, force) {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
replacements,
|
|
1096
|
+
const templatePath = this.templateUtility.resolveTemplatePath(
|
|
1097
|
+
"middleware/middleware.eta",
|
|
1098
|
+
"shared",
|
|
1099
|
+
import.meta.url
|
|
1100
|
+
);
|
|
1101
|
+
const fileExists = this.checkFileExists(
|
|
1104
1102
|
targetFile,
|
|
1105
|
-
|
|
1106
|
-
|
|
1103
|
+
force,
|
|
1104
|
+
"Middleware file"
|
|
1107
1105
|
);
|
|
1106
|
+
const content = this.templateUtility.processTemplate(templatePath, {
|
|
1107
|
+
name
|
|
1108
|
+
});
|
|
1109
|
+
this.writeFile(targetFile, content, "Middleware file", fileExists);
|
|
1108
1110
|
}
|
|
1109
1111
|
};
|
|
1110
1112
|
|
|
@@ -1134,13 +1136,13 @@ var OperationGeneratorBase = class extends ComponentGeneratorBase {
|
|
|
1134
1136
|
}
|
|
1135
1137
|
/**
|
|
1136
1138
|
* Gets the template path for operation templates.
|
|
1137
|
-
* This method resolves operation templates to the
|
|
1139
|
+
* This method resolves operation templates to the shared templates directory
|
|
1138
1140
|
* instead of the current generator's directory.
|
|
1139
1141
|
*/
|
|
1140
1142
|
getOperationTemplatePath(templateName) {
|
|
1141
1143
|
return this.templateUtility.resolveTemplatePath(
|
|
1142
|
-
templateName
|
|
1143
|
-
"
|
|
1144
|
+
`operations/${templateName}`,
|
|
1145
|
+
"shared",
|
|
1144
1146
|
import.meta.url
|
|
1145
1147
|
);
|
|
1146
1148
|
}
|
|
@@ -1489,7 +1491,11 @@ var ApiGenerator = class extends ComponentGeneratorBase {
|
|
|
1489
1491
|
const targetFile = `${apiTargetDirectory}/${fileName}`;
|
|
1490
1492
|
await this.generateApiFile(targetFile, apiName, args);
|
|
1491
1493
|
if (args.customMiddleware) {
|
|
1492
|
-
const
|
|
1494
|
+
const middlewareTargetDirectory = this.path.join(
|
|
1495
|
+
apiTargetDirectory,
|
|
1496
|
+
"middleware"
|
|
1497
|
+
);
|
|
1498
|
+
ensureDirectoryExists(this.fileSystem, middlewareTargetDirectory);
|
|
1493
1499
|
const middlewareFile = `${middlewareTargetDirectory}/${apiName}.ts`;
|
|
1494
1500
|
this.generateMiddlewareFile(
|
|
1495
1501
|
middlewareFile,
|
|
@@ -1614,11 +1620,17 @@ var ApiNamespaceGenerator = class extends ComponentGeneratorBase {
|
|
|
1614
1620
|
namespaceName,
|
|
1615
1621
|
async () => {
|
|
1616
1622
|
const configPath = this.validateFeatureConfig(feature);
|
|
1617
|
-
const {
|
|
1618
|
-
|
|
1623
|
+
const {
|
|
1624
|
+
targetDirectory: apiTargetDirectory,
|
|
1625
|
+
importDirectory: apiImportDirectory
|
|
1626
|
+
} = this.ensureTargetDirectory(feature, "api");
|
|
1627
|
+
const middlewareTargetDirectory = path7.join(
|
|
1628
|
+
apiTargetDirectory,
|
|
1619
1629
|
"middleware"
|
|
1620
1630
|
);
|
|
1621
|
-
|
|
1631
|
+
ensureDirectoryExists(this.fileSystem, middlewareTargetDirectory);
|
|
1632
|
+
const importDirectory = `${apiImportDirectory}/middleware`;
|
|
1633
|
+
const targetFile = `${middlewareTargetDirectory}/${namespaceName}.ts`;
|
|
1622
1634
|
await this.generateMiddlewareFile(
|
|
1623
1635
|
targetFile,
|
|
1624
1636
|
namespaceName,
|
|
@@ -1636,7 +1648,7 @@ var ApiNamespaceGenerator = class extends ComponentGeneratorBase {
|
|
|
1636
1648
|
}
|
|
1637
1649
|
async updateConfigFile(namespaceName, importDirectory, namespacePath, args, configFilePath) {
|
|
1638
1650
|
const { force = false } = args;
|
|
1639
|
-
const importPath =
|
|
1651
|
+
const importPath = `${importDirectory}/${namespaceName}`;
|
|
1640
1652
|
const definition = await this.getDefinition(
|
|
1641
1653
|
namespaceName,
|
|
1642
1654
|
importPath,
|