sedentary 0.0.40 → 0.0.43

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/README.md CHANGED
@@ -52,7 +52,7 @@ const db = new Sedentary("file.db");
52
52
 
53
53
  class Items extends db.model("Item", {
54
54
  num: db.INT,
55
- str: db.VARCHAR(30)
55
+ str: db.VarChar(30)
56
56
  });
57
57
 
58
58
  (async function () {
@@ -109,9 +109,9 @@ To work with the package under Windows, be sure to configure `bash.exe` as your
109
109
  > npm config set script-shell bash.exe
110
110
  ```
111
111
 
112
- # Licence
112
+ # License
113
113
 
114
- [MIT Licence](https://github.com/iccicci/sedentary/blob/master/LICENSE)
114
+ [MIT License](https://github.com/iccicci/sedentary/blob/master/LICENSE)
115
115
 
116
116
  # Bugs
117
117
 
package/package.json CHANGED
@@ -5,31 +5,14 @@
5
5
  "Daniele Ricci <daniele.icc@gmail.com> (https://github.com/iccicci)",
6
6
  "yossarian <sergiybiluk@gmail.com> (https://github.com/captain-yossarian)"
7
7
  ],
8
- "dependencies": {},
9
8
  "description": "The ORM which never needs to migrate",
10
- "devDependencies": {
11
- "@types/jest": "28.1.3",
12
- "@types/node": "18.0.0",
13
- "@types/yamljs": "0.2.31",
14
- "@typescript-eslint/eslint-plugin": "5.30.0",
15
- "@typescript-eslint/parser": "5.30.0",
16
- "eslint": "8.18.0",
17
- "jest": "28.1.1",
18
- "jest-environment-node-single-context": "28.0.0",
19
- "prettier": "2.7.1",
20
- "ts-jest": "28.0.5",
21
- "ts-node": "10.8.1",
22
- "tsd": "0.21.0",
23
- "typescript": "4.7.4",
24
- "yamljs": "0.3.0"
25
- },
26
9
  "engines": {
27
10
  "node": ">=14.0"
28
11
  },
29
12
  "funding": {
30
13
  "url": "https://blockchain.info/address/1Md9WFAHrXTb3yPBwQWmUfv2RmzrtbHioB"
31
14
  },
32
- "homepage": "https://github.com/iccicci/sedentary#readme",
15
+ "homepage": "https://github.com/iccicci/sedentary/packages/sedentary#readme",
33
16
  "keywords": [
34
17
  "DB",
35
18
  "ORM",
@@ -43,29 +26,24 @@
43
26
  "main": "./dist/cjs/index.js",
44
27
  "module": "./dist/es/index.js",
45
28
  "name": "sedentary",
46
- "prettier": {
47
- "arrowParens": "avoid",
48
- "endOfLine": "lf",
49
- "jsxBracketSameLine": true,
50
- "printWidth": 200,
51
- "trailingComma": "none",
52
- "useTabs": false
29
+ "optionalDependencies": {
30
+ "fsevents": "2.3.2"
53
31
  },
54
32
  "readmeFilename": "README.md",
55
33
  "repository": "https://github.com/iccicci/sedentary",
56
34
  "scripts": {
57
- "coverage": "jest --coverage --runInBand",
58
- "gitignore": "node -r ts-node/register utils.ts gitignore",
59
- "npmignore": "node -r ts-node/register utils.ts npmignore",
60
- "packagejson": "node -r ts-node/register utils.ts packagejson",
61
- "test": "jest --runInBand --verbose",
62
- "travis": "node -r ts-node/register utils.ts travis",
63
- "tsc": "tsc -p tsconfig.cjs.json && tsc -p tsconfig.es.json && tsc -p tsconfig.types.json",
64
- "version": "node -r ts-node/register utils.ts version"
35
+ "build": "make build",
36
+ "coverage": "jest --coverage --no-cache --runInBand",
37
+ "deploy": "npm_config_registry=\"registry.npmjs.org\" npm publish",
38
+ "precoverage": "make pretest",
39
+ "preinstall": "if [ -f Makefile ] ; then make ; fi",
40
+ "pretest": "make pretest",
41
+ "test": "jest --no-cache --runInBand"
65
42
  },
66
43
  "tsd": {
67
44
  "compilerOptions": {
68
45
  "alwaysStrict": true,
46
+ "composite": false,
69
47
  "esModuleInterop": true,
70
48
  "moduleResolution": "Node",
71
49
  "noImplicitAny": true,
@@ -80,5 +58,5 @@
80
58
  }
81
59
  },
82
60
  "types": "./dist/types/index.d.ts",
83
- "version": "0.0.40"
84
- }
61
+ "version": "0.0.43"
62
+ }
package/dist/cjs/db.js DELETED
@@ -1,115 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Transaction = exports.DB = exports.Table = exports.Attribute = exports.Type = exports.EntryBase = void 0;
4
- class EntryBase {
5
- constructor(from) {
6
- if (from === "load")
7
- this.preLoad();
8
- else {
9
- if (from)
10
- Object.assign(this, from);
11
- this.construct();
12
- }
13
- }
14
- construct() { }
15
- postLoad() { }
16
- postRemove() { }
17
- postSave() { }
18
- preLoad() { }
19
- preRemove() { }
20
- preSave() { }
21
- async remove() {
22
- return false;
23
- }
24
- async save() {
25
- return false;
26
- }
27
- }
28
- exports.EntryBase = EntryBase;
29
- class Type {
30
- constructor(from) {
31
- Object.assign(this, from);
32
- }
33
- }
34
- exports.Type = Type;
35
- class Attribute extends Type {
36
- constructor(from) {
37
- super(from);
38
- }
39
- }
40
- exports.Attribute = Attribute;
41
- function autoImplement() {
42
- return class {
43
- constructor(defaults) {
44
- Object.assign(this, defaults);
45
- }
46
- };
47
- }
48
- class Table extends autoImplement() {
49
- findField(name) {
50
- return this.attributes.filter(_ => _.fieldName === name)[0];
51
- }
52
- }
53
- exports.Table = Table;
54
- class DB {
55
- constructor(log) {
56
- this.tables = [];
57
- this.sync = true;
58
- this.log = log;
59
- }
60
- findTable(name) {
61
- return this.tables.filter(_ => _.tableName === name)[0];
62
- }
63
- indexesEq(a, b) {
64
- if (a.fields.length !== b.fields.length)
65
- return false;
66
- for (const i in a.fields)
67
- if (a.fields[i] !== b.fields[i])
68
- return false;
69
- if (a.type !== b.type)
70
- return false;
71
- if (a.unique !== b.unique)
72
- return false;
73
- return true;
74
- }
75
- async syncDataBase() {
76
- for (const table of this.tables) {
77
- this.sync = table.sync;
78
- await this.syncTable(table);
79
- const indexes = await this.dropConstraints(table);
80
- await this.dropIndexes(table, indexes);
81
- await this.dropFields(table);
82
- await this.syncFields(table);
83
- await this.syncSequence(table);
84
- await this.syncConstraints(table);
85
- await this.syncIndexes(table);
86
- }
87
- }
88
- syncLog(message) {
89
- this.log(this.sync ? message : "NOT SYNCING: " + message);
90
- }
91
- }
92
- exports.DB = DB;
93
- class Transaction {
94
- constructor(log) {
95
- this.entries = [];
96
- this.log = log;
97
- }
98
- addEntry(entry) {
99
- Object.defineProperty(entry, "tx", { configurable: true, value: this });
100
- this.entries.push(entry);
101
- }
102
- clean() {
103
- const { entries } = this;
104
- for (const entry of entries)
105
- Object.defineProperty(entry, "tx", { configurable: true, value: null });
106
- this.entries = [];
107
- }
108
- async commit() {
109
- this.clean();
110
- }
111
- async rollback() {
112
- this.clean();
113
- }
114
- }
115
- exports.Transaction = Transaction;