Compare commits

..

No commits in common. "master" and "v1.0.7" have entirely different histories.

27 changed files with 13509 additions and 10422 deletions

View File

@ -1,66 +0,0 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm and npmci
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
- name: Run npm prepare
run: npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build

View File

@ -1,124 +0,0 @@
name: Default (tags)
on:
push:
tags:
- '*'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Release
run: |
npmci node install stable
npmci npm publish
metadata:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Code quality
run: |
npmci command npm install -g typescript
npmci npm install
- name: Trigger
run: npmci trigger
- name: Build docs and upload artifacts
run: |
npmci node install stable
npmci npm install
pnpm install -g @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true

4
.gitignore vendored
View File

@ -15,6 +15,8 @@ node_modules/
# builds # builds
dist/ dist/
dist_*/ dist_web/
dist_serve/
dist_ts_web/
# custom # custom

126
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,126 @@
# gitzone ci_default
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: '$CI_BUILD_STAGE'
stages:
- security
- test
- release
- metadata
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
tags:
- lossless
- docker
- notpriv
snyk:
image: registry.gitlab.com/hosttoday/ht-docker-node:snyk
stage: security
script:
- npmci npm prepare
- npmci command npm install --ignore-scripts
- npmci command snyk test
tags:
- lossless
- docker
- notpriv
# ====================
# test stage
# ====================
testStable:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- priv
testBuild:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci command npm run build
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- lossless
- docker
- notpriv
release:
stage: release
script:
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- lossless
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
allow_failure: true
script:
- npmci command npm install -g tslint typescript
- npmci npm prepare
- npmci npm install
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
tags:
- lossless
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- lossless
- docker
- notpriv
pages:
stage: metadata
script:
- npmci node install lts
- npmci command npm install -g @gitzone/tsdoc
- npmci npm prepare
- npmci npm install
- npmci command tsdoc
tags:
- lossless
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

24
.vscode/launch.json vendored
View File

@ -2,10 +2,28 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"command": "npm test", "name": "current file",
"name": "Run npm test", "type": "node",
"request": "launch", "request": "launch",
"type": "node-terminal" "args": [
"${relativeFile}"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "test.ts",
"type": "node",
"request": "launch",
"args": [
"test/test.ts"
],
"runtimeArgs": ["-r", "@gitzone/tsrun"],
"cwd": "${workspaceRoot}",
"protocol": "inspector",
"internalConsoleOptions": "openOnSessionStart"
} }
] ]
} }

View File

@ -15,7 +15,7 @@
"properties": { "properties": {
"projectType": { "projectType": {
"type": "string", "type": "string",
"enum": ["website", "element", "service", "npm", "wcc"] "enum": ["website", "element", "service", "npm"]
} }
} }
} }

View File

@ -1,75 +0,0 @@
# Changelog
## 2024-11-26 - 3.1.1 - fix(core)
Fix S3 cache manager methods for better path encoding consistency
- Corrected path parameter usage in S3 manager methods to ensure encoding and consistency.
- Updated package.json Git dependencies for scoped packages.
## 2024-11-24 - 3.1.0 - feat(core)
Enhanced caching solution with optional configurations and improved documentation.
- Improved package description and keywords for better discoverability.
- Updated dependencies to latest versions.
- Added strict type checking in TypeScript configurations.
- Enhanced README with detailed usage instructions and examples.
## 2024-05-29 to 2024-02-14 - 3.0.8
Minor configuration updates and documentation changes.
- Updated project description.
- Modified tsconfig setup.
- Adjustments to npmextra.json regarding githost.
## 2024-02-14 - 3.0.7
Core enhancements and bug fixes.
- Fixed updates in the core module to improve stability.
## 2024-02-14 - 3.0.6
Core maintenance and updates.
- Implemented minor fixes in the core module.
## 2023-07-21 - 3.0.5
Addressed core module adjustments.
- Patched core module to rectify issues.
## 2023-07-20 - 3.0.4
Further improvements to core functionality.
- Additional fixes applied to the core component.
## 2023-07-11 to 2023-07-10 - 3.0.3
Organizational and structural changes.
- Transitioned to a new organizational scheme.
## 2023-01-09 - 3.0.2
Core module corrections.
- Resolved various issues within the core module.
## 2022-06-09 - 3.0.1
Continuous enhancements in core functionality.
- Continued bug fixes for core module efficiency.
## 2022-04-04 to 2022-04-02 - 3.0.0
Major release with significant updates.
## 2022-03-22 - 2.0.0
Significant breaking changes in core tech stack.
- BREAKING CHANGE: Transitioned core module to ECMAScript Modules (ESM).
## 2021-05-10 - 1.0.9
Caching improvements and optimization.
- Enhanced caching by properly respecting TTL across all cache levels.
## 2020-02-15 to 2020-02-05 - 1.0.6 to 1.0.1
Initial series of core module fixes and updates.
- Persistent efforts to stabilize and improve core functionalities.

View File

