Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"branches": 90,
"lines": 98,
"functions": 98,
"statements": 98,
"extends": "@istanbuljs/nyc-config-typescript",
"check-coverage": true,
"all": true,
"include": ["src/**/!(*.test.*).[tj]s?(x)"],
"exclude": [
"src/index.ts",
"src/**/index.ts",
"src/_tests_/**/*.*",
"node_modules",
".nyc_output",
"coverage",
".git",
".github",
"features"
],
"reporter": ["html", "lcov", "text", "text-summary"],
"report-dir": "coverage"
}
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,18 @@ A property that holds a uuid as a primary key. It is automatically created if no

[Documentation](https://monolithst.github.io/functional-models/functions/index.properties.PrimaryKeyUuidProperty.html)

#### UuidProperty

A property that holds a uuid value. Can be used for any uuid field, not just primary keys. If `autoNow` is set to true, a uuid will be automatically generated if not provided. Validates the value as a uuid if required, or allows undefined if not required.

[Documentation](https://monolithst.github.io/functional-models/functions/index.properties.UuidProperty.html)

#### ForeignKeyProperty

A property for representing a foreign key to another model in ORM-backed models. By default, it uses a uuid type, but can be configured to use a string or integer type via the `dataType` config. Provides utility methods to get the referenced id and model. Useful for defining foreign key relationships in a database-agnostic way.

[Documentation](https://monolithst.github.io/functional-models/functions/index.orm.properties.ForeignKeyProperty.html)

#### ModelReferenceProperty

A property that holds a reference to another model instance. (In database-speak a foreign key). When code requests the value for this property, it is fetched and returns an object. However, when `.toObj()` is called on the model, this reference turns into a id. (number or string)
Expand Down
168 changes: 164 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 4 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "functional-models",
"version": "3.0.16",
"version": "3.1.0",
"description": "Functional models is ooey gooey framework for building and using awesome models EVERYWHERE.",
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"mocha": "mocha -r tsx",
"test": "mocha -r tsx --extensions ts,tsx 'test/**/*.{ts,tsx}'",
"test:coverage": "TS_NODE_PROJECT=tsconfig.test.json nyc npm run test",
"test:coverage": "c8 --all --reporter cobertura --reporter text --reporter lcov --reporter html npm run test",
"test:watch": "nodemon -e '*' --watch test --watch src --exec npm run test:coverage",
"commit": "cz",
"feature-tests": "./node_modules/.bin/cucumber-js -p default",
Expand Down Expand Up @@ -45,34 +45,6 @@
}
},
"homepage": "https://github.com/monolithst/functional-models#readme",
"nyc": {
"branches": 90,
"lines": 100,
"functions": 100,
"statements": 100,
"extends": "@istanbuljs/nyc-config-typescript",
"check-coverage": true,
"all": true,
"include": [
"src/**/!(*.test.*).[tj]s?(x)"
],
"exclude": [
"src/_tests_/**/*.*",
"node_modules",
".nyc_output",
"coverage",
".git",
".github",
"features"
],
"reporter": [
"html",
"lcov",
"text",
"text-summary"
],
"report-dir": "coverage"
},
"devDependencies": {
"@cucumber/cucumber": "^11.0.0",
"@date-fns/utc": "^1.2.0",
Expand All @@ -84,12 +56,13 @@
"@types/chai": "^5.0.1",
"@types/chai-as-promised": "^7.1.4",
"@types/lodash": "^4.14.176",
"@types/mocha": "^9.0.0",
"@types/mocha": "^9.1.1",
"@types/node": "^22.10.7",
"@types/proxyquire": "^1.3.28",
"@types/sinon": "^10.0.6",
"@typescript-eslint/eslint-plugin": "^8.20.0",
"@typescript-eslint/parser": "^8.20.0",
"c8": "^10.1.3",
"chai": "^5.1.2",
"chai-as-promised": "^7.1.1",
"cz-conventional-changelog": "^3.3.0",
Expand Down
Loading