@loomcore/api 0.2.42 → 0.2.45

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 (245) hide show
  1. package/LICENSE +201 -201
  2. package/dist/__tests__/common-test.utils.d.ts +13 -13
  3. package/dist/__tests__/common-test.utils.js +72 -72
  4. package/dist/__tests__/models/category.model.d.ts +1 -1
  5. package/dist/__tests__/models/category.model.js +2 -2
  6. package/dist/__tests__/models/product-with-category.model.d.ts +3 -3
  7. package/dist/__tests__/models/product-with-category.model.js +4 -4
  8. package/dist/__tests__/models/product.model.d.ts +2 -2
  9. package/dist/__tests__/models/product.model.js +2 -2
  10. package/dist/__tests__/models/test-entity.model.d.ts +2 -2
  11. package/dist/__tests__/models/test-entity.model.js +2 -2
  12. package/dist/__tests__/models/test-item.model.d.ts +1 -1
  13. package/dist/__tests__/models/test-item.model.js +3 -3
  14. package/dist/__tests__/mongo-db.test-database.js +1 -1
  15. package/dist/__tests__/postgres-test-migrations/postgres-test-schema.d.ts +2 -2
  16. package/dist/__tests__/postgres-test-migrations/postgres-test-schema.js +38 -38
  17. package/dist/__tests__/postgres.test-database.d.ts +2 -2
  18. package/dist/__tests__/postgres.test-database.js +25 -25
  19. package/dist/__tests__/test-database.interface.d.ts +1 -1
  20. package/dist/__tests__/test-email-client.d.ts +1 -1
  21. package/dist/__tests__/test-express-app.d.ts +3 -3
  22. package/dist/__tests__/test-express-app.js +12 -12
  23. package/dist/__tests__/test-objects.d.ts +1 -1
  24. package/dist/__tests__/test-objects.js +26 -26
  25. package/dist/config/base-api-config.d.ts +2 -2
  26. package/dist/config/base-api-config.js +17 -17
  27. package/dist/controllers/auth.controller.d.ts +4 -4
  28. package/dist/controllers/auth.controller.js +32 -32
  29. package/dist/controllers/authorizations.controller.d.ts +4 -4
  30. package/dist/controllers/authorizations.controller.js +4 -4
  31. package/dist/controllers/features.controller.d.ts +4 -4
  32. package/dist/controllers/features.controller.js +4 -4
  33. package/dist/controllers/index.d.ts +10 -10
  34. package/dist/controllers/index.js +10 -10
  35. package/dist/controllers/organizations.controller.d.ts +5 -5
  36. package/dist/controllers/organizations.controller.js +10 -10
  37. package/dist/controllers/roles.controller.d.ts +4 -4
  38. package/dist/controllers/roles.controller.js +4 -4
  39. package/dist/controllers/types.d.ts +2 -2
  40. package/dist/controllers/user-roles.controller.d.ts +4 -4
  41. package/dist/controllers/user-roles.controller.js +4 -4
  42. package/dist/controllers/users.controller.d.ts +5 -5
  43. package/dist/controllers/users.controller.js +4 -4
  44. package/dist/databases/models/database.interface.d.ts +5 -5
  45. package/dist/databases/mongo-db/commands/mongo-batch-update.command.d.ts +3 -3
  46. package/dist/databases/mongo-db/commands/mongo-batch-update.command.js +5 -5
  47. package/dist/databases/mongo-db/commands/mongo-create-many.command.d.ts +1 -1
  48. package/dist/databases/mongo-db/commands/mongo-create-many.command.js +1 -1
  49. package/dist/databases/mongo-db/commands/mongo-create.command.d.ts +1 -1
  50. package/dist/databases/mongo-db/commands/mongo-create.command.js +1 -1
  51. package/dist/databases/mongo-db/commands/mongo-delete-by-id.command.d.ts +3 -3
  52. package/dist/databases/mongo-db/commands/mongo-delete-by-id.command.js +4 -4
  53. package/dist/databases/mongo-db/commands/mongo-delete-many.command.d.ts +3 -3
  54. package/dist/databases/mongo-db/commands/mongo-delete-many.command.js +2 -2
  55. package/dist/databases/mongo-db/commands/mongo-full-updateby-id.command.d.ts +3 -3
  56. package/dist/databases/mongo-db/commands/mongo-full-updateby-id.command.js +4 -4
  57. package/dist/databases/mongo-db/commands/mongo-partial-update-by-id.command.d.ts +3 -3
  58. package/dist/databases/mongo-db/commands/mongo-partial-update-by-id.command.js +4 -4
  59. package/dist/databases/mongo-db/commands/mongo-update.command.d.ts +3 -3
  60. package/dist/databases/mongo-db/commands/mongo-update.command.js +3 -3
  61. package/dist/databases/mongo-db/migrations/mongo-initial-schema.d.ts +2 -2
  62. package/dist/databases/mongo-db/migrations/mongo-initial-schema.js +108 -108
  63. package/dist/databases/mongo-db/models/no-sql-pipeline.d.ts +4 -4
  64. package/dist/databases/mongo-db/models/no-sql-pipeline.interface.d.ts +3 -3
  65. package/dist/databases/mongo-db/models/no-sql-pipeline.js +1 -1
  66. package/dist/databases/mongo-db/mongo-db.database.d.ts +7 -7
  67. package/dist/databases/mongo-db/mongo-db.database.js +5 -5
  68. package/dist/databases/mongo-db/queries/mongo-find-one.query.d.ts +2 -2
  69. package/dist/databases/mongo-db/queries/mongo-find-one.query.js +1 -1
  70. package/dist/databases/mongo-db/queries/mongo-find.query.d.ts +2 -2
  71. package/dist/databases/mongo-db/queries/mongo-find.query.js +1 -1
  72. package/dist/databases/mongo-db/queries/mongo-get-all.query.d.ts +2 -2
  73. package/dist/databases/mongo-db/queries/mongo-get-all.query.js +1 -1
  74. package/dist/databases/mongo-db/queries/mongo-get-by-id.query.d.ts +4 -4
  75. package/dist/databases/mongo-db/queries/mongo-get-by-id.query.js +3 -3
  76. package/dist/databases/mongo-db/queries/mongo-get-count.query.d.ts +1 -1
  77. package/dist/databases/mongo-db/queries/mongo-get.query.d.ts +3 -3
  78. package/dist/databases/mongo-db/queries/mongo-get.query.js +2 -2
  79. package/dist/databases/mongo-db/utils/build-find-options.util.d.ts +2 -2
  80. package/dist/databases/mongo-db/utils/build-mongo-url.util.d.ts +1 -1
  81. package/dist/databases/mongo-db/utils/build-mongo-url.util.js +4 -4
  82. package/dist/databases/operations/__tests__/models/test-agent.model.d.ts +2 -2
  83. package/dist/databases/operations/__tests__/models/test-agent.model.js +3 -3
  84. package/dist/databases/operations/__tests__/models/test-client-report.model.d.ts +4 -4
  85. package/dist/databases/operations/__tests__/models/test-client-report.model.js +5 -5
  86. package/dist/databases/operations/__tests__/models/test-district.model.d.ts +2 -2
  87. package/dist/databases/operations/__tests__/models/test-district.model.js +2 -2
  88. package/dist/databases/operations/__tests__/models/test-email-address.model.d.ts +1 -1
  89. package/dist/databases/operations/__tests__/models/test-email-address.model.js +2 -2
  90. package/dist/databases/operations/__tests__/models/test-person.model.d.ts +4 -4
  91. package/dist/databases/operations/__tests__/models/test-person.model.js +4 -4
  92. package/dist/databases/operations/__tests__/models/test-phone-number.model.d.ts +1 -1
  93. package/dist/databases/operations/__tests__/models/test-phone-number.model.js +2 -2
  94. package/dist/databases/operations/__tests__/models/test-policy.model.d.ts +3 -3
  95. package/dist/databases/operations/__tests__/models/test-policy.model.js +4 -4
  96. package/dist/databases/operations/__tests__/models/test-premium.model.d.ts +1 -1
  97. package/dist/databases/operations/__tests__/models/test-premium.model.js +2 -2
  98. package/dist/databases/operations/__tests__/models/test-school.model.d.ts +2 -2
  99. package/dist/databases/operations/__tests__/models/test-school.model.js +2 -2
  100. package/dist/databases/operations/__tests__/models/test-state.model.d.ts +1 -1
  101. package/dist/databases/operations/__tests__/models/test-state.model.js +2 -2
  102. package/dist/databases/operations/operation.d.ts +3 -3
  103. package/dist/databases/postgres/commands/postgres-batch-update.command.d.ts +1 -1
  104. package/dist/databases/postgres/commands/postgres-batch-update.command.js +11 -11
  105. package/dist/databases/postgres/commands/postgres-create-many.command.js +5 -5
  106. package/dist/databases/postgres/commands/postgres-create.command.d.ts +3 -3
  107. package/dist/databases/postgres/commands/postgres-create.command.js +5 -5
  108. package/dist/databases/postgres/commands/postgres-delete-by-id.command.d.ts +1 -1
  109. package/dist/databases/postgres/commands/postgres-delete-by-id.command.js +1 -1
  110. package/dist/databases/postgres/commands/postgres-delete-many.command.d.ts +2 -2
  111. package/dist/databases/postgres/commands/postgres-delete-many.command.js +1 -1
  112. package/dist/databases/postgres/commands/postgres-full-update-by-id.command.d.ts +1 -1
  113. package/dist/databases/postgres/commands/postgres-full-update-by-id.command.js +4 -4
  114. package/dist/databases/postgres/commands/postgres-partial-update-by-id.command.d.ts +1 -1
  115. package/dist/databases/postgres/commands/postgres-partial-update-by-id.command.js +11 -11
  116. package/dist/databases/postgres/commands/postgres-update.command.d.ts +2 -2
  117. package/dist/databases/postgres/commands/postgres-update.command.js +11 -11
  118. package/dist/databases/postgres/migrations/postgres-initial-schema.d.ts +2 -2
  119. package/dist/databases/postgres/migrations/postgres-initial-schema.js +69 -69
  120. package/dist/databases/postgres/postgres.database.d.ts +6 -6
  121. package/dist/databases/postgres/postgres.database.js +18 -18
  122. package/dist/databases/postgres/queries/postgres-find-one.query.d.ts +1 -1
  123. package/dist/databases/postgres/queries/postgres-find-one.query.js +2 -2
  124. package/dist/databases/postgres/queries/postgres-find.query.d.ts +1 -1
  125. package/dist/databases/postgres/queries/postgres-find.query.js +2 -2
  126. package/dist/databases/postgres/queries/postgres-get-all.query.d.ts +1 -1
  127. package/dist/databases/postgres/queries/postgres-get-all.query.js +3 -3
  128. package/dist/databases/postgres/queries/postgres-get-by-id.query.d.ts +1 -1
  129. package/dist/databases/postgres/queries/postgres-get-by-id.query.js +5 -5
  130. package/dist/databases/postgres/queries/postgres-get-count.query.js +1 -1
  131. package/dist/databases/postgres/queries/postgres-get.query.d.ts +2 -2
  132. package/dist/databases/postgres/queries/postgres-get.query.js +9 -9
  133. package/dist/databases/postgres/utils/build-count-query.d.ts +1 -1
  134. package/dist/databases/postgres/utils/build-count-query.js +1 -1
  135. package/dist/databases/postgres/utils/build-join-clauses.d.ts +1 -1
  136. package/dist/databases/postgres/utils/build-join-clauses.js +7 -7
  137. package/dist/databases/postgres/utils/build-order-by-clause.d.ts +1 -1
  138. package/dist/databases/postgres/utils/build-pagination-clause.d.ts +1 -1
  139. package/dist/databases/postgres/utils/build-postgres-url.util.d.ts +1 -1
  140. package/dist/databases/postgres/utils/build-postgres-url.util.js +2 -2
  141. package/dist/databases/postgres/utils/build-select-clause.js +9 -9
  142. package/dist/databases/postgres/utils/build-where-clause.d.ts +1 -1
  143. package/dist/databases/postgres/utils/build-where-clause.js +1 -1
  144. package/dist/databases/postgres/utils/columns-and-values-from-entity.d.ts +1 -1
  145. package/dist/databases/postgres/utils/does-table-exist.util.d.ts +1 -1
  146. package/dist/databases/postgres/utils/does-table-exist.util.js +5 -5
  147. package/dist/decorators/index.d.ts +1 -0
  148. package/dist/decorators/index.js +1 -0
  149. package/dist/middleware/authorize/authenticate-request.d.ts +2 -2
  150. package/dist/middleware/authorize/authenticate-request.js +5 -5
  151. package/dist/middleware/index.d.ts +4 -4
  152. package/dist/middleware/index.js +4 -4
  153. package/dist/models/app-config.interface.d.ts +1 -1
  154. package/dist/models/base-api-config.interface.d.ts +6 -6
  155. package/dist/models/initial-database-config.interface.d.ts +3 -3
  156. package/dist/models/log-level.type.d.ts +1 -1
  157. package/dist/services/authorizations.service.d.ts +3 -3
  158. package/dist/services/authorizations.service.js +7 -7
  159. package/dist/services/email.service.js +5 -5
  160. package/dist/services/features.service.d.ts +3 -3
  161. package/dist/services/features.service.js +4 -4
  162. package/dist/services/generic-api-service/generic-api-service.interface.d.ts +6 -6
  163. package/dist/services/generic-api-service/generic-api.service.d.ts +8 -8
  164. package/dist/services/generic-api-service/generic-api.service.js +7 -7
  165. package/dist/services/index.d.ts +16 -16
  166. package/dist/services/index.js +16 -16
  167. package/dist/services/multi-tenant-api.service.d.ts +4 -4
  168. package/dist/services/multi-tenant-api.service.js +9 -9
  169. package/dist/services/organization-domain.service.d.ts +3 -3
  170. package/dist/services/organization-domain.service.js +3 -3
  171. package/dist/services/organization.service.d.ts +4 -4
  172. package/dist/services/organization.service.js +7 -7
  173. package/dist/services/password-reset-token.service.d.ts +3 -3
  174. package/dist/services/password-reset-token.service.js +5 -5
  175. package/dist/services/refresh-token.service.d.ts +3 -3
  176. package/dist/services/refresh-token.service.js +3 -3
  177. package/dist/services/roles.service.d.ts +3 -3
  178. package/dist/services/roles.service.js +4 -4
  179. package/dist/services/tenant-query-decorator.d.ts +1 -1
  180. package/dist/services/tenant-query-decorator.js +8 -8
  181. package/dist/services/user-roles.service.d.ts +3 -3
  182. package/dist/services/user-roles.service.js +4 -4
  183. package/dist/services/user.service.d.ts +4 -4
  184. package/dist/services/user.service.js +11 -11
  185. package/dist/services/utils/audit-for-create.util.d.ts +1 -1
  186. package/dist/services/utils/audit-for-create.util.js +2 -2
  187. package/dist/services/utils/audit-for-update.util.d.ts +1 -1
  188. package/dist/services/utils/audit-for-update.util.js +2 -2
  189. package/dist/services/utils/strip-sender-provided-system-properties.util.d.ts +1 -1
  190. package/dist/services/utils/strip-sender-provided-system-properties.util.js +4 -4
  191. package/dist/utils/auth/assert-admin-or-feature.util.d.ts +1 -1
  192. package/dist/utils/auth/assert-admin-or-feature.util.js +2 -2
  193. package/dist/utils/auth/assert-admin.util.d.ts +1 -1
  194. package/dist/utils/auth/assert-admin.util.js +2 -2
  195. package/dist/utils/auth/assert-owner-or-admin.util.d.ts +1 -1
  196. package/dist/utils/auth/assert-owner-or-admin.util.js +2 -2
  197. package/dist/utils/auth/assert-user-has-feature.util.d.ts +1 -1
  198. package/dist/utils/auth/assert-user-has-feature.util.js +1 -1
  199. package/dist/utils/auth/assert-user-or-admin.util.d.ts +2 -2
  200. package/dist/utils/auth/assert-user-or-admin.util.js +2 -2
  201. package/dist/utils/auth/attempt-login.util.d.ts +4 -4
  202. package/dist/utils/auth/attempt-login.util.js +8 -8
  203. package/dist/utils/auth/auth-user-specs.util.d.ts +1 -1
  204. package/dist/utils/auth/auth-user-specs.util.js +3 -3
  205. package/dist/utils/auth/change-password.util.d.ts +4 -4
  206. package/dist/utils/auth/change-password.util.js +2 -2
  207. package/dist/utils/auth/create-new-refresh-token.util.d.ts +3 -3
  208. package/dist/utils/auth/create-new-refresh-token.util.js +8 -8
  209. package/dist/utils/auth/create-new-tokens.util.d.ts +1 -1
  210. package/dist/utils/auth/create-new-tokens.util.js +3 -3
  211. package/dist/utils/auth/generate-device-id.util.js +2 -2
  212. package/dist/utils/auth/generate-refresh-token.util.js +2 -2
  213. package/dist/utils/auth/get-active-refresh-token.util.d.ts +2 -2
  214. package/dist/utils/auth/get-active-refresh-token.util.js +1 -1
  215. package/dist/utils/auth/get-and-set-device-id-cookie.util.d.ts +1 -1
  216. package/dist/utils/auth/get-and-set-device-id-cookie.util.js +4 -4
  217. package/dist/utils/auth/get-auth-config.util.d.ts +1 -1
  218. package/dist/utils/auth/get-auth-config.util.js +3 -3
  219. package/dist/utils/auth/get-device-id-from-cookie.util.d.ts +1 -1
  220. package/dist/utils/auth/index.d.ts +26 -26
  221. package/dist/utils/auth/index.js +26 -26
  222. package/dist/utils/auth/is-admin.util.d.ts +1 -1
  223. package/dist/utils/auth/is-admin.util.js +1 -1
  224. package/dist/utils/auth/log-user-in.util.d.ts +3 -3
  225. package/dist/utils/auth/log-user-in.util.js +5 -5
  226. package/dist/utils/auth/request-token-using-refresh-token.util.d.ts +4 -4
  227. package/dist/utils/auth/request-token-using-refresh-token.util.js +7 -7
  228. package/dist/utils/auth/reset-password.util.d.ts +4 -4
  229. package/dist/utils/auth/reset-password.util.js +8 -8
  230. package/dist/utils/auth/send-reset-password-email.util.d.ts +2 -2
  231. package/dist/utils/auth/send-reset-password-email.util.js +5 -5
  232. package/dist/utils/auth/update-last-logged-in.util.d.ts +3 -3
  233. package/dist/utils/auth/update-last-logged-in.util.js +3 -3
  234. package/dist/utils/create-public-spec.utils.d.ts +1 -1
  235. package/dist/utils/create-public-spec.utils.js +2 -2
  236. package/dist/utils/express.utils.d.ts +4 -4
  237. package/dist/utils/express.utils.js +5 -5
  238. package/dist/utils/index.d.ts +10 -10
  239. package/dist/utils/index.js +10 -10
  240. package/dist/utils/jwt.utils.d.ts +1 -1
  241. package/dist/utils/jwt.utils.js +3 -3
  242. package/dist/utils/logger.utils.d.ts +1 -1
  243. package/dist/utils/logger.utils.js +10 -10
  244. package/dist/utils/password.utils.js +7 -7
  245. package/package.json +2 -1
