@decaf-ts/transactional-decorators 0.0.21 → 0.1.0

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.
Files changed (53) hide show
  1. package/LICENSE.md +0 -0
  2. package/README.md +38 -245
  3. package/dist/transactional-decorators.cjs +544 -0
  4. package/dist/transactional-decorators.esm.cjs +533 -0
  5. package/lib/Transaction.cjs +13 -0
  6. package/lib/Transaction.d.ts +2 -2
  7. package/lib/constants.cjs +1 -0
  8. package/lib/constants.d.ts +0 -0
  9. package/lib/decorators.cjs +1 -0
  10. package/lib/decorators.d.ts +0 -0
  11. package/lib/esm/Transaction.d.ts +2 -2
  12. package/lib/esm/Transaction.js +13 -2
  13. package/lib/esm/constants.d.ts +0 -0
  14. package/lib/esm/constants.js +1 -2
  15. package/lib/esm/decorators.d.ts +0 -0
  16. package/lib/esm/decorators.js +1 -2
  17. package/lib/esm/index.d.ts +1 -1
  18. package/lib/esm/index.js +2 -3
  19. package/lib/esm/interfaces/TransactionLock.d.ts +0 -0
  20. package/lib/esm/interfaces/TransactionLock.js +1 -2
  21. package/lib/esm/interfaces/index.d.ts +0 -0
  22. package/lib/esm/interfaces/index.js +1 -2
  23. package/lib/esm/locks/Lock.d.ts +0 -0
  24. package/lib/esm/locks/Lock.js +1 -2
  25. package/lib/esm/locks/SyncronousLock.d.ts +0 -0
  26. package/lib/esm/locks/SyncronousLock.js +1 -2
  27. package/lib/esm/locks/index.d.ts +0 -0
  28. package/lib/esm/locks/index.js +1 -2
  29. package/lib/esm/types.d.ts +0 -0
  30. package/lib/esm/types.js +1 -2
  31. package/lib/esm/utils.d.ts +0 -0
  32. package/lib/esm/utils.js +1 -2
  33. package/lib/index.cjs +2 -1
  34. package/lib/index.d.ts +1 -1
  35. package/lib/interfaces/TransactionLock.cjs +1 -0
  36. package/lib/interfaces/TransactionLock.d.ts +0 -0
  37. package/lib/interfaces/index.cjs +1 -0
  38. package/lib/interfaces/index.d.ts +0 -0
  39. package/lib/locks/Lock.cjs +1 -0
  40. package/lib/locks/Lock.d.ts +0 -0
  41. package/lib/locks/SyncronousLock.cjs +1 -0
  42. package/lib/locks/SyncronousLock.d.ts +0 -0
  43. package/lib/locks/index.cjs +1 -0
  44. package/lib/locks/index.d.ts +0 -0
  45. package/lib/types.cjs +1 -0
  46. package/lib/types.d.ts +0 -0
  47. package/lib/utils.cjs +1 -0
  48. package/lib/utils.d.ts +0 -0
  49. package/package.json +38 -42
  50. package/dist/esm/transactional-decorators.bundle.min.esm.js +0 -2
  51. package/dist/esm/transactional-decorators.bundle.min.esm.js.LICENSE.txt +0 -14
  52. package/dist/transactional-decorators.bundle.min.js +0 -2
  53. package/dist/transactional-decorators.bundle.min.js.LICENSE.txt +0 -14
package/LICENSE.md CHANGED
File without changes
package/README.md CHANGED
@@ -1,271 +1,66 @@
1
1
  ![Banner](./workdocs/assets/Banner.png)
2
- ## Typescript Template
3
2
 
3
+ ## Transactional Decorators
4
4
 
5
+ Simple locking and transaction systems
5
6
 
