@memberjunction/server 0.9.246 → 0.9.247
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/server",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.247",
|
|
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,16 +22,16 @@
|
|
|
22
22
|
"@apollo/server": "^4.9.1",
|
|
23
23
|
"@graphql-tools/utils": "^10.0.1",
|
|
24
24
|
"@memberjunction/ai": "^0.9.163",
|
|
25
|
-
"@memberjunction/aiengine": "^0.9.
|
|
25
|
+
"@memberjunction/aiengine": "^0.9.68",
|
|
26
26
|
"@memberjunction/core": "^0.9.177",
|
|
27
|
-
"@memberjunction/core-entities": "^0.9.
|
|
28
|
-
"@memberjunction/data-context": "^0.9.
|
|
29
|
-
"@memberjunction/data-context-server": "^0.9.
|
|
27
|
+
"@memberjunction/core-entities": "^0.9.167",
|
|
28
|
+
"@memberjunction/data-context": "^0.9.54",
|
|
29
|
+
"@memberjunction/data-context-server": "^0.9.50",
|
|
30
30
|
"@memberjunction/global": "^0.9.156",
|
|
31
|
-
"@memberjunction/storage": "^0.9.
|
|
32
|
-
"@memberjunction/queue": "^0.9.
|
|
33
|
-
"@memberjunction/sqlserver-dataprovider": "^0.9.
|
|
34
|
-
"@memberjunction/skip-types": "^0.9.
|
|
31
|
+
"@memberjunction/storage": "^0.9.12",
|
|
32
|
+
"@memberjunction/queue": "^0.9.189",
|
|
33
|
+
"@memberjunction/sqlserver-dataprovider": "^0.9.204",
|
|
34
|
+
"@memberjunction/skip-types": "^0.9.79",
|
|
35
35
|
"@types/cors": "^2.8.13",
|
|
36
36
|
"@types/jsonwebtoken": "^8.5.9",
|
|
37
37
|
"@types/node": "^18.11.14",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* ALL ENTITIES - TypeGraphQL Type Class Definition - AUTO GENERATED FILE
|
|
3
3
|
* Generated Entities and Resolvers for Server
|
|
4
4
|
*
|
|
5
|
-
* GENERATED: 3/
|
|
5
|
+
* GENERATED: 3/24/2024, 11:43:36 AM
|
|
6
6
|
*
|
|
7
7
|
* >>> DO NOT MODIFY THIS FILE!!!!!!!!!!!!
|
|
8
8
|
* >>> YOUR CHANGES WILL BE OVERWRITTEN
|
|
@@ -5531,6 +5531,19 @@ export class Application_ {
|
|
|
5531
5531
|
|
|
5532
5532
|
}
|
|
5533
5533
|
|
|
5534
|
+
//****************************************************************************
|
|
5535
|
+
// INPUT TYPE for Applications
|
|
5536
|
+
//****************************************************************************
|
|
5537
|
+
@InputType()
|
|
5538
|
+
export class CreateApplicationInput {
|
|
5539
|
+
@Field()
|
|
5540
|
+
Name: string;
|
|
5541
|
+
|
|
5542
|
+
@Field({ nullable: true })
|
|
5543
|
+
Description: string;
|
|
5544
|
+
}
|
|
5545
|
+
|
|
5546
|
+
|
|
5534
5547
|
//****************************************************************************
|
|
5535
5548
|
// INPUT TYPE for Applications
|
|
5536
5549
|
//****************************************************************************
|
|
@@ -5622,6 +5635,36 @@ export class ApplicationResolver extends ResolverBase {
|
|
|
5622
5635
|
return result;
|
|
5623
5636
|
}
|
|
5624
5637
|
|
|
5638
|
+
@Mutation(() => Application_)
|
|
5639
|
+
async CreateApplication(
|
|
5640
|
+
@Arg('input', () => CreateApplicationInput) input: CreateApplicationInput,
|
|
5641
|
+
@Ctx() { dataSource, userPayload }: AppContext,
|
|
5642
|
+
@PubSub() pubSub: PubSubEngine
|
|
5643
|
+
) {
|
|
5644
|
+
if (await this.BeforeCreate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
5645
|
+
const entityObject = <ApplicationEntity>await new Metadata().GetEntityObject('Applications', this.GetUserFromPayload(userPayload));
|
|
5646
|
+
await entityObject.NewRecord();
|
|
5647
|
+
entityObject.SetMany(input);
|
|
5648
|
+
if (await entityObject.Save()) {
|
|
5649
|
+
// save worked, fire the AfterCreate event and then return all the data
|
|
5650
|
+
await this.AfterCreate(dataSource, input); // fire event
|
|
5651
|
+
return entityObject.GetAll();
|
|
5652
|
+
}
|
|
5653
|
+
else
|
|
5654
|
+
// save failed, return null
|
|
5655
|
+
return null;
|
|
5656
|
+
}
|
|
5657
|
+
else
|
|
5658
|
+
return null;
|
|
5659
|
+
}
|
|
5660
|
+
|
|
5661
|
+
// Before/After CREATE Event Hooks for Sub-Classes to Override
|
|
5662
|
+
protected async BeforeCreate(dataSource: DataSource, input: CreateApplicationInput): Promise<boolean> {
|
|
5663
|
+
return true;
|
|
5664
|
+
}
|
|
5665
|
+
protected async AfterCreate(dataSource: DataSource, input: CreateApplicationInput) {
|
|
5666
|
+
}
|
|
5667
|
+
|
|
5625
5668
|
@Mutation(() => Application_)
|
|
5626
5669
|
async UpdateApplication(
|
|
5627
5670
|
@Arg('input', () => UpdateApplicationInput) input: UpdateApplicationInput,
|
|
@@ -5630,9 +5673,9 @@ export class ApplicationResolver extends ResolverBase {
|
|
|
5630
5673
|
) {
|
|
5631
5674
|
if (await this.BeforeUpdate(dataSource, input)) { // fire event and proceed if it wasn't cancelled
|
|
5632
5675
|
const entityObject = <ApplicationEntity>await new Metadata().GetEntityObject('Applications', this.GetUserFromPayload(userPayload));
|
|
5633
|
-
entityObject.
|
|
5634
|
-
|
|
5635
|
-
if (await entityObject.Save(
|
|
5676
|
+
await entityObject.Load(input.ID) // Track Changes is turned on, so we need to get the latest data from DB first before we save
|
|
5677
|
+
entityObject.SetMany(input);
|
|
5678
|
+
if (await entityObject.Save()) {
|
|
5636
5679
|
// save worked, fire afterevent and return all the data
|
|
5637
5680
|
await this.AfterUpdate(dataSource, input); // fire event
|
|
5638
5681
|
return entityObject.GetAll();
|
|
@@ -5653,6 +5696,32 @@ export class ApplicationResolver extends ResolverBase {
|
|
|
5653
5696
|
const i = input, d = dataSource; // prevent error
|
|
5654
5697
|
}
|
|
5655
5698
|
|
|
5699
|
+
@Mutation(() => Application_)
|
|
5700
|
+
async DeleteApplication(@Arg('ID', () => Int) ID: number, @Ctx() { dataSource, userPayload }: AppContext, @PubSub() pubSub: PubSubEngine) {
|
|
5701
|
+
if (await this.BeforeDelete(dataSource, ID)) { // fire event and proceed if it wasn't cancelled
|
|
5702
|
+
const entityObject = <ApplicationEntity>await new Metadata().GetEntityObject('Applications', this.GetUserFromPayload(userPayload));
|
|
5703
|
+
await entityObject.Load(ID);
|
|
5704
|
+
const returnValue = entityObject.GetAll(); // grab the values before we delete so we can return last state before delete if we are successful.
|
|
5705
|
+
if (await entityObject.Delete()) {
|
|
5706
|
+
await this.AfterDelete(dataSource, ID); // fire event
|
|
5707
|
+
return returnValue;
|
|
5708
|
+
}
|
|
5709
|
+
else
|
|
5710
|
+
return null; // delete failed, this will cause an exception
|
|
5711
|
+
}
|
|
5712
|
+
else
|
|
5713
|
+
return null; // BeforeDelete canceled the operation, this will cause an exception
|
|
5714
|
+
}
|
|
5715
|
+
|
|
5716
|
+
// Before/After UPDATE Event Hooks for Sub-Classes to Override
|
|
5717
|
+
protected async BeforeDelete(dataSource: DataSource, ID: number): Promise<boolean> {
|
|
5718
|
+
const i = ID, d = dataSource; // prevent error;
|
|
5719
|
+
return true;
|
|
5720
|
+
}
|
|
5721
|
+
protected async AfterDelete(dataSource: DataSource, ID: number) {
|
|
5722
|
+
const i = ID, d = dataSource; // prevent error
|
|
5723
|
+
}
|
|
5724
|
+
|
|
5656
5725
|
}
|
|
5657
5726
|
|
|
5658
5727
|
//****************************************************************************
|