@webiny/api-audit-logs-sql 6.6.0-alpha.10 → 6.6.0-alpha.11

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,13 @@
1
+ import { KnexClient, SqlSchemaConfig, SqlSchemaSetup } from "@webiny/api-core-sql";
2
+ /** The `auditLogs` schema setup step: the audit logs table. */
3
+ declare class AuditLogsSqlSchemaSetupImpl implements SqlSchemaSetup.Interface {
4
+ private readonly knex;
5
+ private readonly schemaConfig?;
6
+ readonly name = "auditLogs";
7
+ constructor(knex: KnexClient.Interface, schemaConfig?: SqlSchemaConfig.Interface | undefined);
8
+ setup(): Promise<void>;
9
+ }
10
+ export declare const AuditLogsSqlSchemaSetup: typeof AuditLogsSqlSchemaSetupImpl & {
11
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-core-sql/schemaSetup/abstractions").ISqlSchemaSetup>;
12
+ };
13
+ export {};
@@ -0,0 +1,33 @@
1
+ import { KnexClient, SqlSchemaConfig, SqlSchemaSetup } from "@webiny/api-core-sql";
2
+ import { SqliteStorage } from "./SqliteStorage.js";
3
+ import { createTableManager } from "./createTableManager.js";
4
+ class AuditLogsSqlSchemaSetupImpl {
5
+ constructor(knex, schemaConfig){
6
+ this.knex = knex;
7
+ this.schemaConfig = schemaConfig;
8
+ this.name = "auditLogs";
9
+ }
10
+ async setup() {
11
+ const tableManager = createTableManager(this.knex, this.schemaConfig, false);
12
+ new SqliteStorage({
13
+ knex: this.knex.client,
14
+ tableManager
15
+ });
16
+ await tableManager.setup();
17
+ }
18
+ }
19
+ const AuditLogsSqlSchemaSetup = SqlSchemaSetup.createImplementation({
20
+ implementation: AuditLogsSqlSchemaSetupImpl,
21
+ dependencies: [
22
+ KnexClient,
23
+ [
24
+ SqlSchemaConfig,
25
+ {
26
+ optional: true
27
+ }
28
+ ]
29
+ ]
30
+ });
31
+ export { AuditLogsSqlSchemaSetup };
32
+
33
+ //# sourceMappingURL=AuditLogsSqlSchemaSetup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuditLogsSqlSchemaSetup.js","sources":["../src/AuditLogsSqlSchemaSetup.ts"],"sourcesContent":["import { KnexClient, SqlSchemaConfig, SqlSchemaSetup } from \"@webiny/api-core-sql\";\nimport { SqliteStorage } from \"~/SqliteStorage.js\";\nimport { createTableManager } from \"~/createTableManager.js\";\n\n/** The `auditLogs` schema setup step: the audit logs table. */\nclass AuditLogsSqlSchemaSetupImpl implements SqlSchemaSetup.Interface {\n public readonly name = \"auditLogs\";\n\n public constructor(\n private readonly knex: KnexClient.Interface,\n private readonly schemaConfig?: SqlSchemaConfig.Interface\n ) {}\n\n public async setup(): Promise<void> {\n const tableManager = createTableManager(this.knex, this.schemaConfig, false);\n // Building the storage declares its table on the manager.\n new SqliteStorage({ knex: this.knex.client, tableManager });\n await tableManager.setup();\n }\n}\n\nexport const AuditLogsSqlSchemaSetup = SqlSchemaSetup.createImplementation({\n implementation: AuditLogsSqlSchemaSetupImpl,\n dependencies: [KnexClient, [SqlSchemaConfig, { optional: true }]]\n});\n"],"names":["AuditLogsSqlSchemaSetupImpl","knex","schemaConfig","tableManager","createTableManager","SqliteStorage","AuditLogsSqlSchemaSetup","SqlSchemaSetup","KnexClient","SqlSchemaConfig"],"mappings":";;;AAKA,MAAMA;IAGF,YACqBC,IAA0B,EAC1BC,YAAwC,CAC3D;aAFmBD,IAAI,GAAJA;aACAC,YAAY,GAAZA;aAJL,IAAI,GAAG;IAKpB;IAEH,MAAa,QAAuB;QAChC,MAAMC,eAAeC,mBAAmB,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE;QAEtE,IAAIC,cAAc;YAAE,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM;YAAEF;QAAa;QACzD,MAAMA,aAAa,KAAK;IAC5B;AACJ;AAEO,MAAMG,0BAA0BC,eAAe,oBAAoB,CAAC;IACvE,gBAAgBP;IAChB,cAAc;QAACQ;QAAY;YAACC;YAAiB;gBAAE,UAAU;YAAK;SAAE;KAAC;AACrE"}
@@ -0,0 +1,11 @@
1
+ import { KnexClient, SqlSchemaConfig } from "@webiny/api-core-sql";
2
+ import { AuditLogsStorage } from "@webiny/api-audit-logs/abstractions.js";
3
+ import { SqliteStorage } from "./SqliteStorage.js";
4
+ /** The audit logs storage on the container's connection and table prefix. */
5
+ declare class SqlAuditLogsStorageImpl extends SqliteStorage implements AuditLogsStorage.Interface {
6
+ constructor(knex: KnexClient.Interface, schemaConfig?: SqlSchemaConfig.Interface);
7
+ }
8
+ export declare const SqlAuditLogsStorage: typeof SqlAuditLogsStorageImpl & {
9
+ __abstraction: import("@webiny/di").Abstraction<import("@webiny/api-audit-logs/storage/abstractions/Storage").IStorage>;
10
+ };
11
+ export {};
@@ -0,0 +1,28 @@
1
+ import { KnexClient, SqlSchemaConfig } from "@webiny/api-core-sql";
2
+ import { AuditLogsStorage } from "@webiny/api-audit-logs/abstractions.js";
3
+ import { SqliteStorage } from "./SqliteStorage.js";
4
+ import { createTableManager } from "./createTableManager.js";
5
+ class SqlAuditLogsStorageImpl extends SqliteStorage {
6
+ constructor(knex, schemaConfig){
7
+ const schemaManaged = schemaConfig?.isManaged() === true;
8
+ super({
9
+ knex: knex.client,
10
+ tableManager: createTableManager(knex, schemaConfig, schemaManaged)
11
+ });
12
+ }
13
+ }
14
+ const SqlAuditLogsStorage = AuditLogsStorage.createImplementation({
15
+ implementation: SqlAuditLogsStorageImpl,
16
+ dependencies: [
17
+ KnexClient,
18
+ [
19
+ SqlSchemaConfig,
20
+ {
21
+ optional: true
22
+ }
23
+ ]
24
+ ]
25
+ });
26
+ export { SqlAuditLogsStorage };
27
+
28
+ //# sourceMappingURL=SqlAuditLogsStorage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SqlAuditLogsStorage.js","sources":["../src/SqlAuditLogsStorage.ts"],"sourcesContent":["import { KnexClient, SqlSchemaConfig } from \"@webiny/api-core-sql\";\nimport { AuditLogsStorage } from \"@webiny/api-audit-logs/abstractions.js\";\nimport { SqliteStorage } from \"~/SqliteStorage.js\";\nimport { createTableManager } from \"~/createTableManager.js\";\n\n/** The audit logs storage on the container's connection and table prefix. */\nclass SqlAuditLogsStorageImpl extends SqliteStorage implements AuditLogsStorage.Interface {\n public constructor(knex: KnexClient.Interface, schemaConfig?: SqlSchemaConfig.Interface) {\n const schemaManaged = schemaConfig?.isManaged() === true;\n super({\n knex: knex.client,\n tableManager: createTableManager(knex, schemaConfig, schemaManaged)\n });\n }\n}\n\nexport const SqlAuditLogsStorage = AuditLogsStorage.createImplementation({\n implementation: SqlAuditLogsStorageImpl,\n dependencies: [KnexClient, [SqlSchemaConfig, { optional: true }]]\n});\n"],"names":["SqlAuditLogsStorageImpl","SqliteStorage","knex","schemaConfig","schemaManaged","createTableManager","SqlAuditLogsStorage","AuditLogsStorage","KnexClient","SqlSchemaConfig"],"mappings":";;;;AAMA,MAAMA,gCAAgCC;IAClC,YAAmBC,IAA0B,EAAEC,YAAwC,CAAE;QACrF,MAAMC,gBAAgBD,cAAc,gBAAgB;QACpD,KAAK,CAAC;YACF,MAAMD,KAAK,MAAM;YACjB,cAAcG,mBAAmBH,MAAMC,cAAcC;QACzD;IACJ;AACJ;AAEO,MAAME,sBAAsBC,iBAAiB,oBAAoB,CAAC;IACrE,gBAAgBP;IAChB,cAAc;QAACQ;QAAY;YAACC;YAAiB;gBAAE,UAAU;YAAK;SAAE;KAAC;AACrE"}
@@ -0,0 +1,4 @@
1
+ import type { KnexClient, SqlSchemaConfig } from "@webiny/api-core-sql";
2
+ import { TableManager } from "@webiny/api-core-sql/TableManager.js";
3
+ /** The audit logs' table manager, on the container's connection and table prefix. */
4
+ export declare const createTableManager: (knex: KnexClient.Interface, schemaConfig: SqlSchemaConfig.Interface | undefined, schemaManaged: boolean) => TableManager;
@@ -0,0 +1,7 @@
1
+ import { TableManager } from "@webiny/api-core-sql/TableManager.js";
2
+ const createTableManager = (knex, schemaConfig, schemaManaged)=>new TableManager(knex.client, schemaConfig?.tableNamePrefix, {
3
+ schemaManaged
4
+ });
5
+ export { createTableManager };
6
+
7
+ //# sourceMappingURL=createTableManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTableManager.js","sources":["../src/createTableManager.ts"],"sourcesContent":["import type { KnexClient, SqlSchemaConfig } from \"@webiny/api-core-sql\";\nimport { TableManager } from \"@webiny/api-core-sql/TableManager.js\";\n\n/** The audit logs' table manager, on the container's connection and table prefix. */\nexport const createTableManager = (\n knex: KnexClient.Interface,\n schemaConfig: SqlSchemaConfig.Interface | undefined,\n schemaManaged: boolean\n): TableManager => {\n return new TableManager(knex.client, schemaConfig?.tableNamePrefix, { schemaManaged });\n};\n"],"names":["createTableManager","knex","schemaConfig","schemaManaged","TableManager"],"mappings":";AAIO,MAAMA,qBAAqB,CAC9BC,MACAC,cACAC,gBAEO,IAAIC,aAAaH,KAAK,MAAM,EAAEC,cAAc,iBAAiB;QAAEC;IAAc"}
package/feature.d.ts ADDED
@@ -0,0 +1,11 @@
1
+ /**
2
+ * The SQL audit logs storage and its `auditLogs` schema setup step. Registered per request, it runs
3
+ * on the connection (`KnexClient`) and the table settings (`SqlSchemaConfig`) the SQL storage keeps
4
+ * in the root.
5
+ */
6
+ export declare const AuditLogsSqlFeature: {
7
+ name: string;
8
+ register(container: import("@webiny/di").Container): void;
9
+ };
10
+ /** `AuditLogsSqlFeature` as an extension plugin, for setups that register storages that way. */
11
+ export declare const registerAuditLogsSqlStorageOperations: () => import("@webiny/handler").RegisterExtensionPlugin<import("@webiny/handler/types").Context>;
package/feature.js ADDED
@@ -0,0 +1,17 @@
1
+ import { createFeature } from "@webiny/feature/api";
2
+ import { createRegisterExtensionPlugin } from "@webiny/handler";
3
+ import { SqlAuditLogsStorage } from "./SqlAuditLogsStorage.js";
4
+ import { AuditLogsSqlSchemaSetup } from "./AuditLogsSqlSchemaSetup.js";
5
+ const AuditLogsSqlFeature = createFeature({
6
+ name: "AuditLogsSql",
7
+ register (container) {
8
+ container.register(SqlAuditLogsStorage);
9
+ container.register(AuditLogsSqlSchemaSetup);
10
+ }
11
+ });
12
+ const registerAuditLogsSqlStorageOperations = ()=>createRegisterExtensionPlugin((context)=>{
13
+ AuditLogsSqlFeature.register(context.container);
14
+ });
15
+ export { AuditLogsSqlFeature, registerAuditLogsSqlStorageOperations };
16
+
17
+ //# sourceMappingURL=feature.js.map
package/feature.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.js","sources":["../src/feature.ts"],"sourcesContent":["import { createFeature } from \"@webiny/feature/api\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport { SqlAuditLogsStorage } from \"~/SqlAuditLogsStorage.js\";\nimport { AuditLogsSqlSchemaSetup } from \"~/AuditLogsSqlSchemaSetup.js\";\n\n/**\n * The SQL audit logs storage and its `auditLogs` schema setup step. Registered per request, it runs\n * on the connection (`KnexClient`) and the table settings (`SqlSchemaConfig`) the SQL storage keeps\n * in the root.\n */\nexport const AuditLogsSqlFeature = createFeature({\n name: \"AuditLogsSql\",\n register(container) {\n container.register(SqlAuditLogsStorage);\n container.register(AuditLogsSqlSchemaSetup);\n }\n});\n\n/** `AuditLogsSqlFeature` as an extension plugin, for setups that register storages that way. */\nexport const registerAuditLogsSqlStorageOperations = () => {\n return createRegisterExtensionPlugin(context => {\n AuditLogsSqlFeature.register(context.container);\n });\n};\n"],"names":["AuditLogsSqlFeature","createFeature","container","SqlAuditLogsStorage","AuditLogsSqlSchemaSetup","registerAuditLogsSqlStorageOperations","createRegisterExtensionPlugin","context"],"mappings":";;;;AAUO,MAAMA,sBAAsBC,cAAc;IAC7C,MAAM;IACN,UAASC,SAAS;QACdA,UAAU,QAAQ,CAACC;QACnBD,UAAU,QAAQ,CAACE;IACvB;AACJ;AAGO,MAAMC,wCAAwC,IAC1CC,8BAA8BC,CAAAA;QACjCP,oBAAoB,QAAQ,CAACO,QAAQ,SAAS;IAClD"}
package/index.d.ts CHANGED
@@ -1,7 +1 @@
1
- import type { Knex } from "knex";
2
- interface RegisterAuditLogsSqlStorageOperationsParams {
3
- knex: Knex;
4
- tableNamePrefix?: string;
5
- }
6
- export declare const registerAuditLogsSqlStorageOperations: (params: RegisterAuditLogsSqlStorageOperationsParams) => import("@webiny/handler").RegisterExtensionPlugin<import("@webiny/handler/types").Context>;
7
- export {};
1
+ export { AuditLogsSqlFeature, registerAuditLogsSqlStorageOperations } from "./feature.js";
package/index.js CHANGED
@@ -1,15 +1 @@
1
- import { TableManager } from "@webiny/api-core-sql/TableManager.js";
2
- import { createRegisterExtensionPlugin } from "@webiny/handler";
3
- import { SqliteStorage } from "./SqliteStorage.js";
4
- import { AuditLogsStorage } from "@webiny/api-audit-logs/abstractions.js";
5
- const registerAuditLogsSqlStorageOperations = (params)=>createRegisterExtensionPlugin((context)=>{
6
- const tableManager = new TableManager(params.knex, params.tableNamePrefix);
7
- const storage = new SqliteStorage({
8
- knex: params.knex,
9
- tableManager
10
- });
11
- context.container.registerInstance(AuditLogsStorage, storage);
12
- });
13
- export { registerAuditLogsSqlStorageOperations };
14
-
15
- //# sourceMappingURL=index.js.map
1
+ export { AuditLogsSqlFeature, registerAuditLogsSqlStorageOperations } from "./feature.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-audit-logs-sql",
3
- "version": "6.6.0-alpha.10",
3
+ "version": "6.6.0-alpha.11",
4
4
  "type": "module",
