@geexcode/geex-extensions-audit-logs 0.0.1
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.
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Apollo } from 'apollo-angular';
|
|
2
|
+
import { firstValueFrom } from 'rxjs';
|
|
3
|
+
import gql from 'graphql-tag';
|
|
4
|
+
import { InjectionToken, makeEnvironmentProviders } from '@angular/core';
|
|
5
|
+
import { provideGeexModuleContribution } from '@geexcode/geex-angular';
|
|
6
|
+
|
|
7
|
+
const GQL_AUDIT_LOGS = gql `
|
|
8
|
+
query auditLogs($skip: Int, $take: Int) {
|
|
9
|
+
auditLogs(skip: $skip, take: $take) {
|
|
10
|
+
totalCount
|
|
11
|
+
items {
|
|
12
|
+
id
|
|
13
|
+
operationName
|
|
14
|
+
operationType
|
|
15
|
+
isSuccess
|
|
16
|
+
operatorId
|
|
17
|
+
clientIp
|
|
18
|
+
createdOn
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
const GQL_DELETE_AUDIT_LOGS = gql `
|
|
24
|
+
mutation deleteAuditLogs($request: DeleteAuditLogsRequest!) {
|
|
25
|
+
deleteAuditLogs(request: $request)
|
|
26
|
+
}
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
function createAuditLogsModule(injector) {
|
|
30
|
+
const apollo = () => injector.get(Apollo);
|
|
31
|
+
return {
|
|
32
|
+
documents: {
|
|
33
|
+
auditLogs: GQL_AUDIT_LOGS,
|
|
34
|
+
deleteAuditLogs: GQL_DELETE_AUDIT_LOGS,
|
|
35
|
+
},
|
|
36
|
+
async loadAuditLogs(options = {}) {
|
|
37
|
+
const res = await firstValueFrom(apollo().query({
|
|
38
|
+
query: GQL_AUDIT_LOGS,
|
|
39
|
+
variables: { skip: options.skip ?? 0, take: options.take ?? 20 },
|
|
40
|
+
fetchPolicy: "no-cache",
|
|
41
|
+
}));
|
|
42
|
+
return {
|
|
43
|
+
items: res.data?.auditLogs?.items ?? [],
|
|
44
|
+
totalCount: res.data?.auditLogs?.totalCount ?? 0,
|
|
45
|
+
};
|
|
46
|
+
},
|
|
47
|
+
async deleteAuditLogs(ids) {
|
|
48
|
+
const res = await firstValueFrom(apollo().mutate({
|
|
49
|
+
mutation: GQL_DELETE_AUDIT_LOGS,
|
|
50
|
+
variables: { request: { ids } },
|
|
51
|
+
}));
|
|
52
|
+
return res.data?.deleteAuditLogs ?? 0;
|
|
53
|
+
},
|
|
54
|
+
init: async () => undefined,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const GEEX_AUDIT_LOGS_OPTIONS = new InjectionToken("GEEX_AUDIT_LOGS_OPTIONS");
|
|
59
|
+
function provideGeexAuditLogs(options = {}) {
|
|
60
|
+
return makeEnvironmentProviders([
|
|
61
|
+
{ provide: GEEX_AUDIT_LOGS_OPTIONS, useValue: options },
|
|
62
|
+
provideGeexModuleContribution({
|
|
63
|
+
createModules: ({ injector }) => ({
|
|
64
|
+
auditLogs: (options.createAuditLogsModule ?? createAuditLogsModule)(injector),
|
|
65
|
+
}),
|
|
66
|
+
}),
|
|
67
|
+
]);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Generated bundle index. Do not edit.
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
export { GEEX_AUDIT_LOGS_OPTIONS, GQL_AUDIT_LOGS, GQL_DELETE_AUDIT_LOGS, createAuditLogsModule, provideGeexAuditLogs };
|
|
75
|
+
//# sourceMappingURL=geexcode-geex-extensions-audit-logs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"geexcode-geex-extensions-audit-logs.mjs","sources":["../../src/graphql.ts","../../src/audit-logs.module.ts","../../src/provide-geex-audit-logs.ts","../../src/geexcode-geex-extensions-audit-logs.ts"],"sourcesContent":["import gql from \"graphql-tag\";\r\n\r\nexport const GQL_AUDIT_LOGS = gql`\r\n query auditLogs($skip: Int, $take: Int) {\r\n auditLogs(skip: $skip, take: $take) {\r\n totalCount\r\n items {\r\n id\r\n operationName\r\n operationType\r\n isSuccess\r\n operatorId\r\n clientIp\r\n createdOn\r\n }\r\n }\r\n }\r\n`;\r\n\r\nexport const GQL_DELETE_AUDIT_LOGS = gql`\r\n mutation deleteAuditLogs($request: DeleteAuditLogsRequest!) {\r\n deleteAuditLogs(request: $request)\r\n }\r\n`;\r\n","import { Injector } from \"@angular/core\";\r\nimport { Apollo } from \"apollo-angular\";\r\nimport { firstValueFrom } from \"rxjs\";\r\nimport { GQL_AUDIT_LOGS, GQL_DELETE_AUDIT_LOGS } from \"./graphql\";\r\nimport type { AuditLogItem, AuditLogsModule } from \"./audit-logs.types\";\r\n\r\nexport function createAuditLogsModule(injector: Injector): AuditLogsModule {\r\n const apollo = () => injector.get(Apollo);\r\n\r\n return {\r\n documents: {\r\n auditLogs: GQL_AUDIT_LOGS,\r\n deleteAuditLogs: GQL_DELETE_AUDIT_LOGS,\r\n },\r\n async loadAuditLogs(options = {}) {\r\n const res = await firstValueFrom(\r\n apollo().query<{\r\n auditLogs: { items: AuditLogItem[]; totalCount: number };\r\n }>({\r\n query: GQL_AUDIT_LOGS,\r\n variables: { skip: options.skip ?? 0, take: options.take ?? 20 },\r\n fetchPolicy: \"no-cache\",\r\n }),\r\n );\r\n return {\r\n items: res.data?.auditLogs?.items ?? [],\r\n totalCount: res.data?.auditLogs?.totalCount ?? 0,\r\n };\r\n },\r\n async deleteAuditLogs(ids: string[]) {\r\n const res = await firstValueFrom(\r\n apollo().mutate<{ deleteAuditLogs: number }>({\r\n mutation: GQL_DELETE_AUDIT_LOGS,\r\n variables: { request: { ids } },\r\n }),\r\n );\r\n return res.data?.deleteAuditLogs ?? 0;\r\n },\r\n init: async () => undefined,\r\n };\r\n}\r\n","import { EnvironmentProviders, InjectionToken, Injector, makeEnvironmentProviders } from \"@angular/core\";\r\nimport { provideGeexModuleContribution } from \"@geexcode/geex-angular\";\r\nimport { createAuditLogsModule } from \"./audit-logs.module\";\r\nimport type { AuditLogsModule } from \"./audit-logs.types\";\r\n\r\nexport interface GeexAuditLogsOptions {\r\n readonly createAuditLogsModule?: (injector: Injector) => AuditLogsModule;\r\n}\r\n\r\nexport const GEEX_AUDIT_LOGS_OPTIONS = new InjectionToken<Readonly<GeexAuditLogsOptions>>(\r\n \"GEEX_AUDIT_LOGS_OPTIONS\",\r\n);\r\n\r\nexport function provideGeexAuditLogs(\r\n options: Readonly<GeexAuditLogsOptions> = {},\r\n): EnvironmentProviders {\r\n return makeEnvironmentProviders([\r\n { provide: GEEX_AUDIT_LOGS_OPTIONS, useValue: options },\r\n provideGeexModuleContribution({\r\n createModules: ({ injector }) => ({\r\n auditLogs: (options.createAuditLogsModule ?? createAuditLogsModule)(injector),\r\n }),\r\n }),\r\n ]);\r\n}\r\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;;;;AAEO,MAAM,cAAc,GAAG,GAAG,CAAA,CAAA;;;;;;;;;;;;;;;;AAiB1B,MAAM,qBAAqB,GAAG,GAAG,CAAA,CAAA;;;;;;ACblC,SAAU,qBAAqB,CAAC,QAAkB,EAAA;IACtD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC;IAEzC,OAAO;AACL,QAAA,SAAS,EAAE;AACT,YAAA,SAAS,EAAE,cAAc;AACzB,YAAA,eAAe,EAAE,qBAAqB;AACvC,SAAA;AACD,QAAA,MAAM,aAAa,CAAC,OAAO,GAAG,EAAE,EAAA;YAC9B,MAAM,GAAG,GAAG,MAAM,cAAc,CAC9B,MAAM,EAAE,CAAC,KAAK,CAEX;AACD,gBAAA,KAAK,EAAE,cAAc;AACrB,gBAAA,SAAS,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,EAAE,EAAE;AAChE,gBAAA,WAAW,EAAE,UAAU;AACxB,aAAA,CAAC,CACH;YACD,OAAO;gBACL,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,IAAI,EAAE;gBACvC,UAAU,EAAE,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,UAAU,IAAI,CAAC;aACjD;QACH,CAAC;QACD,MAAM,eAAe,CAAC,GAAa,EAAA;YACjC,MAAM,GAAG,GAAG,MAAM,cAAc,CAC9B,MAAM,EAAE,CAAC,MAAM,CAA8B;AAC3C,gBAAA,QAAQ,EAAE,qBAAqB;AAC/B,gBAAA,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,EAAE;AAChC,aAAA,CAAC,CACH;AACD,YAAA,OAAO,GAAG,CAAC,IAAI,EAAE,eAAe,IAAI,CAAC;QACvC,CAAC;AACD,QAAA,IAAI,EAAE,YAAY,SAAS;KAC5B;AACH;;MC/Ba,uBAAuB,GAAG,IAAI,cAAc,CACvD,yBAAyB;AAGrB,SAAU,oBAAoB,CAClC,OAAA,GAA0C,EAAE,EAAA;AAE5C,IAAA,OAAO,wBAAwB,CAAC;AAC9B,QAAA,EAAE,OAAO,EAAE,uBAAuB,EAAE,QAAQ,EAAE,OAAO,EAAE;AACvD,QAAA,6BAA6B,CAAC;YAC5B,aAAa,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM;gBAChC,SAAS,EAAE,CAAC,OAAO,CAAC,qBAAqB,IAAI,qBAAqB,EAAE,QAAQ,CAAC;aAC9E,CAAC;SACH,CAAC;AACH,KAAA,CAAC;AACJ;;ACxBA;;AAEG;;;;"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { GeexModule } from '@geexcode/geex-angular';
|
|
2
|
+
import * as graphql from 'graphql';
|
|
3
|
+
import { DocumentNode } from 'graphql';
|
|
4
|
+
import { Injector, InjectionToken, EnvironmentProviders } from '@angular/core';
|
|
5
|
+
|
|
6
|
+
interface AuditLogItem {
|
|
7
|
+
id: string;
|
|
8
|
+
operationName?: string | null;
|
|
9
|
+
operationType?: string | null;
|
|
10
|
+
isSuccess?: boolean | null;
|
|
11
|
+
operatorId?: string | null;
|
|
12
|
+
clientIp?: string | null;
|
|
13
|
+
createdOn?: unknown;
|
|
14
|
+
[key: string]: unknown;
|
|
15
|
+
}
|
|
16
|
+
interface AuditLogsModule extends GeexModule<{
|
|
17
|
+
loadAuditLogs(options?: {
|
|
18
|
+
skip?: number;
|
|
19
|
+
take?: number;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
items: AuditLogItem[];
|
|
22
|
+
totalCount: number;
|
|
23
|
+
}>;
|
|
24
|
+
deleteAuditLogs(ids: string[]): Promise<number>;
|
|
25
|
+
readonly documents: {
|
|
26
|
+
auditLogs: DocumentNode;
|
|
27
|
+
deleteAuditLogs: DocumentNode;
|
|
28
|
+
};
|
|
29
|
+
}> {
|
|
30
|
+
}
|
|
31
|
+
declare module "@geexcode/geex-angular" {
|
|
32
|
+
interface GeexModuleMap {
|
|
33
|
+
auditLogs: AuditLogsModule;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
declare function createAuditLogsModule(injector: Injector): AuditLogsModule;
|
|
38
|
+
|
|
39
|
+
declare const GQL_AUDIT_LOGS: graphql.DocumentNode;
|
|
40
|
+
declare const GQL_DELETE_AUDIT_LOGS: graphql.DocumentNode;
|
|
41
|
+
|
|
42
|
+
interface GeexAuditLogsOptions {
|
|
43
|
+
readonly createAuditLogsModule?: (injector: Injector) => AuditLogsModule;
|
|
44
|
+
}
|
|
45
|
+
declare const GEEX_AUDIT_LOGS_OPTIONS: InjectionToken<Readonly<GeexAuditLogsOptions>>;
|
|
46
|
+
declare function provideGeexAuditLogs(options?: Readonly<GeexAuditLogsOptions>): EnvironmentProviders;
|
|
47
|
+
|
|
48
|
+
export { GEEX_AUDIT_LOGS_OPTIONS, GQL_AUDIT_LOGS, GQL_DELETE_AUDIT_LOGS, createAuditLogsModule, provideGeexAuditLogs };
|
|
49
|
+
export type { AuditLogItem, AuditLogsModule, GeexAuditLogsOptions };
|
|
50
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sources":["../src/audit-logs.types.ts","../src/audit-logs.module.ts","../src/graphql.ts","../src/provide-geex-audit-logs.ts"],"mappings":";;;;;AAGA,sBAAiB;;AAEf;AACA;AACA;AACA;AACA;;AAEA;AACD;AAED,UAAM,eAAW,SAAgB,UAAQ;;;;AACiB,QAAG,OAAO;eACzD,YAAY;;AAEpB;oCAC+B,OAAO;;mBAE1B,YAAY;yBACN,YAAY;;;AAE5B;AAEL;AACE;mBACa,eAAe;AAC3B;AACF;;ACxBD,iBAAA,gCAAsC,QAAU,GAAA;;ACahD,cAAA,cAAa,EAAA,OAAA,CAAA,YAAqB;;;ACdlC,8BAAiB;gDAC6B,QAAQ,KAAK,eAAe;AACzE;AAED,cAAA,uBAAa,EAAA,cAAuB,CAAA,QAAA,CAAA,oBAAA;AAIpC,iBAAA,oBAAgB,WACd,QAAS,CAAA,oBAAS,IAAA,oBACjB;;;;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@geexcode/geex-extensions-audit-logs",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Geex audit logs extension: headless audit logs module. Aligns with Geex.Extensions.AuditLogs.",
|
|
5
|
+
"sideEffects": false,
|
|
6
|
+
"peerDependencies": {
|
|
7
|
+
"@angular/core": "^20.0.0",
|
|
8
|
+
"@geexcode/geex-angular": ">=0.0.41",
|
|
9
|
+
"apollo-angular": "^14.0.0",
|
|
10
|
+
"graphql": "^16.8.0",
|
|
11
|
+
"graphql-tag": "^2.12.0",
|
|
12
|
+
"rxjs": "^7.8.0"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"tslib": "^2.6.3"
|
|
16
|
+
},
|
|
17
|
+
"files": ["dist"],
|
|
18
|
+
"module": "dist/fesm2022/geexcode-geex-extensions-audit-logs.mjs",
|
|
19
|
+
"typings": "dist/index.d.ts",
|
|
20
|
+
"exports": {
|
|
21
|
+
"./package.json": { "default": "./package.json" },
|
|
22
|
+
".": {
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"import": "./dist/fesm2022/geexcode-geex-extensions-audit-logs.mjs",
|
|
25
|
+
"default": "./dist/fesm2022/geexcode-geex-extensions-audit-logs.mjs"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"scripts": {
|
|
29
|
+
"clean": "rimraf dist",
|
|
30
|
+
"build": "ng-packagr -p ng-package.json -c tsconfig.lib.json",
|
|
31
|
+
"test": "node --test src/provide-geex-audit-logs.node-test.mjs",
|
|
32
|
+
"prepublishOnly": "npm run build",
|
|
33
|
+
"publish:public": "npm publish ./dist --access public"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@angular/compiler": "^20.0.0",
|
|
37
|
+
"@angular/compiler-cli": "^20.0.0",
|
|
38
|
+
"@angular/core": "^20.0.0",
|
|
39
|
+
"@geexcode/geex-angular": "workspace:*",
|
|
40
|
+
"apollo-angular": "^14.1.0",
|
|
41
|
+
"graphql": "^16.9.0",
|
|
42
|
+
"graphql-tag": "^2.12.6",
|
|
43
|
+
"ng-packagr": "^20.0.0",
|
|
44
|
+
"rimraf": "^5.0.5",
|
|
45
|
+
"rxjs": "^7.8.2",
|
|
46
|
+
"typescript": "~5.8.3"
|
|
47
|
+
}
|
|
48
|
+
}
|