@@ -6,12 +6,12 @@ const PK = '_id';
6
6
  export async function getTableColumns(client, tableName) {
7
7
  const storeName = toPostgresStoreName(tableName);
8
8
  const result = await client.query(`
9
- SELECT column_name
10
- FROM information_schema.columns
11
- WHERE table_schema = current_schema()
12
- AND table_name = $1
13
- ORDER BY ordinal_position
14
- `, [storeName]);
9
+ SELECT column_name
10
+ FROM information_schema.columns
11
+ WHERE table_schema = current_schema()
12
+ AND table_name = $1
13
+ ORDER BY ordinal_position
14
+ `, [storeName]);
15
15
  return result.rows.map(row => row.column_name);
16
16
  }
17
17
  function getParentAlias(localField) {
@@ -32,11 +32,11 @@ function getTopLevelOperations(operations, mainTableName) {
32
32
  });
33
33
  }
34
34
  function sqlQuote(s) {
35
- return "'" + s.replace(/'/g, "''") + "'";
35
+ return '\'' + s.replace(/'/g, '\'\'') + '\'';
36
36
  }
37
37
  function jsonbBuildObject(entries) {
38
38
  if (entries.length === 0)
39
- return "''{}''::jsonb";
39
+ return '\'\'{}\'\'::jsonb';
40
40
  const parts = entries.flatMap(({ key, expr }) => [sqlQuote(key), expr]);
41
41
  return `jsonb_build_object(${parts.join(', ')})`;
42
42
  }
@@ -168,7 +168,7 @@ async function buildJoinDataObject(client, operations, mainTableName) {
168
168
  }
169
169
  }
170
170
  if (entries.length === 0)
171
- return "''{}''::jsonb";
171
+ return '\'\'{}\'\'::jsonb';
172
172
  return jsonbBuildObject(entries);
173
173
  }
174
174
  export async function buildSelectClause(client, mainTableName, operations) {
@@ -1,4 +1,4 @@
1
- import { IQueryOptions } from "@loomcore/common/models";
1
+ import { IQueryOptions } from '@loomcore/common/models';
2
2
  export declare function buildWhereClause(queryObject: IQueryOptions, values?: any[], tablePrefix?: string): {
3
3
  whereClause: string;
4
4
  values: any[];
@@ -1,4 +1,4 @@
1
- import { toSnakeCase } from "./convert-keys.util.js";
1
+ import { toSnakeCase } from './convert-keys.util.js';
2
2
  export function buildWhereClause(queryObject, values = [], tablePrefix) {
3
3
  const filters = queryObject.filters || {};
4
4
  const conditions = [];
@@ -1,4 +1,4 @@
1
- import { IEntity } from "@loomcore/common/models";
1
+ import { IEntity } from '@loomcore/common/models';
2
2
  export declare function columnsAndValuesFromEntity<T extends IEntity>(entity: Partial<T>): {
3
3
  columns: string[];
4
4
  values: any[];
@@ -1,2 +1,2 @@
1
- import type { PostgresConnection } from "../postgres-connection.js";
1
+ import type { PostgresConnection } from '../postgres-connection.js';
2
2
  export declare function doesTableExist(client: PostgresConnection, tableName: string): Promise<boolean>;
@@ -1,10 +1,10 @@
1
- import { toPostgresStoreName } from "./convert-keys.util.js";
1
+ import { toPostgresStoreName } from './convert-keys.util.js';
2
2
  export async function doesTableExist(client, tableName) {
3
3
  const storeName = toPostgresStoreName(tableName);
4
4
  const result = await client.query(`
5
- SELECT EXISTS (
6
- SELECT 1 FROM information_schema.tables WHERE table_schema = current_schema() AND table_name = $1
7
- )
8
- `, [storeName]);
5
+ SELECT EXISTS (
6
+ SELECT 1 FROM information_schema.tables WHERE table_schema = current_schema() AND table_name = $1
7
+ )
8
+ `, [storeName]);
9
9
  return result.rows[0].exists;