5
5
  "keywords": [
6
6
  "@webiny/api-audit-logs",
@@ -20,14 +20,15 @@
20
20
  "./*": "./*"
21
21
  },
22
22
  "dependencies": {
23
- "@webiny/api-audit-logs": "6.6.0-alpha.10",
24
- "@webiny/api-core-sql": "6.6.0-alpha.10",
25
- "@webiny/handler": "6.6.0-alpha.10",
23
+ "@webiny/api-audit-logs": "6.6.0-alpha.11",
24
+ "@webiny/api-core-sql": "6.6.0-alpha.11",
25
+ "@webiny/feature": "6.6.0-alpha.11",
26
+ "@webiny/handler": "6.6.0-alpha.11",
26
27
  "knex": "3.3.0"
27
28
  },
28
29
  "devDependencies": {
29
- "@webiny/api-core": "6.6.0-alpha.10",
30
- "@webiny/build-tools": "6.6.0-alpha.10",
30
+ "@webiny/api-core": "6.6.0-alpha.11",
31
+ "@webiny/build-tools": "6.6.0-alpha.11",
31
32
  "better-sqlite3": "13.0.3",
32
33
  "rimraf": "6.1.3",
33
34
  "typescript": "7.0.2"
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import type { Knex } from \"knex\";\nimport { TableManager } from \"@webiny/api-core-sql/TableManager.js\";\nimport { createRegisterExtensionPlugin } from \"@webiny/handler\";\nimport { SqliteStorage } from \"~/SqliteStorage.js\";\nimport { AuditLogsStorage } from \"@webiny/api-audit-logs/abstractions.js\";\n\ninterface RegisterAuditLogsSqlStorageOperationsParams {\n knex: Knex;\n tableNamePrefix?: string;\n}\n\nexport const registerAuditLogsSqlStorageOperations = (\n params: RegisterAuditLogsSqlStorageOperationsParams\n) => {\n return createRegisterExtensionPlugin(context => {\n const tableManager = new TableManager(params.knex, params.tableNamePrefix);\n const storage = new SqliteStorage({\n knex: params.knex,\n tableManager\n });\n context.container.registerInstance(AuditLogsStorage, storage);\n });\n};\n"],"names":["registerAuditLogsSqlStorageOperations","params","createRegisterExtensionPlugin","context","tableManager","TableManager","storage","SqliteStorage","AuditLogsStorage"],"mappings":";;;;AAWO,MAAMA,wCAAwC,CACjDC,SAEOC,8BAA8BC,CAAAA;QACjC,MAAMC,eAAe,IAAIC,aAAaJ,OAAO,IAAI,EAAEA,OAAO,eAAe;QACzE,MAAMK,UAAU,IAAIC,cAAc;YAC9B,MAAMN,OAAO,IAAI;YACjBG;QACJ;QACAD,QAAQ,SAAS,CAAC,gBAAgB,CAACK,kBAAkBF;IACzD"}