@memberjunction/server 0.9.228 → 0.9.230

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/build.log.json CHANGED
@@ -349,5 +349,11 @@
349
349
  },
350
350
  {
351
351
  "buildTime": "2024-03-09T19:41:32.5298106-06:00"
352
+ },
353
+ {
354
+ "buildTime": "2024-03-10T09:44:12.9361078-05:00"
355
+ },
356
+ {
357
+ "buildTime": "2024-03-13T08:27:51.1359769-05:00"
352
358
  }
353
359
  ]
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.DuplicateRecordResolver = exports.PotentialDuplicateResponseType = exports.PotentialDuplicateType = exports.PotentialDuplicateRequestType = void 0;
16
+ const type_graphql_1 = require("type-graphql");
17
+ const core_1 = require("@memberjunction/core");
18
+ const MergeRecordsResolver_1 = require("./MergeRecordsResolver");
19
+ const sqlserver_dataprovider_1 = require("@memberjunction/sqlserver-dataprovider");
20
+ let PotentialDuplicateRequestType = class PotentialDuplicateRequestType extends core_1.PotentialDuplicateRequest {
21
+ };
22
+ exports.PotentialDuplicateRequestType = PotentialDuplicateRequestType;
23
+ __decorate([
24
+ (0, type_graphql_1.Field)(() => type_graphql_1.Int),
25
+ __metadata("design:type", Number)
26
+ ], PotentialDuplicateRequestType.prototype, "EntityDocumentID", void 0);
27
+ __decorate([
28
+ (0, type_graphql_1.Field)(() => [MergeRecordsResolver_1.PrimaryKeyValueInputType]),
29
+ __metadata("design:type", Array)
30
+ ], PotentialDuplicateRequestType.prototype, "PrimaryKeyValues", void 0);
31
+ __decorate([
32
+ (0, type_graphql_1.Field)(() => type_graphql_1.Int, { nullable: true }),
33
+ __metadata("design:type", Number)
34
+ ], PotentialDuplicateRequestType.prototype, "EntitiyID", void 0);
35
+ __decorate([
36
+ (0, type_graphql_1.Field)(() => String, { nullable: true }),
37
+ __metadata("design:type", String)
38
+ ], PotentialDuplicateRequestType.prototype, "EntityName", void 0);
39
+ __decorate([
40
+ (0, type_graphql_1.Field)(() => type_graphql_1.Int, { nullable: true }),
41
+ __metadata("design:type", Number)
42
+ ], PotentialDuplicateRequestType.prototype, "ProbabilityScore", void 0);
43
+ exports.PotentialDuplicateRequestType = PotentialDuplicateRequestType = __decorate([
44
+ (0, type_graphql_1.InputType)()
45
+ ], PotentialDuplicateRequestType);
46
+ let PotentialDuplicateType = class PotentialDuplicateType extends core_1.PotentialDuplicate {
47
+ };
48
+ exports.PotentialDuplicateType = PotentialDuplicateType;
49
+ __decorate([
50
+ (0, type_graphql_1.Field)(() => type_graphql_1.Float),
51
+ __metadata("design:type", Number)
52
+ ], PotentialDuplicateType.prototype, "ProbabilityScore", void 0);
53
+ __decorate([
54
+ (0, type_graphql_1.Field)(() => [MergeRecordsResolver_1.PrimaryKeyValueOutputType]),
55
+ __metadata("design:type", Array)
56
+ ], PotentialDuplicateType.prototype, "PrimaryKeyValues", void 0);
57
+ exports.PotentialDuplicateType = PotentialDuplicateType = __decorate([
58
+ (0, type_graphql_1.ObjectType)()
59
+ ], PotentialDuplicateType);
60
+ let PotentialDuplicateResponseType = class PotentialDuplicateResponseType extends core_1.PotentialDuplicateResponse {
61
+ };
62
+ exports.PotentialDuplicateResponseType = PotentialDuplicateResponseType;
63
+ __decorate([
64
+ (0, type_graphql_1.Field)(() => type_graphql_1.Int),
65
+ __metadata("design:type", Number)
66
+ ], PotentialDuplicateResponseType.prototype, "EntityID", void 0);
67
+ __decorate([
68
+ (0, type_graphql_1.Field)(() => [PotentialDuplicateType]),
69
+ __metadata("design:type", Array)
70
+ ], PotentialDuplicateResponseType.prototype, "Duplicates", void 0);
71
+ exports.PotentialDuplicateResponseType = PotentialDuplicateResponseType = __decorate([
72
+ (0, type_graphql_1.ObjectType)()
73
+ ], PotentialDuplicateResponseType);
74
+ let DuplicateRecordResolver = class DuplicateRecordResolver {
75
+ async GetRecordDuplicates({ dataSource, userPayload }, params) {
76
+ const md = new core_1.Metadata();
77
+ const user = sqlserver_dataprovider_1.UserCache.Instance.Users.find((u) => u.Email.trim().toLowerCase() === userPayload.email.trim().toLowerCase());
78
+ if (!user) {
79
+ throw new Error(`User ${userPayload.email} not found in UserCache`);
80
+ }
81
+ const result = await md.GetRecordDuplicates(params, user);
82
+ return result;
83
+ }
84
+ };
85
+ exports.DuplicateRecordResolver = DuplicateRecordResolver;
86
+ __decorate([
87
+ (0, type_graphql_1.Query)(() => PotentialDuplicateResponseType),
88
+ __param(0, (0, type_graphql_1.Ctx)()),
89
+ __param(1, (0, type_graphql_1.Arg)("params")),
90
+ __metadata("design:type", Function),
91
+ __metadata("design:paramtypes", [Object, PotentialDuplicateRequestType]),
92
+ __metadata("design:returntype", Promise)
93
+ ], DuplicateRecordResolver.prototype, "GetRecordDuplicates", null);
94
+ exports.DuplicateRecordResolver = DuplicateRecordResolver = __decorate([
95
+ (0, type_graphql_1.Resolver)(PotentialDuplicateResponseType)
96
+ ], DuplicateRecordResolver);
97
+ //# sourceMappingURL=PotentialDuplicateRecordResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PotentialDuplicateRecordResolver.js","sourceRoot":"","sources":["../../src/resolvers/P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EAAE,CAAC,CAAC,sBAAsB,CAAC,CAAC;;kEACD;yCAN1B,8BAA8B;IAD1C,IAAA,yBAAU,GAAE;GACA,8BAA8B,CAO1C;AAGM,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAG5B,AAAN,KAAK,CAAC,mBAAmB,CAAQ,EAAE,UAAU,EAAE,WAAW,EAAc,EAAgB,MAAqC;QACzH,MAAM,EAAE,GAAG,IAAI,eAAQ,EAAE,CAAC;QAE1B,MAAM,IAAI,GAAG,kCAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,WAAW,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;QAC3H,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,QAAQ,WAAW,CAAC,KAAK,yBAAyB,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,mBAAmB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC1D,OAAO,MAAM,CAAC;IAChB,CAAC;CACJ,CAAA;AAdY,0DAAuB;AAG5B;IADL,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,8BAA8B,CAAC;IACjB,WAAA,IAAA,kBAAG,GAAE,CAAA;IAA2C,WAAA,IAAA,kBAAG,EAAC,QAAQ,CAAC,CAAA;;6CAAQ,6BAA6B;;kEAU1H;kCAbQ,uBAAuB;IADnC,IAAA,uBAAQ,EAAC,8BAA8B,CAAC;GAC5B,uBAAuB,CAcnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/server",
3
- "version": "0.9.228",
3
+ "version": "0.9.230",
4
4
  "description": "MemberJunction: This project provides API access via GraphQL to the common data store.",
