@memberjunction/codegen-lib 1.0.4 → 1.0.7-next.0

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.
Files changed (58) hide show
  1. package/dist/advanced_generation.d.ts +3 -0
  2. package/dist/advanced_generation.d.ts.map +1 -1
  3. package/dist/advanced_generation.js +39 -26
  4. package/dist/advanced_generation.js.map +1 -1
  5. package/dist/angular_client_codegen.d.ts +45 -2
  6. package/dist/angular_client_codegen.d.ts.map +1 -1
  7. package/dist/angular_client_codegen.js +423 -399
  8. package/dist/angular_client_codegen.js.map +1 -1
  9. package/dist/createNewUser.d.ts +6 -1
  10. package/dist/createNewUser.d.ts.map +1 -1
  11. package/dist/createNewUser.js +68 -53
  12. package/dist/createNewUser.js.map +1 -1
  13. package/dist/dbSchema.d.ts +10 -3
  14. package/dist/dbSchema.d.ts.map +1 -1
  15. package/dist/dbSchema.js +144 -130
  16. package/dist/dbSchema.js.map +1 -1
  17. package/dist/entity_subclasses_codegen.d.ts +11 -6
  18. package/dist/entity_subclasses_codegen.d.ts.map +1 -1
  19. package/dist/entity_subclasses_codegen.js +144 -131
  20. package/dist/entity_subclasses_codegen.js.map +1 -1
  21. package/dist/graphql_server_codegen.d.ts +28 -5
  22. package/dist/graphql_server_codegen.d.ts.map +1 -1
  23. package/dist/graphql_server_codegen.js +552 -531
  24. package/dist/graphql_server_codegen.js.map +1 -1
  25. package/dist/logging.d.ts +20 -0
  26. package/dist/logging.d.ts.map +1 -1
  27. package/dist/logging.js +61 -26
  28. package/dist/logging.js.map +1 -1
  29. package/dist/manageMetadata.d.ts +128 -7
  30. package/dist/manageMetadata.d.ts.map +1 -1
  31. package/dist/manageMetadata.js +992 -898
  32. package/dist/manageMetadata.js.map +1 -1
  33. package/dist/runCodeGen.d.ts +16 -0
  34. package/dist/runCodeGen.d.ts.map +1 -1
  35. package/dist/runCodeGen.js +185 -140
  36. package/dist/runCodeGen.js.map +1 -1
  37. package/dist/runCommand.d.ts +7 -2
  38. package/dist/runCommand.d.ts.map +1 -1
  39. package/dist/runCommand.js +104 -90
  40. package/dist/runCommand.js.map +1 -1
  41. package/dist/sql.d.ts +21 -16
  42. package/dist/sql.d.ts.map +1 -1
  43. package/dist/sql.js +98 -87
  44. package/dist/sql.js.map +1 -1
  45. package/dist/sql_codegen.d.ts +56 -13
  46. package/dist/sql_codegen.d.ts.map +1 -1
  47. package/dist/sql_codegen.js +836 -795
  48. package/dist/sql_codegen.js.map +1 -1
  49. package/dist/util.js +0 -2
  50. package/dist/util.js.map +1 -1
  51. package/package.json +32 -32
  52. package/readme.md +2 -2
  53. package/dist/graphql_client_codegen.d.ts +0 -4
  54. package/dist/graphql_client_codegen.js +0 -161
  55. package/dist/graphql_client_codegen.js.map +0 -1
  56. package/dist/react_client_codegen.d.ts +0 -4
  57. package/dist/react_client_codegen.js +0 -147
  58. package/dist/react_client_codegen.js.map +0 -1
@@ -1,21 +1,64 @@
1
- import { EntityInfo } from '@memberjunction/core';
1
+ import { EntityInfo, EntityFieldInfo } from '@memberjunction/core';
2
+ import { SQLUtilityBase } from './sql';
2
3
  import { DataSource } from 'typeorm';
3
- export declare function manageSQLScriptsAndExecution(ds: DataSource, entities: EntityInfo[], directory: string): Promise<boolean>;
4
- export declare function runCustomSQLScripts(ds: DataSource, when: string): Promise<boolean>;
5
- export declare function applyPermissions(ds: DataSource, directory: string, entities: EntityInfo[], batchSize?: number): Promise<boolean>;
6
- export declare function generateAndExecuteAllEntitiesSQLToSeparateFiles(ds: DataSource, entities: EntityInfo[], directory: string, onlyPermissions: boolean, batchSize?: number): Promise<boolean>;
7
- export declare function createCombinedEntitySQLFiles(directory: string, entities: EntityInfo[]): Promise<void>;
8
- export declare function generateAndExecuteSingleEntitySQLToSeparateFiles(ds: DataSource, entity: EntityInfo, directory: string, onlyPermissions: boolean): Promise<boolean>;
9
- export declare function generateSingleEntitySQLToSeparateFiles(ds: DataSource, entity: EntityInfo, directory: string, onlyPermissions: boolean): Promise<string>;
10
- export declare function getSPName(entity: EntityInfo, type: SPType): string;
11
- export declare function getEntityPermissionFileNames(entity: EntityInfo): string[];
12
- export declare function generateEntitySQL(ds: DataSource, entity: EntityInfo): Promise<string>;
13
- export declare function generateAllEntitiesSQLFileHeader(): string;
14
- export declare function generateSingleEntitySQLFileHeader(entity: EntityInfo, itemName: string): string;
15
4
  export declare const SPType: {
16
5
  readonly Create: "Create";
17
6
  readonly Update: "Update";
18
7
  readonly Delete: "Delete";
19
8
  };
