@loomcore/api 0.1.77 → 0.1.79
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 +1 -1
- package/dist/__tests__/common-test.utils.js +5 -3
- package/dist/__tests__/postgres-test-migrations/postgres-test-schema.js +25 -0
- package/dist/__tests__/postgres.test-database.js +2 -2
- package/dist/__tests__/test-objects.d.ts +6 -1
- package/dist/__tests__/test-objects.js +50 -4
- package/dist/controllers/auth.controller.d.ts +2 -0
- package/dist/controllers/auth.controller.js +9 -4
- package/dist/databases/mongo-db/migrations/mongo-initial-schema.js +23 -5
- package/dist/databases/operations/__tests__/models/{agent.model.d.ts → test-agent.model.d.ts} +7 -7
- package/dist/databases/operations/__tests__/models/test-agent.model.js +8 -0
- package/dist/databases/operations/__tests__/models/{client-report.model.d.ts → test-client-report.model.d.ts} +21 -16
- package/dist/databases/operations/__tests__/models/test-client-report.model.js +11 -0
- package/dist/databases/operations/__tests__/models/test-district.model.d.ts +12 -0
- package/dist/databases/operations/__tests__/models/{district.model.js → test-district.model.js} +2 -2
- package/dist/databases/operations/__tests__/models/{email-address.model.d.ts → test-email-address.model.d.ts} +3 -3
- package/dist/databases/operations/__tests__/models/{email-address.model.js → test-email-address.model.js} +2 -2
- package/dist/databases/operations/__tests__/models/test-person.model.d.ts +28 -0
- package/dist/databases/operations/__tests__/models/test-person.model.js +12 -0
- package/dist/databases/operations/__tests__/models/{phone-number.model.d.ts → test-phone-number.model.d.ts} +3 -3
- package/dist/databases/operations/__tests__/models/{phone-number.model.js → test-phone-number.model.js} +2 -2
- package/dist/databases/operations/__tests__/models/{policy.model.d.ts → test-policy.model.d.ts} +14 -7
- package/dist/databases/operations/__tests__/models/test-policy.model.js +12 -0
- package/dist/databases/operations/__tests__/models/test-premium.model.d.ts +12 -0
- package/dist/databases/operations/__tests__/models/test-premium.model.js +8 -0
- package/dist/databases/operations/__tests__/models/test-school.model.d.ts +12 -0
- package/dist/databases/operations/__tests__/models/{school.model.js → test-school.model.js} +2 -2
- package/dist/databases/operations/__tests__/models/test-state.model.d.ts +8 -0
- package/dist/databases/operations/__tests__/models/test-state.model.js +6 -0
- package/dist/databases/operations/join-many.operation.js +3 -0
- package/dist/databases/operations/join-through-many.operation.js +3 -0
- package/dist/databases/operations/join-through.operation.js +3 -0
- package/dist/databases/operations/join.operation.js +3 -0
- package/dist/databases/postgres/migrations/postgres-initial-schema.js +54 -16
- package/dist/databases/postgres/utils/build-join-clauses.js +282 -272
- package/dist/databases/postgres/utils/build-select-clause.js +19 -34
- package/dist/databases/postgres/utils/transform-join-results.js +198 -194
- package/dist/services/auth.service.d.ts +3 -2
- package/dist/services/auth.service.js +15 -1
- package/dist/services/person.service.d.ts +6 -0
- package/dist/services/person.service.js +7 -0
- package/package.json +3 -3
- package/dist/databases/operations/__tests__/models/agent.model.js +0 -8
- package/dist/databases/operations/__tests__/models/client-report.model.js +0 -11
- package/dist/databases/operations/__tests__/models/district.model.d.ts +0 -12
- package/dist/databases/operations/__tests__/models/person.model.d.ts +0 -28
- package/dist/databases/operations/__tests__/models/person.model.js +0 -12
- package/dist/databases/operations/__tests__/models/policy.model.js +0 -10
- package/dist/databases/operations/__tests__/models/school.model.d.ts +0 -12
- package/dist/databases/operations/__tests__/models/state.model.d.ts +0 -8
- package/dist/databases/operations/__tests__/models/state.model.js +0 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loomcore/api",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.79",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Loom Core Api - An opinionated Node.js api using Typescript, Express, and MongoDb or PostgreSQL",
|
|
6
6
|
"scripts": {
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"qs": "^6.14.1"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@loomcore/common": "^0.0.
|
|
60
|
+
"@loomcore/common": "^0.0.46",
|
|
61
61
|
"@sinclair/typebox": "0.34.33",
|
|
62
62
|
"cookie-parser": "^1.4.6",
|
|
63
63
|
"cors": "^2.8.5",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"cross-env": "^7.0.3",
|
|
83
83
|
"mongodb-memory-server": "^9.3.0",
|
|
84
84
|
"npm-run-all": "^4.1.5",
|
|
85
|
-
"pg-mem": "^3.0.
|
|
85
|
+
"pg-mem": "^3.0.12",
|
|
86
86
|
"rxjs": "^7.8.0",
|
|
87
87
|
"supertest": "^7.1.0",
|
|
88
88
|
"typescript": "^5.8.3",
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { entityUtils } from "@loomcore/common/utils";
|
|
2
|
-
import { Type } from "@sinclair/typebox";
|
|
3
|
-
import { personSchema } from "./person.model.js";
|
|
4
|
-
export const agentSchema = Type.Object({
|
|
5
|
-
person_id: Type.Number(),
|
|
6
|
-
agent_person: Type.Optional(personSchema),
|
|
7
|
-
});
|
|
8
|
-
export const agentModelSpec = entityUtils.getModelSpec(agentSchema, { isAuditable: true });
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { personSchema } from "./person.model.js";
|
|
2
|
-
import { agentSchema } from "./agent.model.js";
|
|
3
|
-
import { policySchema } from "./policy.model.js";
|
|
4
|
-
import { entityUtils } from "@loomcore/common/utils";
|
|
5
|
-
import { Type } from "@sinclair/typebox";
|
|
6
|
-
export const clientReportsSchema = Type.Object({
|
|
7
|
-
client_person: personSchema,
|
|
8
|
-
agent: Type.Optional(agentSchema),
|
|
9
|
-
policies: Type.Optional(Type.Array(policySchema))
|
|
10
|
-
});
|
|
11
|
-
export const clientReportsModelSpec = entityUtils.getModelSpec(clientReportsSchema, { isAuditable: true });
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { IAuditable, IEntity } from "@loomcore/common/models";
|
|
2
|
-
import { IStateModel } from "./state.model.js";
|
|
3
|
-
export interface IDistrictModel extends IEntity, IAuditable {
|
|
4
|
-
name: string;
|
|
5
|
-
state_id: number;
|
|
6
|
-
state?: IStateModel;
|
|
7
|
-
}
|
|
8
|
-
export declare const districtSchema: import("@sinclair/typebox").TObject<{
|
|
9
|
-
name: import("@sinclair/typebox").TString;
|
|
10
|
-
state_id: import("@sinclair/typebox").TNumber;
|
|
11
|
-
}>;
|
|
12
|
-
export declare const districtModelSpec: import("@loomcore/common/models").IModelSpec<import("@sinclair/typebox").TSchema>;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { IAuditable, IEntity } from "@loomcore/common/models";
|
|
2
|
-
import { IEmailAddressModel } from "./email-address.model.js";
|
|
3
|
-
import { IPhoneNumberModel } from "./phone-number.model.js";
|
|
4
|
-
import { ISchoolModel } from "./school.model.js";
|
|
5
|
-
export interface IPersonModel extends IEntity, IAuditable {
|
|
6
|
-
first_name: string;
|
|
7
|
-
middle_name: string | null;
|
|
8
|
-
last_name: string;
|
|
9
|
-
email_addresses: IEmailAddressModel[];
|
|
10
|
-
phone_numbers: IPhoneNumberModel[];
|
|
11
|
-
school?: ISchoolModel;
|
|
12
|
-
}
|
|
13
|
-
export declare const personSchema: import("@sinclair/typebox").TObject<{
|
|
14
|
-
first_name: import("@sinclair/typebox").TString;
|
|
15
|
-
middle_name: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
16
|
-
last_name: import("@sinclair/typebox").TString;
|
|
17
|
-
phone_numbers: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
18
|
-
phone_number: import("@sinclair/typebox").TString;
|
|
19
|
-
phone_number_type: import("@sinclair/typebox").TString;
|
|
20
|
-
is_default: import("@sinclair/typebox").TBoolean;
|
|
21
|
-
}>>;
|
|
22
|
-
email_addresses: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
23
|
-
person_id: import("@sinclair/typebox").TNumber;
|
|
24
|
-
email_address: import("@sinclair/typebox").TString;
|
|
25
|
-
is_default: import("@sinclair/typebox").TBoolean;
|
|
26
|
-
}>>;
|
|
27
|
-
}>;
|
|
28
|
-
export declare const personModelSpec: import("@loomcore/common/models").IModelSpec<import("@sinclair/typebox").TSchema>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { entityUtils } from "@loomcore/common/utils";
|
|
2
|
-
import { Type } from "@sinclair/typebox";
|
|
3
|
-
import { emailAddressSchema } from "./email-address.model.js";
|
|
4
|
-
import { phoneNumberSchema } from "./phone-number.model.js";
|
|
5
|
-
export const personSchema = Type.Object({
|
|
6
|
-
first_name: Type.String(),
|
|
7
|
-
middle_name: Type.Optional(Type.String()),
|
|
8
|
-
last_name: Type.String(),
|
|
9
|
-
phone_numbers: Type.Array(phoneNumberSchema),
|
|
10
|
-
email_addresses: Type.Array(emailAddressSchema),
|
|
11
|
-
});
|
|
12
|
-
export const personModelSpec = entityUtils.getModelSpec(personSchema, { isAuditable: true });
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { entityUtils } from "@loomcore/common/utils";
|
|
2
|
-
import { Type } from "@sinclair/typebox";
|
|
3
|
-
import { agentSchema } from "./agent.model.js";
|
|
4
|
-
export const policySchema = Type.Object({
|
|
5
|
-
client_id: Type.Number(),
|
|
6
|
-
amount: Type.Number(),
|
|
7
|
-
frequency: Type.String(),
|
|
8
|
-
agents: Type.Optional(Type.Array(agentSchema))
|
|
9
|
-
});
|
|
10
|
-
export const policyModelSpec = entityUtils.getModelSpec(policySchema, { isAuditable: true });
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { IAuditable, IEntity } from "@loomcore/common/models";
|
|
2
|
-
import { IDistrictModel } from "./district.model.js";
|
|
3
|
-
export interface ISchoolModel extends IEntity, IAuditable {
|
|
4
|
-
name: string;
|
|
5
|
-
district_id: number;
|
|
6
|
-
district?: IDistrictModel;
|
|
7
|
-
}
|
|
8
|
-
export declare const schoolSchema: import("@sinclair/typebox").TObject<{
|
|
9
|
-
name: import("@sinclair/typebox").TString;
|
|
10
|
-
district_id: import("@sinclair/typebox").TNumber;
|
|
11
|
-
}>;
|
|
12
|
-
export declare const schoolModelSpec: import("@loomcore/common/models").IModelSpec<import("@sinclair/typebox").TSchema>;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { IAuditable, IEntity } from "@loomcore/common/models";
|
|
2
|
-
export interface IStateModel extends IEntity, IAuditable {
|
|
3
|
-
name: string;
|
|
4
|
-
}
|
|
5
|
-
export declare const stateSchema: import("@sinclair/typebox").TObject<{
|
|
6
|
-
name: import("@sinclair/typebox").TString;
|
|
7
|
-
}>;
|
|
8
|
-
export declare const stateModelSpec: import("@loomcore/common/models").IModelSpec<import("@sinclair/typebox").TSchema>;
|