@decaf-ts/transactional-decorators 0.0.20 → 0.0.22
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.
- package/LICENSE.md +0 -0
- package/README.md +38 -245
- package/dist/esm/transactional-decorators.js +2 -0
- package/dist/esm/{transactional-decorators.bundle.min.esm.js.LICENSE.txt → transactional-decorators.js.LICENSE.txt} +0 -0
- package/dist/transactional-decorators.js +2 -0
- package/dist/{transactional-decorators.bundle.min.js.LICENSE.txt → transactional-decorators.js.LICENSE.txt} +0 -0
- package/{lib → dist/types}/Transaction.d.ts +2 -2
- package/{lib → dist/types}/constants.d.ts +0 -0
- package/{lib → dist/types}/decorators.d.ts +0 -0
- package/{lib/esm → dist/types}/index.d.ts +1 -1
- package/{lib/esm → dist/types}/interfaces/TransactionLock.d.ts +0 -0
- package/{lib/esm → dist/types}/interfaces/index.d.ts +0 -0
- package/{lib/esm → dist/types}/locks/Lock.d.ts +0 -0
- package/{lib/esm → dist/types}/locks/SyncronousLock.d.ts +0 -0
- package/{lib/esm → dist/types}/locks/index.d.ts +0 -0
- package/{lib/esm → dist/types}/types.d.ts +0 -0
- package/{lib/esm → dist/types}/utils.d.ts +0 -0
- package/lib/Transaction.cjs +14 -0
- package/lib/constants.cjs +2 -0
- package/lib/decorators.cjs +2 -0
- package/lib/esm/Transaction.js +13 -1
- package/lib/esm/constants.js +0 -0
- package/lib/esm/decorators.js +0 -0
- package/lib/esm/index.js +2 -2
- package/lib/esm/interfaces/TransactionLock.js +0 -0
- package/lib/esm/interfaces/index.js +0 -0
- package/lib/esm/locks/Lock.js +0 -0
- package/lib/esm/locks/SyncronousLock.js +0 -0
- package/lib/esm/locks/index.js +0 -0
- package/lib/esm/types.js +0 -0
- package/lib/esm/utils.js +0 -0
- package/lib/index.cjs +3 -1
- package/lib/interfaces/TransactionLock.cjs +2 -0
- package/lib/interfaces/index.cjs +2 -0
- package/lib/locks/Lock.cjs +2 -0
- package/lib/locks/SyncronousLock.cjs +2 -0
- package/lib/locks/index.cjs +2 -0
- package/lib/types.cjs +2 -0
- package/lib/utils.cjs +2 -0
- package/package.json +29 -21
- package/dist/esm/transactional-decorators.bundle.min.esm.js +0 -2
- package/dist/transactional-decorators.bundle.min.js +0 -2
- package/lib/esm/Transaction.d.ts +0 -86
- package/lib/esm/constants.d.ts +0 -1
- package/lib/esm/decorators.d.ts +0 -19
- package/lib/index.d.ts +0 -24
- package/lib/interfaces/TransactionLock.d.ts +0 -26
- package/lib/interfaces/index.d.ts +0 -1
- package/lib/locks/Lock.d.ts +0 -24
- package/lib/locks/SyncronousLock.d.ts +0 -40
- package/lib/locks/index.d.ts +0 -2
- package/lib/types.d.ts +0 -7
- package/lib/utils.d.ts +0 -1
package/LICENSE.md
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
@@ -1,271 +1,66 @@
|
|
|
1
1
|

|
|
2
|
-
## Typescript Template
|
|
3
2
|
|
|
3
|
+
## Transactional Decorators
|
|
4
4
|
|
|
5
|
+
Simple locking and transaction systems
|
|
5
6
|
|
|
6
|
-

|
|
7
|
-

|
|
8
|
-