20
9
  export type SPType = typeof SPType[keyof typeof SPType];
10
+ /**
11
+ * This class is responsible for generating database level objects like views, stored procedures, permissions, etc. You can sub-class this class to create your own SQL generation logic or implement support for other
12
+ * databases. The base class implements support for SQL Server. In future versions of MJ, we will break out an abstract base class that has the skeleton of the logic and then the SQL Server version will be a sub-class
13
+ * of that abstract base class and other databases will be sub-classes of the abstract base class as well.
14
+ */
15
+ export declare class SQLCodeGenBase {
16
+ protected _sqlUtilityObject: SQLUtilityBase;
17
+ get SQLUtilityObject(): SQLUtilityBase;
18
+ manageSQLScriptsAndExecution(ds: DataSource, entities: EntityInfo[], directory: string): Promise<boolean>;
19
+ runCustomSQLScripts(ds: DataSource, when: string): Promise<boolean>;
20
+ applyPermissions(ds: DataSource, directory: string, entities: EntityInfo[], batchSize?: number): Promise<boolean>;
21
+ /**
22
+ * This function will handle the process of creating all of the generated objects like base view, stored procedures, etc. for all entities in the entities array. It will generate the SQL for each entity and then execute it.
23
+ * @param ds The DataSource object to use to execute the SQL
24
+ * @param entities The array of EntityInfo objects to generate SQL for
25
+ * @param directory The directory to save the generated SQL files to
26
+ * @param onlyPermissions If true, only the permissions files will be generated and executed, not the actual SQL files. Use this if you are simply setting permission changes but no actual changes to the entities have occured.
27
+ */
28
+ generateAndExecuteEntitySQLToSeparateFiles(ds: DataSource, entities: EntityInfo[], directory: string, onlyPermissions: boolean, writeFiles?: boolean, batchSize?: number): Promise<boolean>;
29
+ createCombinedEntitySQLFiles(directory: string, entities: EntityInfo[]): Promise<void>;
30
+ generateAndExecuteSingleEntitySQLToSeparateFiles(ds: DataSource, entity: EntityInfo, directory: string, onlyPermissions: boolean, writeFiles?: boolean): Promise<boolean>;
31
+ generateSingleEntitySQLToSeparateFiles(ds: DataSource, entity: EntityInfo, directory: string, onlyPermissions: boolean, writeFiles?: boolean): Promise<{
32
+ sql: string;
33
+ permissionsSQL: string;
34
+ }>;
35
+ getSPName(entity: EntityInfo, type: SPType): string;
36
+ getEntityPermissionFileNames(entity: EntityInfo): string[];
37
+ generateEntitySQL(ds: DataSource, entity: EntityInfo): Promise<string>;
38
+ generateEntityFullTextSearchSQL(ds: DataSource, entity: EntityInfo): Promise<{
39
+ sql: string;
40
+ functionName: string;
41
+ }>;
42
+ getEntityPrimaryKeyIndexName(ds: DataSource, entity: EntityInfo): Promise<string>;
43
+ generateAllEntitiesSQLFileHeader(): string;
44
+ generateSingleEntitySQLFileHeader(entity: EntityInfo, itemName: string): string;
45
+ generateBaseView(ds: DataSource, entity: EntityInfo): Promise<string>;
46
+ protected generateViewPermissions(entity: EntityInfo): string;
47
+ protected generateBaseViewJoins(entityFields: EntityFieldInfo[]): string;
48
+ generateBaseViewRelatedFieldsString(ds: DataSource, entityFields: EntityFieldInfo[]): Promise<string>;
49
+ protected getIsNameFieldForSingleEntity(entityName: string): {
50
+ nameField: string;
51
+ nameFieldIsVirtual: boolean;
52
+ };
53
+ protected stripID(name: string): string;
54
+ protected generateSPPermissions(entity: EntityInfo, spName: string, type: SPType): string;
55
+ protected generateFullTextSearchFunctionPermissions(entity: EntityInfo, functionName: string): string;
56
+ protected generateSPCreate(entity: EntityInfo): string;
57
+ protected generateSPUpdate(entity: EntityInfo): string;
58
+ protected createEntityFieldsParamString(entityFields: EntityFieldInfo[], isUpdate: boolean): string;
59
+ protected createEntityFieldsInsertString(entity: EntityInfo, entityFields: EntityFieldInfo[], prefix: string): string;
60
+ protected createEntityFieldsUpdateString(entityFields: EntityFieldInfo[]): string;
61
+ protected generateSPDelete(entity: EntityInfo): string;
62
+ protected generateCascadeDeletes(entity: EntityInfo): string;
63
+ }
21
64
  //# sourceMappingURL=sql_codegen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sql_codegen.d.ts","sourceRoot":"","sources":["../src/sql_codegen.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmD,MAAM,sBAAsB,CAAC;AAMnG,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAWrC,wBAAsB,4BAA4B,CAAC,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAmE9H;AAED,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAqBxF;AAGD,wBAAsB,gBAAgB,CAAC,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,SAAS,GAAE,MAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAsCzI;AAID,wBAAsB,+CAA+C,CAAC,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,SAAS,GAAE,MAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CA4BlM;AAED,wBAAsB,4BAA4B,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAW3F;AAID,wBAAsB,gDAAgD,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CASxK;AAED,wBAAsB,sCAAsC,CAAC,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe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