@amplication/code-gen-types
Advanced tools
Comparing version 2.0.27 to 2.0.28
{ | ||
"name": "@amplication/code-gen-types", | ||
"version": "2.0.27", | ||
"version": "2.0.28", | ||
"description": "This library supplies all the contracts for Amplication Code Generation. The purpose is to make the contracts available for inclusion in plugins.", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
# amplication-code-gen-types | ||
This library supplies all the contracts for Amplication Code Generation. | ||
This library supplies all the contracts for Amplication Code Generation. | ||
The purpose is to make the contracts available for inclusion in plugins. | ||
@@ -27,2 +27,2 @@ | ||
npm publish --access public .... | ||
``` | ||
``` |
@@ -6,2 +6,3 @@ import type { namedTypes } from "ast-types"; | ||
import { BuildLogger } from "./build-logger"; | ||
import { FileMap, IFile } from "./files"; | ||
export { EnumDataType, EnumEntityAction, EnumEntityPermissionType, EnumMessagePatternConnectionOptions, EnumModuleActionType, EnumModuleDtoType, EnumModuleActionGqlOperation, EnumModuleActionRestVerb, EnumModuleDtoPropertyType, EnumModuleActionRestInputSource, } from "./models"; | ||
@@ -22,2 +23,3 @@ export declare enum EnumModuleDtoDecoratorType { | ||
codeGeneratorVersionOptions: models.CodeGeneratorVersionOptionsInput; | ||
codeGeneratorName?: string; | ||
}; | ||
@@ -58,43 +60,17 @@ export type Role = Omit<models.ResourceRole, "__typename" | "id" | "createdAt" | "updatedAt">; | ||
}; | ||
export type Module = { | ||
path: string; | ||
code: string; | ||
}; | ||
/** | ||
* File is a representation of a file | ||
* @deprecated Use IFile instead | ||
* @see IFile | ||
* @see FileMap | ||
*/ | ||
export type Module = IFile<string>; | ||
/** | ||
* ModuleMap is a map of module paths to modules | ||
* @deprecated Use FileMap instead | ||
* @see FileMap | ||
*/ | ||
export declare class ModuleMap { | ||
private readonly logger; | ||
private map; | ||
export declare class ModuleMap extends FileMap<string> { | ||
constructor(logger: BuildLogger); | ||
/** | ||
* Merge another map into this map | ||
* | ||
* @param anotherMap The map to merge into this map | ||
* @returns This map | ||
*/ | ||
merge(anotherMap: ModuleMap): Promise<ModuleMap>; | ||
/** | ||
* Merge many maps into this map | ||
* @param maps The maps to merge into this map | ||
* @returns This map | ||
* @see merge | ||
*/ | ||
mergeMany(maps: ModuleMap[]): Promise<void>; | ||
/** | ||
* Set a module in the map. If the module already exists, it will be overwritten and a log message will be printed. | ||
* @param module The module (file) to add to the set | ||
*/ | ||
set(module: Module): Promise<void>; | ||
/** | ||
* @returns A module for the given path, or undefined if no module exists for the path | ||
*/ | ||
get(path: string): Module; | ||
/** | ||
* Replace a module in the map. If the module does not exist, it will be added to the set. | ||
* @param oldModule The module to replace | ||
* @param newModule The new module to replace the old module with | ||
*/ | ||
replace(oldModule: Module, newModule: Module): void; | ||
/** | ||
* Replace all modules paths using a function | ||
@@ -105,7 +81,2 @@ * @param fn A function that receives a module path and returns a new path | ||
/** | ||
* Remove modules from the map | ||
* @param paths An array of module paths to remove | ||
*/ | ||
removeMany(paths: string[]): void; | ||
/** | ||
* Replace all modules code using a function | ||
@@ -252,1 +223,2 @@ * @param fn A function that receives a module code and returns a new code | ||
}; | ||
export { EnumActionStepStatus, EnumAuthProviderType, EnumBlockType, EnumGitProvider, EnumPendingChangeAction, EnumPendingChangeOriginType, EnumPreviewAccountType, EnumResourceType, CodeGeneratorVersionStrategy, MessagePatternCreateInput, RedesignProjectMovedEntity, RedesignProjectNewService, } from "./models"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ModuleMap = exports.EnumModuleDtoDecoratorType = exports.EnumModuleActionRestInputSource = exports.EnumModuleDtoPropertyType = exports.EnumModuleActionRestVerb = exports.EnumModuleActionGqlOperation = exports.EnumModuleDtoType = exports.EnumModuleActionType = exports.EnumMessagePatternConnectionOptions = exports.EnumEntityPermissionType = exports.EnumEntityAction = exports.EnumDataType = void 0; | ||
exports.CodeGeneratorVersionStrategy = exports.EnumResourceType = exports.EnumPreviewAccountType = exports.EnumPendingChangeOriginType = exports.EnumPendingChangeAction = exports.EnumGitProvider = exports.EnumBlockType = exports.EnumAuthProviderType = exports.EnumActionStepStatus = exports.ModuleMap = exports.EnumModuleDtoDecoratorType = exports.EnumModuleActionRestInputSource = exports.EnumModuleDtoPropertyType = exports.EnumModuleActionRestVerb = exports.EnumModuleActionGqlOperation = exports.EnumModuleDtoType = exports.EnumModuleActionType = exports.EnumMessagePatternConnectionOptions = exports.EnumEntityPermissionType = exports.EnumEntityAction = exports.EnumDataType = void 0; | ||
const files_1 = require("./files"); | ||
var models_1 = require("./models"); | ||
@@ -23,61 +24,10 @@ Object.defineProperty(exports, "EnumDataType", { enumerable: true, get: function () { return models_1.EnumDataType; } }); | ||
* ModuleMap is a map of module paths to modules | ||
* @deprecated Use FileMap instead | ||
* @see FileMap | ||
*/ | ||
class ModuleMap { | ||
logger; | ||
map = {}; | ||
class ModuleMap extends files_1.FileMap { | ||
constructor(logger) { | ||
this.logger = logger; | ||
super(logger); | ||
} | ||
/** | ||
* Merge another map into this map | ||
* | ||
* @param anotherMap The map to merge into this map | ||
* @returns This map | ||
*/ | ||
async merge(anotherMap) { | ||
for await (const module of anotherMap.modules()) { | ||
await this.set(module); | ||
} | ||
return this; | ||
} | ||
/** | ||
* Merge many maps into this map | ||
* @param maps The maps to merge into this map | ||
* @returns This map | ||
* @see merge | ||
*/ | ||
async mergeMany(maps) { | ||
const modules = maps.map((map) => map.modules()).flat(); | ||
for await (const module of modules) { | ||
await this.set(module); | ||
} | ||
} | ||
/** | ||
* Set a module in the map. If the module already exists, it will be overwritten and a log message will be printed. | ||
* @param module The module (file) to add to the set | ||
*/ | ||
async set(module) { | ||
if (this.map[module.path]) { | ||
await this.logger.warn(`Module ${module.path} already exists. Overwriting...`); | ||
} | ||
this.map[module.path] = module; | ||
} | ||
/** | ||
* @returns A module for the given path, or undefined if no module exists for the path | ||
*/ | ||
get(path) { | ||
return this.map[path]; | ||
} | ||
/** | ||
* Replace a module in the map. If the module does not exist, it will be added to the set. | ||
* @param oldModule The module to replace | ||
* @param newModule The new module to replace the old module with | ||
*/ | ||
replace(oldModule, newModule) { | ||
if (newModule.path !== oldModule.path) { | ||
delete this.map[oldModule.path]; | ||
} | ||
this.map[newModule.path] = newModule; | ||
} | ||
/** | ||
* Replace all modules paths using a function | ||
@@ -87,20 +37,5 @@ * @param fn A function that receives a module path and returns a new path | ||
replaceModulesPath(fn) { | ||
for (const oldModule of this.modules()) { | ||
const newModule = { | ||
...oldModule, | ||
path: fn(oldModule.path), | ||
}; | ||
this.replace(oldModule, newModule); | ||
} | ||
this.replaceFilesPath(fn); | ||
} | ||
/** | ||
* Remove modules from the map | ||
* @param paths An array of module paths to remove | ||
*/ | ||
removeMany(paths) { | ||
for (const path of paths) { | ||
delete this.map[path]; | ||
} | ||
} | ||
/** | ||
* Replace all modules code using a function | ||
@@ -110,6 +45,3 @@ * @param fn A function that receives a module code and returns a new code | ||
async replaceModulesCode(fn) { | ||
for await (const module of Object.values(this.map)) { | ||
module.code = fn(module.path, module.code); | ||
this.map[module.path] = module; | ||
} | ||
await this.replaceFilesCode(fn); | ||
} | ||
@@ -120,6 +52,16 @@ /** | ||
modules() { | ||
return Object.values(this.map); | ||
return Array.from(this.getAll()); | ||
} | ||
} | ||
exports.ModuleMap = ModuleMap; | ||
var models_2 = require("./models"); | ||
Object.defineProperty(exports, "EnumActionStepStatus", { enumerable: true, get: function () { return models_2.EnumActionStepStatus; } }); | ||
Object.defineProperty(exports, "EnumAuthProviderType", { enumerable: true, get: function () { return models_2.EnumAuthProviderType; } }); | ||
Object.defineProperty(exports, "EnumBlockType", { enumerable: true, get: function () { return models_2.EnumBlockType; } }); | ||
Object.defineProperty(exports, "EnumGitProvider", { enumerable: true, get: function () { return models_2.EnumGitProvider; } }); | ||
Object.defineProperty(exports, "EnumPendingChangeAction", { enumerable: true, get: function () { return models_2.EnumPendingChangeAction; } }); | ||
Object.defineProperty(exports, "EnumPendingChangeOriginType", { enumerable: true, get: function () { return models_2.EnumPendingChangeOriginType; } }); | ||
Object.defineProperty(exports, "EnumPreviewAccountType", { enumerable: true, get: function () { return models_2.EnumPreviewAccountType; } }); | ||
Object.defineProperty(exports, "EnumResourceType", { enumerable: true, get: function () { return models_2.EnumResourceType; } }); | ||
Object.defineProperty(exports, "CodeGeneratorVersionStrategy", { enumerable: true, get: function () { return models_2.CodeGeneratorVersionStrategy; } }); | ||
//# sourceMappingURL=code-gen-types.js.map |
@@ -10,1 +10,2 @@ export { getSchemaForDataType } from "./get-schema-for-data-type"; | ||
export * from "./build-logger"; | ||
export * from "./files"; |
@@ -14,2 +14,3 @@ "use strict"; | ||
tslib_1.__exportStar(require("./build-logger"), exports); | ||
tslib_1.__exportStar(require("./files"), exports); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SortOrder = exports.Role = exports.QueryMode = exports.EnumWorkspaceMemberType = exports.EnumUserActionType = exports.EnumUserActionStatus = exports.EnumTimeGroup = exports.EnumSubscriptionStatus = exports.EnumSubscriptionPlan = exports.EnumSchemaNames = exports.EnumResourceType = exports.EnumPreviewAccountType = exports.EnumPendingChangeOriginType = exports.EnumPendingChangeAction = exports.EnumModuleDtoType = exports.EnumModuleDtoPropertyType = exports.EnumModuleActionType = exports.EnumModuleActionRestVerb = exports.EnumModuleActionRestInputSource = exports.EnumModuleActionGqlOperation = exports.EnumMessagePatternConnectionOptions = exports.EnumGitProvider = exports.EnumGitOrganizationType = exports.EnumEntityPermissionType = exports.EnumEntityAction = exports.EnumDataType = exports.EnumBuildStatus = exports.EnumBlockType = exports.EnumAuthProviderType = exports.EnumAssistantMessageRole = exports.EnumActionStepStatus = exports.EnumActionLogLevel = exports.CodeGeneratorVersionStrategy = void 0; | ||
exports.SortOrder = exports.Role = exports.QueryMode = exports.EnumWorkspaceMemberType = exports.EnumUserActionType = exports.EnumUserActionStatus = exports.EnumTimeGroup = exports.EnumSubscriptionStatus = exports.EnumSubscriptionPlan = exports.EnumSchemaNames = exports.EnumResourceType = exports.EnumPreviewAccountType = exports.EnumPendingChangeOriginType = exports.EnumPendingChangeAction = exports.EnumModuleDtoType = exports.EnumModuleDtoPropertyType = exports.EnumModuleActionType = exports.EnumModuleActionRestVerb = exports.EnumModuleActionRestInputSource = exports.EnumModuleActionGqlOperation = exports.EnumMessagePatternConnectionOptions = exports.EnumGitProvider = exports.EnumGitOrganizationType = exports.EnumEntityPermissionType = exports.EnumEntityAction = exports.EnumDataType = exports.EnumBuildStatus = exports.EnumBlockType = exports.EnumAuthProviderType = exports.EnumAssistantMessageRole = exports.EnumAssistantFunctions = exports.EnumActionStepStatus = exports.EnumActionLogLevel = exports.CodeGeneratorVersionStrategy = void 0; | ||
var CodeGeneratorVersionStrategy; | ||
@@ -24,2 +24,22 @@ (function (CodeGeneratorVersionStrategy) { | ||
})(EnumActionStepStatus || (exports.EnumActionStepStatus = EnumActionStepStatus = {})); | ||
var EnumAssistantFunctions; | ||
(function (EnumAssistantFunctions) { | ||
EnumAssistantFunctions["CommitProjectPendingChanges"] = "CommitProjectPendingChanges"; | ||
EnumAssistantFunctions["CreateEntities"] = "CreateEntities"; | ||
EnumAssistantFunctions["CreateEntityFields"] = "CreateEntityFields"; | ||
EnumAssistantFunctions["CreateModule"] = "CreateModule"; | ||
EnumAssistantFunctions["CreateModuleAction"] = "CreateModuleAction"; | ||
EnumAssistantFunctions["CreateModuleDto"] = "CreateModuleDto"; | ||
EnumAssistantFunctions["CreateModuleEnum"] = "CreateModuleEnum"; | ||
EnumAssistantFunctions["CreateProject"] = "CreateProject"; | ||
EnumAssistantFunctions["CreateService"] = "CreateService"; | ||
EnumAssistantFunctions["GetModuleActions"] = "GetModuleActions"; | ||
EnumAssistantFunctions["GetModuleDtosAndEnums"] = "GetModuleDtosAndEnums"; | ||
EnumAssistantFunctions["GetPlugins"] = "GetPlugins"; | ||
EnumAssistantFunctions["GetProjectPendingChanges"] = "GetProjectPendingChanges"; | ||
EnumAssistantFunctions["GetProjectServices"] = "GetProjectServices"; | ||
EnumAssistantFunctions["GetServiceEntities"] = "GetServiceEntities"; | ||
EnumAssistantFunctions["GetServiceModules"] = "GetServiceModules"; | ||
EnumAssistantFunctions["InstallPlugins"] = "InstallPlugins"; | ||
})(EnumAssistantFunctions || (exports.EnumAssistantFunctions = EnumAssistantFunctions = {})); | ||
var EnumAssistantMessageRole; | ||
@@ -26,0 +46,0 @@ (function (EnumAssistantMessageRole) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
211640
126
4899
28
1