|
|
9
|
-
[](http://www.pdmfc.com)
|
|
10
|
-
[](https://github.com/decaf-ts/ts-workspace/actions?query=workflow%3ACodeQL)
|
|
11
7
|
|
|
12
|
-

|
|
13
|
-

|
|
14
|
-

|
|
15
|
-

|
|
16
8
|
|
|
17
|
-

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
21
12
|
|
|
13
|
+
[](https://github.com/decaf-ts/transactional-decorators/actions/workflows/nodejs-build-prod.yaml)
|
|
14
|
+
[](https://github.com/decaf-ts/transactional-decorators/actions/workflows/codeql-analysis.yml)[](https://github.com/decaf-ts/transactional-decorators/actions/workflows/snyk-analysis.yaml)
|
|
15
|
+
[](https://github.com/decaf-ts/transactional-decorators/actions/workflows/pages.yaml)
|
|
16
|
+
[](https://github.com/decaf-ts/transactional-decorators/actions/workflows/release-on-tag.yaml)
|
|
22
17
|
|
|
23
|
-

|
|
19
|
+

|
|
20
|
+

|
|
21
|
+

|
|
26
22
|
|
|
27
|
-

|
|
24
|
+

|
|
25
|
+

|
|
26
|
+

|
|
29
27
|
|
|
30
|
-
Defaults to module, but exports to CommonJS and ESM.
|
|
31
28
|
|
|
32
|
-
|
|
29
|
+

|
|
30
|
+

|
|
31
|
+

|
|
33
32
|
|
|
34
|
-
|
|
33
|
+

|
|
34
|
+

|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
Documentation available [here](https://decaf-ts.github.io/transactional-decorators/)
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
### Description
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
### How to Use
|
|
41
41
|
|
|
42
|
-
|
|
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
|
-
|
|
48
|
+
### Related
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
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
|
+
[](https://github.com/decaf-ts/decaf-ts)
|
|
51
|
+
[](https://github.com/decaf-ts/core)
|
|
52
|
+
[](https://github.com/decaf-ts/decorator-validation)
|
|
53
|
+
[](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
|
-
|
|
56
|
+
### Social
|
|
67
57
|
|
|
68
|
-
|
|
58
|
+
[](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
|
-
[](https://github.com/decaf-ts/ts-workspace)
|
|
188
|
-
### Social
|
|
189
62
|
|
|
190
|
-
|
|
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
|

|
|
271
66
|

|
|
@@ -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
|
|
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
|
-
|
|
90
|
+
By developers, for developers...
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see transactional-decorators.js.LICENSE.txt */
|
|
2
|
+
var e={3:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Model=t.ModelRegistryManager=void 0,t.isPropertyModel=p,t.isModel=y,t.bulkModelRegister=function(...e){e.forEach((e=>{const t=e.constructor?e.constructor:e;g.register(t,e.name)}))};const n=r(4744),o=r(32),a=r(2709),i=r(2252),s=r(7675),c=r(5021),u=r(1318),l=r(8539);let f,d;function p(e,t){if(y(e[t]))return!0;const r=Reflect.getMetadata(s.ModelKeys.TYPE,e,t);return g.get(r.name)?r.name:void 0}function y(e){try{return e instanceof g||!!g.getMetadata(e)}catch(e){return!1}}class h{constructor(e=y){this.cache={},this.testFunction=e}register(e,t){if("function"!=typeof e)throw new Error("Model registering failed. Missing Class name or constructor");t=t||e.name,this.cache[t]=e}get(e){try{return this.cache[e]}catch(e){return}}build(e={},t){if(!t&&!this.testFunction(e))throw new Error("Provided obj is not a Model object");const r=t||g.getMetadata(e);if(!(r in this.cache))throw new Error((0,u.sf)("Provided class {0} is not a registered Model object",r));return new this.cache[r](e)}}t.ModelRegistryManager=h;class g{constructor(e){}hasErrors(...e){return(0,a.validate)(this,...e)}equals(e,...t){return(0,o.isEqual)(this,e,...t)}serialize(){return g.serialize(this)}toString(){return this.constructor.name+": "+JSON.stringify(this,void 0,2)}hash(){return g.hash(this)}static deserialize(e){const t=Reflect.getMetadata(g.key(s.ModelKeys.SERIALIZATION),this.constructor);return t&&t.serializer?n.Serialization.deserialize(e,t.serializer,...t.args||[]):n.Serialization.deserialize(e)}static fromObject(e,t){t||(t={});for(const r of g.getAttributes(e))e[r]=t[r]||void 0;return e}static fromModel(e,t){let r,n;t||(t={});const a=g.getAttributes(e);for(const i of a){if(e[i]=t[i]||void 0,"object"!=typeof e[i])continue;const a=p(e,i);if(a){try{e[i]=g.build(e[i],"string"==typeof a?a:void 0)}catch(e){console.log(e)}continue}const f=o.Reflection.getPropertyDecorators(c.ValidationKeys.REFLECT,e,i).decorators;if(r=f.filter((e=>-1!==[s.ModelKeys.TYPE,c.ValidationKeys.TYPE].indexOf(e.key))),!r||!r.length)throw new Error((0,u.sf)("failed to find decorators for property {0}",i));n=r.pop();const d=n.props.name?[n.props.name]:Array.isArray(n.props.customTypes)?n.props.customTypes:[n.props.customTypes],y=Object.values(l.ReservedModels).map((e=>e.toLowerCase()));d.forEach((t=>{if(-1===y.indexOf(t.toLowerCase()))try{switch(t){case"Array":case"Set":if(f.length){const r=f.find((e=>e.key===c.ValidationKeys.LIST));if(r){const n=r.props.clazz.find((e=>!l.jsTypes.includes(e.toLowerCase())));if("Array"===t&&(e[i]=e[i].map((e=>["object","function"].includes(typeof e)&&n?g.build(e,n):e))),"Set"===t){const t=new Set;for(const r of e[i])["object","function"].includes(typeof r)&&n?t.add(g.build(r,n)):t.add(r);e[i]=t}}}break;default:e[i]&&(e[i]=g.build(e[i],t))}}catch(e){console.log(e)}}))}return e}static setBuilder(e){f=e}static getBuilder(){return f}static getRegistry(){return d||(d=new h),d}static setRegistry(e){d=e}static register(e,t){return g.getRegistry().register(e,t)}static get(e){return g.getRegistry().get(e)}static build(e={},t){return g.getRegistry().build(e,t)}static getMetadata(e){const t=Reflect.getMetadata(g.key(s.ModelKeys.MODEL),e.constructor);if(!t)throw new Error("could not find metadata for provided "+e.constructor.name);return t}static getAttributes(e){const t=[];let r=e instanceof g?Object.getPrototypeOf(e):e.prototype;for(;null!=r;){const e=r[s.ModelKeys.ATTRIBUTE];e&&t.push(...e),r=Object.getPrototypeOf(r)}return t}static equals(e,t,...r){return(0,o.isEqual)(e,t,...r)}static hasErrors(e,...t){return(0,a.validate)(e,...t)}static serialize(e){const t=Reflect.getMetadata(g.key(s.ModelKeys.SERIALIZATION),e.constructor);return t&&t.serializer?n.Serialization.serialize(this,t.serializer,...t.args||[]):n.Serialization.serialize(e)}static hash(e){const t=Reflect.getMetadata(g.key(s.ModelKeys.HASHING),e.constructor);return t&&t.algorithm?i.Hashing.hash(e,t.algorithm,...t.args||[]):i.Hashing.hash(e)}static key(e){return s.ModelKeys.REFLECT+e}}t.Model=g},32:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=void 0,o(r(1267),t),o(r(5530),t),o(r(3032),t),o(r(6163),t),o(r(2199),t),t.VERSION="0.4.1"},70:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(5021),t),o(r(3576),t),o(r(8024),t),o(r(5224),t),o(r(2888),t),o(r(2382),t),o(r(9378),t),o(r(2396),t),o(r(9320),t),o(r(3317),t),o(r(6174),t),o(r(8089),t),o(r(6942),t),o(r(4972),t),o(r(8689),t),o(r(7036),t),o(r(3201),t)},200:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},592:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getAllPropertyDecoratorsRecursive=t.getHandlerArgs=void 0,t.enforceDBDecorators=async function(e,r,a,u,l,f){const d=c(a,u,l);if(d)for(const c in d){const p=d[c];for(const d of p){const{key:p}=d,y=n.Operations.get(a,c,l+p);if(!y||!y.length)throw new i.InternalError(`Could not find registered handler for the operation ${l+p} under property ${c}`);const h=(0,t.getHandlerArgs)(d,c,a);if(!h||Object.values(h).length!==y.length)throw new i.InternalError((0,s.sf)("Args and handlers length do not match"));let g,E;for(let t=0;t<y.length;t++){g=y[t],E=Object.values(h)[t];const n=[r,E.data,c,a];if(u===o.OperationKeys.UPDATE&&l===o.OperationKeys.ON){if(!f)throw new i.InternalError("Missing old model for update operation");n.push(f)}await g.apply(e,n)}}}},t.getDbDecorators=c;const n=r(9121),o=r(6050),a=r(32),i=r(3036),s=r(2302);function c(e,t,r){const n=a.Reflection.getAllPropertyDecorators(e,o.OperationKeys.REFLECT+(r||""));if(n)return Object.keys(n).reduce(((e,r)=>{const o=n[r].filter((e=>e.key===t));return o&&o.length&&(e||(e={}),e[r]=o),e}),void 0)}t.getHandlerArgs=function(e,r,n,o){const a=n.constructor.name;if(!a)throw new i.InternalError("Could not determine model class");o=o||{},e.props.handlers[a]&&e.props.handlers[a][r]&&(o={...e.props.handlers[a][r],...o});let s=Object.getPrototypeOf(n);return s===Object.prototype?o:(s.constructor.name===a&&(s=Object.getPrototypeOf(s)),(0,t.getHandlerArgs)(e,r,s,o))},t.getAllPropertyDecoratorsRecursive=function(e,r,...n){const i=r||{},c=a.Reflection.getAllPropertyDecorators(e,...n);if(c&&function(e){Object.entries(e).forEach((([e,t])=>{i[e]=i[e]||[],((e,...t)=>{t.forEach((t=>{let r;if(!(r=i[e].find((e=>e.key===t.key)))||r.props.operation!==t.props.operation)return void i[e].push(t);if(t.key===s.ModelKeys.TYPE)return;const{handlers:n,operation:a}=t.props;if(!a||!a.match(new RegExp(`^(:?${o.OperationKeys.ON}|${o.OperationKeys.AFTER})(:?${o.OperationKeys.CREATE}|${o.OperationKeys.READ}|${o.OperationKeys.UPDATE}|${o.OperationKeys.DELETE})$`)))return void i[e].push(t);const c=r.props.handlers;Object.entries(n).forEach((([e,t])=>{e in c?Object.entries(t).forEach((([t,r])=>{t in c[e]?Object.entries(r).forEach((([r,n])=>{r in c[e][t]?console.warn((0,s.sf)("Skipping handler registration for {0} under prop {0} because handler is the same",e,t)):c[e][t][r]=n})):c[e][t]=r})):c[e]=t}))}))})(e,...t)}))}(c),Object.getPrototypeOf(e)===Object.prototype)return i;const u=Object.getPrototypeOf(e);return u?(0,t.getAllPropertyDecoratorsRecursive)(u,i,...n):i}},749:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.prefixMethod=function(e,t,r,n){const o=async function(...e){const n=await Promise.resolve(r.call(this,...e));return Promise.resolve(t.apply(this,n))}.bind(e),a=n||t.name;Object.defineProperty(o,"name",{enumerable:!0,configurable:!0,writable:!1,value:a}),e[a]=o},t.suffixMethod=function(e,t,r,n){const o=async function(...e){const n=await Promise.resolve(t.call(this,...e));return r.call(this,...n)}.bind(e),a=n||t.name;Object.defineProperty(o,"name",{enumerable:!0,configurable:!0,writable:!1,value:a}),e[a]=o},t.wrapMethodWithContext=function(e,t,r,a,i){const s=async function(...i){let s=t.call(e,...i);s instanceof Promise&&(s=await s);const c=s[s.length-1];if(!(c instanceof n.Context))throw new o.InternalError("Missing a context");let u=await r.call(e,...s);return u instanceof Promise&&(u=await u),u=a.call(this,u,c),u instanceof Promise&&(u=await u),u}.bind(e),c=i||r.name;Object.defineProperty(s,"name",{enumerable:!0,configurable:!0,writable:!1,value:c}),e[c]=s};const n=r(2586),o=r(3036)},754:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.model=function(e){return t=>{const r=function(...r){const s=(0,n.construct)(t,...r);(0,n.bindModelPrototype)(s);const c=a.Model.getBuilder();return c&&c(s,r.length?r[0]:void 0),(0,i.metadata)(a.Model.key(o.ModelKeys.MODEL),t.name)(s.constructor),e&&e(s,...r),s};return r.prototype=t.prototype,Object.defineProperty(r,"name",{writable:!1,enumerable:!0,configurable:!1,value:t.prototype.constructor.name}),(0,i.metadata)(a.Model.key(o.ModelKeys.MODEL),t.name)(t),a.Model.register(r,t.name),r}},t.hashedBy=function(e,...t){return(0,i.metadata)(a.Model.key(o.ModelKeys.HASHING),{algorithm:e,args:t})},t.serializedBy=function(e,...t){return(0,i.metadata)(a.Model.key(o.ModelKeys.SERIALIZATION),{serializer:e,args:t})};const n=r(4939),o=r(7675),a=r(3),i=r(32)},1101:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},1206:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(7633),t)},1267:(e,t)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ReflectionKeys=void 0,function(e){e.TYPE="design:type"}(r||(t.ReflectionKeys=r={}))},1318:(e,t)=>{function r(e,...t){return e.replace(/{(\d+)}/g,(function(e,r){return void 0!==t[r]?t[r].toString():"undefined"}))}Object.defineProperty(t,"__esModule",{value:!0}),t.sf=void 0,t.stringFormat=r,t.sf=r},1362:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(9174),t),o(r(8944),t),o(r(4981),t)},1375:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Validation=void 0;const n=r(3201),o=r(5021);class a{static{this.actingValidatorRegistry=void 0}constructor(){}static setRegistry(e,t){t&&a.actingValidatorRegistry&&a.actingValidatorRegistry.getKeys().forEach((r=>{const n=e.get(r);n&&e.register(t(n))})),a.actingValidatorRegistry=e}static getRegistry(){return a.actingValidatorRegistry||(a.actingValidatorRegistry=new n.ValidatorRegistry),a.actingValidatorRegistry}static get(e){return a.getRegistry().get(e)}static register(...e){return a.getRegistry().register(...e)}static key(e){return o.ValidationKeys.REFLECT+e}static keys(){return this.getRegistry().getKeys()}}t.Validation=a},1967:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},2022:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseRepository=void 0;const n=r(2302),o=r(592),a=r(6050),i=r(3036),s=r(749),c=r(3802),u=r(2586);t.BaseRepository=class{get class(){if(!this._class)throw new i.InternalError("No class definition found for this repository");return this._class}get pk(){return this._pk||(this._pk=(0,c.findPrimaryKey)(new this.class).id),this._pk}constructor(e){e&&(this._class=e);const t=this;[this.create,this.read,this.update,this.delete].forEach((e=>{const r=e.name;(0,s.wrapMethodWithContext)(t,t[r+"Prefix"],e,t[r+"Suffix"])}))}async createAll(e,...t){return Promise.all(e.map((e=>this.create(e,...t))))}async createPrefix(e,...t){const r=await u.Context.args(a.OperationKeys.CREATE,this.class,t);return e=new this.class(e),await(0,o.enforceDBDecorators)(this,r.context,e,a.OperationKeys.CREATE,a.OperationKeys.ON),[e,...r.args]}async createSuffix(e,t){return await(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.CREATE,a.OperationKeys.AFTER),e}async createAllPrefix(e,...t){const r=await u.Context.args(a.OperationKeys.CREATE,this.class,t);return await Promise.all(e.map((async e=>(e=new this.class(e),await(0,o.enforceDBDecorators)(this,r.context,e,a.OperationKeys.CREATE,a.OperationKeys.ON),e)))),[e,...r.args]}async createAllSuffix(e,t){return await Promise.all(e.map((e=>(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.CREATE,a.OperationKeys.AFTER)))),e}async readAll(e,...t){return await Promise.all(e.map((e=>this.read(e,...t))))}async readSuffix(e,t){return await(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.READ,a.OperationKeys.AFTER),e}async readPrefix(e,...t){const r=await u.Context.args(a.OperationKeys.READ,this.class,t),n=new this.class;return n[this.pk]=e,await(0,o.enforceDBDecorators)(this,r.context,n,a.OperationKeys.READ,a.OperationKeys.ON),[e,...r.args]}async readAllPrefix(e,...t){const r=await u.Context.args(a.OperationKeys.READ,this.class,t);return await Promise.all(e.map((async e=>{const t=new this.class;return t[this.pk]=e,(0,o.enforceDBDecorators)(this,r.context,t,a.OperationKeys.READ,a.OperationKeys.ON)}))),[e,...r.args]}async readAllSuffix(e,t){return await Promise.all(e.map((e=>(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.READ,a.OperationKeys.AFTER)))),e}async updateAll(e,...t){return Promise.all(e.map((e=>this.update(e,...t))))}async updateSuffix(e,t){return await(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.UPDATE,a.OperationKeys.AFTER),e}async updatePrefix(e,...t){const r=await u.Context.args(a.OperationKeys.UPDATE,this.class,t),n=e[this.pk];if(!n)throw new i.InternalError(`No value for the Id is defined under the property ${this.pk}`);const s=await this.read(n);return await(0,o.enforceDBDecorators)(this,r.context,e,a.OperationKeys.UPDATE,a.OperationKeys.ON,s),[e,...r.args]}async updateAllPrefix(e,...t){const r=await u.Context.args(a.OperationKeys.UPDATE,this.class,t);return await Promise.all(e.map((e=>(e=new this.class(e),(0,o.enforceDBDecorators)(this,r.context,e,a.OperationKeys.UPDATE,a.OperationKeys.ON),e)))),[e,...r.args]}async updateAllSuffix(e,t){return await Promise.all(e.map((e=>(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.UPDATE,a.OperationKeys.AFTER)))),e}async deleteAll(e,...t){return Promise.all(e.map((e=>this.delete(e,...t))))}async deleteSuffix(e,t){return await(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.DELETE,a.OperationKeys.AFTER),e}async deletePrefix(e,...t){const r=await u.Context.args(a.OperationKeys.DELETE,this.class,t),n=await this.read(e,...r.args);return await(0,o.enforceDBDecorators)(this,r.context,n,a.OperationKeys.DELETE,a.OperationKeys.ON),[e,...r.args]}async deleteAllPrefix(e,...t){const r=await u.Context.args(a.OperationKeys.DELETE,this.class,t),n=await this.readAll(e,...r.args);return await Promise.all(n.map((async e=>(0,o.enforceDBDecorators)(this,r.context,e,a.OperationKeys.DELETE,a.OperationKeys.ON)))),[e,...r.args]}async deleteAllSuffix(e,t){return await Promise.all(e.map((e=>(0,o.enforceDBDecorators)(this,t,e,a.OperationKeys.DELETE,a.OperationKeys.AFTER)))),e}merge(e,t){const r=e=>Object.entries(e).reduce(((e,[t,r])=>(void 0!==r&&(e[t]=r),e)),{});return new this.class(Object.assign({},r(e),r(t)))}toString(){return(0,n.sf)("[{0}] - Repository for {1}",this.constructor.name,this.class.name)}}},2156:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SyncronousLock=void 0;const n=r(5467);t.SyncronousLock=class{constructor(e=1,t,r){this.currentTransaction=void 0,this.lock=new n.Lock,this.counter=e,this.pendingTransactions=[],this.onBegin=t,this.onEnd=r}submit(e){const t=this;t.lock.acquire().then((()=>t.currentTransaction&&t.currentTransaction.id===e.id?(t.lock.release(),e.fire()):t.counter>0?(t.counter--,t.lock.release(),t.fireTransaction(e)):(t.pendingTransactions.push(e),void t.lock.release())))}fireTransaction(e){const t=this;t.lock.acquire().then((()=>{t.currentTransaction=e,t.lock.release(),t.onBegin?t.onBegin().then((()=>{e.fire()})):e.fire()}))}async release(e){const t=this;return new Promise((r=>{t.lock.acquire().then((()=>{t.currentTransaction||console.warn("Trying to release an unexisting transaction. should never happen..."),t.currentTransaction=void 0,t.lock.release();const n=()=>{t.lock.acquire().then((()=>{if(t.pendingTransactions.length>0){const e=t.pendingTransactions.shift(),r=()=>t.fireTransaction(e);void 0===globalThis.window?globalThis.process.nextTick(r):setTimeout(r,0)}else t.counter++;t.lock.release(),r()}))};t.onEnd?t.onEnd(e).then((()=>n())):n()}))}))}}},2199:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},2252:(e,t)=>{function r(e){e=String(e);let t=0;for(let r=0;r<e.length;r++)t=(t<<5)-t+e.charCodeAt(r),t|=0;return t.toString()}function n(e){const t=function(e,t){const r=o(t);return"string"==typeof r?o((e||"")+o(t)):0|(e=((e=e||0)<<5)-e+r)},n=r,o=function(e){return void 0===e?"":-1!==["string","number","symbol"].indexOf(typeof e)?n(e.toString()):e instanceof Date?n(e.getTime()):Array.isArray(e)?e.reduce(t,void 0):Object.values(e).reduce(t,void 0)},a=Object.values(e).reduce(t,0);return("number"==typeof a?Math.abs(a):a).toString()}Object.defineProperty(t,"__esModule",{value:!0}),t.Hashing=t.DefaultHashingMethod=void 0,t.hashCode=r,t.hashObj=n,t.DefaultHashingMethod="default";class o{static{this.current=t.DefaultHashingMethod}static{this.cache={default:n}}constructor(){}static get(e){if(e in this.cache)return this.cache[e];throw new Error(`No hashing method registered under ${e}`)}static register(e,t,r=!1){if(e in this.cache)throw new Error(`Hashing method ${e} already registered`);this.cache[e]=t,r&&(this.current=e)}static hash(e,t,...r){return t?this.get(t)(e,...r):this.get(this.current)(e,...r)}static setDefault(e){this.current=this.get(e)}}t.Hashing=o},2302:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=void 0,o(r(4072),t),o(r(5030),t),o(r(5643),t),t.VERSION="1.5.11"},2382:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MaxLengthValidator=void 0;const a=r(7036),i=r(5021),s=r(8024);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.MAX_LENGTH){super(e,String.name,Array.name)}hasErrors(e,t){if(void 0!==e)return e.length>t.maxLength?this.getMessage(t.message||this.message,t.maxLength):void 0}};t.MaxLengthValidator=c,t.MaxLengthValidator=c=n([(0,s.validator)(i.ValidationKeys.MAX_LENGTH),o("design:paramtypes",[String])],c)},2396:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MinLengthValidator=void 0;const a=r(7036),i=r(5021),s=r(8024);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.MIN_LENGTH){super(e,String.name,Array.name)}hasErrors(e,t){if(void 0!==e)return e.length<t.minLength?this.getMessage(t.message||this.message,t.minLength):void 0}};t.MinLengthValidator=c,t.MinLengthValidator=c=n([(0,s.validator)(i.ValidationKeys.MIN_LENGTH),o("design:paramtypes",[String])],c)},2417:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},2503:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.transactional=function(...e){return function(t,r,s){if(!s)throw new i.InternalError("Missing descriptor. Should be impossible");(0,o.metadata)(a.Transaction.key(n.TransactionalKeys.TRANSACTIONAL),e)(t,r);const c=s.value,u=function(...t){const n=this;return new Promise(((o,i)=>{const s=(e,t)=>{a.Transaction.release(e).then((()=>{if(e)return i(e);o(t)}))};let u=t.shift();if(u instanceof a.Transaction){const s=new a.Transaction(this.constructor.name,r,(async()=>{c.call(s.bindToTransaction(n),...t).then(o).catch(i)}),e.length?e:void 0);u.bindTransaction(s),u.fire()}else t.unshift(u),u=new a.Transaction(this.constructor.name,r,(()=>{c.call(u.bindToTransaction(n),...t).then((e=>s(void 0,e))).catch(s)}),e.length?e:void 0),a.Transaction.submit(u)}))};Object.defineProperty(u,"name",{value:r}),s.value=u}},t.transactionalSuperCall=function(e,...t){return e(a.Transaction.getLock().currentTransaction,...t)};const n=r(2640),o=r(32),a=r(5789),i=r(5922)},2552:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getObjectName=function(e){if(e)return"string"==typeof e?e:e.constructor&&e.constructor.name&&-1===["Function","Object"].indexOf(e.constructor.name)?e.constructor.name:"function"==typeof e&&e.name?e.name:e.toString()}},2586:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Context=void 0;const n=r(8569),o=r(3036);class a extends n.DataCache{constructor(e,t,r){super(),this.operation=e,this.model=t,this.parent=r}get timestamp(){return new Date}async get(e){try{return super.get(e)}catch(t){if(this.parent)return this.parent.get(e);throw t}}async pop(e){if(e in this.cache)return super.pop(e);if(!this.parent)throw new o.NotFoundError(`Key ${e} not in dataStore`);return this.parent.pop(e)}child(e,t){return this.constructor(e,t,this)}static async from(e,t,...r){return new a(e,t)}static async args(e,t,r,n){const o=r.pop();async function i(){return n?n.context(e,t,...r):new a(e,t)}let s;return o?o instanceof a?(s=o,r.push(o)):(s=await i(),r.push(o,s)):(s=await i(),r.push(s)),{context:s,args:r}}}t.Context=a},2640:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TransactionalKeys=void 0,t.TransactionalKeys={REFLECT:"model.transactional.",TRANSACTIONAL:"transactional"}},2709:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validate=function(e,...t){const r=[];for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&-1===t.indexOf(n)&&r.push(o.Reflection.getPropertyDecorators(l.ValidationKeys.REFLECT,e,n));let f;for(const t of r){const{prop:r,decorators:n}=t;if(!n||!n.length)continue;const o=n[0];let i;n.find((e=>e.key===l.ValidationKeys.TYPE||!!e.props.types?.find((e=>e===o.props.name))))&&n.shift();for(const t of n){const n=u.Validation.get(t.key);if(!n)throw new Error(`Missing validator for ${t.key}`);const o=t.key===a.ModelKeys.TYPE?[t.props]:t.props||{},s=n.hasErrors(e[r.toString()],o);s&&(i=i||{},i[t.key]=s)}i&&(f=f||{},f[t.prop.toString()]=i)}for(const t of Object.keys(e).filter((e=>!f||!f[e]))){let r;const n=o.Reflection.getPropertyDecorators(l.ValidationKeys.REFLECT,e,t).decorators,u=o.Reflection.getPropertyDecorators(l.ValidationKeys.REFLECT,e,t).decorators.filter((e=>-1!==[a.ModelKeys.TYPE,l.ValidationKeys.TYPE].indexOf(e.key)));if(!u||!u.length)continue;const d=u.pop(),p=d.props.name?[d.props.name]:Array.isArray(d.props.customTypes)?d.props.customTypes:[d.props.customTypes],y=Object.values(s.ReservedModels).map((e=>e.toLowerCase()));for(const o of p){if(-1===y.indexOf(o.toLowerCase())){const a=Array.isArray(e[t])?l.ValidationKeys.LIST:l.ValidationKeys.TYPE,s=n.find((e=>e.key===a))||{};let u=[];if(s&&s.props){const r=Array.isArray(e[t])?s.props.class:s.props.customTypes;r&&(u=Array.isArray(r)?r.map((e=>`${e}`.toLowerCase())):[r.toLowerCase()])}const f=(e,t)=>{if("object"==typeof t||"function"==typeof t)return(0,c.isModel)(t)?t.hasErrors():u.includes(typeof t)?void 0:"Value has no validatable type"};switch(o){case Array.name:case Set.name:n.length&&n.find((e=>e.key===l.ValidationKeys.LIST))&&(r=(o===Array.name?e[t]:e[t].values()).map((e=>f(t,e))).filter((e=>!!e)),r?.length||(r=void 0));break;default:try{e[t]&&(r=f(t,e[t]))}catch(e){console.warn((0,i.sf)("Model should be validatable but its not: "+e))}}}r&&(f=f||{},f[t]=r)}}return f?new n.ModelErrorDefinition(f):void 0};const n=r(3368),o=r(32),a=r(7675),i=r(1318),s=r(8539),c=r(3),u=r(1375),l=r(5021)},2828:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(6569),t),o(r(4367),t),o(r(3793),t),o(r(9607),t)},2888:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ListValidator=void 0;const a=r(7036),i=r(5021),s=r(8024);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.LIST){super(e,Array.name,Set.name)}hasErrors(e,t){if(!e||(Array.isArray(e)?!e.length:!e.size))return;const r=Array.isArray(t.clazz)?t.clazz:[t.clazz];let n,o=!0;for(let t=0;t<(Array.isArray(e)?e.length:e.size);t++)switch(n=e[t],typeof n){case"object":case"function":o=r.includes(n.constructor?.name);break;default:o=r.some((e=>typeof n===e.toLowerCase()))}return o?void 0:this.getMessage(t.message||this.message,r)}};t.ListValidator=c,t.ListValidator=c=n([(0,s.validator)(i.ValidationKeys.LIST),o("design:paramtypes",[String])],c)},3032:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isEqual=function e(t,r,...n){if(t===r)return 0!==t||1/t==1/r;if(null==t||null==r)return t===r;if(typeof t!=typeof r)return!1;if(Number.isNaN(t)&&Number.isNaN(r))return!0;if("object"!=typeof t)return t===r;if(t instanceof Date&&r instanceof Date)return!(!isNaN(t.getTime())||!isNaN(r.getTime()))||t.getTime()===r.getTime();if(t instanceof RegExp&&r instanceof RegExp)return t.toString()===r.toString();if(t instanceof Error&&r instanceof Error)return t.name===r.name&&t.message===r.message;if(Array.isArray(t)&&Array.isArray(r)){if(t.length!==r.length)return!1;for(let o=0;o<t.length;o++)if(!e(t[o],r[o],...n))return!1;return!0}if(t instanceof Map&&r instanceof Map){if(t.size!==r.size)return!1;for(const[o,a]of t)if(!r.has(o)||!e(a,r.get(o),...n))return!1;return!0}if(t instanceof Set&&r instanceof Set){if(t.size!==r.size)return!1;for(const e of t)if(!r.has(e))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(r)){if(t.byteLength!==r.byteLength)return!1;if(t.byteOffset!==r.byteOffset)return!1;if(t.buffer.byteLength!==r.buffer.byteLength)return!1;const e=new Uint8Array(t.buffer,t.byteOffset,t.byteLength),n=new Uint8Array(r.buffer,r.byteOffset,r.byteLength);for(let t=0;t<e.length;t++)if(e[t]!==n[t])return!1;return!0}const o=Object.keys(t).filter((e=>!n.includes(e))),a=Object.keys(r).filter((e=>!n.includes(e)));if(o.length!==a.length)return!1;for(const i of o){if(!a.includes(i))return!1;if(!e(t[i],r[i],...n))return!1}const i=Object.getOwnPropertySymbols(t).filter((e=>!n.includes(e.toString()))),s=Object.getOwnPropertySymbols(r).filter((e=>!n.includes(e.toString())));if(i.length!==s.length)return!1;for(const o of i){if(!s.includes(o))return!1;if(!e(t[o],r[o],...n))return!1}return Object.getPrototypeOf(t)===Object.getPrototypeOf(r)}},3036:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ConflictError=t.NotFoundError=t.SerializationError=t.InternalError=t.ValidationError=t.BaseError=void 0;class r extends Error{constructor(e,t){if(t instanceof r)return t;super(`[${e}] ${t instanceof Error?t.message:t}`),t instanceof Error&&(this.stack=t.stack)}}t.BaseError=r;class n extends r{constructor(e){super(n.name,e)}}t.ValidationError=n;class o extends r{constructor(e){super(o.name,e)}}t.InternalError=o;class a extends r{constructor(e){super(a.name,e)}}t.SerializationError=a;class i extends r{constructor(e){super(i.name,e)}}t.NotFoundError=i;class s extends r{constructor(e){super(s.name,e)}}t.ConflictError=s},3042:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.prop=a,t.propMetadata=function(e,t){return(0,n.apply)(a(),(0,n.metadata)(e,t))};const n=r(32),o=r(7675);function a(e=o.ModelKeys.ATTRIBUTE){return(t,r)=>{let n;n=Object.prototype.hasOwnProperty.call(t,e)?t[e]:t[e]=[],n.includes(r)||n.push(r)}}},3162:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(1362),t),o(r(6753),t),o(r(9252),t),o(r(6723),t)},3201:(e,t)=>{function r(e){return e.constructor&&e.hasErrors}Object.defineProperty(t,"__esModule",{value:!0}),t.ValidatorRegistry=void 0,t.isValidator=r,t.ValidatorRegistry=class{constructor(...e){this.cache={},this.customKeyCache={},this.register(...e)}getCustomKeys(){return Object.assign({},this.customKeyCache)}getKeys(){return Object.keys(this.cache)}get(e){if(!(e in this.cache))return;const t=this.cache[e];if(r(t))return t;const n=new(t.default||t);return this.cache[e]=n,n}register(...e){e.forEach((e=>{if(r(e)){if(e.validationKey in this.cache)return;this.cache[e.validationKey]=e}else{const{validationKey:t,validator:r,save:n}=e;if(t in this.cache)return;if(this.cache[t]=r,!n)return;const o={};o[t.toUpperCase()]=t,this.customKeyCache=Object.assign({},this.customKeyCache,o)}}))}}},3317:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.PasswordValidator=void 0;const a=r(6174),i=r(5021),s=r(8024);let c=class extends a.PatternValidator{constructor(e=i.DEFAULT_ERROR_MESSAGES.PASSWORD){super(e)}hasErrors(e,t={}){return super.hasErrors(e,{...t,message:t.message||this.message})}};t.PasswordValidator=c,t.PasswordValidator=c=n([(0,s.validator)(i.ValidationKeys.PASSWORD),o("design:paramtypes",[Object])],c)},3368:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ModelErrorDefinition=void 0,t.ModelErrorDefinition=class{constructor(e){for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&e[t]&&Object.defineProperty(this,t,{enumerable:!0,configurable:!1,value:e[t],writable:!1})}toString(){const e=this;return Object.keys(e).filter((t=>Object.prototype.hasOwnProperty.call(e,t)&&"function"!=typeof e[t])).reduce(((t,r)=>{let n=Object.keys(e[r]).reduce(((t,n)=>(t?t+=`\n${e[r][n]}`:t=e[r][n],t)),void 0);return n&&(n=`${r} - ${n}`,t?t+=`\n${n}`:t=n),t}),"")}}},3576:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.DateValidator=void 0;const a=r(7036),i=r(5021),s=r(8024);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.DATE){super(e,Number.name,Date.name,String.name)}hasErrors(e,t={}){if(void 0!==e&&("string"==typeof e&&(e=new Date(e)),Number.isNaN(e.getDate()))){const{message:e=""}=t;return this.getMessage(e||this.message)}}};t.DateValidator=c,t.DateValidator=c=n([(0,s.validator)(i.ValidationKeys.DATE),o("design:paramtypes",[String])],c)},3793:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.hashOnCreateUpdate=l,t.hash=f,t.composedFromCreateUpdate=d,t.composedFromKeys=function(e,t=n.DefaultSeparator,r=!1,o="",a=""){return p(e,r,t,"keys",o,a)},t.composed=function(e,t=n.DefaultSeparator,r=!1,o="",a=""){return p(e,r,t,"values",o,a)},t.versionCreateUpdate=y,t.version=function(){return(0,o.apply)((0,a.type)(Number.name),(0,i.onCreate)(y(u.OperationKeys.CREATE)),(0,i.onUpdate)(y(u.OperationKeys.UPDATE)),(0,a.propMetadata)(c.Repository.key(n.DBKeys.VERSION),!0))};const n=r(4367),o=r(32),a=r(2302),i=r(6441),s=r(3036),c=r(9553),u=r(7781);function l(e,t,r,n){if(!r[t])return;const o=a.Hashing.hash(r[t]);n&&r[t]===o||(r[t]=o)}function f(){return(0,o.apply)((0,i.onCreateUpdate)(l),(0,a.propMetadata)(c.Repository.key(n.DBKeys.HASH),{}))}function d(e,t,r,n){try{const{args:e,type:o,prefix:i,suffix:c,separator:u}=t,l=e.map((e=>{if(!(e in n))throw new s.InternalError((0,a.sf)("Property {0} not found to compose from",e));if("keys"===o)return e;if(void 0===n[e])throw new s.InternalError((0,a.sf)("Property {0} does not contain a value to compose from",e));return n[e].toString()}));i&&l.unshift(i),c&&l.push(c),n[r]=l.join(u)}catch(e){throw new s.InternalError(`Failed to compose value: ${e}`)}}function p(e,t=!1,r=n.DefaultSeparator,s="values",u="",l=""){const p={args:e,hashResult:t,separator:r,type:s,prefix:u,suffix:l},y=[(0,i.onCreateUpdate)(d,p),(0,a.propMetadata)(c.Repository.key(n.DBKeys.COMPOSED),p)];return t&&y.push(f()),(0,o.apply)(...y)}function y(e){return function(t,r,n,o){try{switch(e){case u.OperationKeys.CREATE:o[n]=1;break;case u.OperationKeys.UPDATE:o[n]++;break;default:throw new s.InternalError(`Invalid operation: ${e}`)}}catch(e){throw new s.InternalError(`Failed to update version: ${e}`)}}}},3802:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.findPrimaryKey=s,t.findModelId=function(e,t=!1){const r=s(e).id,n=e[r];if(!n&&!t)throw new i.InternalError((0,a.sf)("No value for the Id is defined under the property {0}",r));return n};const n=r(4367),o=r(592),a=r(2302),i=r(3036);function s(e){const t=(0,o.getAllPropertyDecoratorsRecursive)(e,void 0,n.DBKeys.REFLECT+n.DBKeys.ID),r=Object.entries(t).reduce(((e,[t,r])=>{const n=r.filter((e=>e.key!==a.ModelKeys.TYPE));return n&&n.length&&(e[t]=e[t]||[],e[t].push(...n)),e}),{});if(!r||!Object.keys(r).length)throw new i.InternalError("Could not find ID decorated Property");if(Object.keys(r).length>1)throw new i.InternalError((0,a.sf)(Object.keys(r).join(", ")));const s=Object.keys(r)[0];if(!s)throw new i.InternalError("Could not find ID decorated Property");return{id:s,props:r[s][0].props}}},3949:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},4072:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(7675),t),o(r(5243),t),o(r(3042),t),o(r(2252),t),o(r(2417),t),o(r(4744),t),o(r(1318),t),o(r(7759),t)},4213:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},4300:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OperationsRegistry=void 0;const n=r(9121);t.OperationsRegistry=class{constructor(){this.cache={}}get(e,t,r,n){let o;n=n||[];try{o="string"==typeof e?e:e.constructor.name,n.unshift(...Object.values(this.cache[o][t][r]||[]))}catch(t){if("string"==typeof e||e===Object.prototype||Object.getPrototypeOf(e)===Object.prototype)return n}let a=Object.getPrototypeOf(e);return a.constructor.name===o&&(a=Object.getPrototypeOf(a)),this.get(a,t,r,n)}register(e,t,r,o){const a=r.constructor.name,i=n.Operations.getHandlerName(e);this.cache[a]||(this.cache[a]={}),this.cache[a][o]||(this.cache[a][o]={}),this.cache[a][o][t]||(this.cache[a][o][t]={}),this.cache[a][o][t][i]||(this.cache[a][o][t][i]=e)}}},4367:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_TIMESTAMP_FORMAT=t.DefaultSeparator=t.DBKeys=void 0;const n=r(2302);t.DBKeys={REFLECT:`${n.ModelKeys.REFLECT}persistence.`,REPOSITORY:"repository",CLASS:"_class",ID:"id",INDEX:"index",UNIQUE:"unique",SERIALIZE:"serialize",READONLY:"readonly",TIMESTAMP:"timestamp",HASH:"hash",COMPOSED:"composed",VERSION:"version",ORIGINAL:"__originalObj"},t.DefaultSeparator="_",t.DEFAULT_TIMESTAMP_FORMAT="dd/MM/yyyy HH:mm:ss:S"},4744:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Serialization=t.JSONSerializer=t.DefaultSerializationMethod=void 0;const n=r(3),o=r(7675);t.DefaultSerializationMethod="json";class a{constructor(){}preSerialize(e){const t=Object.assign({},e),r=n.Model.getMetadata(e);return t[o.ModelKeys.ANCHOR]=r||e.constructor.name,t}deserialize(e){const t=JSON.parse(e),r=t[o.ModelKeys.ANCHOR];if(!r)throw new Error("Could not find class reference in serialized model");return n.Model.build(t,r)}serialize(e){return JSON.stringify(this.preSerialize(e))}}t.JSONSerializer=a;class i{static{this.current=t.DefaultSerializationMethod}static{this.cache={json:new a}}constructor(){}static get(e){if(e in this.cache)return this.cache[e];throw new Error(`No serialization method registered under ${e}`)}static register(e,t,r=!1){if(e in this.cache)throw new Error(`Serialization method ${e} already registered`);this.cache[e]=new t,r&&(this.current=e)}static serialize(e,t,...r){return t?this.get(t).serialize(e,...r):this.get(this.current).serialize(e,...r)}static deserialize(e,t,...r){return t?this.get(t).deserialize(e,...r):this.get(this.current).deserialize(e,...r)}static setDefault(e){this.current=this.get(e)}}t.Serialization=i},4939:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.construct=function(e,...t){const r=(...t)=>new e(...t);return r.prototype=e.prototype,r(...t)},t.findLastProtoBeforeObject=function(e){let t=Object.getPrototypeOf(e);if(t===Object.prototype)return e;for(;t!==Object.prototype;){if(t=Object.getPrototypeOf(t),t===Object.prototype)return t;if(Object.getPrototypeOf(t)===Object.prototype)return t}throw new Error("Could not find proper prototype")},t.bindModelPrototype=function(e){if(e instanceof n.Model)return;function t(e,t){Object.setPrototypeOf(e,t)}const r=Object.getPrototypeOf(e);if(r===Object.prototype)return t(e,n.Model.prototype);for(;r!==Object.prototype;){const e=Object.getPrototypeOf(r);if(e===Object.prototype||Object.getPrototypeOf(e)===Object.prototype)return t(r,n.Model.prototype)}throw new Error("Could not find proper prototype to bind")};const n=r(3)},4972:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TypeValidator=void 0;const a=r(7036),i=r(5021),s=r(8024),c=r(1375),u=r(7675),l=r(32);let f=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.TYPE){super(e)}hasErrors(e,t){if(void 0===e)return;const{types:r,message:n}=t;return l.Reflection.evaluateDesignTypes(e,r)?void 0:this.getMessage(n||this.message,"string"==typeof r?r:Array.isArray(r)?r.join(", "):r.name,typeof e)}};t.TypeValidator=f,t.TypeValidator=f=n([(0,s.validator)(i.ValidationKeys.TYPE),o("design:paramtypes",[String])],f),c.Validation.register({validator:f,validationKey:u.ModelKeys.TYPE,save:!1})},4981:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UpdateValidator=void 0;const n=r(2302);class o extends n.Validator{constructor(e=n.DEFAULT_ERROR_MESSAGES.DEFAULT,...t){super(e,...t)}}t.UpdateValidator=o},5021:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PATTERNS=t.DEFAULT_ERROR_MESSAGES=t.DAYS_OF_WEEK_NAMES=t.MONTH_NAMES=t.ValidationKeys=void 0;const n=r(7675);t.ValidationKeys={REFLECT:`${n.ModelKeys.REFLECT}validation.`,VALIDATOR:"validator",REQUIRED:"required",MIN:"min",MAX:"max",STEP:"step",MIN_LENGTH:"minlength",MAX_LENGTH:"maxlength",PATTERN:"pattern",EMAIL:"email",URL:"url",DATE:"date",TYPE:"type",PASSWORD:"password",LIST:"list"},t.MONTH_NAMES=["January","February","March","April","May","June","July","August","September","October","November","December"],t.DAYS_OF_WEEK_NAMES=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],t.DEFAULT_ERROR_MESSAGES={REQUIRED:"This field is required",MIN:"The minimum value is {0}",MAX:"The maximum value is {0}",MIN_LENGTH:"The minimum length is {0}",MAX_LENGTH:"The maximum length is {0}",PATTERN:"The value does not match the pattern",EMAIL:"The value is not a valid email",URL:"The value is not a valid URL",TYPE:"Invalid type. Expected {0}, received {1}",STEP:"Invalid value. Not a step of {0}",DATE:"Invalid value. not a valid Date",DEFAULT:"There is an Error",PASSWORD:"Must be at least 8 characters and contain one of number, lower and upper case letters, and special character (@$!%*?&_-.,)",LIST:"Invalid list of {0}",MODEL_NOT_FOUND:"No model registered under {0}"},t.DEFAULT_PATTERNS={EMAIL:/[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?/,URL:/^(?:(?:(?:https?|ftp):)?\/\/)(?:\S+(?::\S*)?@)?(?:(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(?::\d{2,5})?(?:[/?#]\S*)?$/i,PASSWORD:{CHAR8_ONE_OF_EACH:/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&_\-.,])[A-Za-z\d@$!%*?&_\-.,]{8,}$/g}}},5030:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(70),t),o(r(9944),t),o(r(4213),t),o(r(1375),t)},5224:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.EmailValidator=void 0;const a=r(5021),i=r(6174),s=r(8024);let c=class extends i.PatternValidator{constructor(e=a.DEFAULT_ERROR_MESSAGES.EMAIL){super(e)}hasErrors(e,t={}){return super.hasErrors(e,{...t,pattern:t?.pattern||a.DEFAULT_PATTERNS.EMAIL})}};t.EmailValidator=c,t.EmailValidator=c=n([(0,s.validator)(a.ValidationKeys.EMAIL),o("design:paramtypes",[String])],c)},5243:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.dateFromFormat=a,t.bindDateToString=i,t.isValidDate=s,t.twoDigitPad=c,t.formatDate=u,t.parseDate=function(e,t){let r;if(t){if(t instanceof Date)try{r=a(u(t,e),e)}catch(r){throw new Error((0,o.sf)("Could not convert date {0} to format: {1}",t.toString(),e))}else if("string"==typeof t)r=a(t,e);else if("number"==typeof t)r=a(u(new Date(t),e),e);else{if(!s(t))throw new Error(`Invalid value provided ${t}`);try{r=a(u(new Date(t),e),e)}catch(r){throw new Error((0,o.sf)("Could not convert date {0} to format: {1}",t,e))}}return i(r,e)}},r(8630);const n=r(5021),o=r(1318);function a(e,t){let r=t;r.match(/hh/)?r=r.replace("hh","(?<hour>\\d{2})"):r.match(/h/)?r=r.replace("h","(?<hour>\\d{1,2})"):r.match(/HH/)?r=r.replace("HH","(?<hour>\\d{2})"):r.match(/H/)&&(r=r.replace("H","(?<hour>\\d{1,2})")),r.match(/mm/)?r=r.replace("mm","(?<minutes>\\d{2})"):r.match(/m/)&&(r=r.replace("m","(?<minutes>\\d{1,2})")),r.match(/ss/)?r=r.replace("ss","(?<seconds>\\d{2})"):r.match(/s/)&&(r=r.replace("s","(?<seconds>\\d{1,2})")),r.match(/dd/)?r=r.replace("dd","(?<day>\\d{2})"):r.match(/d/)&&(r=r.replace("d","(?<day>\\d{1,2})")),r.match(/EEEE/)?r=r.replace("EEEE","(?<dayofweek>\\w+)"):r.match(/EEEE/)&&(r=r.replace("EEE","(?<dayofweek>\\w+)")),r.match(/yyyy/)?r=r.replace("yyyy","(?<year>\\d{4})"):r.match(/yy/)&&(r=r.replace("yy","(?<year>\\d{2})")),r.match(/MMMM/)?r=r.replace("MMMM","(?<monthname>\\w+)"):r.match(/MMM/)&&(r=r.replace("MMM","(?<monthnamesmall>\\w+)")),r.match(/MM/)?r=r.replace("MM","(?<month>\\d{2})"):r.match(/M/)&&(r=r.replace("M","(?<month>\\d{1,2})")),r=r.replace("S","(?<milis>\\d{1,3})").replace("aaa","(?<ampm>\\w{2})");const o=new RegExp(r,"g").exec(e);if(!o||!o.groups)return new Date(e);const a=function(e){if(!e)return 0;const t=parseInt(e);return isNaN(t)?0:t},i=a(o.groups.year),s=a(o.groups.day),c=o.groups.ampm;let u=a(o.groups.hour);c&&(u="PM"===c?u+12:u);const l=a(o.groups.minutes),f=a(o.groups.seconds),d=a(o.groups.milis),p=o.groups.monthname,y=o.groups.monthnamesmall;let h=o.groups.month;if(p)h=n.MONTH_NAMES.indexOf(p);else if(y){const t=n.MONTH_NAMES.find((e=>e.toLowerCase().startsWith(y.toLowerCase())));if(!t)return new Date(e);h=n.MONTH_NAMES.indexOf(t)}else h=a(`${h}`);return new Date(i,h-1,s,u,l,f,d)}function i(e,t){if(!e)return;const r=()=>u(e,t);return Object.defineProperty(e,"toISOString",{enumerable:!1,configurable:!1,value:r}),Object.defineProperty(e,"toString",{enumerable:!1,configurable:!1,value:r}),e}function s(e){return e&&"[object Date]"===Object.prototype.toString.call(e)&&!Number.isNaN(e)}function c(e){return e<10?"0"+e:e.toString()}function u(e,t="yyyy/MM/dd"){const r=e.getDate(),o=e.getMonth(),a=e.getFullYear(),i=e.getHours(),s=e.getMinutes(),u=e.getSeconds(),l=e.getMilliseconds(),f=i%12,d=c(f),p=c(i),y=c(s),h=c(u),g=i<12?"AM":"PM",E=n.DAYS_OF_WEEK_NAMES[e.getDay()],O=E.substr(0,3),v=c(r),b=o+1,_=c(b),m=n.MONTH_NAMES[o],R=m.substr(0,3),M=a+"",T=M.substr(2,2);return(t=t.replace("hh",d).replace("h",f.toString()).replace("HH",p).replace("H",i.toString()).replace("mm",y).replace("m",s.toString()).replace("ss",h).replace("s",u.toString()).replace("S",l.toString()).replace("dd",v).replace("d",r.toString()).replace("EEEE",E).replace("EEE",O).replace("yyyy",M).replace("yy",T).replace("aaa",g)).indexOf("MMM")>-1?t.replace("MMMM",m).replace("MMM",R):t.replace("MM",_).replace("M",b.toString())}},5467:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Lock=void 0,t.Lock=class{constructor(){this.queue=[],this.locked=!1}async execute(e){let t;await this.acquire();try{t=await Promise.resolve(e())}catch(e){throw this.release(),e}return this.release(),t}async acquire(){const e=this;return e.locked?new Promise((t=>e.queue.push(t))):(e.locked=!0,Promise.resolve())}release(){const e=this.queue.shift();e?void 0===globalThis.window?globalThis.process.nextTick(e):setTimeout(e,0):this.locked=!1}}},5530:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.metadata=function(e,t){return(r,n,o)=>{o?Reflect.defineMetadata(e,t,o.value):n?Reflect.defineMetadata(e,t,r,n):Reflect.defineMetadata(e,t,r)}},t.apply=function(...e){return(t,r,n)=>{for(const o of e)t instanceof Function&&!n?o(t):o(t,r,n)}},r(8630)},5537:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(9501),t),o(r(3802),t)},5643:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(8539),t),o(r(4939),t),o(r(754),t),o(r(3),t),o(r(3368),t),o(r(1967),t),o(r(2709),t)},5732:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},5789:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Transaction=void 0;const n=r(32),o=r(2156),a=r(5922),i=r(2552),s=r(2640);class c{constructor(e,t,r,n){this.id=Date.now(),this.action=r,this.method=t,this.log=[[this.id,e,t].join(" | ")],this.source=e,this.metadata=n}static push(e,t,...r){const n=r.pop();if(!n||"function"!=typeof n)throw new Error("Missing callback");const o=(e,...t)=>{c.getLock().release(e).then((()=>n(e,...t)))},a=new c(e.constructor.name,t.name?(0,i.getObjectName)(t):"Anonymous",(()=>t.call(a.bindToTransaction(e),...r,o)));c.getLock().submit(a)}static setLock(e){this.lock=e}static getLock(){return this.lock||(this.lock=new o.SyncronousLock),this.lock}static submit(e){c.getLock().submit(e)}static async release(e){return c.getLock().release(e)}getMetadata(){return this.metadata?[...this.metadata]:void 0}bindTransaction(e){this.log.push(...e.log),e.bindTransaction=this.bindToTransaction.bind(this),e.bindToTransaction=this.bindToTransaction.bind(this),this.action=e.action}bindToTransaction(e){const t=(0,a.getAllPropertyDecoratorsRecursive)(e,void 0,s.TransactionalKeys.REFLECT);if(!t)return e;const r=this,o=n.Reflection.getAllProperties(e).reduce(((o,a)=>(-1!==Object.keys(t).indexOf(a)&&t[a].find((e=>e.key===s.TransactionalKeys.TRANSACTIONAL))?o[a]=(...t)=>e[a].call(e.__originalObj||e,r,...t):"clazz"===a||"constructor"===a?o[a]=e[a]:"function"==typeof e[a]?o[a]=e[a].bind(e.__originalObj||e):"object"==typeof e[a]&&e[a].constructor&&n.Reflection.getClassDecorators(s.TransactionalKeys.REFLECT,e[a]).find((e=>e.key===s.TransactionalKeys.TRANSACTIONAL))?o[a]=r.bindToTransaction(e[a]):o[a]=e[a],o)),{});return o[a.DBKeys.ORIGINAL]=e[a.DBKeys.ORIGINAL]||e,o.toString=()=>(0,i.getObjectName)(o[a.DBKeys.ORIGINAL])+" proxy for transaction "+this.id,o}fire(){if(!this.action)throw new Error("Missing the method");return this.action()}toString(e=!0,t=!1){return`${e?`[${this.id}]`:""}[Transaction][${this.source}.${this.method}${t?`]\nTransaction Log:\n${this.log.join("\n")}`:"]"}`}static key(e){return s.TransactionalKeys.REFLECT+e}}t.Transaction=c},5922:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(5537),t),o(r(8403),t),o(r(2828),t),o(r(7781),t),o(r(9191),t),o(r(3162),t)},5970:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},6050:(e,t)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.DBOperations=t.OperationKeys=void 0,function(e){e.REFLECT="decaf.model.db.operations.",e.CREATE="create",e.READ="read",e.UPDATE="update",e.DELETE="delete",e.ON="on.",e.AFTER="after."}(r||(t.OperationKeys=r={})),t.DBOperations={CREATE:[r.CREATE],READ:[r.READ],UPDATE:[r.UPDATE],DELETE:[r.DELETE],CREATE_UPDATE:[r.CREATE,r.UPDATE],READ_CREATE:[r.READ,r.CREATE],ALL:[r.CREATE,r.READ,r.UPDATE,r.DELETE]}},6163:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Reflection=void 0;const n=r(1267),o=r(3032);class a{constructor(){}static checkType(e,t){return typeof e===t.toLowerCase()||void 0!==e&&"object"==typeof e&&e.constructor&&e.constructor.name.toLowerCase()===t.toLowerCase()}static checkTypes(e,t){return!t.every((t=>!this.checkType(e,t)))}static evaluateDesignTypes(e,t){switch(typeof t){case"string":return this.checkType(e,t);case"object":return!Array.isArray(t)||a.checkTypes(e,t);case"function":return!t.name||"Object"===t.name||this.checkType(e,t.name);default:return!0}}static getAllProperties(e,t=!0,r="Object"){const n=new Set;let o=e;const a=function(){if(!t)return;const e=Object.getPrototypeOf(o);return e&&e.constructor.name!==r?(o=e,o):void 0};do{Object.getOwnPropertyNames(o).forEach((e=>n.add(e)))}while(a());return Array.from(n)}static getClassDecorators(e,t){const r=Reflect.getOwnMetadataKeys(t.constructor),n=[];for(const o of r)o.startsWith(e)&&n.push({key:o.slice(e.length),props:Reflect.getMetadata(o,t.constructor)});return n}static getAllPropertyDecorators(e,...t){if(!t||0===t.length)return;const r={},n=Object.getOwnPropertyNames(e);for(const o of n)for(let n=0;n<t.length;n++){const i=a.getPropertyDecorators(t[n],e,o,0!==n);i.decorators.length>0&&(r[o]||(r[o]=[]),r[o].push(...i.decorators))}return Object.keys(r).length>0?r:void 0}static getTypeFromDecorator(e,t){const r=a.getPropertyDecorators(n.ReflectionKeys.TYPE,e,t,!1);if(!r||!r.decorators)return;const o=r.decorators.shift(),i=o.props?o.props.name:void 0;return"Function"!==i?i:void 0}static getPropertyDecorators(e,t,r,i=!1,s=!0,c){const u=function(e,t,r,o=!1,a){const i=Reflect.getMetadataKeys(t,r).filter((t=>o?t.toString().startsWith(e):t===n.ReflectionKeys.TYPE||t.toString().startsWith(e))).reduce(((o,a)=>{const i={key:a!==n.ReflectionKeys.TYPE?a.substring(e.length):a,props:Reflect.getMetadata(a,t,r)};return o.concat(i)}),a||[]);return{prop:r.toString(),decorators:i}}(e,t,r,i,c);return s&&Object.getPrototypeOf(t)!==Object.prototype?a.getPropertyDecorators(e,Object.getPrototypeOf(t.constructor),r,!0,s,u.decorators):{prop:u.prop,decorators:function(e){const r={};return e.filter((e=>e.key in r?((0,o.isEqual)(e.props,r[e.key])||console.log(`Found a similar decorator for the ${e.key} propertyof a ${t.constructor.name} model but with different attributes.The original one will be kept`),!1):(r[e.key.toString()]=e.props,!0)))}(u.decorators)}}}t.Reflection=a},6174:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.PatternValidator=t.regexpParser=void 0;const a=r(7036),i=r(5021),s=r(8024);t.regexpParser=new RegExp("^/(.+)/([gimus]*)$");let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.PATTERN){super(e,"string")}getPattern(e){if(!t.regexpParser.test(e))return new RegExp(e);const r=e.match(t.regexpParser);return new RegExp(r[1],r[2])}hasErrors(e,t){if(!e)return;let{pattern:r}=t;if(!r)throw new Error("Missing Pattern");return r="string"==typeof r?this.getPattern(r):r,r.lastIndex=0,r.test(e)?void 0:this.getMessage(t.message||this.message)}};t.PatternValidator=c,t.PatternValidator=c=n([(0,s.validator)(i.ValidationKeys.PATTERN),o("design:paramtypes",[String])],c)},6441:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.onCreateUpdate=function(e,t){return s(n.DBOperations.CREATE_UPDATE,e,t)},t.onUpdate=function(e,t){return s(n.DBOperations.UPDATE,e,t)},t.onCreate=function(e,t){return s(n.DBOperations.CREATE,e,t)},t.onRead=function(e,t){return s(n.DBOperations.READ,e,t)},t.onDelete=function(e,t){return s(n.DBOperations.DELETE,e,t)},t.onAny=function(e,t){return s(n.DBOperations.ALL,e,t)},t.on=s,t.afterCreateUpdate=function(e,t){return c(n.DBOperations.CREATE_UPDATE,e,t)},t.afterUpdate=function(e,t){return c(n.DBOperations.UPDATE,e,t)},t.afterCreate=function(e,t){return c(n.DBOperations.CREATE,e,t)},t.afterRead=function(e,t){return c(n.DBOperations.READ,e,t)},t.afterDelete=function(e,t){return c(n.DBOperations.DELETE,e,t)},t.afterAny=function(e,t){return c(n.DBOperations.ALL,e,t)},t.after=c,t.operation=u;const n=r(6050),o=r(9121),a=r(32),i=r(2302);function s(e=n.DBOperations.ALL,t,r){return u(n.OperationKeys.ON,e,t,r)}function c(e=n.DBOperations.ALL,t,r){return u(n.OperationKeys.AFTER,e,t,r)}function u(e,t=n.DBOperations.ALL,r,s){return(n,c)=>{const u=n.constructor.name,l=t.reduce(((t,a)=>{const l=e+a;let f=Reflect.getMetadata(o.Operations.key(l),n,c);f||(f={operation:a,handlers:{}});const d=o.Operations.getHandlerName(r);return f.handlers[u]&&f.handlers[u][c]&&d in f.handlers[u][c]||(f.handlers[u]=f.handlers[u]||{},f.handlers[u][c]=f.handlers[u][c]||{},f.handlers[u][c][d]={data:s},t.push(function(e,t){return(r,n)=>{o.Operations.register(t,e,r,n)}}(l,r),(0,i.propMetadata)(o.Operations.key(l),f))),t}),[]);return(0,a.apply)(...l)(n,c)}}},6569:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validateCompare=function(e,t,...r){const s=[];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&-1===r.indexOf(e)&&s.push(o.Reflection.getPropertyDecorators(a.UpdateValidationKeys.REFLECT,t,e));let c;for(const r of s){const{prop:o,decorators:a}=r;if(a.shift(),!a||!a.length)continue;let i;for(const s of a){const a=n.Validation.get(s.key);if(!a){console.error(`Could not find Matching validator for ${s.key} for property ${String(r.prop)}`);continue}const c=a.updateHasErrors(t[o.toString()],e[o.toString()],...Object.values(s.props));c&&(i=i||{},i[s.key]=c)}i&&(c=c||{},c[r.prop.toString()]=i)}for(const a of Object.keys(t).filter((e=>!(r.includes(e)||c&&c[e])))){let r;const s=o.Reflection.getPropertyDecorators(n.ValidationKeys.REFLECT,t,a).decorators,u=o.Reflection.getPropertyDecorators(n.ValidationKeys.REFLECT,t,a).decorators.filter((e=>-1!==[n.ModelKeys.TYPE,n.ValidationKeys.TYPE].indexOf(e.key)));if(!u||!u.length)continue;const l=u.pop(),f=l.props.name?[l.props.name]:Array.isArray(l.props.customTypes)?l.props.customTypes:[l.props.customTypes],d=Object.values(n.ReservedModels).map((e=>e.toLowerCase()));for(const o of f){if(-1===d.indexOf(o.toLowerCase()))switch(o){case Array.name:case Set.name:if(s.length&&s.find((e=>e.key===n.ValidationKeys.LIST))){let n,s;switch(o){case Array.name:n=t[a],s=e[a];break;case Set.name:n=t[a].values(),s=e[a].values();break;default:throw new Error(`Invalid attribute type ${o}`)}r=n.map((e=>{const t=(0,i.findModelId)(e,!0);if(!t)return"Failed to find model id";const r=s.find((e=>t===(0,i.findModelId)(e,!0)));return r?e.hasErrors(r):void 0})).filter((e=>!!e)),r?.length||(r=void 0)}break;default:try{t[a]&&e[a]&&(r=t[a].hasErrors(e[a]))}catch(e){console.warn((0,n.sf)("Model should be validatable but its not"))}}r&&(c=c||{},c[a]=r)}}return c?new n.ModelErrorDefinition(c):void 0};const n=r(2302),o=r(32),a=r(3162),i=r(5537)},6723:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(2302),o=r(6753);n.Validation.updateKey=function(e){return o.UpdateValidationKeys.REFLECT+e}},6753:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.UpdateValidationKeys=t.DEFAULT_ERROR_MESSAGES=void 0;const n=r(4367);t.DEFAULT_ERROR_MESSAGES={ID:{INVALID:"This Id is invalid",REQUIRED:"The Id is mandatory"},READONLY:{INVALID:"This cannot be updated"},TIMESTAMP:{REQUIRED:"Timestamp is Mandatory",DATE:"The Timestamp must the a valid date",INVALID:"This value must always increase"}},t.UpdateValidationKeys={REFLECT:"db.update.validation.",TIMESTAMP:n.DBKeys.TIMESTAMP,READONLY:n.DBKeys.READONLY}},6942:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.StepValidator=void 0;const a=r(7036),i=r(5021),s=r(8024);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.STEP){super(e,"number","string")}hasErrors(e,t){if(void 0!==e)return Number(e)%Number(t.step)!=0?this.getMessage(t.message||this.message,t.step):void 0}};t.StepValidator=c,t.StepValidator=c=n([(0,s.validator)(i.ValidationKeys.STEP),o("design:paramtypes",[String])],c)},7036:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Validator=void 0;const n=r(5021),o=r(1318),a=r(32);t.Validator=class{constructor(e=n.DEFAULT_ERROR_MESSAGES.DEFAULT,...t){this.message=e,t.length&&(this.acceptedTypes=t),this.acceptedTypes&&(this.hasErrors=this.checkTypeAndHasErrors(this.hasErrors.bind(this)))}getMessage(e,...t){return(0,o.sf)(e,...t)}checkTypeAndHasErrors(e){return function(t,...r){return void 0!==t&&this.acceptedTypes?a.Reflection.checkTypes(t,this.acceptedTypes)?e(t,...r):this.getMessage(n.DEFAULT_ERROR_MESSAGES.TYPE,this.acceptedTypes.join(", "),typeof t):e(t,...r)}.bind(this)}}},7633:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7674:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7675:(e,t)=>{var r;Object.defineProperty(t,"__esModule",{value:!0}),t.ModelKeys=void 0,function(e){e.REFLECT="decaf.model.",e.TYPE="design:type",e.PARAMS="design:paramtypes",e.RETURN="design:returntype",e.MODEL="model",e.ANCHOR="__model",e.CONSTRUCTION="constructed-by",e.ATTRIBUTE="__attributes",e.HASHING="hashing",e.SERIALIZATION="serialization"}(r||(t.ModelKeys=r={}))},7729:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),t.VERSION=void 0,o(r(1206),t),o(r(8242),t),o(r(2640),t),o(r(2503),t),o(r(5789),t),o(r(5732),t),t.VERSION="0.0.22"},7759:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0})},7781:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(6050),t),o(r(6441),t),o(r(9121),t),o(r(4300),t),o(r(5970),t)},8024:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.validator=function(...e){return(0,a.apply)((t=>(e.forEach((e=>{n.Validation.register({validator:t,validationKey:e,save:!0})})),t)),(0,a.metadata)(n.Validation.key(o.ValidationKeys.VALIDATOR),e))};const n=r(1375),o=r(5021),a=r(32)},8089:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.RequiredValidator=void 0;const a=r(7036),i=r(5021),s=r(8024);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.REQUIRED){super(e)}hasErrors(e,t={}){switch(typeof e){case"boolean":case"number":return void 0===e?this.getMessage(t.message||this.message):void 0;default:return e?void 0:this.getMessage(t.message||this.message)}}};t.RequiredValidator=c,t.RequiredValidator=c=n([(0,s.validator)(i.ValidationKeys.REQUIRED),o("design:paramtypes",[String])],c)},8242:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(5467),t),o(r(2156),t)},8403:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(3949),t),o(r(200),t),o(r(1101),t),o(r(7674),t)},8539:(e,t)=>{var r,n;Object.defineProperty(t,"__esModule",{value:!0}),t.jsTypes=t.ReservedModels=t.Primitives=void 0,function(e){e.STRING="string",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint"}(r||(t.Primitives=r={})),function(e){e.STRING="string",e.OBJECT="object",e.NUMBER="number",e.BOOLEAN="boolean",e.BIGINT="bigint",e.DATE="date"}(n||(t.ReservedModels=n={})),t.jsTypes=["string","array","number","boolean","symbol","function","object","undefined","null","bigint"]},8569:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DataCache=void 0;const n=r(3036);t.DataCache=class{constructor(){this.cache={}}async get(e){if(!(e in this.cache))throw new n.NotFoundError(`Key ${e} not in dataStore`);return this.cache[e]}async push(e,t){if(e in this.cache)throw new n.ConflictError(`Key ${e} already in dataStore`);this.cache[e]=t}async put(e,t){this.cache[e]=t}async pop(e){const t=this.get(e);return delete this.cache[e],t}async filter(e){return"string"==typeof e&&(e=new RegExp(e)),Object.keys(this.cache).filter((t=>!!e.exec(t))).map((e=>this.cache[e]))}async purge(e){e?await this.pop(e):this.cache={}}}},8630:()=>{var e;!function(e){!function(){var t="object"==typeof globalThis?globalThis:"object"==typeof global?global:"object"==typeof self?self:"object"==typeof this?this:function(){try{return Function("return this;")()}catch(e){}}()||function(){try{return(0,eval)("(function() { return this; })()")}catch(e){}}(),r=n(e);function n(e,t){return function(r,n){Object.defineProperty(e,r,{configurable:!0,writable:!0,value:n}),t&&t(r,n)}}void 0!==t.Reflect&&(r=n(t.Reflect,r)),function(e,t){var r=Object.prototype.hasOwnProperty,n="function"==typeof Symbol,o=n&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",a=n&&void 0!==Symbol.iterator?Symbol.iterator:"@@iterator",i="function"==typeof Object.create,s={__proto__:[]}instanceof Array,c=!i&&!s,u={create:i?function(){return B(Object.create(null))}:s?function(){return B({__proto__:null})}:function(){return B({})},has:c?function(e,t){return r.call(e,t)}:function(e,t){return t in e},get:c?function(e,t){return r.call(e,t)?e[t]:void 0}:function(e,t){return e[t]}},l=Object.getPrototypeOf(Function),f="function"==typeof Map&&"function"==typeof Map.prototype.entries?Map:function(){var e={},t=[],r=function(){function e(e,t,r){this._index=0,this._keys=e,this._values=t,this._selector=r}return e.prototype["@@iterator"]=function(){return this},e.prototype[a]=function(){return this},e.prototype.next=function(){var e=this._index;if(e>=0&&e<this._keys.length){var r=this._selector(this._keys[e],this._values[e]);return e+1>=this._keys.length?(this._index=-1,this._keys=t,this._values=t):this._index++,{value:r,done:!1}}return{value:void 0,done:!0}},e.prototype.throw=function(e){throw this._index>=0&&(this._index=-1,this._keys=t,this._values=t),e},e.prototype.return=function(e){return this._index>=0&&(this._index=-1,this._keys=t,this._values=t),{value:e,done:!0}},e}();return function(){function t(){this._keys=[],this._values=[],this._cacheKey=e,this._cacheIndex=-2}return Object.defineProperty(t.prototype,"size",{get:function(){return this._keys.length},enumerable:!0,configurable:!0}),t.prototype.has=function(e){return this._find(e,!1)>=0},t.prototype.get=function(e){var t=this._find(e,!1);return t>=0?this._values[t]:void 0},t.prototype.set=function(e,t){var r=this._find(e,!0);return this._values[r]=t,this},t.prototype.delete=function(t){var r=this._find(t,!1);if(r>=0){for(var n=this._keys.length,o=r+1;o<n;o++)this._keys[o-1]=this._keys[o],this._values[o-1]=this._values[o];return this._keys.length--,this._values.length--,k(t,this._cacheKey)&&(this._cacheKey=e,this._cacheIndex=-2),!0}return!1},t.prototype.clear=function(){this._keys.length=0,this._values.length=0,this._cacheKey=e,this._cacheIndex=-2},t.prototype.keys=function(){return new r(this._keys,this._values,n)},t.prototype.values=function(){return new r(this._keys,this._values,o)},t.prototype.entries=function(){return new r(this._keys,this._values,i)},t.prototype["@@iterator"]=function(){return this.entries()},t.prototype[a]=function(){return this.entries()},t.prototype._find=function(e,t){if(!k(this._cacheKey,e)){this._cacheIndex=-1;for(var r=0;r<this._keys.length;r++)if(k(this._keys[r],e)){this._cacheIndex=r;break}}return this._cacheIndex<0&&t&&(this._cacheIndex=this._keys.length,this._keys.push(e),this._values.push(void 0)),this._cacheIndex},t}();function n(e,t){return e}function o(e,t){return t}function i(e,t){return[e,t]}}(),d="function"==typeof Set&&"function"==typeof Set.prototype.entries?Set:function(){function e(){this._map=new f}return Object.defineProperty(e.prototype,"size",{get:function(){return this._map.size},enumerable:!0,configurable:!0}),e.prototype.has=function(e){return this._map.has(e)},e.prototype.add=function(e){return this._map.set(e,e),this},e.prototype.delete=function(e){return this._map.delete(e)},e.prototype.clear=function(){this._map.clear()},e.prototype.keys=function(){return this._map.keys()},e.prototype.values=function(){return this._map.keys()},e.prototype.entries=function(){return this._map.entries()},e.prototype["@@iterator"]=function(){return this.keys()},e.prototype[a]=function(){return this.keys()},e}(),p="function"==typeof WeakMap?WeakMap:function(){var e=u.create(),t=n();return function(){function e(){this._key=n()}return e.prototype.has=function(e){var t=o(e,!1);return void 0!==t&&u.has(t,this._key)},e.prototype.get=function(e){var t=o(e,!1);return void 0!==t?u.get(t,this._key):void 0},e.prototype.set=function(e,t){return o(e,!0)[this._key]=t,this},e.prototype.delete=function(e){var t=o(e,!1);return void 0!==t&&delete t[this._key]},e.prototype.clear=function(){this._key=n()},e}();function n(){var t;do{t="@@WeakMap@@"+i()}while(u.has(e,t));return e[t]=!0,t}function o(e,n){if(!r.call(e,t)){if(!n)return;Object.defineProperty(e,t,{value:u.create()})}return e[t]}function a(e,t){for(var r=0;r<t;++r)e[r]=255*Math.random()|0;return e}function i(){var e=function(e){if("function"==typeof Uint8Array){var t=new Uint8Array(e);return"undefined"!=typeof crypto?crypto.getRandomValues(t):"undefined"!=typeof msCrypto?msCrypto.getRandomValues(t):a(t,e),t}return a(new Array(e),e)}(16);e[6]=79&e[6]|64,e[8]=191&e[8]|128;for(var t="",r=0;r<16;++r){var n=e[r];4!==r&&6!==r&&8!==r||(t+="-"),n<16&&(t+="0"),t+=n.toString(16).toLowerCase()}return t}}(),y=n?Symbol.for("@reflect-metadata:registry"):void 0,h=function(){var e;return!T(y)&&A(t.Reflect)&&Object.isExtensible(t.Reflect)&&(e=t.Reflect[y]),T(e)&&(e=function(){var e,r,n,o;T(y)||void 0===t.Reflect||y in t.Reflect||"function"!=typeof t.Reflect.defineMetadata||(e=function(e){var t=e.defineMetadata,r=e.hasOwnMetadata,n=e.getOwnMetadata,o=e.getOwnMetadataKeys,a=e.deleteMetadata,i=new p;return{isProviderFor:function(e,t){var r=i.get(e);return!(T(r)||!r.has(t))||!!o(e,t).length&&(T(r)&&(r=new d,i.set(e,r)),r.add(t),!0)},OrdinaryDefineOwnMetadata:t,OrdinaryHasOwnMetadata:r,OrdinaryGetOwnMetadata:n,OrdinaryOwnMetadataKeys:o,OrdinaryDeleteMetadata:a}}(t.Reflect));var a=new p,i={registerProvider:s,getProvider:u,setProvider:h};return i;function s(t){if(!Object.isExtensible(i))throw new Error("Cannot add provider to a frozen registry.");switch(!0){case e===t:break;case T(r):r=t;break;case r===t:break;case T(n):n=t;break;case n===t:break;default:void 0===o&&(o=new d),o.add(t)}}function c(t,a){if(!T(r)){if(r.isProviderFor(t,a))return r;if(!T(n)){if(n.isProviderFor(t,a))return r;if(!T(o))for(var i=x(o);;){var s=V(i);if(!s)return;var c=I(s);if(c.isProviderFor(t,a))return C(i),c}}}if(!T(e)&&e.isProviderFor(t,a))return e}function u(e,t){var r,n=a.get(e);return T(n)||(r=n.get(t)),T(r)?(T(r=c(e,t))||(T(n)&&(n=new f,a.set(e,n)),n.set(t,r)),r):r}function l(e){if(T(e))throw new TypeError;return r===e||n===e||!T(o)&&o.has(e)}function h(e,t,r){if(!l(r))throw new Error("Metadata provider not registered.");var n=u(e,t);if(n!==r){if(!T(n))return!1;var o=a.get(e);T(o)&&(o=new f,a.set(e,o)),o.set(t,r)}return!0}}()),!T(y)&&A(t.Reflect)&&Object.isExtensible(t.Reflect)&&Object.defineProperty(t.Reflect,y,{enumerable:!1,configurable:!1,writable:!1,value:e}),e}(),g=function(e){var t=new p,r={isProviderFor:function(e,r){var n=t.get(e);return!T(n)&&n.has(r)},OrdinaryDefineOwnMetadata:function(e,t,r,o){n(r,o,!0).set(e,t)},OrdinaryHasOwnMetadata:function(e,t,r){var o=n(t,r,!1);return!T(o)&&S(o.has(e))},OrdinaryGetOwnMetadata:function(e,t,r){var o=n(t,r,!1);if(!T(o))return o.get(e)},OrdinaryOwnMetadataKeys:function(e,t){var r=[],o=n(e,t,!1);if(T(o))return r;for(var a=x(o.keys()),i=0;;){var s=V(a);if(!s)return r.length=i,r;var c=I(s);try{r[i]=c}catch(e){try{C(a)}finally{throw e}}i++}},OrdinaryDeleteMetadata:function(e,r,o){var a=n(r,o,!1);if(T(a))return!1;if(!a.delete(e))return!1;if(0===a.size){var i=t.get(r);T(i)||(i.delete(o),0===i.size&&t.delete(i))}return!0}};return h.registerProvider(r),r;function n(n,o,a){var i=t.get(n),s=!1;if(T(i)){if(!a)return;i=new f,t.set(n,i),s=!0}var c=i.get(o);if(T(c)){if(!a)return;if(c=new f,i.set(o,c),!e.setProvider(n,o,r))throw i.delete(o),s&&t.delete(n),new Error("Wrong provider for target.")}return c}}(h);function E(e,t,r){if(O(e,t,r))return!0;var n=U(t);return!w(n)&&E(e,n,r)}function O(e,t,r){var n=F(t,r,!1);return!T(n)&&S(n.OrdinaryHasOwnMetadata(e,t,r))}function v(e,t,r){if(O(e,t,r))return b(e,t,r);var n=U(t);return w(n)?void 0:v(e,n,r)}function b(e,t,r){var n=F(t,r,!1);if(!T(n))return n.OrdinaryGetOwnMetadata(e,t,r)}function _(e,t,r,n){F(r,n,!0).OrdinaryDefineOwnMetadata(e,t,r,n)}function m(e,t){var r=R(e,t),n=U(e);if(null===n)return r;var o=m(n,t);if(o.length<=0)return r;if(r.length<=0)return o;for(var a=new d,i=[],s=0,c=r;s<c.length;s++){var u=c[s];a.has(u)||(a.add(u),i.push(u))}for(var l=0,f=o;l<f.length;l++)u=f[l],a.has(u)||(a.add(u),i.push(u));return i}function R(e,t){var r=F(e,t,!1);return r?r.OrdinaryOwnMetadataKeys(e,t):[]}function M(e){if(null===e)return 1;switch(typeof e){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===e?1:6;default:return 6}}function T(e){return void 0===e}function w(e){return null===e}function A(e){return"object"==typeof e?null!==e:"function"==typeof e}function P(e,t){switch(M(e)){case 0:case 1:case 2:case 3:case 4:case 5:return e}var r=3===t?"string":5===t?"number":"default",n=N(e,o);if(void 0!==n){var a=n.call(e,r);if(A(a))throw new TypeError;return a}return function(e,t){if("string"===t){var r=e.toString;if(L(r)&&!A(o=r.call(e)))return o;if(L(n=e.valueOf)&&!A(o=n.call(e)))return o}else{var n;if(L(n=e.valueOf)&&!A(o=n.call(e)))return o;var o,a=e.toString;if(L(a)&&!A(o=a.call(e)))return o}throw new TypeError}(e,"default"===r?"number":r)}function S(e){return!!e}function D(e){var t=P(e,3);return"symbol"==typeof t?t:function(e){return""+e}(t)}function j(e){return Array.isArray?Array.isArray(e):e instanceof Object?e instanceof Array:"[object Array]"===Object.prototype.toString.call(e)}function L(e){return"function"==typeof e}function K(e){return"function"==typeof e}function k(e,t){return e===t||e!=e&&t!=t}function N(e,t){var r=e[t];if(null!=r){if(!L(r))throw new TypeError;return r}}function x(e){var t=N(e,a);if(!L(t))throw new TypeError;var r=t.call(e);if(!A(r))throw new TypeError;return r}function I(e){return e.value}function V(e){var t=e.next();return!t.done&&t}function C(e){var t=e.return;t&&t.call(e)}function U(e){var t=Object.getPrototypeOf(e);if("function"!=typeof e||e===l)return t;if(t!==l)return t;var r=e.prototype,n=r&&Object.getPrototypeOf(r);if(null==n||n===Object.prototype)return t;var o=n.constructor;return"function"!=typeof o||o===e?t:o}function F(e,t,r){var n=h.getProvider(e,t);if(!T(n))return n;if(r){if(h.setProvider(e,t,g))return g;throw new Error("Illegal state.")}}function B(e){return e.__=void 0,delete e.__,e}e("decorate",(function(e,t,r,n){if(T(r)){if(!j(e))throw new TypeError;if(!K(t))throw new TypeError;return function(e,t){for(var r=e.length-1;r>=0;--r){var n=(0,e[r])(t);if(!T(n)&&!w(n)){if(!K(n))throw new TypeError;t=n}}return t}(e,t)}if(!j(e))throw new TypeError;if(!A(t))throw new TypeError;if(!A(n)&&!T(n)&&!w(n))throw new TypeError;return w(n)&&(n=void 0),function(e,t,r,n){for(var o=e.length-1;o>=0;--o){var a=(0,e[o])(t,r,n);if(!T(a)&&!w(a)){if(!A(a))throw new TypeError;n=a}}return n}(e,t,r=D(r),n)})),e("metadata",(function(e,t){return function(r,n){if(!A(r))throw new TypeError;if(!T(n)&&!function(e){switch(M(e)){case 3:case 4:return!0;default:return!1}}(n))throw new TypeError;_(e,t,r,n)}})),e("defineMetadata",(function(e,t,r,n){if(!A(r))throw new TypeError;return T(n)||(n=D(n)),_(e,t,r,n)})),e("hasMetadata",(function(e,t,r){if(!A(t))throw new TypeError;return T(r)||(r=D(r)),E(e,t,r)})),e("hasOwnMetadata",(function(e,t,r){if(!A(t))throw new TypeError;return T(r)||(r=D(r)),O(e,t,r)})),e("getMetadata",(function(e,t,r){if(!A(t))throw new TypeError;return T(r)||(r=D(r)),v(e,t,r)})),e("getOwnMetadata",(function(e,t,r){if(!A(t))throw new TypeError;return T(r)||(r=D(r)),b(e,t,r)})),e("getMetadataKeys",(function(e,t){if(!A(e))throw new TypeError;return T(t)||(t=D(t)),m(e,t)})),e("getOwnMetadataKeys",(function(e,t){if(!A(e))throw new TypeError;return T(t)||(t=D(t)),R(e,t)})),e("deleteMetadata",(function(e,t,r){if(!A(t))throw new TypeError;if(T(r)||(r=D(r)),!A(t))throw new TypeError;T(r)||(r=D(r));var n=F(t,r,!1);return!T(n)&&n.OrdinaryDeleteMetadata(e,t,r)}))}(r,t),void 0===t.Reflect&&(t.Reflect=e)}()}(e||(e={}))},8689:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.URLValidator=void 0;const a=r(5021),i=r(6174),s=r(8024);let c=class extends i.PatternValidator{constructor(e=a.DEFAULT_ERROR_MESSAGES.URL){super(e)}hasErrors(e,t={}){return super.hasErrors(e,{...t,pattern:t.pattern||a.DEFAULT_PATTERNS.URL})}};t.URLValidator=c,t.URLValidator=c=n([(0,s.validator)(a.ValidationKeys.URL),o("design:paramtypes",[String])],c)},8944:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.TimestampValidator=void 0;const a=r(2302),i=r(6753);let s=class extends a.Validator{constructor(){super(i.DEFAULT_ERROR_MESSAGES.TIMESTAMP.INVALID)}hasErrors(e,...t){}updateHasErrors(e,t,r){if(void 0!==e){r=r||this.getMessage(r||this.message);try{e=new Date(e),t=new Date(t)}catch(e){return r}return e<=t?r:void 0}}};t.TimestampValidator=s,t.TimestampValidator=s=n([(0,a.validator)(i.UpdateValidationKeys.TIMESTAMP),o("design:paramtypes",[])],s)},9121:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Operations=void 0;const n=r(2302),o=r(4300),a=r(6050);class i{constructor(){}static getHandlerName(e){return e.name?e.name:(console.warn("Handler name not defined. A name will be generated, but this is not desirable. please avoid using anonymous functions"),n.Hashing.hash(e.toString()))}static key(e){return a.OperationKeys.REFLECT+e}static get(e,t,r){return i.registry.get(e,t,r)}static getOpRegistry(){return i.registry||(i.registry=new o.OperationsRegistry),i.registry}static register(e,t,r,n){i.getOpRegistry().register(e,t,r,n)}}t.Operations=i},9174:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.ReadOnlyValidator=void 0;const a=r(2302),i=r(6753),s=r(32);let c=class extends a.Validator{constructor(){super(i.DEFAULT_ERROR_MESSAGES.READONLY.INVALID)}hasErrors(e,...t){}updateHasErrors(e,t,r){if(void 0!==e)return(0,s.isEqual)(e,t)?void 0:this.getMessage(r||this.message)}};t.ReadOnlyValidator=c,t.ReadOnlyValidator=c=n([(0,a.validator)(i.UpdateValidationKeys.READONLY),o("design:paramtypes",[])],c)},9191:function(e,t,r){var n=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),o=this&&this.__exportStar||function(e,t){for(var r in e)"default"===r||Object.prototype.hasOwnProperty.call(t,r)||n(t,e,r)};Object.defineProperty(t,"__esModule",{value:!0}),o(r(2022),t),o(r(2586),t),o(r(8569),t),o(r(3036),t),o(r(9553),t),o(r(592),t),o(r(749),t)},9252:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.readonly=function(e=a.DEFAULT_ERROR_MESSAGES.READONLY.INVALID){return(0,n.propMetadata)(n.Validation.updateKey(o.DBKeys.READONLY),{message:e})},t.timestampHandler=f,t.timestamp=function(e=i.DBOperations.CREATE_UPDATE,t=o.DEFAULT_TIMESTAMP_FORMAT){const r=[(0,n.date)(t,a.DEFAULT_ERROR_MESSAGES.TIMESTAMP.DATE),(0,n.required)(a.DEFAULT_ERROR_MESSAGES.TIMESTAMP.REQUIRED),(0,s.on)(e,f)];return-1!==e.indexOf(i.OperationKeys.UPDATE)&&r.push((0,n.propMetadata)(n.Validation.updateKey(o.DBKeys.TIMESTAMP),{message:a.DEFAULT_ERROR_MESSAGES.TIMESTAMP.INVALID})),(0,u.apply)(...r)},t.serializeOnCreateUpdate=d,t.serializeAfterAll=p,t.serialize=function(){return(0,u.apply)((0,s.onCreateUpdate)(d),(0,s.after)(i.DBOperations.ALL,p),(0,n.type)([String.name,Object.name]),(0,u.metadata)(l.Repository.key(o.DBKeys.SERIALIZE),{}))};const n=r(2302),o=r(4367),a=r(6753),i=r(6050),s=r(6441),c=r(3036),u=r(32),l=r(9191);async function f(e,t,r,n){n[r]=e.timestamp}async function d(e,t,r,o){if(r[t])try{r[t]=JSON.stringify(r[t])}catch(e){throw new c.SerializationError((0,n.sf)("Failed to serialize {0} property on {1} model: {2}",t,r.constructor.name,e.message))}}async function p(e,t,r){if(r[t]&&"string"==typeof r[t])try{r[t]=JSON.parse(r[t])}catch(e){throw new c.SerializationError((0,n.sf)("Failed to deserialize {0} property on {1} model: {2}",t,r.constructor.name,e.message))}}},9320:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MinValidator=void 0;const a=r(7036),i=r(5021),s=r(8024);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.MIN){super(e,"number","Date","string")}hasErrors(e,t){if(void 0===e)return;let{min:r}=t;if(e instanceof Date&&!(r instanceof Date)&&(r=new Date(r),Number.isNaN(r.getDate())))throw new Error("Invalid Min param defined");return e<r?this.getMessage(t.message||this.message,r):void 0}};t.MinValidator=c,t.MinValidator=c=n([(0,s.validator)(i.ValidationKeys.MIN),o("design:paramtypes",[String])],c)},9378:function(e,t,r){var n=this&&this.__decorate||function(e,t,r,n){var o,a=arguments.length,i=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(i=(a<3?o(i):a>3?o(t,r,i):o(t,r))||i);return a>3&&i&&Object.defineProperty(t,r,i),i},o=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)};Object.defineProperty(t,"__esModule",{value:!0}),t.MaxValidator=void 0;const a=r(7036),i=r(5021),s=r(8024);let c=class extends a.Validator{constructor(e=i.DEFAULT_ERROR_MESSAGES.MAX){super(e,"number","Date","string")}hasErrors(e,t){if(void 0===e)return;let{max:r}=t;if(e instanceof Date&&!(r instanceof Date)&&(r=new Date(r),Number.isNaN(r.getDate())))throw new Error("Invalid Max param defined");return e>r?this.getMessage(t.message||this.message,r):void 0}};t.MaxValidator=c,t.MaxValidator=c=n([(0,s.validator)(i.ValidationKeys.MAX),o("design:paramtypes",[String])],c)},9501:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.id=function(){return(0,o.apply)((0,n.required)(),(0,a.readonly)(),(0,n.propMetadata)(s.Repository.key(i.DBKeys.ID),{}))};const n=r(2302),o=r(32),a=r(3162),i=r(4367),s=r(9191)},9553:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Repository=void 0;const n=r(592),o=r(6050),a=r(3036),i=r(2022),s=r(4367),c=r(2586);class u extends i.BaseRepository{constructor(e){super(e)}async createPrefix(e,...t){const r=await c.Context.args(o.OperationKeys.CREATE,this.class,t);e=new this.class(e),await(0,n.enforceDBDecorators)(this,r.context,e,o.OperationKeys.CREATE,o.OperationKeys.ON);const i=e.hasErrors();if(i)throw new a.ValidationError(i.toString());return[e,...r.args]}async createAllPrefix(e,...t){const r=await c.Context.args(o.OperationKeys.CREATE,this.class,t);await Promise.all(e.map((async e=>(e=new this.class(e),await(0,n.enforceDBDecorators)(this,r.context,e,o.OperationKeys.CREATE,o.OperationKeys.ON),e))));const i=e.map((e=>e.hasErrors())).reduce(((e,t,r)=>(t&&(e="string"==typeof e?e+`\n - ${r}: ${t.toString()}`:` - ${r}: ${t.toString()}`),e)),void 0);if(i)throw new a.ValidationError(i);return[e,...r.args]}async updatePrefix(e,...t){const r=await c.Context.args(o.OperationKeys.UPDATE,this.class,t),i=e[this.pk];if(!i)throw new a.InternalError(`No value for the Id is defined under the property ${this.pk}`);const s=await this.read(i);e=this.merge(s,e),await(0,n.enforceDBDecorators)(this,r.context,e,o.OperationKeys.UPDATE,o.OperationKeys.ON,s);const u=e.hasErrors(s);if(u)throw new a.ValidationError(u.toString());return[e,...r.args]}async updateAllPrefix(e,...t){const r=await c.Context.args(o.OperationKeys.UPDATE,this.class,t),i=e.map((e=>{const t=e[this.pk];if(!t)throw new a.InternalError(`No value for the Id is defined under the property ${this.pk}`);return t})),s=await this.readAll(i,...r.args);e=e.map(((e,t)=>this.merge(s[t],e))),await Promise.all(e.map(((e,t)=>(0,n.enforceDBDecorators)(this,r.context,e,o.OperationKeys.UPDATE,o.OperationKeys.ON,s[t]))));const u=e.map(((e,t)=>e.hasErrors(s[t],e))).reduce(((e,t,r)=>(t&&(e="string"==typeof e?e+`\n - ${r}: ${t.toString()}`:` - ${r}: ${t.toString()}`),e)),void 0);if(u)throw new a.ValidationError(u);return[e,...r.args]}static key(e){return s.DBKeys.REFLECT+e}}t.Repository=u},9607:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0});const n=r(2302),o=r(6569);n.Model.prototype.hasErrors=function(e,...t){!e||e instanceof n.Model||(t.unshift(e),e=void 0);const r=(0,n.validate)(this,...t);return r||!e?r:(0,o.validateCompare)(e,this,...t)}},9944:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.required=function(e=n.DEFAULT_ERROR_MESSAGES.REQUIRED){return(0,i.propMetadata)(s.Validation.key(n.ValidationKeys.REQUIRED),{message:e})},t.min=function(e,t=n.DEFAULT_ERROR_MESSAGES.MIN){return(0,i.propMetadata)(s.Validation.key(n.ValidationKeys.MIN),{min:e,message:t,types:[Number.name,Date.name]})},t.max=function(e,t=n.DEFAULT_ERROR_MESSAGES.MAX){return(0,i.propMetadata)(s.Validation.key(n.ValidationKeys.MAX),{max:e,message:t,types:[Number.name,Date.name]})},t.step=function(e,t=n.DEFAULT_ERROR_MESSAGES.STEP){return(0,i.propMetadata)(s.Validation.key(n.ValidationKeys.STEP),{step:e,message:t,types:[Number.name]})},t.minlength=function(e,t=n.DEFAULT_ERROR_MESSAGES.MIN_LENGTH){return(0,i.propMetadata)(s.Validation.key(n.ValidationKeys.MIN_LENGTH),{minLength:e,message:t,types:[String.name,Array.name,Set.name]})},t.maxlength=function(e,t=n.DEFAULT_ERROR_MESSAGES.MAX_LENGTH){return(0,i.propMetadata)(s.Validation.key(n.ValidationKeys.MAX_LENGTH),{maxLength:e,message:t,types:[String.name,Array.name,Set.name]})},t.pattern=function(e,t=n.DEFAULT_ERROR_MESSAGES.PATTERN){return(0,i.propMetadata)(s.Validation.key(n.ValidationKeys.PATTERN),{pattern:"string"==typeof e?e:e.toString(),message:t,types:[String.name]})},t.email=function(e=n.DEFAULT_ERROR_MESSAGES.EMAIL){return(0,i.propMetadata)(s.Validation.key(n.ValidationKeys.EMAIL),{pattern:n.DEFAULT_PATTERNS.EMAIL,message:e,types:[String.name]})},t.url=function(e=n.DEFAULT_ERROR_MESSAGES.URL){return(0,i.propMetadata)(s.Validation.key(n.ValidationKeys.URL),{pattern:n.DEFAULT_PATTERNS.URL,message:e,types:[String.name]})},t.type=function(e,t=n.DEFAULT_ERROR_MESSAGES.TYPE){return(0,i.propMetadata)(s.Validation.key(n.ValidationKeys.TYPE),{customTypes:e,message:t})},t.date=function(e="dd/MM/yyyy",t=n.DEFAULT_ERROR_MESSAGES.DATE){return(r,c)=>{(0,i.propMetadata)(s.Validation.key(n.ValidationKeys.DATE),{format:e,message:t,types:[Date.name]})(r,c);const u=new WeakMap;Object.defineProperty(r,c,{configurable:!1,set(t){const r=Object.getOwnPropertyDescriptor(this,c);r&&!r.configurable||Object.defineProperty(this,c,{enumerable:!0,configurable:!1,get:()=>u.get(this),set:t=>{let r;try{r=(0,a.parseDate)(e,t),u.set(this,r)}catch(e){console.error((0,o.sf)("Failed to parse date: {0}",e.message||e))}}}),this[c]=t},get(){console.log("here")}})}},t.password=function(e=n.DEFAULT_PATTERNS.PASSWORD.CHAR8_ONE_OF_EACH,t=n.DEFAULT_ERROR_MESSAGES.PASSWORD){return(0,i.propMetadata)(s.Validation.key(n.ValidationKeys.PASSWORD),{pattern:e,message:t,types:[String.name]})},t.list=c,t.set=function(e,t=n.DEFAULT_ERROR_MESSAGES.LIST){return c(e,"Set",t)},r(8630);const n=r(5021),o=r(1318),a=r(5243),i=r(3042),s=r(1375);function c(e,t="Array",r=n.DEFAULT_ERROR_MESSAGES.LIST){return(0,i.propMetadata)(s.Validation.key(n.ValidationKeys.LIST),{clazz:Array.isArray(e)?e.map((e=>e.name)):[e.name],type:t,message:r})}}},t={};!function r(n){var o=t[n];if(void 0!==o)return o.exports;var a=t[n]={exports:{}};return e[n].call(a.exports,a,a.exports,r),a.exports}(7729);
|
|
File without changes
|