@loomcore/api 0.1.22 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +49 -49
  3. package/dist/__tests__/postgres-test-migrations/001-create-test-entities-table.migration.js +24 -24
  4. package/dist/__tests__/postgres-test-migrations/002-create-categories-table.migration.js +14 -14
  5. package/dist/__tests__/postgres-test-migrations/003-create-products-table.migration.js +23 -23
  6. package/dist/__tests__/postgres-test-migrations/004-create-test-users-table.migration.js +27 -27
  7. package/dist/__tests__/postgres-test-migrations/005-create-test-items-table.migration.js +22 -22
  8. package/dist/__tests__/postgres.test-database.js +8 -8
  9. package/dist/databases/migrations/migration-runner.d.ts +15 -0
  10. package/dist/databases/migrations/migration-runner.js +118 -0
  11. package/dist/databases/postgres/commands/postgres-batch-update.command.js +7 -7
  12. package/dist/databases/postgres/commands/postgres-create-many.command.js +10 -10
  13. package/dist/databases/postgres/commands/postgres-create.command.js +4 -4
  14. package/dist/databases/postgres/commands/postgres-full-update-by-id.command.js +13 -13
  15. package/dist/databases/postgres/commands/postgres-partial-update-by-id.command.js +7 -7
  16. package/dist/databases/postgres/commands/postgres-update.command.js +7 -7
  17. package/dist/databases/postgres/migrations/001-create-migrations-table.migration.js +12 -12
  18. package/dist/databases/postgres/migrations/002-create-organizations-table.migration.js +24 -24
  19. package/dist/databases/postgres/migrations/003-create-users-table.migration.js +26 -26
  20. package/dist/databases/postgres/migrations/004-create-refresh-tokens-table.migration.js +18 -18
  21. package/dist/databases/postgres/migrations/005-create-meta-org.migration.js +7 -7
  22. package/dist/databases/postgres/migrations/006-create-admin-user.migration.js +3 -3
  23. package/dist/databases/postgres/migrations/setup-for-auth.migration.js +4 -4
  24. package/dist/databases/postgres/migrations/setup-for-multitenant.migration.js +4 -4
  25. package/dist/databases/postgres/utils/build-select-clause.js +6 -6
  26. package/dist/databases/postgres/utils/does-table-exist.util.js +4 -4
  27. package/package.json +88 -87