10
10
  }
@@ -0,0 +1 @@
1
+ export { Authorize, AllowAnonymous } from './authorize.decorator.js';
@@ -0,0 +1 @@
1
+ export { Authorize, AllowAnonymous } from './authorize.decorator.js';
@@ -1,3 +1,3 @@
1
- import type { IUserContext } from "@loomcore/common/models";
2
- import type { Request } from "express";
1
+ import type { IUserContext } from '@loomcore/common/models';
2
+ import type { Request } from 'express';
3
3
  export declare function authenticateRequest(req: Request): IUserContext;
@@ -1,13 +1,13 @@
1
- import jwt from "jsonwebtoken";
2
- import { UnauthenticatedError } from "../../errors/unauthenticated.error.js";
3
- import { getAuthConfig } from "../../utils/auth/get-auth-config.util.js";
4
- import { getAuthUserContextSpec } from "../../utils/index.js";
1
+ import jwt from 'jsonwebtoken';
2
+ import { UnauthenticatedError } from '../../errors/unauthenticated.error.js';
3
+ import { getAuthConfig } from '../../utils/auth/get-auth-config.util.js';
4
+ import { getAuthUserContextSpec } from '../../utils/index.js';
5
5
  function extractBearerToken(req) {
6
6
  const authHeader = req.headers?.authorization;
7
7
  if (!authHeader) {
8
8
  return null;
9
9
  }
10
- const parts = authHeader.split("Bearer ");
10
+ const parts = authHeader.split('Bearer ');
11
11
  return parts.length > 1 ? parts[1] : null;
12
12
  }