@ -2,34 +2,17 @@
"gitzone": { "gitzone": {
"projectType": "npm", "projectType": "npm",
"module": { "module": {
"githost": "code.foss.global", "githost": "gitlab.com",
"gitscope": "push.rocks", "gitscope": "pushrocks",
"gitrepo": "levelcache", "gitrepo": "levelcache",
"description": "A versatile caching solution offering multi-level storage utilizing memory, disk, and Amazon S3 for efficient data management and backup.", "shortDescription": "a cache that uses memory/disk/s3 as backup",
"npmPackagename": "@push.rocks/levelcache", "npmPackagename": "@pushrocks/levelcache",
"license": "MIT", "license": "MIT",
"projectDomain": "push.rocks", "projectDomain": "push.rocks"
"keywords": [
"caching",
"data storage",
"memory cache",
"disk cache",
"S3 storage",
"data backup",
"multi-level caching",
"performance",
"persistent storage",
"data retrieval",
"Node.js",
"TypeScript"
]
} }
}, },
"npmci": { "npmci": {
"npmGlobalTools": [], "npmGlobalTools": [],
"npmAccessLevel": "public" "npmAccessLevel": "public"
},
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
} }
} }

13188
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,73 +1,45 @@
{ {
"name": "@push.rocks/levelcache", "name": "@pushrocks/levelcache",
"version": "3.1.1", "version": "1.0.7",
"private": false, "private": false,
"description": "A versatile caching solution offering multi-level storage utilizing memory, disk, and Amazon S3 for efficient data management and backup.", "description": "a cache that uses memory/disk/s3 as backup",
"main": "dist_ts/index.js", "main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts", "typings": "dist_ts/index.d.ts",
"type": "module",
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"test": "(tstest test/ --web)", "test": "(tstest test/ --web)",
"build": "(tsbuild --web --allowimplicitany)", "build": "(tsbuild --web)"
"buildDocs": "tsdoc",
"localPublish": "gitzone commit && pnpm run build && pnpm publish && pnpm publish --access public --registry=\"https://registry.npmjs.org\""
}, },
"devDependencies": { "devDependencies": {
"@git.zone/tsbuild": "^2.1.66", "@gitzone/tsbuild": "^2.1.25",
"@git.zone/tsrun": "^1.2.44", "@gitzone/tstest": "^1.0.52",
"@git.zone/tstest": "^1.0.77", "@pushrocks/tapbundle": "^3.2.14",
"@push.rocks/tapbundle": "^5.5.3", "@types/node": "^14.14.41",
"@types/node": "^22.9.3" "tslint": "^6.1.3",
"tslint-config-prettier": "^1.15.0"
}, },
"dependencies": { "dependencies": {
"@push.rocks/lik": "^6.1.0", "@pushrocks/lik": "^4.0.20",
"@push.rocks/smartbucket": "^3.3.3", "@pushrocks/smartbucket": "^1.0.39",
"@push.rocks/smartcache": "^1.0.13", "@pushrocks/smartcache": "^1.0.13",
"@push.rocks/smartenv": "^5.0.12", "@pushrocks/smartexit": "^1.0.15",
"@push.rocks/smartexit": "^1.0.23", "@pushrocks/smartfile": "^8.0.9",
"@push.rocks/smartfile": "^11.0.21", "@pushrocks/smartjson": "^4.0.6",
"@push.rocks/smartjson": "^5.0.20", "@pushrocks/smartpromise": "^3.1.5",
"@push.rocks/smartpath": "^5.0.18", "@pushrocks/smartstring": "^3.0.24",
"@push.rocks/smartpromise": "^4.0.4", "@pushrocks/smartunique": "^3.0.3",
"@push.rocks/smartstring": "^4.0.15", "@pushrocks/taskbuffer": "^2.1.13"
"@push.rocks/smartunique": "^3.0.9",
"@push.rocks/taskbuffer": "^3.1.7",
"@tsclass/tsclass": "^4.1.2"
}, },
"files": [ "files": [
"ts/**/*", "ts/**/*",
"ts_web/**/*", "ts_web/**/*",
"dist/**/*", "dist/**/*",
"dist_*/**/*", "dist_web/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*", "dist_ts_web/**/*",
"assets/**/*", "assets/**/*",
"cli.js", "cli.js",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
], ]
"browserslist": [
"last 1 chrome versions"
],
"keywords": [
"caching",
"data storage",
"memory cache",
"disk cache",
"S3 storage",
"data backup",
"multi-level caching",
"performance",
"persistent storage",
"data retrieval",
"Node.js",
"TypeScript"
],
"homepage": "https://code.foss.global/push.rocks/levelcache",
"repository": {
"type": "git",
"url": "https://code.foss.global/push.rocks/levelcache.git"
}
} }

9689
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@

186
readme.md
View File