@@ -8,13 +8,13 @@ export class CreateMigrationTableMigration {
8
8
  async execute() {
9
9
  const _id = randomUUID().toString();
10
10
  try {
11
- await this.client.query(`
12
- CREATE TABLE "migrations" (
13
- "_id" VARCHAR(255) PRIMARY KEY,
14
- "index" INTEGER NOT NULL,
15
- "hasRun" BOOLEAN NOT NULL,
16
- "reverted" BOOLEAN NOT NULL
17
- )
11
+ await this.client.query(`
12
+ CREATE TABLE "migrations" (
13
+ "_id" VARCHAR(255) PRIMARY KEY,
14
+ "index" INTEGER NOT NULL,
15
+ "hasRun" BOOLEAN NOT NULL,
16
+ "reverted" BOOLEAN NOT NULL
17
+ )
18
18
  `);
19
19
  }
20
20
  catch (error) {
@@ -23,9 +23,9 @@ export class CreateMigrationTableMigration {
23
23
  }
24
24
  }
25
25
  try {
26
- const result = await this.client.query(`
27
- INSERT INTO "migrations" ("_id", "index", "hasRun", "reverted")
28
- VALUES ('${_id}', ${this.index}, TRUE, FALSE);
26
+ const result = await this.client.query(`
27
+ INSERT INTO "migrations" ("_id", "index", "hasRun", "reverted")
28
+ VALUES ('${_id}', ${this.index}, TRUE, FALSE);
29
29
  `);
30
30
  if (result.rowCount === 0) {
31
31
  return { success: false, error: new Error(`Error inserting migration ${this.index} to migrations table: No row returned`) };
@@ -38,8 +38,8 @@ export class CreateMigrationTableMigration {
38
38
  }
39
39
  async revert() {
40
40
  try {
41
- const result = await this.client.query(`
42
- DROP TABLE "migrations";
41
+ const result = await this.client.query(`
42
+ DROP TABLE "migrations";
43
43
  `);
44
44
  if (result.rowCount === 0) {
45
45
  return { success: false, error: new Error(`Error dropping migrations table: No row returned`) };
@@ -12,22 +12,22 @@ export class CreateOrganizationsTableMigration {
12
12
  async execute() {
13
13
  const _id = randomUUID().toString();
14
14
  try {
15
- await this.client.query(`
16
- CREATE TABLE "organizations" (
17
- "_id" VARCHAR(255) PRIMARY KEY,
18
- "name" VARCHAR(255) NOT NULL,
19
- "code" VARCHAR(255) NOT NULL,
20
- "description" TEXT,
21
- "status" INTEGER NOT NULL,
22
- "isMetaOrg" BOOLEAN NOT NULL,
23
- "authToken" TEXT,
24
- "_created" TIMESTAMP NOT NULL,
25
- "_createdBy" VARCHAR(255) NOT NULL,
26
- "_updated" TIMESTAMP NOT NULL,
27
- "_updatedBy" VARCHAR(255) NOT NULL,
28
- "_deleted" TIMESTAMP,
29
- "_deletedBy" VARCHAR(255)
30
- )
15
+ await this.client.query(`
16
+ CREATE TABLE "organizations" (
17
+ "_id" VARCHAR(255) PRIMARY KEY,
18
+ "name" VARCHAR(255) NOT NULL,
19
+ "code" VARCHAR(255) NOT NULL,
20
+ "description" TEXT,
21
+ "status" INTEGER NOT NULL,
22
+ "isMetaOrg" BOOLEAN NOT NULL,
23
+ "authToken" TEXT,
24
+ "_created" TIMESTAMP NOT NULL,
25
+ "_createdBy" VARCHAR(255) NOT NULL,
26
+ "_updated" TIMESTAMP NOT NULL,
27
+ "_updatedBy" VARCHAR(255) NOT NULL,
28
+ "_deleted" TIMESTAMP,
29
+ "_deletedBy" VARCHAR(255)
30
+ )
31
31
  `);
32
32
  }
33
33
  catch (error) {
@@ -39,9 +39,9 @@ export class CreateOrganizationsTableMigration {
39
39
  }
40
40
  }
41
41
  try {
42
- const result = await this.client.query(`
43
- INSERT INTO "migrations" ("_id", "index", "hasRun", "reverted")
44
- VALUES ('${_id}', ${this.index}, TRUE, FALSE);
42
+ const result = await this.client.query(`
43
+ INSERT INTO "migrations" ("_id", "index", "hasRun", "reverted")
44
+ VALUES ('${_id}', ${this.index}, TRUE, FALSE);
45
45
  `);
46
46
  if (result.rowCount === 0) {
47
47
  return { success: false, error: new Error(`Error inserting migration ${this.index} to migrations table: No row returned`) };
@@ -54,8 +54,8 @@ export class CreateOrganizationsTableMigration {
54
54
  }
55
55
  async revert() {
56
56
  try {
57
- const result = await this.client.query(`
58
- DROP TABLE "organizations";
57
+ const result = await this.client.query(`
58
+ DROP TABLE "organizations";
59
59
  `);
60
60
  if (result.rowCount === 0) {
61
61
  return { success: false, error: new Error(`Error dropping organizations table: No row returned`) };
@@ -65,12 +65,12 @@ export class CreateOrganizationsTableMigration {
65
65
  return { success: false, error: new Error(`Error dropping organizations table: ${error.message}`) };
66
66
  }
67
67
  try {
68
- const result = await this.client.query(`
69
- Update "migrations" SET "reverted" = TRUE WHERE "index" = '${this.index}';
68
+ const result = await this.client.query(`
69
+ Update "migrations" SET "reverted" = TRUE WHERE "index" = '${this.index}';
70
70
  `);
71
71
  if (result.rowCount === 0) {
72
72
  return {
73
- success: false, error: new Error(`Error updating migration record for index ${this.index}: Migration record not found.
73
+ success: false, error: new Error(`Error updating migration record for index ${this.index}: Migration record not found.
74
74
  Migration index: ${this.index}`)
75
75
  };
76
76
  }
@@ -8,25 +8,25 @@ export class CreateUsersTableMigration {
8
8
  async execute(_orgId) {
9
9
  const _id = randomUUID().toString();
10
10
  try {
11
- await this.client.query(`
12
- CREATE TABLE "users" (
13
- "_id" VARCHAR(255) PRIMARY KEY,
14
- "_orgId" VARCHAR(255),
15
- "email" VARCHAR(255) NOT NULL,
16
- "firstName" VARCHAR(255),
17
- "lastName" VARCHAR(255),
18
- "displayName" VARCHAR(255),
19
- "password" VARCHAR(255) NOT NULL,
20
- "roles" TEXT[],
21
- "_lastLoggedIn" TIMESTAMP,
22
- "_lastPasswordChange" TIMESTAMP,
23
- "_created" TIMESTAMP NOT NULL,
24
- "_createdBy" VARCHAR(255) NOT NULL,
25
- "_updated" TIMESTAMP NOT NULL,
26
- "_updatedBy" VARCHAR(255) NOT NULL,
27
- "_deleted" TIMESTAMP,
28
- "_deletedBy" VARCHAR(255)
29
- )
11
+ await this.client.query(`
12
+ CREATE TABLE "users" (
13
+ "_id" VARCHAR(255) PRIMARY KEY,
14
+ "_orgId" VARCHAR(255),
15
+ "email" VARCHAR(255) NOT NULL,
16
+ "firstName" VARCHAR(255),
17
+ "lastName" VARCHAR(255),
18
+ "displayName" VARCHAR(255),
19
+ "password" VARCHAR(255) NOT NULL,
20
+ "roles" TEXT[],
21
+ "_lastLoggedIn" TIMESTAMP,
22
+ "_lastPasswordChange" TIMESTAMP,
23
+ "_created" TIMESTAMP NOT NULL,
24
+ "_createdBy" VARCHAR(255) NOT NULL,
25
+ "_updated" TIMESTAMP NOT NULL,
26
+ "_updatedBy" VARCHAR(255) NOT NULL,
27
+ "_deleted" TIMESTAMP,
28
+ "_deletedBy" VARCHAR(255)
29
+ )
30
30
  `);
31
31
  }
32
32
  catch (error) {
@@ -38,9 +38,9 @@ export class CreateUsersTableMigration {
38
38
  }
39
39
  }
40
40
  try {
41
- const result = await this.client.query(`
42
- INSERT INTO "migrations" ("_id", "index", "hasRun", "reverted")
43
- VALUES ('${_id}', ${this.index}, TRUE, FALSE);
41
+ const result = await this.client.query(`
42
+ INSERT INTO "migrations" ("_id", "index", "hasRun", "reverted")
43
+ VALUES ('${_id}', ${this.index}, TRUE, FALSE);
44
44
  `);
45
45
  if (result.rowCount === 0) {
46
46
  return { success: false, error: new Error(`Error inserting migration ${this.index} to migrations table: No row returned`) };
@@ -53,8 +53,8 @@ export class CreateUsersTableMigration {
53
53
  }
54
54
  async revert() {
55
55
  try {
56
- const result = await this.client.query(`
57
- DROP TABLE "users";
56
+ const result = await this.client.query(`
57
+ DROP TABLE "users";
58
58
  `);
59
59
  if (result.rowCount === 0) {
60
60
  return { success: false, error: new Error(`Error dropping users table: No row returned`) };
@@ -64,8 +64,8 @@ export class CreateUsersTableMigration {
64
64
  return { success: false, error: new Error(`Error dropping users table: ${error.message}`) };
65
65
  }
66
66
  try {
67
- const result = await this.client.query(`
68
- UPDATE "migrations" SET "reverted" = TRUE WHERE "index" = '${this.index}';
67
+ const result = await this.client.query(`
68
+ UPDATE "migrations" SET "reverted" = TRUE WHERE "index" = '${this.index}';
69
69
  `);
70
70
  if (result.rowCount === 0) {
71
71
  return { success: false, error: new Error(`Error updating migration record for index ${this.index}: No row returned`) };
@@ -8,17 +8,17 @@ export class CreateRefreshTokenTableMigration {
8
8
  async execute(_orgId) {
9
9
  const _id = randomUUID().toString();
10
10
  try {
11
- await this.client.query(`
12
- CREATE TABLE "refreshTokens" (
13
- "_id" VARCHAR(255) PRIMARY KEY,
14
- "_orgId" VARCHAR(255),
15
- "token" VARCHAR(255) NOT NULL,
16
- "deviceId" VARCHAR(255) NOT NULL,
17
- "userId" VARCHAR(255) NOT NULL,
18
- "expiresOn" BIGINT NOT NULL,
19
- "created" TIMESTAMP NOT NULL,
20
- "createdBy" VARCHAR(255) NOT NULL
21
- )
11
+ await this.client.query(`
12
+ CREATE TABLE "refreshTokens" (
13
+ "_id" VARCHAR(255) PRIMARY KEY,
14
+ "_orgId" VARCHAR(255),
15
+ "token" VARCHAR(255) NOT NULL,
16
+ "deviceId" VARCHAR(255) NOT NULL,
17
+ "userId" VARCHAR(255) NOT NULL,
18
+ "expiresOn" BIGINT NOT NULL,
19
+ "created" TIMESTAMP NOT NULL,
20
+ "createdBy" VARCHAR(255) NOT NULL
21
+ )
22
22
  `);
23
23
  }
24
24
  catch (error) {
@@ -30,9 +30,9 @@ export class CreateRefreshTokenTableMigration {
30
30
  }
31
31
  }
32
32
  try {
33
- const result = await this.client.query(`
34
- INSERT INTO "migrations" ("_id", "index", "hasRun", "reverted")
35
- VALUES ('${_id}', ${this.index}, TRUE, FALSE);
33
+ const result = await this.client.query(`
34
+ INSERT INTO "migrations" ("_id", "index", "hasRun", "reverted")
35
+ VALUES ('${_id}', ${this.index}, TRUE, FALSE);
36
36
  `);
37
37
  if (result.rowCount === 0) {
38
38
  return { success: false, error: new Error(`Error inserting migration ${this.index} to migrations table: No row returned`) };
@@ -45,8 +45,8 @@ export class CreateRefreshTokenTableMigration {
45
45
  }
46
46
  async revert() {
47
47
  try {
48
- const result = await this.client.query(`
49
- DROP TABLE "refreshTokens";
48
+ const result = await this.client.query(`
49
+ DROP TABLE "refreshTokens";
50
50
  `);
51
51
  if (result.rowCount === 0) {
52
52
  return { success: false, error: new Error(`Error dropping refresh token table: No row returned`) };
@@ -56,8 +56,8 @@ export class CreateRefreshTokenTableMigration {
56
56
  return { success: false, error: new Error(`Error dropping refresh token table: ${error.message}`) };
57
57
  }
58
58
  try {
59
- const result = await this.client.query(`
60
- UPDATE "migrations" SET "reverted" = TRUE WHERE "index" = '${this.index}';
59
+ const result = await this.client.query(`
60
+ UPDATE "migrations" SET "reverted" = TRUE WHERE "index" = '${this.index}';
61
61
  `);
62
62
  if (result.rowCount === 0) {
63
63
  return { success: false, error: new Error(`Error updating migration record for index ${this.index}: No row returned`) };
@@ -12,8 +12,8 @@ export class CreateMetaOrgMigration {
12
12
  async execute() {
13
13
  const _id = randomUUID().toString();
14
14
  try {
15
- const result = await this.client.query(`
16
- INSERT INTO "organizations" ("_id", "name", "code", "status", "isMetaOrg", "_created", "_createdBy", "_updated", "_updatedBy")
15
+ const result = await this.client.query(`
16
+ INSERT INTO "organizations" ("_id", "name", "code", "status", "isMetaOrg", "_created", "_createdBy", "_updated", "_updatedBy")
17
17
  VALUES ('${_id}', '${this.orgName}', '${this.orgCode}', 1, true, NOW(), 'system', NOW(), 'system');`);
18
18
  if (result.rowCount === 0) {
19
19
  return { success: false, error: new Error(`Error creating meta org: No row returned`) };
@@ -23,9 +23,9 @@ export class CreateMetaOrgMigration {
23
23
  return { success: false, error: new Error(`Error creating meta org: ${error.message}`) };
24
24
  }
25
25
  try {
26
- const result = await this.client.query(`
27
- INSERT INTO "migrations" ("_id", "index", "hasRun", "reverted")
28
- VALUES ('${_id}', ${this.index}, TRUE, FALSE);
26
+ const result = await this.client.query(`
27
+ INSERT INTO "migrations" ("_id", "index", "hasRun", "reverted")
28
+ VALUES ('${_id}', ${this.index}, TRUE, FALSE);
29
29
  `);
30
30
  if (result.rowCount === 0) {
31
31
  return { success: false, error: new Error(`Error inserting migration ${this.index} to migrations table: No row returned`) };
@@ -47,8 +47,8 @@ export class CreateMetaOrgMigration {
47
47
  return { success: false, error: new Error(`Error reverting meta org: ${error.message}`) };
48
48
  }
49
49
  try {
50
- const result = await this.client.query(`
51
- UPDATE "migrations" SET "reverted" = TRUE WHERE "index" = '${this.index}';
50
+ const result = await this.client.query(`
51
+ UPDATE "migrations" SET "reverted" = TRUE WHERE "index" = '${this.index}';
52
52
  `);
53
53
  if (result.rowCount === 0) {
54
54
  return { success: false, error: new Error(`Error updating migration record for index ${this.index}: No row returned`) };
@@ -34,9 +34,9 @@ export class CreateAdminUserMigration {
34
34
  return { success: false, error: new Error(`Error creating admin user: ${error.message}`) };
35
35
  }
36
36
  try {
37
- const result = await this.client.query(`
38
- INSERT INTO "migrations" ("_id", "index", "hasRun", "reverted")
39
- VALUES ('${_id}', ${this.index}, TRUE, FALSE);
37
+ const result = await this.client.query(`
38
+ INSERT INTO "migrations" ("_id", "index", "hasRun", "reverted")
39
+ VALUES ('${_id}', ${this.index}, TRUE, FALSE);
40
40
  `);
41
41
  if (result.rowCount === 0) {
42
42
  return { success: false, error: new Error(`Error inserting migration ${this.index} to migrations table: No row returned`) };
@@ -7,10 +7,10 @@ import { getSystemUserContext } from "@loomcore/common/models";
7
7
  export async function setupDatabaseForAuth(client, adminUsername, adminPassword) {
8
8
  let runMigrations = [];
9
9
  if (await doesTableExist(client, 'migrations')) {
10
- const migrations = await client.query(`
11
- SELECT "_id", "index"
12
- FROM migrations
13
- WHERE "hasRun" = TRUE AND "reverted" = FALSE
10
+ const migrations = await client.query(`
11
+ SELECT "_id", "index"
12
+ FROM migrations
13
+ WHERE "hasRun" = TRUE AND "reverted" = FALSE
14
14
  `);
15
15
  runMigrations = migrations.rows.map((row) => {
16
16
  return row.index;
@@ -10,10 +10,10 @@ export async function setupDatabaseForMultitenant(client, orgName, orgCode) {
10
10
  let runMigrations = [];
11
11
  let metaOrgId = randomUUID().toString();
12
12
  if (await doesTableExist(client, 'migrations')) {
13
- const migrations = await client.query(`
14
- SELECT "_id", "index"
15
- FROM migrations
16
- WHERE "hasRun" = TRUE AND "reverted" = FALSE
13
+ const migrations = await client.query(`
14
+ SELECT "_id", "index"
15
+ FROM migrations
16
+ WHERE "hasRun" = TRUE AND "reverted" = FALSE
17
17
  `);
18
18
  runMigrations = migrations.rows.map((row) => {
19
19
  return row.index;
@@ -1,11 +1,11 @@
1
1
  import { Join } from '../../operations/join.operation.js';
2
2
  async function getTableColumns(client, tableName) {
3
- const result = await client.query(`
4
- SELECT column_name
5
- FROM information_schema.columns
6
- WHERE table_schema = current_schema()
7
- AND table_name = $1
8
- ORDER BY ordinal_position
3
+ const result = await client.query(`
4
+ SELECT column_name
5
+ FROM information_schema.columns
6
+ WHERE table_schema = current_schema()
7
+ AND table_name = $1
8
+ ORDER BY ordinal_position
9
9
  `, [tableName]);
10
10
  return result.rows.map(row => row.column_name);
11
11
  }
@@ -1,8 +1,8 @@
1
1
  export async function doesTableExist(client, tableName) {
2
- const result = await client.query(`
3
- SELECT EXISTS (
4
- SELECT 1 FROM information_schema.tables WHERE table_schema = current_schema() AND table_name = $1
5
- )
2
+ const result = await client.query(`
3
+ SELECT EXISTS (
4
+ SELECT 1 FROM information_schema.tables WHERE table_schema = current_schema() AND table_name = $1
5
+ )
6
6
  `, [tableName]);
7
7
  return result.rows[0].exists;
8
8
  }
package/package.json CHANGED
@@ -1,87 +1,88 @@
1
- {
2
- "name": "@loomcore/api",
3
- "version": "0.1.22",
4
- "private": false,
5
- "description": "Loom Core Api - An opinionated Node.js api using Typescript, Express, and MongoDb or PostgreSQL",
6
- "scripts": {
7
- "clean": "rm -rf dist",
8
- "tsc": "tsc --project tsconfig.prod.json",
9
- "build": "npm-run-all -s clean tsc",
10
- "add": "git add .",
11
- "commit": "git commit -m \"Updates\"",
12
- "patch": "npm version patch",
13
- "push": "git push",
14
- "publishMe": "npm publish --access public",
15
- "pub": "npm-run-all -s add commit patch build push publishMe",
16
- "update-lib-versions": "npx --yes npm-check-updates -u -f @loomcore/models",
17
- "install-updated-libs": "npm i @loomcore/models",
18
- "update-libs": "npm-run-all -s update-lib-versions install-updated-libs",
19
- "typecheck": "tsc",
20
- "test": "npm-run-all -s test:postgres test:mongodb",
21
- "test:postgres": "cross-env NODE_ENV=test TEST_DATABASE=postgres vitest run",
22
- "test:mongodb": "cross-env NODE_ENV=test TEST_DATABASE=mongodb vitest run",
23
- "test:ci": "npm-run-all -s test:ci:postgres test:ci:mongodb",
24
- "test:ci:postgres": "cross-env NODE_ENV=test TEST_DATABASE=postgres vitest run --reporter=json --outputFile=test-results-postgres.json",
25
- "test:ci:mongodb": "cross-env NODE_ENV=test TEST_DATABASE=mongodb vitest run --reporter=json --outputFile=test-results-mongodb.json",
26
- "test:watch": "cross-env NODE_ENV=test vitest",
27
- "coverage": "npm-run-all -s coverage:postgres coverage:mongodb",
28
- "coverage:postgres": "cross-env NODE_ENV=test TEST_DATABASE=postgres vitest run --coverage",
29
- "coverage:mongodb": "cross-env NODE_ENV=test TEST_DATABASE=mongodb vitest run --coverage"
30
- },
31
- "author": "Tim Hardy",
32
- "license": "Apache 2.0",
33
- "main": "dist/index.js",
34
- "type": "module",
35
- "types": "dist/index.d.ts",
36
- "files": [
37
- "dist/**/*"
38
- ],
39
- "exports": {
40
- "./__tests__": "./dist/__tests__/index.js",
41
- "./config": "./dist/config/index.js",
42
- "./controllers": "./dist/controllers/index.js",
43
- "./databases": "./dist/databases/index.js",
44
- "./errors": "./dist/errors/index.js",
45
- "./middleware": "./dist/middleware/index.js",
46
- "./models": "./dist/models/index.js",
47
- "./services": "./dist/services/index.js",
48
- "./utils": "./dist/utils/index.js"
49
- },
50
- "dependencies": {
51
- "jsonwebtoken": "^9.0.2",
52
- "node-mailjet": "^6.0.8",
53
- "qs": "^6.14.0"
54
- },
55
- "peerDependencies": {
56
- "@loomcore/common": "^0.0.19",
57
- "@sinclair/typebox": "0.34.33",
58
- "cookie-parser": "^1.4.6",
59
- "cors": "^2.8.5",
60
- "express": "^5.1.0",
61
- "lodash": "^4.17.21",
62
- "moment": "^2.30.1",
63
- "mongodb": "^6.16.0",
64
- "pg": "^8.15.6",
65
- "rxjs": "^7.8.0"
66
- },
67
- "devDependencies": {
68
- "@types/cookie-parser": "^1.4.7",
69
- "@types/cors": "^2.8.18",
70
- "@types/express": "^5.0.1",
71
- "@types/jsonwebtoken": "^9.0.9",
72
- "@types/lodash": "^4.17.13",
73
- "@types/qs": "^6.14.0",
74
- "@types/supertest": "^6.0.3",
75
- "@types/pg": "^8.15.6",
76
- "@vitest/coverage-v8": "^3.0.9",
77
- "cross-env": "^7.0.3",
78
- "mongodb-memory-server": "^9.3.0",
79
- "npm-run-all": "^4.1.5",
80
- "rxjs": "^7.8.0",
81
- "supertest": "^7.1.0",
82
- "typescript": "^5.8.3",
83
- "pg-mem": "^3.0.5",
84
- "vite": "^6.2.5",
85
- "vitest": "^3.0.9"
86
- }
87
- }
1
+ {
2
+ "name": "@loomcore/api",
3
+ "version": "0.1.23",
4
+ "private": false,
5
+ "description": "Loom Core Api - An opinionated Node.js api using Typescript, Express, and MongoDb or PostgreSQL",
6
+ "scripts": {
7
+ "clean": "rm -rf dist",
8
+ "tsc": "tsc --project tsconfig.prod.json",
9
+ "build": "npm-run-all -s clean tsc",
10
+ "add": "git add .",
11
+ "commit": "git commit -m \"Updates\"",
12
+ "patch": "npm version patch",
13
+ "push": "git push",
14
+ "publishMe": "npm publish --access public",
15
+ "pub": "npm-run-all -s add commit patch build push publishMe",
16
+ "update-lib-versions": "npx --yes npm-check-updates -u -f @loomcore/models",
17
+ "install-updated-libs": "npm i @loomcore/models",
18
+ "update-libs": "npm-run-all -s update-lib-versions install-updated-libs",
19
+ "typecheck": "tsc",
20
+ "test": "npm-run-all -s test:postgres test:mongodb",
21
+ "test:postgres": "cross-env NODE_ENV=test TEST_DATABASE=postgres vitest run",
22
+ "test:mongodb": "cross-env NODE_ENV=test TEST_DATABASE=mongodb vitest run",
23
+ "test:ci": "npm-run-all -s test:ci:postgres test:ci:mongodb",
24
+ "test:ci:postgres": "cross-env NODE_ENV=test TEST_DATABASE=postgres vitest run --reporter=json --outputFile=test-results-postgres.json",
25
+ "test:ci:mongodb": "cross-env NODE_ENV=test TEST_DATABASE=mongodb vitest run --reporter=json --outputFile=test-results-mongodb.json",
26
+ "test:watch": "cross-env NODE_ENV=test vitest",
27
+ "coverage": "npm-run-all -s coverage:postgres coverage:mongodb",
28
+ "coverage:postgres": "cross-env NODE_ENV=test TEST_DATABASE=postgres vitest run --coverage",
29
+ "coverage:mongodb": "cross-env NODE_ENV=test TEST_DATABASE=mongodb vitest run --coverage"
30
+ },
31
+ "author": "Tim Hardy",
32
+ "license": "Apache 2.0",
33
+ "main": "dist/index.js",
34
+ "type": "module",
35
+ "types": "dist/index.d.ts",
36
+ "files": [
37
+ "dist/**/*"
38
+ ],
39
+ "exports": {
40
+ "./__tests__": "./dist/__tests__/index.js",
41
+ "./config": "./dist/config/index.js",
42
+ "./controllers": "./dist/controllers/index.js",
43
+ "./databases": "./dist/databases/index.js",
44
+ "./errors": "./dist/errors/index.js",
45
+ "./middleware": "./dist/middleware/index.js",
46
+ "./models": "./dist/models/index.js",
47
+ "./services": "./dist/services/index.js",
48
+ "./utils": "./dist/utils/index.js"
49
+ },
50
+ "dependencies": {
51
+ "jsonwebtoken": "^9.0.2",
52
+ "node-mailjet": "^6.0.8",
53
+ "qs": "^6.14.0"
54
+ },
55
+ "peerDependencies": {
56
+ "@loomcore/common": "^0.0.19",
57
+ "@sinclair/typebox": "0.34.33",
58
+ "cookie-parser": "^1.4.6",
59
+ "cors": "^2.8.5",
60
+ "express": "^5.1.0",
61
+ "lodash": "^4.17.21",
62
+ "moment": "^2.30.1",
63
+ "mongodb": "^6.16.0",
64
+ "pg": "^8.15.6",
65
+ "rxjs": "^7.8.0",
66
+ "umzug": "^3.8.2"
67
+ },
68
+ "devDependencies": {
69
+ "@types/cookie-parser": "^1.4.7",
70
+ "@types/cors": "^2.8.18",
71
+ "@types/express": "^5.0.1",
72
+ "@types/jsonwebtoken": "^9.0.9",
73
+ "@types/lodash": "^4.17.13",
74
+ "@types/qs": "^6.14.0",
75
+ "@types/supertest": "^6.0.3",
76
+ "@types/pg": "^8.15.6",
77
+ "@vitest/coverage-v8": "^3.0.9",
78
+ "cross-env": "^7.0.3",
79
+ "mongodb-memory-server": "^9.3.0",
80
+ "npm-run-all": "^4.1.5",
81
+ "rxjs": "^7.8.0",
82
+ "supertest": "^7.1.0",
83
+ "typescript": "^5.8.3",
84
+ "pg-mem": "^3.0.5",
85
+ "vite": "^6.2.5",
86
+ "vitest": "^3.0.9"
87
+ }
88
+ }