casbin-knex-adapter
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -6,2 +6,3 @@ import type Knex from 'knex'; | ||
chunkSize?: number; | ||
concurrentDeletes?: number; | ||
}; | ||
@@ -12,2 +13,3 @@ export declare class KnexAdapter implements Adapter, BatchAdapter { | ||
private readonly chunkSize; | ||
private readonly concurrentDeletes; | ||
constructor(knex: Knex, options?: KnexAdapterOptions); | ||
@@ -14,0 +16,0 @@ static newAdapter(knex: Knex, options?: KnexAdapterOptions): Promise<KnexAdapter>; |
@@ -11,2 +11,3 @@ "use strict"; | ||
this.chunkSize = (options === null || options === void 0 ? void 0 : options.chunkSize) || 100; | ||
this.concurrentDeletes = (options === null || options === void 0 ? void 0 : options.concurrentDeletes) || 5; | ||
} | ||
@@ -82,5 +83,8 @@ static async newAdapter(knex, options) { | ||
async removePolicies(sec, ptype, rules) { | ||
const deleteChunks = utils_1.chunk(rules, this.chunkSize); | ||
for (const deleteChunk of deleteChunks) { | ||
await this.removePolicy(sec, ptype, deleteChunk); | ||
const deleteChunks = utils_1.chunk(rules, this.concurrentDeletes); | ||
for (const chunk of deleteChunks) { | ||
const promises = chunk.map((rule) => { | ||
return this.removePolicy(sec, ptype, rule); | ||
}); | ||
await Promise.all(promises); | ||
} | ||
@@ -87,0 +91,0 @@ } |
{ | ||
"name": "casbin-knex-adapter", | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Knex adapter for Casbin", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28439
195