@peculiar/acme-data-memory
Advanced tools
Comparing version 1.2.3 to 1.2.10
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AccountRepository = void 0; | ||
const tslib_1 = require("tslib"); | ||
const base_1 = require("./base"); | ||
class AccountRepository extends base_1.BaseRepository { | ||
findByPublicKey(publicKey) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const thumbprint = yield publicKey.getThumbprint(); | ||
const item = this.items.find(o => o.thumbprint === thumbprint); | ||
return item ? item : null; | ||
}); | ||
async findByPublicKey(publicKey) { | ||
const thumbprint = await publicKey.getThumbprint(); | ||
const item = this.items.find(o => o.thumbprint === thumbprint); | ||
return item ? item : null; | ||
} | ||
} | ||
exports.AccountRepository = AccountRepository; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AuthorizationRepository = void 0; | ||
const tslib_1 = require("tslib"); | ||
const base_1 = require("./base"); | ||
class AuthorizationRepository extends base_1.BaseRepository { | ||
findByIdentifier(accountId, identifier) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const items = this.items.filter(o => o.accountId === accountId && o.identifier.type === identifier.type && o.identifier.value === identifier.value); | ||
return items[items.length - 1] || null; | ||
}); | ||
async findByIdentifier(accountId, identifier) { | ||
const items = this.items.filter(o => o.accountId === accountId && o.identifier.type === identifier.type && o.identifier.value === identifier.value); | ||
return items[items.length - 1] || null; | ||
} | ||
} | ||
exports.AuthorizationRepository = AuthorizationRepository; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BaseRepository = void 0; | ||
const tslib_1 = require("tslib"); | ||
class BaseRepository { | ||
@@ -10,45 +9,37 @@ constructor() { | ||
} | ||
findById(id) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return this.items.find(o => { return o.id == id; }) || null; | ||
}); | ||
async findById(id) { | ||
return this.items.find(o => { return o.id == id; }) || null; | ||
} | ||
add(item) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
if (!item.id) { | ||
item.id = ++this.lastId; | ||
this.items.push(item); | ||
} | ||
else { | ||
throw new Error("Element already exists"); | ||
} | ||
return item; | ||
}); | ||
async add(item) { | ||
if (!item.id) { | ||
item.id = ++this.lastId; | ||
this.items.push(item); | ||
} | ||
else { | ||
throw new Error("Element already exists"); | ||
} | ||
return item; | ||
} | ||
update(item) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const updateItem = this.items.find(o => { return o.id == item.id; }); | ||
if (updateItem) { | ||
const index = this.items.indexOf(updateItem); | ||
this.items[index] = item; | ||
} | ||
else { | ||
throw new Error("Element not found"); | ||
} | ||
return item; | ||
}); | ||
async update(item) { | ||
const updateItem = this.items.find(o => { return o.id == item.id; }); | ||
if (updateItem) { | ||
const index = this.items.indexOf(updateItem); | ||
this.items[index] = item; | ||
} | ||
else { | ||
throw new Error("Element not found"); | ||
} | ||
return item; | ||
} | ||
remove(item) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const removeItem = this.items.find(o => { return o.id == item.id; }); | ||
if (removeItem) { | ||
const index = this.items.indexOf(item); | ||
if (index > -1) { | ||
this.items.splice(index, 1); | ||
} | ||
async remove(item) { | ||
const removeItem = this.items.find(o => { return o.id == item.id; }); | ||
if (removeItem) { | ||
const index = this.items.indexOf(item); | ||
if (index > -1) { | ||
this.items.splice(index, 1); | ||
} | ||
return; | ||
}); | ||
} | ||
return; | ||
} | ||
} | ||
exports.BaseRepository = BaseRepository; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CertificateRepository = void 0; | ||
const tslib_1 = require("tslib"); | ||
const base_1 = require("./base"); | ||
class CertificateRepository extends base_1.BaseRepository { | ||
findCaCertificates() { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const caCerts = this.items.filter(o => o.type === "ca"); | ||
return caCerts ? caCerts : null; | ||
}); | ||
async findCaCertificates() { | ||
const caCerts = this.items.filter(o => o.type === "ca"); | ||
return caCerts ? caCerts : null; | ||
} | ||
findByThumbprint(thumbprint) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const item = this.items.find(o => o.thumbprint === thumbprint); | ||
return item ? item : null; | ||
}); | ||
async findByThumbprint(thumbprint) { | ||
const item = this.items.find(o => o.thumbprint === thumbprint); | ||
return item ? item : null; | ||
} | ||
} | ||
exports.CertificateRepository = CertificateRepository; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ChallengeRepository = void 0; | ||
const tslib_1 = require("tslib"); | ||
const base_1 = require("./base"); | ||
class ChallengeRepository extends base_1.BaseRepository { | ||
findByAuthorization(authId) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return this.items.filter(o => o.authorizationId === authId); | ||
}); | ||
async findByAuthorization(authId) { | ||
return this.items.filter(o => o.authorizationId === authId); | ||
} | ||
} | ||
exports.ChallengeRepository = ChallengeRepository; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.NonceRepository = void 0; | ||
const tslib_1 = require("tslib"); | ||
const x509_1 = require("@peculiar/x509"); | ||
@@ -11,25 +10,19 @@ const pvtsutils_1 = require("pvtsutils"); | ||
} | ||
remove(value) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const index = this.items.indexOf(value); | ||
if (index > -1) { | ||
this.items.splice(index, 1); | ||
} | ||
}); | ||
async remove(value) { | ||
const index = this.items.indexOf(value); | ||
if (index > -1) { | ||
this.items.splice(index, 1); | ||
} | ||
} | ||
create() { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const crypto = x509_1.cryptoProvider.get(); | ||
const buffer = crypto.getRandomValues(new Uint8Array(20)); | ||
const item = pvtsutils_1.Convert.ToBase64Url(buffer); | ||
this.items.push(item); | ||
return item; | ||
}); | ||
async create() { | ||
const crypto = x509_1.cryptoProvider.get(); | ||
const buffer = crypto.getRandomValues(new Uint8Array(20)); | ||
const item = pvtsutils_1.Convert.ToBase64Url(buffer); | ||
this.items.push(item); | ||
return item; | ||
} | ||
contains(value) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return this.items.includes(value); | ||
}); | ||
async contains(value) { | ||
return this.items.includes(value); | ||
} | ||
} | ||
exports.NonceRepository = NonceRepository; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.OrderAuthorizationRepository = void 0; | ||
const tslib_1 = require("tslib"); | ||
const base_1 = require("./base"); | ||
class OrderAuthorizationRepository extends base_1.BaseRepository { | ||
findByOrder(orderId) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return this.items.filter(o => o.orderId === orderId) || null; | ||
}); | ||
async findByOrder(orderId) { | ||
return this.items.filter(o => o.orderId === orderId) || null; | ||
} | ||
findByAuthorization(authId) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return this.items.filter(o => o.authorizationId === authId) || null; | ||
}); | ||
async findByAuthorization(authId) { | ||
return this.items.filter(o => o.authorizationId === authId) || null; | ||
} | ||
} | ||
exports.OrderAuthorizationRepository = OrderAuthorizationRepository; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.OrderRepository = void 0; | ||
const tslib_1 = require("tslib"); | ||
const base_1 = require("./base"); | ||
class OrderRepository extends base_1.BaseRepository { | ||
findByThumbprint(thumbprint) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
return this.items.find(o => o.certificate && o.certificate === thumbprint) || null; | ||
}); | ||
async findByThumbprint(thumbprint) { | ||
return this.items.find(o => o.certificate && o.certificate === thumbprint) || null; | ||
} | ||
lastByIdentifier(accountId, identifier) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const items = this.items.filter(o => o.accountId === accountId && o.identifier === identifier); | ||
return items[items.length - 1] || null; | ||
}); | ||
async lastByIdentifier(accountId, identifier) { | ||
const items = this.items.filter(o => o.accountId === accountId && o.identifier === identifier); | ||
return items[items.length - 1] || null; | ||
} | ||
getList(accountId, page, size) { | ||
async getList(accountId, page, size) { | ||
var _a; | ||
return tslib_1.__awaiter(this, void 0, void 0, function* () { | ||
const list = this.items.filter(o => o.accountId === accountId && o.status !== "invalid"); | ||
const cursor = +(((_a = page.cursor) === null || _a === void 0 ? void 0 : _a[0]) || 0); | ||
const items = list.slice(cursor * size, cursor * size + size); | ||
const orderLIst = { | ||
items: items, | ||
next: cursor * size + size < list.length, | ||
}; | ||
return orderLIst; | ||
}); | ||
const list = this.items.filter(o => o.accountId === accountId && o.status !== "invalid"); | ||
const cursor = +(((_a = page.cursor) === null || _a === void 0 ? void 0 : _a[0]) || 0); | ||
const items = list.slice(cursor * size, cursor * size + size); | ||
const orderLIst = { | ||
items: items, | ||
next: cursor * size + size < list.length, | ||
}; | ||
return orderLIst; | ||
} | ||
} | ||
exports.OrderRepository = OrderRepository; |
@@ -1,11 +0,8 @@ | ||
import { __awaiter } from "tslib"; | ||
import { BaseRepository } from "./base"; | ||
export class AccountRepository extends BaseRepository { | ||
findByPublicKey(publicKey) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const thumbprint = yield publicKey.getThumbprint(); | ||
const item = this.items.find(o => o.thumbprint === thumbprint); | ||
return item ? item : null; | ||
}); | ||
async findByPublicKey(publicKey) { | ||
const thumbprint = await publicKey.getThumbprint(); | ||
const item = this.items.find(o => o.thumbprint === thumbprint); | ||
return item ? item : null; | ||
} | ||
} |
@@ -1,10 +0,7 @@ | ||
import { __awaiter } from "tslib"; | ||
import { BaseRepository } from "./base"; | ||
export class AuthorizationRepository extends BaseRepository { | ||
findByIdentifier(accountId, identifier) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const items = this.items.filter(o => o.accountId === accountId && o.identifier.type === identifier.type && o.identifier.value === identifier.value); | ||
return items[items.length - 1] || null; | ||
}); | ||
async findByIdentifier(accountId, identifier) { | ||
const items = this.items.filter(o => o.accountId === accountId && o.identifier.type === identifier.type && o.identifier.value === identifier.value); | ||
return items[items.length - 1] || null; | ||
} | ||
} |
@@ -1,2 +0,1 @@ | ||
import { __awaiter } from "tslib"; | ||
export class BaseRepository { | ||
@@ -7,44 +6,36 @@ constructor() { | ||
} | ||
findById(id) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.items.find(o => { return o.id == id; }) || null; | ||
}); | ||
async findById(id) { | ||
return this.items.find(o => { return o.id == id; }) || null; | ||
} | ||
add(item) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
if (!item.id) { | ||
item.id = ++this.lastId; | ||
this.items.push(item); | ||
} | ||
else { | ||
throw new Error("Element already exists"); | ||
} | ||
return item; | ||
}); | ||
async add(item) { | ||
if (!item.id) { | ||
item.id = ++this.lastId; | ||
this.items.push(item); | ||
} | ||
else { | ||
throw new Error("Element already exists"); | ||
} | ||
return item; | ||
} | ||
update(item) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const updateItem = this.items.find(o => { return o.id == item.id; }); | ||
if (updateItem) { | ||
const index = this.items.indexOf(updateItem); | ||
this.items[index] = item; | ||
} | ||
else { | ||
throw new Error("Element not found"); | ||
} | ||
return item; | ||
}); | ||
async update(item) { | ||
const updateItem = this.items.find(o => { return o.id == item.id; }); | ||
if (updateItem) { | ||
const index = this.items.indexOf(updateItem); | ||
this.items[index] = item; | ||
} | ||
else { | ||
throw new Error("Element not found"); | ||
} | ||
return item; | ||
} | ||
remove(item) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const removeItem = this.items.find(o => { return o.id == item.id; }); | ||
if (removeItem) { | ||
const index = this.items.indexOf(item); | ||
if (index > -1) { | ||
this.items.splice(index, 1); | ||
} | ||
async remove(item) { | ||
const removeItem = this.items.find(o => { return o.id == item.id; }); | ||
if (removeItem) { | ||
const index = this.items.indexOf(item); | ||
if (index > -1) { | ||
this.items.splice(index, 1); | ||
} | ||
return; | ||
}); | ||
} | ||
return; | ||
} | ||
} |
@@ -1,16 +0,11 @@ | ||
import { __awaiter } from "tslib"; | ||
import { BaseRepository } from "./base"; | ||
export class CertificateRepository extends BaseRepository { | ||
findCaCertificates() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const caCerts = this.items.filter(o => o.type === "ca"); | ||
return caCerts ? caCerts : null; | ||
}); | ||
async findCaCertificates() { | ||
const caCerts = this.items.filter(o => o.type === "ca"); | ||
return caCerts ? caCerts : null; | ||
} | ||
findByThumbprint(thumbprint) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const item = this.items.find(o => o.thumbprint === thumbprint); | ||
return item ? item : null; | ||
}); | ||
async findByThumbprint(thumbprint) { | ||
const item = this.items.find(o => o.thumbprint === thumbprint); | ||
return item ? item : null; | ||
} | ||
} |
@@ -1,9 +0,6 @@ | ||
import { __awaiter } from "tslib"; | ||
import { BaseRepository } from "./base"; | ||
export class ChallengeRepository extends BaseRepository { | ||
findByAuthorization(authId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.items.filter(o => o.authorizationId === authId); | ||
}); | ||
async findByAuthorization(authId) { | ||
return this.items.filter(o => o.authorizationId === authId); | ||
} | ||
} |
@@ -1,2 +0,1 @@ | ||
import { __awaiter } from "tslib"; | ||
import { cryptoProvider } from "@peculiar/x509"; | ||
@@ -8,24 +7,18 @@ import { Convert } from "pvtsutils"; | ||
} | ||
remove(value) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const index = this.items.indexOf(value); | ||
if (index > -1) { | ||
this.items.splice(index, 1); | ||
} | ||
}); | ||
async remove(value) { | ||
const index = this.items.indexOf(value); | ||
if (index > -1) { | ||
this.items.splice(index, 1); | ||
} | ||
} | ||
create() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const crypto = cryptoProvider.get(); | ||
const buffer = crypto.getRandomValues(new Uint8Array(20)); | ||
const item = Convert.ToBase64Url(buffer); | ||
this.items.push(item); | ||
return item; | ||
}); | ||
async create() { | ||
const crypto = cryptoProvider.get(); | ||
const buffer = crypto.getRandomValues(new Uint8Array(20)); | ||
const item = Convert.ToBase64Url(buffer); | ||
this.items.push(item); | ||
return item; | ||
} | ||
contains(value) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.items.includes(value); | ||
}); | ||
async contains(value) { | ||
return this.items.includes(value); | ||
} | ||
} |
@@ -1,14 +0,9 @@ | ||
import { __awaiter } from "tslib"; | ||
import { BaseRepository } from "./base"; | ||
export class OrderAuthorizationRepository extends BaseRepository { | ||
findByOrder(orderId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.items.filter(o => o.orderId === orderId) || null; | ||
}); | ||
async findByOrder(orderId) { | ||
return this.items.filter(o => o.orderId === orderId) || null; | ||
} | ||
findByAuthorization(authId) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.items.filter(o => o.authorizationId === authId) || null; | ||
}); | ||
async findByAuthorization(authId) { | ||
return this.items.filter(o => o.authorizationId === authId) || null; | ||
} | ||
} |
@@ -1,28 +0,21 @@ | ||
import { __awaiter } from "tslib"; | ||
import { BaseRepository } from "./base"; | ||
export class OrderRepository extends BaseRepository { | ||
findByThumbprint(thumbprint) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return this.items.find(o => o.certificate && o.certificate === thumbprint) || null; | ||
}); | ||
async findByThumbprint(thumbprint) { | ||
return this.items.find(o => o.certificate && o.certificate === thumbprint) || null; | ||
} | ||
lastByIdentifier(accountId, identifier) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const items = this.items.filter(o => o.accountId === accountId && o.identifier === identifier); | ||
return items[items.length - 1] || null; | ||
}); | ||
async lastByIdentifier(accountId, identifier) { | ||
const items = this.items.filter(o => o.accountId === accountId && o.identifier === identifier); | ||
return items[items.length - 1] || null; | ||
} | ||
getList(accountId, page, size) { | ||
async getList(accountId, page, size) { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const list = this.items.filter(o => o.accountId === accountId && o.status !== "invalid"); | ||
const cursor = +(((_a = page.cursor) === null || _a === void 0 ? void 0 : _a[0]) || 0); | ||
const items = list.slice(cursor * size, cursor * size + size); | ||
const orderLIst = { | ||
items: items, | ||
next: cursor * size + size < list.length, | ||
}; | ||
return orderLIst; | ||
}); | ||
const list = this.items.filter(o => o.accountId === accountId && o.status !== "invalid"); | ||
const cursor = +(((_a = page.cursor) === null || _a === void 0 ? void 0 : _a[0]) || 0); | ||
const items = list.slice(cursor * size, cursor * size + size); | ||
const orderLIst = { | ||
items: items, | ||
next: cursor * size + size < list.length, | ||
}; | ||
return orderLIst; | ||
} | ||
} |
@@ -6,2 +6,10 @@ # Change Log | ||
## [1.2.10](https://github.com/PeculiarVentures/acme-ts/compare/v1.2.9...v1.2.10) (2020-10-27) | ||
**Note:** Version bump only for package @peculiar/acme-data-memory | ||
## [1.2.3](https://github.com/PeculiarVentures/acme-ts/compare/v1.2.2...v1.2.3) (2020-10-13) | ||
@@ -8,0 +16,0 @@ |
{ | ||
"name": "@peculiar/acme-data-memory", | ||
"version": "1.2.3", | ||
"version": "1.2.10", | ||
"description": "Memory data module forAutomatic Certificate Management Environment (ACME) implementing RFC 8555 framework", | ||
@@ -45,4 +45,4 @@ "keywords": [ | ||
"dependencies": { | ||
"@peculiar/acme-core": "^1.2.3", | ||
"@peculiar/acme-data": "^1.2.3", | ||
"@peculiar/acme-core": "^1.2.10", | ||
"@peculiar/acme-data": "^1.2.10", | ||
"@peculiar/acme-protocol": "^1.2.3", | ||
@@ -54,3 +54,3 @@ "@peculiar/asn1-x509": "2.0.23", | ||
}, | ||
"gitHead": "e423e2bf1b95ca032cc533fde89f4949436274a8" | ||
"gitHead": "cdb9ad9f950430017f3e3b8d3d509db843d0ac14" | ||
} |
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
69680
794
Updated@peculiar/acme-core@^1.2.10
Updated@peculiar/acme-data@^1.2.10