5
5
  "main": "dist/index.js",
6
6
  "types": "src/index.ts",
@@ -21,16 +21,16 @@
21
21
  "dependencies": {
22
22
  "@apollo/server": "^4.9.1",
23
23
  "@graphql-tools/utils": "^10.0.1",
24
- "@memberjunction/ai": "^0.9.156",
25
- "@memberjunction/aiengine": "^0.9.58",
26
- "@memberjunction/core": "^0.9.169",
27
- "@memberjunction/core-entities": "^0.9.156",
28
- "@memberjunction/data-context": "^0.9.42",
29
- "@memberjunction/data-context-server": "^0.9.38",
30
- "@memberjunction/global": "^0.9.148",
31
- "@memberjunction/queue": "^0.9.176",
32
- "@memberjunction/sqlserver-dataprovider": "^0.9.187",
33
- "@memberjunction/skip-types": "^0.9.66",
24
+ "@memberjunction/ai": "^0.9.159",
25
+ "@memberjunction/aiengine": "^0.9.56",
26
+ "@memberjunction/core": "^0.9.171",
27
+ "@memberjunction/core-entities": "^0.9.155",
28
+ "@memberjunction/data-context": "^0.9.43",
29
+ "@memberjunction/data-context-server": "^0.9.39",
30
+ "@memberjunction/global": "^0.9.152",
31
+ "@memberjunction/queue": "^0.9.177",
32
+ "@memberjunction/sqlserver-dataprovider": "^0.9.188",
33
+ "@memberjunction/skip-types": "^0.9.67",
34
34
  "@types/cors": "^2.8.13",
35
35
  "@types/jsonwebtoken": "^8.5.9",
36
36
  "@types/node": "^18.11.14",
@@ -0,0 +1,60 @@
1
+ import { Arg, Ctx, Field, Float, InputType, Int, ObjectType, Query, Resolver } from "type-graphql";
2
+ import { PotentialDuplicateRequest, PotentialDuplicateResponse, PotentialDuplicate, Metadata, PrimaryKeyValue, LogError } from '@memberjunction/core';
3
+ import {PrimaryKeyValueInputType, PrimaryKeyValueOutputType} from './MergeRecordsResolver'
4
+ import { AppContext } from "../types";
5
+ import { UserCache } from "@memberjunction/sqlserver-dataprovider";
6
+
7
+ @InputType()
8
+ export class PotentialDuplicateRequestType extends PotentialDuplicateRequest {
9
+ @Field(() => Int)
10
+ EntityDocumentID: number;
11
+
12
+ @Field(() => [PrimaryKeyValueInputType])
13
+ PrimaryKeyValues: PrimaryKeyValueInputType[];
14
+
15
+ @Field(() => Int, { nullable: true })
16
+ EntitiyID: number;
17
+
18
+ @Field(() => String, { nullable: true })
19
+ EntityName: string;
20
+
21
+ @Field(() => Int, { nullable: true })
22
+ ProbabilityScore: number;
23
+
24
+ }
25
+
26
+ @ObjectType()
27
+ export class PotentialDuplicateType extends PotentialDuplicate {
28
+ @Field(() => Float)
29
+ ProbabilityScore: number;
30
+
31
+ @Field(() => [PrimaryKeyValueOutputType])
32
+ PrimaryKeyValues: PrimaryKeyValueOutputType[];
33
+ }
34
+
35
+ @ObjectType()
36
+ export class PotentialDuplicateResponseType extends PotentialDuplicateResponse{
37
+
38
+ @Field(() => Int)
39
+ EntityID: number;
40
+
41
+ @Field(() => [PotentialDuplicateType])
42
+ Duplicates: PotentialDuplicateType[];
43
+ }
44
+
45
+ @Resolver(PotentialDuplicateResponseType)
46
+ export class DuplicateRecordResolver {
47
+
48
+ @Query(() => PotentialDuplicateResponseType)
49
+ async GetRecordDuplicates(@Ctx() { dataSource, userPayload }: AppContext, @Arg("params")params: PotentialDuplicateRequestType): Promise<PotentialDuplicateResponseType> {
50
+ const md = new Metadata();
51
+
52
+ const user = UserCache.Instance.Users.find((u) => u.Email.trim().toLowerCase() === userPayload.email.trim().toLowerCase());
53
+ if (!user) {
54
+ throw new Error(`User ${userPayload.email} not found in UserCache`);
55
+ }
56
+
57
+ const result = await md.GetRecordDuplicates(params, user);
58
+ return result;
59
+ }
60
+ }