@ -1,173 +1,35 @@
# @push.rocks/levelcache # @pushrocks/levelcache
A cache that utilizes memory, disk, and S3 for data storage and backup. a cache that uses memory/disk/s3 as backup
## Install ## Availabililty and Links
To install `@push.rocks/levelcache`, you can use npm or yarn: * [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/levelcache)
* [gitlab.com (source)](https://gitlab.com/pushrocks/levelcache)
* [github.com (source mirror)](https://github.com/pushrocks/levelcache)
* [docs (typedoc)](https://pushrocks.gitlab.io/levelcache/)
```bash ## Status for master
npm install @push.rocks/levelcache --save [![pipeline status](https://gitlab.com/pushrocks/levelcache/badges/master/pipeline.svg)](https://gitlab.com/pushrocks/levelcache/commits/master)
``` [![coverage report](https://gitlab.com/pushrocks/levelcache/badges/master/coverage.svg)](https://gitlab.com/pushrocks/levelcache/commits/master)
or [![npm downloads per month](https://img.shields.io/npm/dm/@pushrocks/levelcache.svg)](https://www.npmjs.com/package/@pushrocks/levelcache)
```bash [![Known Vulnerabilities](https://snyk.io/test/npm/@pushrocks/levelcache/badge.svg)](https://snyk.io/test/npm/@pushrocks/levelcache)
yarn add @push.rocks/levelcache [![TypeScript](https://img.shields.io/badge/TypeScript->=%203.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
``` [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://prettier.io/)
This installs `@push.rocks/levelcache` and adds it to your project's dependencies.
## Usage ## Usage
`@push.rocks/levelcache` provides a comprehensive solution for multi-level caching that takes advantage of memory, disk, and Amazon S3 storage, making it a versatile tool for data caching and backup. The package is built with TypeScript, enabling strict type checks and better development experience. Below, we'll explore how to effectively employ `@push.rocks/levelcache` in your projects, discussing its features and demonstrating its usage with code examples. @pushrocks/levelcache implements an efficient way to cache larger amounts of data ind a multilevel approach.
smaller and prioritized data is safed in memory.
### 1. Overview Use TypeScript for best in class intellisense.
The `LevelCache` class handles all cache operations. It decides where to store data based on pre-configured thresholds corresponding to the data size and the total storage capacity allocated for each storage type (memory/disk/S3). This mechanism optimizes both speed and persistence, allowing for efficient data storage and retrieval. ## Contribution
### 2. Getting Started: Initialization We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
To use `@push.rocks/levelcache`, you'll need to import the main classes: `LevelCache` and `CacheEntry`. `LevelCache` is the primary class, while `CacheEntry` represents individual pieces of cached data. For further information read the linked docs at the top of this readme.
```typescript > MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
import { LevelCache, CacheEntry } from '@push.rocks/levelcache'; | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
```
#### Initialization with Optional Configurations [![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
To create a cache, instantiate the `LevelCache` class with desired configurations. You can specify the limits for memory and disk storage, setup S3 configurations if needed, and more.
```typescript
const myCache = new LevelCache({
cacheId: 'myUniqueCacheId', // Unique ID for cache delineation
maxMemoryStorageInMB: 10, // Maximum memory use in MB (default 0.5 MB)
maxDiskStorageInMB: 100, // Maximum disk space in MB (default 10 MB)
diskStoragePath: './myCache', // Path for storing disk cache; default is '.nogit'
s3Config: {
accessKeyId: 'yourAccessKeyId', // AWS S3 access key
secretAccessKey: 'yourSecretAccessKey', // Corresponding secret key
region: 'us-west-2' // AWS region, e.g., 'us-west-2'
},
s3BucketName: 'myBucketName', // Designated name for S3 bucket
immutableCache: false, // Whether stored cache entries should remain unaltered
persistentCache: true, // Should the cache persist upon restarts
});
```
### 3. Storing and Retrieving Data
`LevelCache` methods enable seamless data storage and retrieval, handling complexity under the hood.
#### Storing Data
Create a `CacheEntry` specifying the data content and time-to-live (`ttl`). Use `storeCacheEntryByKey` to add this entry to the cache.
```typescript
async function storeData() {
// Wait for cache to be ready before operations
await myCache.ready;
const entryContents = Buffer.from('Caching this data');
const myCacheEntry = new CacheEntry({
ttl: 7200000, // Time-to-live in milliseconds (2 hours)
contents: entryContents,
});
// Storing the cache entry associated with a specific key
await myCache.storeCacheEntryByKey('someDataKey', myCacheEntry);
}
```
#### Retrieving Data
Retrieve stored data using `retrieveCacheEntryByKey`. The retrieved `CacheEntry` will give access to the original data.
```typescript
async function retrieveData() {
const retrievedEntry = await myCache.retrieveCacheEntryByKey('someDataKey');
if (retrievedEntry) {
const data = retrievedEntry.contents.toString();
console.log(data); // Expected output: Caching this data
} else {
console.log('Data not found or expired.');
}
}
```
### 4. Key Management: Updating and Deleting
#### Deleting Cache Entries
Remove entries with `deleteCacheEntryByKey`, enabling clean cache management.
```typescript
async function deleteData() {
// Removes an entry using its unique key identifier
await myCache.deleteCacheEntryByKey('someDataKey');
}
```
### 5. Cache Cleaning
Often, managing storage limits or removing outdated data becomes essential. The library supports these scenarios.
#### Automated Cleaning
While cache entries will naturally expire with `ttl` values, you can force-remove outdated entries.
```typescript
// Clean outdated or expired entries
await myCache.cleanOutdated();
```
#### Full Cache Reset
Clear all entries, efficiently resetting your cache storage.
```typescript
// Flush entire cache content
await myCache.cleanAll();
```
### 6. Configuring and Managing Advanced Use Cases
The flexible nature of `@push.rocks/levelcache` grants additional customization suited for more advanced requirements.
#### Custom Route Management
For certain demands, you might want to specify distinct data handling policies or routing logic.
- Adjust S3 handling, size thresholds, or immutability options dynamically.
- Utilize internal API expansions defined within the library for fine-grained operations.
#### Handling Large Datasets
Tailor the cache levels (memory, disk, S3) to accommodate higher loads:
```typescript
const largeDatasetCache = new LevelCache({
cacheId: 'largeDatasetCache',
// Customize limits and behavior for particular patterns
maxMemoryStorageInMB: 1024, // 1 GB memory allocation
maxDiskStorageInMB: 2048, // 2 GB disk space allowance
maxS3StorageInMB: 10240, // 10 GB S3 backup buffering
});
```
With intelligent routing and management embedded, `LevelCache` ensures optimal trade-offs between speed and stability.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.

View File

@ -1,43 +1,24 @@
import { expect, tap } from '@push.rocks/tapbundle'; import { expect, tap } from '@pushrocks/tapbundle';
import * as levelcache from '../ts/index.js'; import * as levelcache from '../ts/index';
import { CacheEntry } from '../ts/index.js'; import { CacheEntry } from '../ts/index';
let testLevelCache: levelcache.LevelCache; let testLevelCache: levelcache.LevelCache;
tap.test('should create a new levelcache instance', async () => { tap.test('should create a new levelcache instance', async () => {
testLevelCache = new levelcache.LevelCache({ testLevelCache = new levelcache.LevelCache({
cacheId: 'myCache', cacheId: 'myCache'
}); });
expect(testLevelCache).toBeInstanceOf(levelcache.LevelCache); expect(testLevelCache).to.be.instanceOf(levelcache.LevelCache);
}); });
tap.test('should cache a value', async () => { tap.test('should cache a value', async () => {
await testLevelCache.storeCacheEntryByKey( await testLevelCache.storeCacheEntryByKey('mykey', new CacheEntry({
'mykey', contents: Buffer.from('heythere'),
new CacheEntry({ ttl: 10000,
contents: Buffer.from('heythere'), typeInfo: 'string'
ttl: 10000, }));
typeInfo: 'string',
})
);
const result = await testLevelCache.retrieveCacheEntryByKey('mykey'); const result = await testLevelCache.retrieveCacheEntryByKey('mykey');
expect(result.contents.toString()).toEqual('heythere'); console.log(result);
});
tap.test('should respect ttl', async (tools) => {
await testLevelCache.storeCacheEntryByKey(
'mykey',
new CacheEntry({
contents: Buffer.from('heythere'),
ttl: 1000,
typeInfo: 'string',
})
);
const result = await testLevelCache.retrieveCacheEntryByKey('mykey');
expect(result.contents.toString()).toEqual('heythere');
await tools!.delayFor(1100);
const result2 = await testLevelCache.retrieveCacheEntryByKey('mykey');
expect(result2).toBeNull();
}); });
tap.start(); tap.start();

View File

@ -1,8 +0,0 @@
/**
* autocreated commitinfo by @push.rocks/commitinfo
*/
export const commitinfo = {
name: '@push.rocks/levelcache',
version: '3.1.1',
description: 'A versatile caching solution offering multi-level storage utilizing memory, disk, and Amazon S3 for efficient data management and backup.'
}

View File

@ -1,2 +1,3 @@
export * from './levelcache.classes.levelcache.js'; export * from './levelcache.classes.levelcache';
export * from './levelcache.classes.cacheentry.js'; export * from './levelcache.classes.cacheentry';

View File

@ -1,38 +1,25 @@
import { CacheEntry } from './levelcache.classes.cacheentry.js'; import { CacheEntry } from "./levelcache.classes.cacheentry";
export abstract class AbstractCache { export abstract class AbstractCache {
public abstract ready: Promise<void>; public abstract ready: Promise<void>;
public abstract status: 'active' | 'inactive'; public abstract status: 'active' | 'inactive';
// Cache Entries // Blobs
/** /**
* store a Blob * store a Blob
*/ */
public abstract storeCacheEntryByKey(keyArg: string, valueArg: CacheEntry): Promise<void>; public abstract storeCacheEntryByKey(keyArg: string, valueArg: CacheEntry): Promise<void>;
// Cache Entries
/** /**
* retrieve cache entry * retrieve cache entry
*/ */
public abstract retrieveCacheEntryByKey(keyArg: string): Promise<CacheEntry>; public abstract retrieveCacheEntryByKey(keyArg: string): Promise<CacheEntry>;
/**
* checks for the presence of a key
* @param keyArg
*/
public abstract checkKeyPresence(keyArg: string): Promise<boolean>; public abstract checkKeyPresence(keyArg: string): Promise<boolean>;
/** /**
* delete a key * cleans the cache
*/ */
public abstract deleteCacheEntryByKey(keyArg: string): Promise<void>; public abstract clean(): Promise<void>;
/**
* clean the cache
*/
public abstract cleanOutdated(): Promise<void>;
/**
* cleans the complete cache
*/
public abstract cleanAll(): Promise<void>;
} }

View File

@ -1,8 +1,8 @@
import * as plugins from './levelcache.plugins.js'; import * as plugins from './levelcache.plugins';
import * as paths from './levelcache.paths.js'; import * as paths from './levelcache.paths';
import { AbstractCache } from './levelcache.abstract.classes.cache.js'; import { AbstractCache } from './levelcache.abstract.classes.cache';
import { type ILevelCacheConstructorOptions, LevelCache } from './levelcache.classes.levelcache.js'; import { ILevelCacheConstructorOptions, LevelCache } from './levelcache.classes.levelcache';
import { CacheEntry } from './levelcache.classes.cacheentry.js'; import { CacheEntry } from './levelcache.classes.cacheentry';
/** /**
* *
@ -12,7 +12,7 @@ export class CacheDiskManager extends AbstractCache {
private readyDeferred = plugins.smartpromise.defer<void>(); private readyDeferred = plugins.smartpromise.defer<void>();
public ready = this.readyDeferred.promise; public ready = this.readyDeferred.promise;
public status: 'active' | 'inactive'; public status: 'active' | 'inactive';
public fsPath: string; public fsPath: string;
public maxCacheSizeInMb: number; public maxCacheSizeInMb: number;
@ -24,10 +24,7 @@ export class CacheDiskManager extends AbstractCache {
public async init() { public async init() {
if (this.levelCacheRef.options.diskStoragePath) { if (this.levelCacheRef.options.diskStoragePath) {
this.fsPath = plugins.path.join( this.fsPath = plugins.path.join(this.levelCacheRef.options.diskStoragePath, this.levelCacheRef.options.cacheId);
this.levelCacheRef.options.diskStoragePath,
this.levelCacheRef.options.cacheId
);
} else { } else {
this.fsPath = plugins.path.join(paths.nogitDir, this.levelCacheRef.options.cacheId); this.fsPath = plugins.path.join(paths.nogitDir, this.levelCacheRef.options.cacheId);
} }
@ -38,30 +35,22 @@ export class CacheDiskManager extends AbstractCache {
} }
public async retrieveCacheEntryByKey(keyArg: string): Promise<CacheEntry> { public async retrieveCacheEntryByKey(keyArg: string): Promise<CacheEntry> {
const fileString = await plugins.smartfile.fs.toStringSync( const fileString = await plugins.smartfile.fs.toStringSync(plugins.path.join(this.fsPath, encodeURIComponent(keyArg)));
plugins.path.join(this.fsPath, encodeURIComponent(keyArg))
);
return CacheEntry.fromStorageJsonString(fileString); return CacheEntry.fromStorageJsonString(fileString);
} }
public async storeCacheEntryByKey(keyArg: string, cacheEntryArg: CacheEntry) { public async storeCacheEntryByKey(keyArg: string, cacheEntryArg: CacheEntry) {
await plugins.smartfile.memory.toFs( await plugins.smartfile.memory.toFs(cacheEntryArg.foldToJson(), plugins.path.join(this.fsPath, encodeURIComponent(keyArg)));
cacheEntryArg.foldToJson(),
plugins.path.join(this.fsPath, encodeURIComponent(keyArg))
);
} }
public async checkKeyPresence(keyArg: string): Promise<boolean> { public async checkKeyPresence(keyArg): Promise<boolean> {
return plugins.smartfile.fs.isFile(plugins.path.join(this.fsPath, encodeURIComponent(keyArg))); return plugins.smartfile.fs.isFile(plugins.path.join(this.fsPath, encodeURIComponent(keyArg)));
} }
public async deleteCacheEntryByKey(keyArg: string) { /**
await plugins.smartfile.fs.remove(plugins.path.join(this.fsPath, encodeURIComponent(keyArg))); * cleans the DiskCache directory
} */
public async clean() {
public async cleanOutdated() {}
public async cleanAll() {
if (this.status === 'active') { if (this.status === 'active') {
if (plugins.smartfile.fs.isDirectory(this.fsPath)) { if (plugins.smartfile.fs.isDirectory(this.fsPath)) {
await plugins.smartfile.fs.ensureEmptyDir(this.fsPath); await plugins.smartfile.fs.ensureEmptyDir(this.fsPath);

View File

@ -1,7 +1,7 @@
import * as plugins from './levelcache.plugins.js'; import * as plugins from './levelcache.plugins';
import { AbstractCache } from './levelcache.abstract.classes.cache.js'; import { AbstractCache } from './levelcache.abstract.classes.cache';
import { CacheEntry } from './levelcache.classes.cacheentry.js'; import { CacheEntry } from './levelcache.classes.cacheentry';
import { type ILevelCacheConstructorOptions, LevelCache } from './levelcache.classes.levelcache.js'; import { ILevelCacheConstructorOptions, LevelCache } from './levelcache.classes.levelcache';
export class CacheMemoryManager extends AbstractCache { export class CacheMemoryManager extends AbstractCache {
private levelCacheRef: LevelCache; private levelCacheRef: LevelCache;
@ -38,13 +38,8 @@ export class CacheMemoryManager extends AbstractCache {
} }
} }
public async deleteCacheEntryByKey(keyArg: string) { public async clean() {
this.fastMap.removeFromMap(keyArg);
}
public async cleanOutdated() {}
public async cleanAll() {
this.fastMap.clean(); this.fastMap.clean();
} }
} }

View File

@ -1,7 +1,7 @@
import * as plugins from './levelcache.plugins.js'; import * as plugins from './levelcache.plugins';
import { AbstractCache } from './levelcache.abstract.classes.cache.js'; import { AbstractCache } from './levelcache.abstract.classes.cache';
import { LevelCache } from './levelcache.classes.levelcache.js'; import { LevelCache } from './levelcache.classes.levelcache';
import { CacheEntry } from './levelcache.classes.cacheentry.js'; import { CacheEntry } from './levelcache.classes.cacheentry';
/** /**
* *
@ -26,9 +26,9 @@ export class CacheS3Manager extends AbstractCache {
if (this.levelCacheRef.options.s3Config) { if (this.levelCacheRef.options.s3Config) {
this.smartbucket = new plugins.smartbucket.SmartBucket(this.levelCacheRef.options.s3Config); this.smartbucket = new plugins.smartbucket.SmartBucket(this.levelCacheRef.options.s3Config);
this.s3CacheBucket = await this.smartbucket.getBucketByName(''); this.s3CacheBucket = await this.smartbucket.getBucketByName('');
this.s3CacheDir = await ( this.s3CacheDir = await (await this.s3CacheBucket.getBaseDirectory()).getSubDirectoryByName(
await this.s3CacheBucket.getBaseDirectory() this.levelCacheRef.options.cacheId
).getSubDirectoryByName(this.levelCacheRef.options.cacheId); );
if (this.levelCacheRef.options.maxS3StorageInMB) { if (this.levelCacheRef.options.maxS3StorageInMB) {
console.log(`cache level S3 activated with ${this.levelCacheRef.options.maxS3StorageInMB}`); console.log(`cache level S3 activated with ${this.levelCacheRef.options.maxS3StorageInMB}`);
} else { } else {
@ -42,18 +42,13 @@ export class CacheS3Manager extends AbstractCache {
} }
public async retrieveCacheEntryByKey(keyArg: string): Promise<CacheEntry> { public async retrieveCacheEntryByKey(keyArg: string): Promise<CacheEntry> {
const jsonFileString = (await this.s3CacheDir.fastGet({ const jsonFileString = (await this.s3CacheDir.fastGet(encodeURIComponent(keyArg))).toString();
path: encodeURIComponent(keyArg),
})).toString();
const cacheEntry = CacheEntry.fromStorageJsonString(jsonFileString); const cacheEntry = CacheEntry.fromStorageJsonString(jsonFileString);
return cacheEntry; return cacheEntry;
} }
public async storeCacheEntryByKey(keyArg: string, cacheEntryArg: CacheEntry) { public async storeCacheEntryByKey(keyArg: string, cacheEntryArg: CacheEntry) {
await this.s3CacheDir.fastPut({ await this.s3CacheDir.fastStore(encodeURIComponent(keyArg), cacheEntryArg.toStorageJsonString());
path: encodeURIComponent(keyArg),
contents: cacheEntryArg.toStorageJsonString()
});
} }
public async checkKeyPresence(keyArg: string): Promise<boolean> { public async checkKeyPresence(keyArg: string): Promise<boolean> {
@ -66,22 +61,7 @@ export class CacheS3Manager extends AbstractCache {
return false; return false;
} }
public async deleteCacheEntryByKey(keyArg: string) { public async clean() {
if (this.status === 'active') { await this.s3CacheDir.deleteWithAllContents();
await this.s3CacheDir.fastRemove({
path: encodeURIComponent(keyArg),
});
}
}
/**
* clean outdated
*/
public async cleanOutdated() {}
public async cleanAll() {
await this.s3CacheDir.delete({
mode: 'permanent',
});
} }
} }

View File

@ -1,4 +1,4 @@
import * as plugins from './levelcache.plugins.js'; import * as plugins from './levelcache.plugins';
export interface ICacheEntryConstructorOptions { export interface ICacheEntryConstructorOptions {
key?: string; key?: string;
@ -10,10 +10,7 @@ export interface ICacheEntryConstructorOptions {
/** /**
* a CacheEntry * a CacheEntry
*/ */
export class CacheEntry export class CacheEntry extends plugins.smartjson.Smartjson implements ICacheEntryConstructorOptions {
extends plugins.smartjson.Smartjson
implements ICacheEntryConstructorOptions
{
public static fromStorageJsonString(storageJsonString: string) { public static fromStorageJsonString(storageJsonString: string) {
return new CacheEntry(plugins.smartjson.parse(storageJsonString)); return new CacheEntry(plugins.smartjson.parse(storageJsonString));
} }
@ -24,9 +21,6 @@ export class CacheEntry
@plugins.smartjson.foldDec() @plugins.smartjson.foldDec()
public ttl: number; public ttl: number;
@plugins.smartjson.foldDec()
public createdAt: number;
@plugins.smartjson.foldDec() @plugins.smartjson.foldDec()
public typeInfo: string; public typeInfo: string;

View File

@ -1,7 +1,7 @@
import * as plugins from './levelcache.plugins.js'; import * as plugins from './levelcache.plugins';
import { LevelCache } from './levelcache.classes.levelcache.js'; import { LevelCache } from './levelcache.classes.levelcache';
import { AbstractCache } from './levelcache.abstract.classes.cache.js'; import { AbstractCache } from './levelcache.abstract.classes.cache';
import { CacheEntry } from './levelcache.classes.cacheentry.js'; import { CacheEntry } from './levelcache.classes.cacheentry';
export class CacheRouter { export class CacheRouter {
public levelCacheRef: LevelCache; public levelCacheRef: LevelCache;
@ -16,29 +16,22 @@ export class CacheRouter {
*/ */
async getCacheForStoreAction(keyArg: string, cacheEntry: CacheEntry): Promise<AbstractCache> { async getCacheForStoreAction(keyArg: string, cacheEntry: CacheEntry): Promise<AbstractCache> {
let returnCache: AbstractCache; let returnCache: AbstractCache;
const mbToBytesMultiplier = 1000 * 1000;
const maxMemoryBytes = this.levelCacheRef.options.maxMemoryStorageInMB * mbToBytesMultiplier;
const maxDiskBytes = this.levelCacheRef.options.maxDiskStorageInMB * mbToBytesMultiplier;
const maxS3Bytes = this.levelCacheRef.options.maxS3StorageInMB * mbToBytesMultiplier;
switch (true) { switch (true) {
case cacheEntry.contents.byteLength <= maxMemoryBytes && case cacheEntry.contents.byteLength <= 500:
this.levelCacheRef.cacheMemoryManager.status === 'active':
returnCache = this.levelCacheRef.cacheMemoryManager; returnCache = this.levelCacheRef.cacheMemoryManager;
break; break;
case this.levelCacheRef.cacheDiskManager.status === 'active' && case this.levelCacheRef.cacheDiskManager.status === 'active' &&
cacheEntry.contents.byteLength > maxMemoryBytes && cacheEntry.contents.byteLength >= 500 &&
cacheEntry.contents.byteLength <= maxDiskBytes && (cacheEntry.contents.byteLength < 10000 ||
this.levelCacheRef.cacheDiskManager.status === 'active': this.levelCacheRef.cacheS3Manager.status === 'inactive'):
returnCache = this.levelCacheRef.cacheDiskManager; returnCache = this.levelCacheRef.cacheDiskManager;
break; break;
case cacheEntry.contents.byteLength > maxDiskBytes && case cacheEntry.contents.byteLength >= 10000 &&
cacheEntry.contents.byteLength < maxS3Bytes &&
this.levelCacheRef.cacheS3Manager.status === 'active': this.levelCacheRef.cacheS3Manager.status === 'active':
returnCache = this.levelCacheRef.cacheS3Manager; returnCache = this.levelCacheRef.cacheS3Manager;
break; break;
default: default:
returnCache = null; returnCache = this.levelCacheRef.cacheMemoryManager;
} }
this.cacheKeyMap.addToMap(keyArg, returnCache); this.cacheKeyMap.addToMap(keyArg, returnCache);
return returnCache; return returnCache;
@ -53,7 +46,7 @@ export class CacheRouter {
if (!returnCache && this.levelCacheRef.options.persistentCache) { if (!returnCache && this.levelCacheRef.options.persistentCache) {
const checkCache = (cacheArg: AbstractCache) => { const checkCache = (cacheArg: AbstractCache) => {
const resultPromise = cacheArg.checkKeyPresence(keyArg); const resultPromise = cacheArg.checkKeyPresence(keyArg);
resultPromise.then((hasKeyArg) => { resultPromise.then(hasKeyArg => {
if (hasKeyArg) { if (hasKeyArg) {
done.resolve(cacheArg); done.resolve(cacheArg);
} }
@ -63,7 +56,7 @@ export class CacheRouter {
Promise.all([ Promise.all([
checkCache(this.levelCacheRef.cacheMemoryManager), checkCache(this.levelCacheRef.cacheMemoryManager),
checkCache(this.levelCacheRef.cacheDiskManager), checkCache(this.levelCacheRef.cacheDiskManager),
checkCache(this.levelCacheRef.cacheMemoryManager), checkCache(this.levelCacheRef.cacheMemoryManager)
]).then(() => { ]).then(() => {
done.resolve(returnCache); done.resolve(returnCache);
}); });

View File

@ -1,10 +1,10 @@
import * as plugins from './levelcache.plugins.js'; import * as plugins from './levelcache.plugins';
import { CacheDiskManager } from './levelcache.classes.cache.diskmanager.js'; import { CacheDiskManager } from './levelcache.classes.cache.diskmanager';
import { CacheMemoryManager } from './levelcache.classes.cache.memorymanager.js'; import { CacheMemoryManager } from './levelcache.classes.cache.memorymanager';
import { CacheS3Manager } from './levelcache.classes.cache.s3manager.js'; import { CacheS3Manager } from './levelcache.classes.cache.s3manager';
import { CacheEntry } from './levelcache.classes.cacheentry.js'; import { CacheEntry } from './levelcache.classes.cacheentry';
import { CacheRouter } from './levelcache.classes.cacherouter.js'; import { CacheRouter } from './levelcache.classes.cacherouter';
import { AbstractCache } from './levelcache.abstract.classes.cache.js'; import { AbstractCache } from './levelcache.abstract.classes.cache';
export interface ILevelCacheConstructorOptions { export interface ILevelCacheConstructorOptions {
/** /**
@ -15,7 +15,7 @@ export interface ILevelCacheConstructorOptions {
maxDiskStorageInMB?: number; maxDiskStorageInMB?: number;
maxS3StorageInMB?: number; maxS3StorageInMB?: number;
diskStoragePath?: string; diskStoragePath?: string;
s3Config?: plugins.tsclass.storage.IS3Descriptor; s3Config?: plugins.smartbucket.ISmartBucketConfig;
s3BucketName?: string; s3BucketName?: string;
forceLevel?: 'memory' | 'disk' | 's3'; forceLevel?: 'memory' | 'disk' | 's3';
expirationInMs?: number; expirationInMs?: number;
@ -42,18 +42,13 @@ export class LevelCache extends AbstractCache {
constructor(optionsArg: ILevelCacheConstructorOptions) { constructor(optionsArg: ILevelCacheConstructorOptions) {
super(); super();
this.options = { this.options = optionsArg;
maxMemoryStorageInMB: 0.5,
maxDiskStorageInMB: 10,
maxS3StorageInMB: 50,
...optionsArg,
};
this.init(); this.init();
} }
public async init() { public async init() {
this.cacheMemoryManager = new CacheMemoryManager(this);
this.cacheDiskManager = new CacheDiskManager(this); this.cacheDiskManager = new CacheDiskManager(this);
this.cacheMemoryManager = new CacheMemoryManager(this);
this.cacheS3Manager = new CacheS3Manager(this); this.cacheS3Manager = new CacheS3Manager(this);
await Promise.all([ await Promise.all([
this.cacheDiskManager.ready, this.cacheDiskManager.ready,
@ -67,7 +62,6 @@ export class LevelCache extends AbstractCache {
public async storeCacheEntryByKey(keyArg: string, cacheEntryArg: CacheEntry): Promise<void> { public async storeCacheEntryByKey(keyArg: string, cacheEntryArg: CacheEntry): Promise<void> {
cacheEntryArg.key = keyArg; cacheEntryArg.key = keyArg;
const targetCache = await this.cacheRouter.getCacheForStoreAction(keyArg, cacheEntryArg); const targetCache = await this.cacheRouter.getCacheForStoreAction(keyArg, cacheEntryArg);
cacheEntryArg.createdAt = Date.now();
await targetCache.storeCacheEntryByKey(keyArg, cacheEntryArg); await targetCache.storeCacheEntryByKey(keyArg, cacheEntryArg);
} }
@ -79,43 +73,30 @@ export class LevelCache extends AbstractCache {
const targetCache = await this.cacheRouter.getCacheForRetrieveAction(keyArg); const targetCache = await this.cacheRouter.getCacheForRetrieveAction(keyArg);
if (targetCache) { if (targetCache) {
const cacheEntry = await targetCache.retrieveCacheEntryByKey(keyArg); const cacheEntry = await targetCache.retrieveCacheEntryByKey(keyArg);
if (cacheEntry.createdAt + cacheEntry.ttl < Date.now()) {
await this.deleteCacheEntryByKey(keyArg).catch();
return null;
}
return cacheEntry; return cacheEntry;
} else { } else {
return null; return null;
} }
} }
public async checkKeyPresence(keyArg: string): Promise<boolean> { public async checkKeyPresence(keyArg: string): Promise<boolean> {
return plugins.smartpromise.getFirstTrueOrFalse([ return plugins.smartpromise.getFirstTrueOrFalse([
this.cacheMemoryManager.checkKeyPresence(keyArg), this.cacheMemoryManager.checkKeyPresence(keyArg),
this.cacheDiskManager.checkKeyPresence(keyArg), this.cacheDiskManager.checkKeyPresence(keyArg),
this.cacheS3Manager.checkKeyPresence(keyArg), this.cacheS3Manager.checkKeyPresence(keyArg)
]);
}
public async deleteCacheEntryByKey(keyArg) {
await Promise.all([
this.cacheMemoryManager.deleteCacheEntryByKey(keyArg),
this.cacheDiskManager.deleteCacheEntryByKey(keyArg),
this.cacheS3Manager.deleteCacheEntryByKey(keyArg),
]); ]);
} }
// cache maintenance // cache maintenance
public async cleanOutdated() {}
/** /**
* cleans the complete cache * cleans the cache
*/ */
public async cleanAll(): Promise<void> { public async clean(): Promise<void> {
await Promise.all([ await Promise.all([
this.cacheDiskManager.cleanAll(), this.cacheDiskManager.clean(),
this.cacheDiskManager.cleanAll(), this.cacheDiskManager.clean(),
this.cacheS3Manager.cleanAll(), this.cacheS3Manager.clean(),
]); ]);
} }
} }

View File

@ -1,7 +1,4 @@
import * as plugins from './levelcache.plugins.js'; import * as plugins from './levelcache.plugins';
export const packageDir = plugins.path.join( export const packageDir = plugins.path.join(__dirname, '../');
plugins.smartpath.get.dirnameFromImportMetaUrl(import.meta.url),
'../'
);
export const nogitDir = plugins.path.join(packageDir, '.nogit/'); export const nogitDir = plugins.path.join(packageDir, '.nogit/');

View File

@ -3,17 +3,16 @@ import * as path from 'path';
export { path }; export { path };
// @push.rocks scope // @pushrocks scope
import * as lik from '@push.rocks/lik'; import * as lik from '@pushrocks/lik';
import * as smartbucket from '@push.rocks/smartbucket'; import * as smartbucket from '@pushrocks/smartbucket';
import * as smartcache from '@push.rocks/smartcache'; import * as smartcache from '@pushrocks/smartcache';
import * as smartfile from '@push.rocks/smartfile'; import * as smartfile from '@pushrocks/smartfile';
import * as smartjson from '@push.rocks/smartjson'; import * as smartjson from '@pushrocks/smartjson';
import * as smartpath from '@push.rocks/smartpath'; import * as smartpromise from '@pushrocks/smartpromise';
import * as smartpromise from '@push.rocks/smartpromise'; import * as smartstring from '@pushrocks/smartstring';
import * as smartstring from '@push.rocks/smartstring'; import * as smartunique from '@pushrocks/smartunique';
import * as smartunique from '@push.rocks/smartunique'; import * as taskbuffer from '@pushrocks/taskbuffer';
import * as taskbuffer from '@push.rocks/taskbuffer';
export { export {
lik, lik,
@ -21,16 +20,8 @@ export {
smartcache, smartcache,
smartfile, smartfile,
smartjson, smartjson,
smartpath,
smartpromise, smartpromise,
smartstring, smartstring,
smartunique, smartunique,
taskbuffer, taskbuffer,
}; };
// @tsclass scope
import * as tsclass from '@tsclass/tsclass';
export {
tsclass,
};

View File

@ -1,14 +1,7 @@
{ {
"compilerOptions": { "compilerOptions": {
"experimentalDecorators": true, "experimentalDecorators": true,
"useDefineForClassFields": false, "target": "es2017",
"target": "ES2022", "module": "commonjs"
"module": "NodeNext", }
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
} }

17
tslint.json Normal file
View File

@ -0,0 +1,17 @@
{
"extends": ["tslint:latest", "tslint-config-prettier"],
"rules": {
"semicolon": [true, "always"],
"no-console": false,
"ordered-imports": false,
"object-literal-sort-keys": false,
"member-ordering": {
"options":{
"order": [
"static-method"
]
}
}
},
"defaultSeverity": "warning"
}