13
13
  export function authenticateRequest(req) {
@@ -1,4 +1,4 @@
1
- export * from "./ensure-user-context.js";
2
- export * from "./error-handler.js";
3
- export * from "./request-lifecycle.js";
4
- export * from "./authorize/authorize.middleware.js";
1
+ export * from './ensure-user-context.js';
2
+ export * from './error-handler.js';
3
+ export * from './request-lifecycle.js';
4
+ export * from './authorize/authorize.middleware.js';
@@ -1,4 +1,4 @@
1
- export * from "./ensure-user-context.js";
2
- export * from "./error-handler.js";
3
- export * from "./request-lifecycle.js";
4
- export * from "./authorize/authorize.middleware.js";
1
+ export * from './ensure-user-context.js';
2
+ export * from './error-handler.js';
3
+ export * from './request-lifecycle.js';
4
+ export * from './authorize/authorize.middleware.js';
@@ -1,4 +1,4 @@
1
- import type { DbType } from "../databases/db-type.type.js";
1
+ import type { DbType } from '../databases/db-type.type.js';
2
2
  export interface IAppConfig {
3
3
  dbType: DbType;
4
4
  isMultiTenant: boolean;
@@ -1,9 +1,9 @@
1
- import type { IAppConfig } from "./app-config.interface.js";
2
- import type { IAuthConfig } from "./auth-config.interface.js";
3
- import type { IDatabaseConfig } from "./database-config.interface.js";
4
- import type { IEmailClient } from "./email-client.interface.js";
5
- import type { IEmailConfig } from "./email-config.interface.js";
6
- import { LogLevel } from "./index.js";
1
+ import type { IAppConfig } from './app-config.interface.js';
2
+ import type { IAuthConfig } from './auth-config.interface.js';
3
+ import type { IDatabaseConfig } from './database-config.interface.js';
4
+ import type { IEmailClient } from './email-client.interface.js';
5
+ import type { IEmailConfig } from './email-config.interface.js';
6
+ import { LogLevel } from './index.js';
7
7
  export interface IBaseApiConfig {
8
8
  app: IAppConfig;
9
9
  auth?: IAuthConfig;
@@ -1,6 +1,6 @@
1
- import type { IAppConfig } from "./app-config.interface.js";
2
- import type { IDatabaseConfig } from "./database-config.interface.js";
3
- import type { IEmailConfig } from "./email-config.interface.js";
1
+ import type { IAppConfig } from './app-config.interface.js';
2
+ import type { IDatabaseConfig } from './database-config.interface.js';
3
+ import type { IEmailConfig } from './email-config.interface.js';
4
4
  export interface IInitialDbMigrationConfig {
5
5
  env: string;
6
6
  app: IAppConfig;
@@ -1 +1 @@
1
- export type LogLevel = "debug" | "info" | "warn" | "error";
1
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
@@ -1,6 +1,6 @@
1
- import { type IAuthorization, type IUser, type IUserContext } from "@loomcore/common/models";
2
- import type { IDatabase } from "../databases/index.js";
3
- import { MultiTenantApiService } from "./multi-tenant-api.service.js";
1
+ import { type IAuthorization, type IUser, type IUserContext } from '@loomcore/common/models';
2
+ import type { IDatabase } from '../databases/index.js';
3
+ import { MultiTenantApiService } from './multi-tenant-api.service.js';
4
4
  export declare class AuthorizationsService extends MultiTenantApiService<IAuthorization> {
5
5
  private userRolesService;
6
6
  private featuresService;
@@ -1,18 +1,18 @@
1
- import { AuthorizationModelSpec, getSystemUserContext, } from "@loomcore/common/models";
2
- import { assertUserHasFeature } from "../utils/index.js";
3
- import { FeaturesService } from "./features.service.js";
4
- import { MultiTenantApiService } from "./multi-tenant-api.service.js";
5
- import { UserRolesService } from "./user-roles.service.js";
1
+ import { AuthorizationModelSpec, getSystemUserContext, } from '@loomcore/common/models';
2
+ import { assertUserHasFeature } from '../utils/index.js';
3
+ import { FeaturesService } from './features.service.js';
4
+ import { MultiTenantApiService } from './multi-tenant-api.service.js';
5
+ import { UserRolesService } from './user-roles.service.js';
6
6
  export class AuthorizationsService extends MultiTenantApiService {
7
7
  userRolesService;
8
8
  featuresService;
9
9
  constructor(database) {
10
- super(database, "authorizations", "authorization", AuthorizationModelSpec);
10
+ super(database, 'authorizations', 'authorization', AuthorizationModelSpec);
11
11
  this.userRolesService = new UserRolesService(database);
12
12
  this.featuresService = new FeaturesService(database);
13
13
  }
14
14
  async preProcessEntity(userContext, entity, isCreate, allowId = true) {
15
- assertUserHasFeature(userContext, ["admin", "system", "authorizations"]);
15
+ assertUserHasFeature(userContext, ['admin', 'system', 'authorizations']);
16
16
  return super.preProcessEntity(userContext, entity, isCreate, allowId);
17
17
  }
18
18
  async getUserContextFeatures(user) {
@@ -1,5 +1,5 @@
1
- import { config } from "../config/index.js";
2
- import { ServerError } from "../errors/index.js";
1
+ import { config } from '../config/index.js';
2
+ import { ServerError } from '../errors/index.js';
3
3
  export class EmailService {
4
4
  emailClient;
5
5
  constructor() {
@@ -7,7 +7,7 @@ export class EmailService {
7
7
  this.emailClient = config.thirdPartyClients.emailClient;
8
8
  }
9
9
  else {
10
- throw new ServerError("Email client is not available. Email client is not set in the config.");
10
+ throw new ServerError('Email client is not available. Email client is not set in the config.');
11
11
  }
12
12
  }
13
13
  async sendResetPasswordEmail(emailAddress, resetPasswordLink) {
@@ -16,8 +16,8 @@ export class EmailService {
16
16
  console.log(`Reset password email sent to ${emailAddress} with reset password link ${resetPasswordLink}`);
17
17
  }
18
18
  catch (error) {
19
- console.error("Error sending reset password email:", error);
20
- throw new ServerError("Error sending reset password email");
19
+ console.error('Error sending reset password email:', error);
20
+ throw new ServerError('Error sending reset password email');
21
21
  }
22
22
  }
23
23
  }
@@ -1,6 +1,6 @@
1
- import { IFeature, IUserContext } from "@loomcore/common/models";
2
- import { IDatabase } from "../databases/index.js";
3
- import { MultiTenantApiService } from "./multi-tenant-api.service.js";
1
+ import { IFeature, IUserContext } from '@loomcore/common/models';
2
+ import { IDatabase } from '../databases/index.js';
3
+ import { MultiTenantApiService } from './multi-tenant-api.service.js';
4
4
  export declare class FeaturesService extends MultiTenantApiService<IFeature> {
5
5
  constructor(database: IDatabase);
6
6
  preProcessEntity(userContext: IUserContext, entity: Partial<IFeature>, isCreate: boolean, allowId?: boolean): Promise<Partial<IFeature>>;
@@ -1,9 +1,9 @@
1
- import { FeatureModelSpec } from "@loomcore/common/models";
2
- import { MultiTenantApiService } from "./multi-tenant-api.service.js";
3
- import { assertUserHasFeature } from "../utils/index.js";
1
+ import { FeatureModelSpec } from '@loomcore/common/models';
2
+ import { MultiTenantApiService } from './multi-tenant-api.service.js';
3
+ import { assertUserHasFeature } from '../utils/index.js';
4
4
  export class FeaturesService extends MultiTenantApiService {
5
5
  constructor(database) {
6
- super(database, "features", "feature", FeatureModelSpec);
6
+ super(database, 'features', 'feature', FeatureModelSpec);
7
7
  }
8
8
  async preProcessEntity(userContext, entity, isCreate, allowId = true) {
9
9
  assertUserHasFeature(userContext, ['admin', 'system', 'features']);
@@ -1,9 +1,9 @@
1
- import type { IEntity, IModelSpec, IPagedResult, IQueryOptions, IUserContext } from "@loomcore/common/models";
2
- import type { AppIdType } from "@loomcore/common/types";
3
- import type { ValueError } from "@sinclair/typebox/errors";
4
- import type { PostProcessEntityCustomFunction, PrepareQueryCustomFunction } from "../../controllers/types.js";
5
- import type { DeleteResult } from "../../databases/models/delete-result.js";
6
- import type { Operation } from "../../databases/operations/operation.js";
1
+ import type { IEntity, IModelSpec, IPagedResult, IQueryOptions, IUserContext } from '@loomcore/common/models';
2
+ import type { AppIdType } from '@loomcore/common/types';
3
+ import type { ValueError } from '@sinclair/typebox/errors';
4
+ import type { PostProcessEntityCustomFunction, PrepareQueryCustomFunction } from '../../controllers/types.js';
5
+ import type { DeleteResult } from '../../databases/models/delete-result.js';
6
+ import type { Operation } from '../../databases/operations/operation.js';
7
7
  export interface IGenericApiService<T extends IEntity> {
8
8
  getModelSpec(): IModelSpec;
9
9
  validate(doc: any, isPartial?: boolean): ValueError[] | null;
@@ -1,11 +1,11 @@
1
- import { type IEntity, type IModelSpec, type IPagedResult, type IQueryOptions, type IUserContext } from "@loomcore/common/models";
2
- import type { AppIdType } from "@loomcore/common/types";
3
- import type { ValueError } from "@sinclair/typebox/errors";
4
- import type { PostProcessEntityCustomFunction, PrepareQueryCustomFunction } from "../../controllers/types.js";
5
- import type { DeleteResult } from "../../databases/models/delete-result.js";
6
- import type { IDatabase } from "../../databases/models/index.js";
7
- import type { Operation } from "../../databases/operations/operation.js";
8
- import type { IGenericApiService } from "./generic-api-service.interface.js";
1
+ import { type IEntity, type IModelSpec, type IPagedResult, type IQueryOptions, type IUserContext } from '@loomcore/common/models';
2
+ import type { AppIdType } from '@loomcore/common/types';
3
+ import type { ValueError } from '@sinclair/typebox/errors';
4
+ import type { PostProcessEntityCustomFunction, PrepareQueryCustomFunction } from '../../controllers/types.js';
5
+ import type { DeleteResult } from '../../databases/models/delete-result.js';
6
+ import type { IDatabase } from '../../databases/models/index.js';
7
+ import type { Operation } from '../../databases/operations/operation.js';
8
+ import type { IGenericApiService } from './generic-api-service.interface.js';
9
9
  export declare class GenericApiService<T extends IEntity> implements IGenericApiService<T> {
10
10
  protected database: IDatabase;
11
11
  protected pluralResourceName: string;
@@ -1,10 +1,10 @@
1
- import { DefaultQueryOptions, } from "@loomcore/common/models";
2
- import { entityUtils } from "@loomcore/common/utils";
3
- import _ from "lodash";
4
- import { IdNotFoundError, ServerError } from "../../errors/index.js";
5
- import { auditForCreate } from "../utils/audit-for-create.util.js";
6
- import { auditForUpdate } from "../utils/audit-for-update.util.js";
7
- import { stripSenderProvidedSystemProperties } from "../utils/strip-sender-provided-system-properties.util.js";
1
+ import { DefaultQueryOptions, } from '@loomcore/common/models';
2
+ import { entityUtils } from '@loomcore/common/utils';
3
+ import _ from 'lodash';
4
+ import { IdNotFoundError, ServerError } from '../../errors/index.js';
5
+ import { auditForCreate } from '../utils/audit-for-create.util.js';
6
+ import { auditForUpdate } from '../utils/audit-for-update.util.js';
7
+ import { stripSenderProvidedSystemProperties } from '../utils/strip-sender-provided-system-properties.util.js';
8
8
  export class GenericApiService {
9
9
  database;
10
10
  pluralResourceName;
@@ -1,16 +1,16 @@
1
- export * from "./email.service.js";
2
- export * from "./generic-api-service/generic-api.service.js";
3
- export * from "./generic-api-service/generic-api-service.interface.js";
4
- export * from "./generic-query-service/generic-query.service.js";
5
- export * from "./generic-query-service/generic-query-service.interface.js";
6
- export * from "./multi-tenant-api.service.js";
7
- export * from "./organization.service.js";
8
- export * from "./organization-domain.service.js";
9
- export * from "./password-reset-token.service.js";
10
- export * from "./refresh-token.service.js";
11
- export * from "./authorizations.service.js";
12
- export * from "./features.service.js";
13
- export * from "./roles.service.js";
14
- export * from "./user-roles.service.js";
15
- export * from "./tenant-query-decorator.js";
16
- export * from "./user.service.js";
1
+ export * from './email.service.js';
2
+ export * from './generic-api-service/generic-api.service.js';
3
+ export * from './generic-api-service/generic-api-service.interface.js';
4
+ export * from './generic-query-service/generic-query.service.js';
5
+ export * from './generic-query-service/generic-query-service.interface.js';
6
+ export * from './multi-tenant-api.service.js';
7
+ export * from './organization.service.js';
8
+ export * from './organization-domain.service.js';
9
+ export * from './password-reset-token.service.js';
10
+ export * from './refresh-token.service.js';
11
+ export * from './authorizations.service.js';
12
+ export * from './features.service.js';
13
+ export * from './roles.service.js';
14
+ export * from './user-roles.service.js';
15
+ export * from './tenant-query-decorator.js';
16
+ export * from './user.service.js';
@@ -1,16 +1,16 @@
1
- export * from "./email.service.js";
2
- export * from "./generic-api-service/generic-api.service.js";
3
- export * from "./generic-api-service/generic-api-service.interface.js";
4
- export * from "./generic-query-service/generic-query.service.js";
5
- export * from "./generic-query-service/generic-query-service.interface.js";
6
- export * from "./multi-tenant-api.service.js";
7
- export * from "./organization.service.js";
8
- export * from "./organization-domain.service.js";
9
- export * from "./password-reset-token.service.js";
10
- export * from "./refresh-token.service.js";
11
- export * from "./authorizations.service.js";
12
- export * from "./features.service.js";
13
- export * from "./roles.service.js";
14
- export * from "./user-roles.service.js";
15
- export * from "./tenant-query-decorator.js";
16
- export * from "./user.service.js";
1
+ export * from './email.service.js';
2
+ export * from './generic-api-service/generic-api.service.js';
3
+ export * from './generic-api-service/generic-api-service.interface.js';
4
+ export * from './generic-query-service/generic-query.service.js';
5
+ export * from './generic-query-service/generic-query-service.interface.js';
6
+ export * from './multi-tenant-api.service.js';
7
+ export * from './organization.service.js';
8
+ export * from './organization-domain.service.js';
9
+ export * from './password-reset-token.service.js';
10
+ export * from './refresh-token.service.js';
11
+ export * from './authorizations.service.js';
12
+ export * from './features.service.js';
13
+ export * from './roles.service.js';
14
+ export * from './user-roles.service.js';
15
+ export * from './tenant-query-decorator.js';
16
+ export * from './user.service.js';
@@ -1,7 +1,7 @@
1
- import type { IEntity, IModelSpec, IQueryOptions, IUserContext } from "@loomcore/common/models";
2
- import type { IDatabase } from "../databases/models/index.js";
3
- import type { Operation } from "../databases/operations/operation.js";
4
- import { GenericApiService } from "./generic-api-service/generic-api.service.js";
1
+ import type { IEntity, IModelSpec, IQueryOptions, IUserContext } from '@loomcore/common/models';
2
+ import type { IDatabase } from '../databases/models/index.js';
3
+ import type { Operation } from '../databases/operations/operation.js';
4
+ import { GenericApiService } from './generic-api-service/generic-api.service.js';
5
5
  export declare class MultiTenantApiService<T extends IEntity> extends GenericApiService<T> {
6
6
  private tenantDecorator?;
7
7
  constructor(database: IDatabase, pluralResourceName: string, singularResourceName: string, modelSpec: IModelSpec);
@@ -1,9 +1,9 @@
1
- import { getSystemUserId } from "@loomcore/common/validation";
2
- import { config } from "../config/base-api-config.js";
3
- import { BadRequestError } from "../errors/bad-request.error.js";
4
- import { ServerError } from "../errors/index.js";
5
- import { GenericApiService } from "./generic-api-service/generic-api.service.js";
6
- import { TenantQueryDecorator } from "./tenant-query-decorator.js";
1
+ import { getSystemUserId } from '@loomcore/common/validation';
2
+ import { config } from '../config/base-api-config.js';
3
+ import { BadRequestError } from '../errors/bad-request.error.js';
4
+ import { ServerError } from '../errors/index.js';
5
+ import { GenericApiService } from './generic-api-service/generic-api.service.js';
6
+ import { TenantQueryDecorator } from './tenant-query-decorator.js';
7
7
  export class MultiTenantApiService extends GenericApiService {
8
8
  tenantDecorator;
9
9
  constructor(database, pluralResourceName, singularResourceName, modelSpec) {
@@ -18,10 +18,10 @@ export class MultiTenantApiService extends GenericApiService {
18
18
  return super.prepareQuery(userContext, queryOptions, operations);
19
19
  }
20
20
  if (!userContext?.user?._orgId) {
21
- throw new BadRequestError("A valid userContext was not provided to MultiTenantApiService.prepareQuery");
21
+ throw new BadRequestError('A valid userContext was not provided to MultiTenantApiService.prepareQuery');
22
22
  }
23
23
  if (!this.tenantDecorator) {
24
- throw new ServerError("A valid tenantDecorator was not provided to MultiTenantApiService.prepareQuery");
24
+ throw new ServerError('A valid tenantDecorator was not provided to MultiTenantApiService.prepareQuery');
25
25
  }
26
26
  const queryObject = this.tenantDecorator.applyTenantToQuery(userContext, queryOptions, this.pluralResourceName);
27
27
  return { queryObject, operations };
@@ -31,7 +31,7 @@ export class MultiTenantApiService extends GenericApiService {
31
31
  return super.preProcessEntity(userContext, entity, isCreate, allowId);
32
32
  }
33
33
  if (!userContext?.user?._orgId) {
34
- throw new BadRequestError("A valid userContext was not provided to MultiTenantApiService.prepareEntity");
34
+ throw new BadRequestError('A valid userContext was not provided to MultiTenantApiService.prepareEntity');
35
35
  }
36
36
  const preparedEntity = await super.preProcessEntity(userContext, entity, isCreate, allowId);
37
37
  if (isCreate && userContext.user._id !== getSystemUserId()) {
@@ -1,6 +1,6 @@
1
- import { type IOrganizationDomain } from "@loomcore/common/models";
2
- import type { IDatabase } from "../databases/models/index.js";
3
- import { GenericApiService } from "./generic-api-service/generic-api.service.js";
1
+ import { type IOrganizationDomain } from '@loomcore/common/models';
2
+ import type { IDatabase } from '../databases/models/index.js';
3
+ import { GenericApiService } from './generic-api-service/generic-api.service.js';
4
4
  export declare class OrganizationDomainService extends GenericApiService<IOrganizationDomain> {
5
5
  constructor(database: IDatabase);
6
6
  }
@@ -1,7 +1,7 @@
1
- import { OrganizationDomainSpec, } from "@loomcore/common/models";
2
- import { GenericApiService } from "./generic-api-service/generic-api.service.js";
1
+ import { OrganizationDomainSpec, } from '@loomcore/common/models';
2
+ import { GenericApiService } from './generic-api-service/generic-api.service.js';
3
3
  export class OrganizationDomainService extends GenericApiService {
4
4
  constructor(database) {
5
- super(database, "organizationDomains", "organizationDomain", OrganizationDomainSpec);
5
+ super(database, 'organizationDomains', 'organizationDomain', OrganizationDomainSpec);
6
6
  }
7
7
  }
@@ -1,7 +1,7 @@
1
- import { type IOrganization, type IUserContext } from "@loomcore/common/models";
2
- import type { AppIdType } from "@loomcore/common/types";
3
- import type { IDatabase } from "../databases/models/index.js";
4
- import { GenericApiService } from "./generic-api-service/generic-api.service.js";
1
+ import { type IOrganization, type IUserContext } from '@loomcore/common/models';
2
+ import type { AppIdType } from '@loomcore/common/types';
3
+ import type { IDatabase } from '../databases/models/index.js';
4
+ import { GenericApiService } from './generic-api-service/generic-api.service.js';
5
5
  export declare class OrganizationService extends GenericApiService<IOrganization> {
6
6
  private organizationDomainService;
7
7
  constructor(database: IDatabase);
@@ -1,21 +1,21 @@
1
- import { OrganizationSpec, } from "@loomcore/common/models";
2
- import { BadRequestError } from "../errors/index.js";
3
- import { GenericApiService } from "./generic-api-service/generic-api.service.js";
4
- import { OrganizationDomainService } from "./organization-domain.service.js";
1
+ import { OrganizationSpec, } from '@loomcore/common/models';
2
+ import { BadRequestError } from '../errors/index.js';
3
+ import { GenericApiService } from './generic-api-service/generic-api.service.js';
4
+ import { OrganizationDomainService } from './organization-domain.service.js';
5
5
  export class OrganizationService extends GenericApiService {
6
6
  organizationDomainService;
7
7
  constructor(database) {
8
- super(database, "organizations", "organization", OrganizationSpec);
8
+ super(database, 'organizations', 'organization', OrganizationSpec);
9
9
  this.organizationDomainService = new OrganizationDomainService(database);
10
10
  }
11
11
  async preProcessEntity(userContext, entity, isCreate, allowId = true) {
12
12
  if (isCreate) {
13
13
  const metaOrg = await this.getMetaOrg(userContext);
14
14
  if (metaOrg && entity.isMetaOrg) {
15
- throw new BadRequestError("Meta organization already exists");
15
+ throw new BadRequestError('Meta organization already exists');
16
16
  }
17
17
  if (metaOrg && userContext.user._orgId !== metaOrg._id) {
18
- throw new BadRequestError("User is not authorized to create an organization");
18
+ throw new BadRequestError('User is not authorized to create an organization');
19
19
  }
20
20
  }
21
21
  const result = await super.preProcessEntity(userContext, entity, isCreate, allowId);
@@ -1,6 +1,6 @@
1
- import { type IPasswordResetToken, type IUserContext } from "@loomcore/common/models";
2
- import type { IDatabase } from "../databases/models/index.js";
3
- import { MultiTenantApiService } from "./multi-tenant-api.service.js";
1
+ import { type IPasswordResetToken, type IUserContext } from '@loomcore/common/models';
2
+ import type { IDatabase } from '../databases/models/index.js';
3
+ import { MultiTenantApiService } from './multi-tenant-api.service.js';
4
4
  export declare class PasswordResetTokenService extends MultiTenantApiService<IPasswordResetToken> {
5
5
  constructor(database: IDatabase);
6
6
  createPasswordResetToken(userContext: IUserContext, email: string, expiresOn: number): Promise<IPasswordResetToken | null>;
@@ -1,9 +1,9 @@
1
- import crypto from "node:crypto";
2
- import { PasswordResetTokenSpec, } from "@loomcore/common/models";
3
- import { MultiTenantApiService } from "./multi-tenant-api.service.js";
1
+ import crypto from 'node:crypto';
2
+ import { PasswordResetTokenSpec, } from '@loomcore/common/models';
3
+ import { MultiTenantApiService } from './multi-tenant-api.service.js';
4
4
  export class PasswordResetTokenService extends MultiTenantApiService {
5
5
  constructor(database) {
6
- super(database, "passwordResetTokens", "passwordResetToken", PasswordResetTokenSpec);
6
+ super(database, 'passwordResetTokens', 'passwordResetToken', PasswordResetTokenSpec);
7
7
  }
8
8
  async createPasswordResetToken(userContext, email, expiresOn) {
9
9
  const lowerCaseEmail = email.toLowerCase();
@@ -12,7 +12,7 @@ export class PasswordResetTokenService extends MultiTenantApiService {
12
12
  });
13
13
  const passwordResetToken = {
14
14
  email: lowerCaseEmail,
15
- token: crypto.randomBytes(40).toString("hex"),
15
+ token: crypto.randomBytes(40).toString('hex'),
16
16
  expiresOn: expiresOn,
17
17
  };
18
18
  return super.create(userContext, passwordResetToken);
@@ -1,6 +1,6 @@
1
- import { IRefreshToken } from "@loomcore/common/models";
2
- import type { IDatabase } from "../databases/models/index.js";
3
- import { MultiTenantApiService } from "./multi-tenant-api.service.js";
1
+ import { IRefreshToken } from '@loomcore/common/models';
2
+ import type { IDatabase } from '../databases/models/index.js';
3
+ import { MultiTenantApiService } from './multi-tenant-api.service.js';
4
4
  export declare class RefreshTokenService extends MultiTenantApiService<IRefreshToken> {
5
5
  constructor(database: IDatabase);
6
6
  }
@@ -1,7 +1,7 @@
1
- import { refreshTokenModelSpec } from "@loomcore/common/models";
2
- import { MultiTenantApiService } from "./multi-tenant-api.service.js";
1
+ import { refreshTokenModelSpec } from '@loomcore/common/models';
2
+ import { MultiTenantApiService } from './multi-tenant-api.service.js';
3
3
  export class RefreshTokenService extends MultiTenantApiService {
4
4
  constructor(database) {
5
- super(database, "refreshTokens", "refreshToken", refreshTokenModelSpec);
5
+ super(database, 'refreshTokens', 'refreshToken', refreshTokenModelSpec);
6
6
  }
7
7
  }
@@ -1,6 +1,6 @@
1
- import { IRole, IUserContext } from "@loomcore/common/models";
2
- import { IDatabase } from "../databases/index.js";
3
- import { MultiTenantApiService } from "./multi-tenant-api.service.js";
1
+ import { IRole, IUserContext } from '@loomcore/common/models';
2
+ import { IDatabase } from '../databases/index.js';
3
+ import { MultiTenantApiService } from './multi-tenant-api.service.js';
4
4
  export declare class RolesService extends MultiTenantApiService<IRole> {
5
5
  constructor(database: IDatabase);
6
6
  preProcessEntity(userContext: IUserContext, entity: Partial<IRole>, isCreate: boolean, allowId?: boolean): Promise<Partial<IRole>>;