@memberjunction/server 2.21.0 → 2.22.0
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.
|
@@ -5,70 +5,37 @@ export declare class GetDataInputType {
|
|
|
5
5
|
}
|
|
6
6
|
export declare class GetDataOutputType {
|
|
7
7
|
Success: boolean;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Results: string[];
|
|
8
|
+
Queries: string[];
|
|
9
|
+
ErrorMessages: (string | null)[];
|
|
10
|
+
Results: (string | null)[];
|
|
11
11
|
}
|
|
12
12
|
export declare class SimpleEntityResultType {
|
|
13
13
|
Success: boolean;
|
|
14
|
-
ErrorMessage
|
|
14
|
+
ErrorMessage?: string;
|
|
15
15
|
Results: SimpleEntityOutputType[];
|
|
16
16
|
}
|
|
17
17
|
export declare class SimpleEntityOutputType {
|
|
18
18
|
ID: string;
|
|
19
19
|
Name: string;
|
|
20
|
-
Description
|
|
20
|
+
Description?: string;
|
|
21
21
|
SchemaName: string;
|
|
22
22
|
BaseView: string;
|
|
23
23
|
BaseTable: string;
|
|
24
|
-
CodeName
|
|
25
|
-
ClassName
|
|
24
|
+
CodeName?: string;
|
|
25
|
+
ClassName?: string;
|
|
26
26
|
Fields: SimpleEntityFieldOutputType[];
|
|
27
27
|
}
|
|
28
28
|
export declare class SimpleEntityFieldOutputType {
|
|
29
29
|
ID: string;
|
|
30
30
|
Name: string;
|
|
31
|
-
Description
|
|
31
|
+
Description?: string;
|
|
32
32
|
Type: string;
|
|
33
33
|
AllowsNull: boolean;
|
|
34
34
|
MaxLength: number;
|
|
35
35
|
}
|
|
36
36
|
export declare class GetDataResolver {
|
|
37
|
-
GetData(input: GetDataInputType, context: AppContext): Promise<
|
|
38
|
-
|
|
39
|
-
Results: string[];
|
|
40
|
-
ErrorMessage?: undefined;
|
|
41
|
-
} | {
|
|
42
|
-
Success: boolean;
|
|
43
|
-
ErrorMessage: any;
|
|
44
|
-
Results: any[];
|
|
45
|
-
}>;
|
|
46
|
-
GetAllEntities(context: AppContext): Promise<{
|
|
47
|
-
Success: boolean;
|
|
48
|
-
Results: {
|
|
49
|
-
ID: string;
|
|
50
|
-
Name: string;
|
|
51
|
-
Description: string;
|
|
52
|
-
SchemaName: string;
|
|
53
|
-
BaseView: string;
|
|
54
|
-
BaseTable: string;
|
|
55
|
-
CodeName: string;
|
|
56
|
-
ClassName: string;
|
|
57
|
-
Fields: {
|
|
58
|
-
ID: string;
|
|
59
|
-
Name: string;
|
|
60
|
-
Description: string;
|
|
61
|
-
Type: string;
|
|
62
|
-
AllowsNull: boolean;
|
|
63
|
-
MaxLength: number;
|
|
64
|
-
}[];
|
|
65
|
-
}[];
|
|
66
|
-
ErrorMessage?: undefined;
|
|
67
|
-
} | {
|
|
68
|
-
Success: boolean;
|
|
69
|
-
ErrorMessage: any;
|
|
70
|
-
Results: any[];
|
|
71
|
-
}>;
|
|
37
|
+
GetData(input: GetDataInputType, context: AppContext): Promise<GetDataOutputType>;
|
|
38
|
+
GetAllEntities(context: AppContext): Promise<SimpleEntityResultType>;
|
|
72
39
|
}
|
|
73
40
|
export declare class TokenUseLog {
|
|
74
41
|
Token: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetDataResolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/GetDataResolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,qBACa,gBAAgB;IAEzB,KAAK,EAAE,MAAM,CAAC;IAGd,OAAO,EAAE,MAAM,EAAE,CAAC;CACrB;AAGD,qBACa,iBAAiB;IAE1B,OAAO,EAAE,OAAO,CAAC;IAGjB,
|
|
1
|
+
{"version":3,"file":"GetDataResolver.d.ts","sourceRoot":"","sources":["../../src/resolvers/GetDataResolver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,qBACa,gBAAgB;IAEzB,KAAK,EAAE,MAAM,C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AAE,GAAG,CAAC;CACnB;AAMD,qBAAa,kBAAkB;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,IAAI,CAAC;IAChB,UAAU,EAAE,IAAI,CAAC;IAIjB,gBAAgB,EAAE,GAAG,CAAC;IACtB,SAAS,EAAE,WAAW,EAAE,CAAC;CAC5B;AAGD,wBAAgB,mBAAmB,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,GAAE,MAA+B,EAAE,gBAAgB,CAAC,EAAE,GAAG,GAAG,kBAAkB,CAezI;AACD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,QAQ9C;AACD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,WAExC;AACD,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,WAMzC;AACD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,QAQ5D"}
|
|
@@ -32,8 +32,8 @@ GetDataInputType = __decorate([
|
|
|
32
32
|
export { GetDataInputType };
|
|
33
33
|
let GetDataOutputType = class GetDataOutputType {
|
|
34
34
|
Success;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
Queries;
|
|
36
|
+
ErrorMessages;
|
|
37
37
|
Results;
|
|
38
38
|
};
|
|
39
39
|
__decorate([
|
|
@@ -41,15 +41,15 @@ __decorate([
|
|
|
41
41
|
__metadata("design:type", Boolean)
|
|
42
42
|
], GetDataOutputType.prototype, "Success", void 0);
|
|
43
43
|
__decorate([
|
|
44
|
-
Field(() => String),
|
|
45
|
-
__metadata("design:type",
|
|
46
|
-
], GetDataOutputType.prototype, "
|
|
44
|
+
Field(() => [String]),
|
|
45
|
+
__metadata("design:type", Array)
|
|
46
|
+
], GetDataOutputType.prototype, "Queries", void 0);
|
|
47
47
|
__decorate([
|
|
48
|
-
Field(() => String),
|
|
49
|
-
__metadata("design:type",
|
|
50
|
-
], GetDataOutputType.prototype, "
|
|
48
|
+
Field(() => [String], { nullable: 'itemsAndList' }),
|
|
49
|
+
__metadata("design:type", Array)
|
|
50
|
+
], GetDataOutputType.prototype, "ErrorMessages", void 0);
|
|
51
51
|
__decorate([
|
|
52
|
-
Field(() => [String]),
|
|
52
|
+
Field(() => [String], { nullable: 'itemsAndList' }),
|
|
53
53
|
__metadata("design:type", Array)
|
|
54
54
|
], GetDataOutputType.prototype, "Results", void 0);
|
|
55
55
|
GetDataOutputType = __decorate([
|
|
@@ -66,7 +66,7 @@ __decorate([
|
|
|
66
66
|
__metadata("design:type", Boolean)
|
|
67
67
|
], SimpleEntityResultType.prototype, "Success", void 0);
|
|
68
68
|
__decorate([
|
|
69
|
-
Field(() => String),
|
|
69
|
+
Field(() => String, { nullable: true }),
|
|
70
70
|
__metadata("design:type", String)
|
|
71
71
|
], SimpleEntityResultType.prototype, "ErrorMessage", void 0);
|
|
72
72
|
__decorate([
|
|
@@ -97,7 +97,7 @@ __decorate([
|
|
|
97
97
|
__metadata("design:type", String)
|
|
98
98
|
], SimpleEntityOutputType.prototype, "Name", void 0);
|
|
99
99
|
__decorate([
|
|
100
|
-
Field(() => String),
|
|
100
|
+
Field(() => String, { nullable: true }),
|
|
101
101
|
__metadata("design:type", String)
|
|
102
102
|
], SimpleEntityOutputType.prototype, "Description", void 0);
|
|
103
103
|
__decorate([
|
|
@@ -113,11 +113,11 @@ __decorate([
|
|
|
113
113
|
__metadata("design:type", String)
|
|
114
114
|
], SimpleEntityOutputType.prototype, "BaseTable", void 0);
|
|
115
115
|
__decorate([
|
|
116
|
-
Field(() => String),
|
|
116
|
+
Field(() => String, { nullable: true }),
|
|
117
117
|
__metadata("design:type", String)
|
|
118
118
|
], SimpleEntityOutputType.prototype, "CodeName", void 0);
|
|
119
119
|
__decorate([
|
|
120
|
-
Field(() => String),
|
|
120
|
+
Field(() => String, { nullable: true }),
|
|
121
121
|
__metadata("design:type", String)
|
|
122
122
|
], SimpleEntityOutputType.prototype, "ClassName", void 0);
|
|
123
123
|
__decorate([
|
|
@@ -145,7 +145,7 @@ __decorate([
|
|
|
145
145
|
__metadata("design:type", String)
|
|
146
146
|
], SimpleEntityFieldOutputType.prototype, "Name", void 0);
|
|
147
147
|
__decorate([
|
|
148
|
-
Field(() => String),
|
|
148
|
+
Field(() => String, { nullable: true }),
|
|
149
149
|
__metadata("design:type", String)
|
|
150
150
|
], SimpleEntityFieldOutputType.prototype, "Description", void 0);
|
|
151
151
|
__decorate([
|
|
@@ -173,17 +173,27 @@ export class GetDataResolver {
|
|
|
173
173
|
if (!isTokenValid(input.Token)) {
|
|
174
174
|
throw new Error(`Token ${input.Token} is not valid or has expired`);
|
|
175
175
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
176
|
+
const results = await Promise.allSettled(input.Queries.map(async (query) => {
|
|
177
|
+
try {
|
|
178
|
+
const result = await context.dataSource.query(query);
|
|
179
|
+
return { result, error: null };
|
|
180
|
+
}
|
|
181
|
+
catch (err) {
|
|
182
|
+
return { result: null, error: err };
|
|
183
|
+
}
|
|
184
|
+
}));
|
|
185
|
+
const processedResults = results.map((res) => res.status === "fulfilled" ? res.value.result : null);
|
|
186
|
+
const errorMessages = results.map((res) => res.status === "fulfilled" ? res.value.error : res.reason);
|
|
187
|
+
const returnVal = { Success: errorMessages.filter((e) => e !== null).length === 0,
|
|
188
|
+
Results: processedResults.map((r) => JSON.stringify(r)),
|
|
189
|
+
Queries: input.Queries,
|
|
190
|
+
ErrorMessages: errorMessages };
|
|
191
|
+
recordTokenUse(input.Token, { request: input, results: returnVal });
|
|
192
|
+
return returnVal;
|
|
183
193
|
}
|
|
184
194
|
catch (err) {
|
|
185
195
|
LogError(err);
|
|
186
|
-
return { Success: false,
|
|
196
|
+
return { Success: false, ErrorMessages: [typeof err === 'string' ? err : err.message], Results: [], Queries: input.Queries };
|
|
187
197
|
}
|
|
188
198
|
}
|
|
189
199
|
async GetAllEntities(context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GetDataResolver.js","sourceRoot":"","sources":["../../src/resolvers/GetDataResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE7E,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAG7B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAEzB,KAAK,CAAS;IAGd,OAAO,CAAW;CACrB,CAAA;AAJG;IADC,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC;;+CACN;AAGd;IADC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC;;iDACJ;AALT,gBAAgB;IAD5B,SAAS,EAAE;GACC,gBAAgB,CAM5B;;AAIM,IAAM,iBAAiB,GAAvB,MAAM,iBAAiB;IAE1B,OAAO,CAAU;IAGjB,
|
|
1
|
+
{"version":3,"file":"GetDataResolver.js","sourceRoot":"","sources":["../../src/resolvers/GetDataResolver.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAE7E,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AAG7B,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAEzB,KAAK,CAAS;IAGd,OAA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@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.22.0",
|
|
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",
|
|
@@ -22,27 +22,27 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@apollo/server": "^4.9.1",
|
|
24
24
|
"@graphql-tools/utils": "^10.0.1",
|
|
25
|
-
"@memberjunction/actions": "2.
|
|
26
|
-
"@memberjunction/ai": "2.
|
|
27
|
-
"@memberjunction/ai-mistral": "2.
|
|
28
|
-
"@memberjunction/ai-openai": "2.
|
|
29
|
-
"@memberjunction/ai-vectors-pinecone": "2.
|
|
30
|
-
"@memberjunction/aiengine": "2.
|
|
31
|
-
"@memberjunction/core": "2.
|
|
32
|
-
"@memberjunction/core-actions": "2.
|
|
33
|
-
"@memberjunction/core-entities": "2.
|
|
34
|
-
"@memberjunction/data-context": "2.
|
|
35
|
-
"@memberjunction/data-context-server": "2.
|
|
36
|
-
"@memberjunction/doc-utils": "2.
|
|
37
|
-
"@memberjunction/entity-communications-server": "2.
|
|
38
|
-
"@memberjunction/external-change-detection": "2.
|
|
39
|
-
"@memberjunction/global": "2.
|
|
40
|
-
"@memberjunction/graphql-dataprovider": "2.
|
|
41
|
-
"@memberjunction/queue": "2.
|
|
42
|
-
"@memberjunction/skip-types": "2.
|
|
43
|
-
"@memberjunction/sqlserver-dataprovider": "2.
|
|
44
|
-
"@memberjunction/storage": "2.
|
|
45
|
-
"@memberjunction/templates": "2.
|
|
25
|
+
"@memberjunction/actions": "2.22.0",
|
|
26
|
+
"@memberjunction/ai": "2.22.0",
|
|
27
|
+
"@memberjunction/ai-mistral": "2.22.0",
|
|
28
|
+
"@memberjunction/ai-openai": "2.22.0",
|
|
29
|
+
"@memberjunction/ai-vectors-pinecone": "2.22.0",
|
|
30
|
+
"@memberjunction/aiengine": "2.22.0",
|
|
31
|
+
"@memberjunction/core": "2.22.0",
|
|
32
|
+
"@memberjunction/core-actions": "2.22.0",
|
|
33
|
+
"@memberjunction/core-entities": "2.22.0",
|
|
34
|
+
"@memberjunction/data-context": "2.22.0",
|
|
35
|
+
"@memberjunction/data-context-server": "2.22.0",
|
|
36
|
+
"@memberjunction/doc-utils": "2.22.0",
|
|
37
|
+
"@memberjunction/entity-communications-server": "2.22.0",
|
|
38
|
+
"@memberjunction/external-change-detection": "2.22.0",
|
|
39
|
+
"@memberjunction/global": "2.22.0",
|
|
40
|
+
"@memberjunction/graphql-dataprovider": "2.22.0",
|
|
41
|
+
"@memberjunction/queue": "2.22.0",
|
|
42
|
+
"@memberjunction/skip-types": "2.22.0",
|
|
43
|
+
"@memberjunction/sqlserver-dataprovider": "2.22.0",
|
|
44
|
+
"@memberjunction/storage": "2.22.0",
|
|
45
|
+
"@memberjunction/templates": "2.22.0",
|
|
46
46
|
"@types/cors": "^2.8.13",
|
|
47
47
|
"@types/jsonwebtoken": "9.0.6",
|
|
48
48
|
"@types/node": "20.14.2",
|
|
@@ -19,17 +19,17 @@ export class GetDataOutputType {
|
|
|
19
19
|
@Field(() => Boolean)
|
|
20
20
|
Success: boolean;
|
|
21
21
|
|
|
22
|
-
@Field(() => String)
|
|
23
|
-
|
|
22
|
+
@Field(() => [String])
|
|
23
|
+
Queries: string[];
|
|
24
24
|
|
|
25
|
-
@Field(() => String)
|
|
26
|
-
|
|
25
|
+
@Field(() => [String], { nullable: 'itemsAndList' }) // Allow nulls inside array & entire field nullable
|
|
26
|
+
ErrorMessages: (string | null)[];
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* Each query's results will be converted to JSON and returned as a string
|
|
30
30
|
*/
|
|
31
|
-
@Field(() => [String])
|
|
32
|
-
Results: string[];
|
|
31
|
+
@Field(() => [String], { nullable: 'itemsAndList' }) // Allow nulls inside array & entire field nullable
|
|
32
|
+
Results: (string | null)[];
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
@ObjectType()
|
|
@@ -37,8 +37,8 @@ export class SimpleEntityResultType {
|
|
|
37
37
|
@Field(() => Boolean)
|
|
38
38
|
Success: boolean;
|
|
39
39
|
|
|
40
|
-
@Field(() => String)
|
|
41
|
-
ErrorMessage
|
|
40
|
+
@Field(() => String, { nullable: true })
|
|
41
|
+
ErrorMessage?: string;
|
|
42
42
|
|
|
43
43
|
@Field(() => [SimpleEntityOutputType])
|
|
44
44
|
Results: SimpleEntityOutputType[];
|
|
@@ -52,8 +52,8 @@ export class SimpleEntityOutputType {
|
|
|
52
52
|
@Field(() => String)
|
|
53
53
|
Name: string;
|
|
54
54
|
|
|
55
|
-
@Field(() => String)
|
|
56
|
-
Description
|
|
55
|
+
@Field(() => String, { nullable: true })
|
|
56
|
+
Description?: string;
|
|
57
57
|
|
|
58
58
|
@Field(() => String)
|
|
59
59
|
SchemaName: string;
|
|
@@ -64,11 +64,11 @@ export class SimpleEntityOutputType {
|
|
|
64
64
|
@Field(() => String)
|
|
65
65
|
BaseTable: string;
|
|
66
66
|
|
|
67
|
-
@Field(() => String)
|
|
68
|
-
CodeName
|
|
67
|
+
@Field(() => String, { nullable: true })
|
|
68
|
+
CodeName?: string;
|
|
69
69
|
|
|
70
|
-
@Field(() => String)
|
|
71
|
-
ClassName
|
|
70
|
+
@Field(() => String, { nullable: true })
|
|
71
|
+
ClassName?: string;
|
|
72
72
|
|
|
73
73
|
@Field(() => [SimpleEntityFieldOutputType])
|
|
74
74
|
Fields: SimpleEntityFieldOutputType[];
|
|
@@ -82,8 +82,8 @@ export class SimpleEntityFieldOutputType {
|
|
|
82
82
|
@Field(() => String)
|
|
83
83
|
Name: string;
|
|
84
84
|
|
|
85
|
-
@Field(() => String)
|
|
86
|
-
Description
|
|
85
|
+
@Field(() => String, { nullable: true })
|
|
86
|
+
Description?: string;
|
|
87
87
|
|
|
88
88
|
@Field(() => String)
|
|
89
89
|
Type: string;
|
|
@@ -107,7 +107,7 @@ export class GetDataResolver {
|
|
|
107
107
|
async GetData(
|
|
108
108
|
@Arg('input', () => GetDataInputType) input: GetDataInputType,
|
|
109
109
|
@Ctx() context: AppContext
|
|
110
|
-
) {
|
|
110
|
+
): Promise<GetDataOutputType> {
|
|
111
111
|
try {
|
|
112
112
|
LogStatus(`GetDataResolver.GetData() ---- IMPORTANT - temporarily using the same connection as rest of the server, we need to separately create a READ ONLY CONNECTION and pass that in
|
|
113
113
|
the AppContext so we can use that special connection here to ensure we are using a lower privileged connection for this operation to prevent mutation from being possible.`);
|
|
@@ -118,21 +118,37 @@ export class GetDataResolver {
|
|
|
118
118
|
throw new Error(`Token ${input.Token} is not valid or has expired`);
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
//
|
|
122
|
-
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
121
|
+
// Execute all queries in parallel, but execute each individual query in its own try catch block so that if one fails, the others can still be processed
|
|
122
|
+
// and also so that we can capture the error message for each query and return it
|
|
123
|
+
const results = await Promise.allSettled(
|
|
124
|
+
input.Queries.map(async (query) => {
|
|
125
|
+
try {
|
|
126
|
+
const result = await context.dataSource.query(query);
|
|
127
|
+
return { result, error: null };
|
|
128
|
+
} catch (err) {
|
|
129
|
+
return { result: null, error: err };
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
// Extract results and errors from the promises
|
|
135
|
+
const processedResults = results.map((res) => res.status === "fulfilled" ? res.value.result : null);
|
|
136
|
+
const errorMessages = results.map((res) => res.status === "fulfilled" ? res.value.error : res.reason);
|
|
127
137
|
|
|
128
138
|
// record the use of the token
|
|
129
|
-
|
|
139
|
+
const returnVal = { Success: errorMessages.filter((e) => e !== null).length === 0,
|
|
140
|
+
Results: processedResults.map((r) => JSON.stringify(r)),
|
|
141
|
+
Queries: input.Queries,
|
|
142
|
+
ErrorMessages: errorMessages }
|
|
143
|
+
|
|
144
|
+
recordTokenUse(input.Token, {request: input, results: returnVal});
|
|
130
145
|
|
|
131
|
-
|
|
146
|
+
// Success below is derived from having no errorMessages, check that array
|
|
147
|
+
return returnVal;
|
|
132
148
|
}
|
|
133
149
|
catch (err) {
|
|
134
150
|
LogError(err);
|
|
135
|
-
return { Success: false,
|
|
151
|
+
return { Success: false, ErrorMessages: [typeof err === 'string' ? err : (err as any).message], Results: [], Queries: input.Queries };
|
|
136
152
|
}
|
|
137
153
|
}
|
|
138
154
|
|
|
@@ -140,7 +156,7 @@ export class GetDataResolver {
|
|
|
140
156
|
@Query(() => SimpleEntityResultType)
|
|
141
157
|
async GetAllEntities(
|
|
142
158
|
@Ctx() context: AppContext
|
|
143
|
-
) {
|
|
159
|
+
): Promise<SimpleEntityResultType> {
|
|
144
160
|
try {
|
|
145
161
|
const md = new Metadata();
|
|
146
162
|
const result = md.Entities.map((e) => {
|