6
- ![Licence](https://img.shields.io/github/license/decaf-ts/ts-workspace.svg?style=plastic)
7
- ![GitHub language count](https://img.shields.io/github/languages/count/decaf-ts/ts-workspace?style=plastic)
8
- ![GitHub top language](https://img.shields.io/github/languages/top/decaf-ts/ts-workspace?style=plastic)
9
- [![Tests](https://github.com/decaf-ts/ts-workspace/actions/workflows/jest-test.yaml/badge.svg)](http://www.pdmfc.com)
10
- [![CodeQL](https://github.com/starnowski/posmulten/workflows/CodeQL/badge.svg)](https://github.com/decaf-ts/ts-workspace/actions?query=workflow%3ACodeQL)
11
7
 
12
- ![Open Issues](https://img.shields.io/github/issues/decaf-ts/ts-workspace.svg)
13
- ![Closed Issues](https://img.shields.io/github/issues-closed/decaf-ts/ts-workspace.svg)
14
- ![Pull Requests](https://img.shields.io/github/issues-pr-closed/decaf-ts/ts-workspace.svg)
15
- ![Maintained](https://img.shields.io/badge/Maintained%3F-yes-green.svg)
16
8
 
17
- ![Line Coverage](workdocs/coverage/badge-lines.svg)
18
- ![Function Coverage](workdocs/coverage/badge-functions.svg)
19
- ![Statement Coverage](workdocs/coverage/badge-statements.svg)
20
- ![Branch Coverage](workdocs/coverage/badge-branches.svg)
9
+ ![Licence](https://img.shields.io/github/license/decaf-ts/transactional-decorators.svg?style=plastic)
10
+ ![GitHub language count](https://img.shields.io/github/languages/count/decaf-ts/transactional-decorators?style=plastic)
11
+ ![GitHub top language](https://img.shields.io/github/languages/top/decaf-ts/transactional-decorators?style=plastic)
21
12
 
13
+ [![Build & Test](https://github.com/decaf-ts/transactional-decorators/actions/workflows/nodejs-build-prod.yaml/badge.svg)](https://github.com/decaf-ts/transactional-decorators/actions/workflows/nodejs-build-prod.yaml)
14
+ [![CodeQL](https://github.com/decaf-ts/transactional-decorators/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/decaf-ts/transactional-decorators/actions/workflows/codeql-analysis.yml)[![Snyk Analysis](https://github.com/decaf-ts/transactional-decorators/actions/workflows/snyk-analysis.yaml/badge.svg)](https://github.com/decaf-ts/transactional-decorators/actions/workflows/snyk-analysis.yaml)
15
+ [![Pages builder](https://github.com/decaf-ts/transactional-decorators/actions/workflows/pages.yaml/badge.svg)](https://github.com/decaf-ts/transactional-decorators/actions/workflows/pages.yaml)
16
+ [![.github/workflows/release-on-tag.yaml](https://github.com/decaf-ts/transactional-decorators/actions/workflows/release-on-tag.yaml/badge.svg?event=release)](https://github.com/decaf-ts/transactional-decorators/actions/workflows/release-on-tag.yaml)
22
17
 
23
- ![Forks](https://img.shields.io/github/forks/decaf-ts/ts-workspace.svg)
24
- ![Stars](https://img.shields.io/github/stars/decaf-ts/ts-workspace.svg)
25
- ![Watchers](https://img.shields.io/github/watchers/decaf-ts/ts-workspace.svg)
18
+ ![Open Issues](https://img.shields.io/github/issues/decaf-ts/transactional-decorators.svg)
19
+ ![Closed Issues](https://img.shields.io/github/issues-closed/decaf-ts/transactional-decorators.svg)
20
+ ![Pull Requests](https://img.shields.io/github/issues-pr-closed/decaf-ts/transactional-decorators.svg)
21
+ ![Maintained](https://img.shields.io/badge/Maintained%3F-yes-green.svg)
26
22
 
27
- ![Node Version](https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbadges%2Fshields%2Fmaster%2Fpackage.json&label=Node&query=$.engines.node&colorB=blue)
28
- ![NPM Version](https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbadges%2Fshields%2Fmaster%2Fpackage.json&label=NPM&query=$.engines.npm&colorB=purple)
23
+ ![Line Coverage](workdocs/reports/coverage/badge-lines.svg)
24
+ ![Function Coverage](workdocs/reports/coverage/badge-functions.svg)
25
+ ![Statement Coverage](workdocs/reports/coverage/badge-statements.svg)
26
+ ![Branch Coverage](workdocs/reports/coverage/badge-branches.svg)
29
27
 
30
- Defaults to module, but exports to CommonJS and ESM.
31
28
 
32
- With documentation, update and release mechanisms and gitlab/github workflows to match;
29
+ ![Forks](https://img.shields.io/github/forks/decaf-ts/transactional-decorators.svg)
30
+ ![Stars](https://img.shields.io/github/stars/decaf-ts/transactional-decorators.svg)
31
+ ![Watchers](https://img.shields.io/github/watchers/decaf-ts/transactional-decorators.svg)
33
32
 
34
- Defines a 'way' to write jsDocs to optimize the output
33
+ ![Node Version](https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbadges%2Fshields%2Fmaster%2Fpackage.json&label=Node&query=$.engines.node&colorB=blue)
34
+ ![NPM Version](https://img.shields.io/badge/dynamic/json.svg?url=https%3A%2F%2Fraw.githubusercontent.com%2Fbadges%2Fshields%2Fmaster%2Fpackage.json&label=NPM&query=$.engines.npm&colorB=purple)
35
35
 
36
- Optimized for github in terms of badges. CI is equivalent between Gitlab and Github.
36
+ Documentation available [here](https://decaf-ts.github.io/transactional-decorators/)
37
37
 
38
- Auto setup on first `npm install`
38
+ ### Description
39
39
 
40
- Will accept a `.token` file containing token valid for private npm dependencies, npm and docker registries
40
+ ### How to Use
41
41
 
42
- ### ***Initial Setup***
42
+ - [Initial Setup](./tutorials/For%20Developers.md#_initial-setup_)
43
+ - [Installation](./tutorials/For%20Developers.md#installation)
43
44
 
44
- #### if you use github
45
45
 
46
- create a new project using this one as a template.
47
46
 
48
- clone it `git clone <project>` and navigate to the root folder `cd <project>`
49
47
 
50
- #### If your project has private dependencies or publishes to private npm registries, create an `.npmrc` containing:
48
+ ### Related
51
49
 
52
- ```text
53
- @<scope1>:registry=https://<ADDRESS>.com/api/v4/packages/npm/
54
- @<scope2>:registry=https://<ADDRESS>.<DOMAIN>.com/api/v4/packages/npm/
55
- //<ADDRESS>.<DOMAIN>.com/:_authToken=${TOKEN}
56
- //<ADDRESS>.<DOMAIN>.com/api/v4/groups/<GROUP_ID>/packages/npm/:_authToken=${TOKEN}
57
- //<ADDRESS>.<DOMAIN>.com/api/v4/projects/<PROJECT_ID>/packages/npm/:_authToken=${TOKEN}
58
- ```
50
+ [![decaf-ts](https://github-readme-stats.vercel.app/api/pin/?username=decaf-ts&repo=decaf-ts)](https://github.com/decaf-ts/decaf-ts)
51
+ [![core](https://github-readme-stats.vercel.app/api/pin/?username=decaf-ts&repo=core)](https://github.com/decaf-ts/core)
52
+ [![decorator-validation](https://github-readme-stats.vercel.app/api/pin/?username=decaf-ts&repo=decorator-validation)](https://github.com/decaf-ts/decorator-validation)
53
+ [![db-decorators](https://github-readme-stats.vercel.app/api/pin/?username=decaf-ts&repo=db-decorators)](https://github.com/decaf-ts/db-decorators)
59
54
 
60
- Changing:
61
- - <ADDRESS> to `gitlab` or `github` (or other);
62
- - <DOMAIN> to your domain if any (if you are using plain gitlab or github use empty and take care to remove the extra `.`);
63
- - <GROUP_ID> to your project's group id (if any). otherwise remove this line
64
- - <PROJECT_ID> to your project's id
65
55
 
66
- and adding a `.token` file containing your access token to the private registries na repositories.
56
+ ### Social
67
57
 
68
- ### Installation
58
+ [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/decaf-ts/)
69
59
 
70
- Run `npm install` (or `npm run do-install` if you have private dependencies and a `.token` file) to install the dependencies:
71
60
 
72
- If this is the first time you are running this command it will also:
73
- - update this repository's dependencies to their latest version;
74
- - creates a `.token` file which you can leave empty unless you have private dependencies or publish to private registries
75
- - delete this 'first run script' file and npm call from the `package.json`;
76
- - try to commit the updated `package.json` and deleted files (having ssh access helps here);
77
- ## Linting
78
-
79
- This repo comes with eslint + prettier preconfigured to the default standards
80
- ## Testing
81
-
82
- Preconfigured Jest based testing:
83
-
84
- - unit tests under the `tests/unit` folder;
85
- - include a default bundle test (helps with circular dependencies and such);
86
- - integration tests under the `tests/integration` folder;
87
- - stores converage results under `workdocs/coverage`;
88
- - publishes coverage result to docs;
89
- - ignores `cli.ts` from coverage since that is an executable file;
90
- - defines the coverage threshold in `jest.config.ts`;
91
- ### Releases
92
-
93
- This repository automates releases in the following manner:
94
-
95
- - run `npm run release -- <major|minor|patch|version> <message>`:
96
- - if arguments are missing you will be prompted for them;
97
- - it will run `npm run prepare-release` npm script;
98
- - it will commit all changes;
99
- - it will push the new tag;
100
-
101
- If publishing to a private repo's npm registry, make sure you add to your `package.json`:
102
-
103
- ```json
104
- {
105
- "publishConfig": {
106
- "<SCOPE>:registry": " https://<REGISTRY>/api/v4/projects/<PROJECT_ID>/packages/npm/"
107
- }
108
- }
109
- ```
110
-
111
- Where:
112
-
113
- - `<SCOPE>` - Is the scope of your package;
114
- - `<REGISTRY>` - your registry host;
115
- - `<PROJECT_ID>` - you project ID number (easy to grab via UI in gitlab or by
116
- running `$("meta[name=octolytics-dimension-repository_id]").getAttribute('content')` in the repository page in github)
117
- ;
118
-
119
- ### Publishing
120
-
121
- Unless the `-no-ci` flag is passed in the commit message to the `npm run release` command, publishing will be handled
122
- automatically by github/gitlab (triggered by the tag).
123
-
124
- When the `-no-ci` flag is passed then you can:
125
-
126
- - run `npm run publish`. This command assumes :
127
- - you have previously run the `npm run release`;
128
- - you have you publishing properly configured in `npmrc` and `package.json`;
129
- - The token for any special access required is stored in the `.token` file;
130
-
131
- ## Continuous Integration/Deployment
132
-
133
- While the implementationfor gitlab and github are not perfectly matched, they are perfectly usable.
134
-
135
- The template comes with ci/cd for :
136
- - gitlab (with caching for performance):
137
- - stages:
138
- - dependencies: Installs dependencies (on `package-lock.json` changes, caches node modules);
139
- - build: builds the code (on `src/*` changes, caches `lib` and `dist`);
140
- - test: tests the code (on `src/*`, `test/*` changes, caches `workdocs/{resources, badges, coverage}`);
141
- - deploy:
142
- - deploys to package registry on a tag (public|private);
143
- - deploys docker image to docker registry (private);
144
- - Deploys the documentation to the repository pages;
145
- - github:
146
- - jest-test: standard `install -> build -> test` loop;
147
- - jest-coverage: extracts coverage from the tests;
148
- - codeql-analysis: Code quality analisys;
149
- - pages: builds the documentation and deploys to github pages
150
- - release-on-tag: issues a release when the tag does not contain `-no-ci` string
151
- - publish-on-release: publishes to package registry when the tag does not contain the `-no-ci` string
152
- - Requires Variables:
153
- - CONSECUTIVE_ACTION_TRIGGER: secret to enable actions to trigger other actions;
154
- - NPM_TOKEN: npm/docker registry token
155
- ## Considerations
156
- - Setup for a linux based environment (Sorry windows users. use WSL... or just change already);
157
- - Setup for node 20, but will work at least with 16;
158
- - Requires docker to build documentation (drawings and PlantUML)
159
- ## Documentation
160
-
161
- The repository proposes a way to generate documentation that while still not ideal, produces verys consitest results.
162
-
163
- In the code you see an example on how to properly document each code object, but the overall structure is:
164
- - each package is a `@module`;
165
- - Classes and Interfaces are categorized into `@category` and `@subcategory`;
166
- - All other objects are categorized by `@namespace` and `@memberOf`;
167
- - Enums and const are declared as `@const` and both must describe their properties as `@property` (when constants are objects);
168
- - Interfaces must declare their methods `@method`;
169
-
170
- There are 3 steps the generating the documentation (automated in CI):
171
- - `npm run drawings` - generates png files from each drawing in the `workdocs/drawings` folder and moves them to the `workdocs/resources` folder (requires Docker);
172
- - `npm run uml` - generates png files from each PlantUML diagram in the `workdocs/uml` folder and moves them to the `workdocs/resources` folder (requires Docker);
173
- - `npm run docs` - this has several stages, defined under the `gulp docs` (gulpfile.js):
174
- - compiles the Readme file via md compile:
175
- - enables keeping separate files for sections that are then joined into a single file;
176
- - Allows keeping specific files in the jsdocs tutorial folder so they show up on their own menu;
177
- - compiles the documentation from the source code using jsdocs:
178
- - uses the better docs template with the category and component plugins
179
- - uses the mermaid jsdoc plugin to embue uml diagrams in the docs
180
- - includes a nav link to the test coverage results;
181
- - copies the jsdoc and mds to `/docs`;
182
- - copies the `./workdocs/{drawings, uml, assets, resources}` to `./docs`;
183
-
184
- The produced `docs` folder contains the resulting documentation;
185
- ### Related
186
61
 
187
- [![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=decaf-ts&repo=ts-workspace)](https://github.com/decaf-ts/ts-workspace)
188
- ### Social
189
62
 
190
- [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/decaf-ts/)
191
- ### Scripts
192
-
193
- The following npm scripts are available for development:
194
-
195
- - `preinstall` - will run only on the first install to trigger the dep update. will self delete;
196
- - `do-install` - sets a `TOKEN` environment variable to the contents of `.token` and runs npm install (useful when you
197
- have private dependencies);
198
- - `flash-forward` - updates all dependencies. Take care, This may not be desirable is some cases;
199
- - `reset` - updates all dependencies. Take care, This may not be desirable is some cases;
200
- - `build` - builds the code (via gulp `gulpfile.js`) in development mode (generates `lib` and `dist` folder);
201
- - `build:prod` - builds the code (via gulp `gulpfile.js`) in production mode (generates `lib` and `dist` folder);
202
- - `test` - runs unit tests;
203
- - `test:integration` - runs it tests;
204
- - `test:all` - runs all tests;
205
- - `lint` - runs es lint on the code folder;
206
- - `lint-fix` - tries to auto-fix the code folder;
207
- - `prepare-release` - defines the commands to run prior to a new tag (defaults to linting, building production code,
208
- running tests and documentation generation);
209
- - `release` - triggers a new tag being pushed to master (via `./bin/tag_release.sh`);
210
- - `clean-publish` - cleans the package.json for publishing;
211
- - `coverage` - runs all test, calculates coverage and generates badges for readme;
212
- - `drawings` - compiles all DrawIO `*.drawio` files in the `workdocs/drawings` folder to png and moves them to
213
- the `workdocs/resources` folder;
214
- - `uml` - compiles all PlantUML `*.puml` files in the `workdocs/uml` folder to png and moves them to
215
- the `workdocs/resources` folder;
216
- - `docs` - compiles all the coverage, drawings, uml, jsdocs and md docs into a readable web page under `./docs`;
217
-
218
- ### Repository Structure
219
-
220
- ```
221
- ts-workspace
222
-
223
- │ .gitignore <-- Defines files ignored to git
224
- │ .npmignore <-- Defines files ignored by npm
225
- │ .nmprc <-- Defines the Npm registry for this package
226
- │ .eslintrc.cjs <-- linting for the project
227
- │ .prettier.config.cjs <-- Code style for the project
228
- │ .gitlab-ci.yml <-- Gillab CI/CD file
229
- │ gulpfile.js <-- Gulp build scripts. used for building na other features (eg docs)
230
- │ jest.config.ts <-- Tests Configuration file
231
- │ mdCompile.json <-- md Documentation generation configuration file
232
- │ jsdocs.json <-- jsdoc Documentation generation configuration file
233
- │ Dockerfile <-- minimal example of a node service Dockerfile
234
- │ LICENCE.md <-- Licence disclamer
235
- │ package.json
236
- │ package-lock.json
237
- │ README.md <-- Readme File dynamically compiled from 'workdocs' via the 'docs' npm script
238
- │ tsconfig.json <-- Typescript config file. Is overriden in 'gulpfile.js'
239
-
240
- └───bin
241
- │ │ tag_release.sh <-- Script to help with releases
242
-
243
- └───docs
244
- │ │ ... <-- Dinamically generated folder, containing the compiled documentation for this repository. generated via the 'docs' npm script
245
-
246
- └───src
247
- │ │ ... <-- Source code for this repository
248
-
249
- └───tests
250
- │ │───unit <-- Unit tests
251
- │ └───integration <-- Integration tests
252
-
253
- └───workdocs <-- Folder with all pre-compiled documentation
254
- │ │───assets <-- Documentation asset folder
255
- │ │───badges <-- Auto generated coverage badges folder
256
- │ │───coverage <-- Auto generated coverage results
257
- │ │───drawings <-- DrawIO folder. Drawings (*.drawio) here will be processed to generate documentation (requires docker)
258
- │ │───uml <-- PlantUML folder. Diagrams (*.puml) here will be processed to generate documentation (requires docker)
259
- │ │───tutorials <-- Tutorial folder
260
- │ │ ... <-- Categorized *.md files that are merged to generate the final readme (via md compile)
261
- │ │ Readme.md <-- Entry point to the README.md
262
-
263
- └───dist
264
- │ │ ... <-- Dinamically generated folder containing the bundles for distribution
265
-
266
- └───lib
267
- | ... <-- Dinamically generated folder containing the compiled code
268
- ```
63
+ #### Languages
269
64
 
270
65
  ![TypeScript](https://img.shields.io/badge/TypeScript-007ACC?style=for-the-badge&logo=typescript&logoColor=white)
271
66
  ![JavaScript](https://img.shields.io/badge/JavaScript-F7DF1E?style=for-the-badge&logo=javascript&logoColor=black)
@@ -284,14 +79,12 @@ I am grateful for any contributions made to this project. Please read [this](./w
284
79
 
285
80
  The first and easiest way you can support it is by [Contributing](./workdocs/98-Contributing.md). Even just finding a typo in the documentation is important.
286
81
 
287
- Financial support is always welcome and helps keep the both me and the project alive and healthy.
82
+ Financial support is always welcome and helps keep both me and the project alive and healthy.
288
83
 
289
84
  So if you can, if this project in any way. either by learning something or simply by helping you save precious time, please consider donating.
290
85
 
291
86
  ## License
292
87
 
293
- This project is released under the [MIT License](LICENSE.md).
294
-
295
- #### Disclaimer:
88
+ This project is released under the [MIT License](./LICENSE.md).
296
89
 
297
- badges found [here](https://dev.to/envoy_/150-badges-for-github-pnk), [here](https://github.com/alexandresanlim/Badges4-README.md-Profile#-social-) and [here](https://github.com/Ileriayo/markdown-badges)
90
+ By developers, for developers...