11import { handler } from "./src" ;
2- import { AppSyncResolverEvent } from "aws-lambda/trigger/appsync-resolver" ;
3- import { createDatabaseTunnel } from "../shared/database/local/databaseTunnel" ;
2+ import { createDatabaseTunnel } from "shared/database/local/databaseTunnel" ;
43import prompts from "prompts" ;
5- import { DatabaseOperation } from "../shared/graphql/operations" ;
6- import { getYourEmail } from "../shared/local/yourEmail" ;
7- import { CreateItemInput , EditItemInput } from "../shared/graphql/graphql" ;
4+ import { DatabaseOperation } from "shared/graphql/operations" ;
5+ import { getYourEmail } from "shared/local/yourEmail" ;
6+ import { CreateItemInput , EditItemInput } from "shared/graphql/graphql" ;
7+ import { IMAGING_REQUEST_ITEM_TYPE } from "shared/octopusImaging" ;
88
99( async ( ) => {
1010 const baseInput = {
1111 identity : { resolverContext : { userEmail : await getYourEmail ( ) } } ,
12+ request : { headers : { referrer : "LOCAL-TESTING" } , domainName : null } ,
1213 } ;
1314
14- const sampleInputs : Partial < Record < DatabaseOperation , unknown > > = {
15+ const sampleInputs = {
1516 listItems : { pinboardId : "63206" } ,
1617 searchMentionableUsers : { prefix : "a" } ,
1718 claimItem : { itemId : "1667" } ,
@@ -35,7 +36,7 @@ import { CreateItemInput, EditItemInput } from "../shared/graphql/graphql";
3536 deleteItem : { itemId : "2352" } ,
3637 getMyUser : { } ,
3738 visitTourStep : { tourStepId : "testing" } ,
38- } ;
39+ } satisfies Partial < Record < DatabaseOperation , unknown > > ;
3940
4041 await createDatabaseTunnel ( ) ;
4142
@@ -48,14 +49,34 @@ import { CreateItemInput, EditItemInput } from "../shared/graphql/graphql";
4849 type : "select" ,
4950 name : "inputPayload" ,
5051 message : "Operation?" ,
51- choices : Object . entries ( sampleInputs ) . map ( ( [ operation , sampleInput ] ) => ( {
52- title : operation ,
53- value : {
54- ...baseInput ,
55- arguments : sampleInput ,
56- info : { fieldName : operation } ,
57- } as AppSyncResolverEvent < unknown , unknown > ,
58- } ) ) ,
52+ choices : [
53+ ...Object . entries ( sampleInputs ) . map ( ( [ operation , sampleInput ] ) => ( {
54+ title : operation ,
55+ value : {
56+ ...baseInput ,
57+ arguments : sampleInput ,
58+ info : { fieldName : operation } ,
59+ } ,
60+ } ) ) ,
61+ {
62+ title : "Digital Imaging Order (via octopus)" ,
63+ value : {
64+ ...baseInput ,
65+ info : { fieldName : "createItem" } ,
66+ arguments : {
67+ input : {
68+ ...sampleInputs . createItem . input ,
69+ type : IMAGING_REQUEST_ITEM_TYPE ,
70+ payload : {
71+ requestType : "Cut out" ,
72+ embeddableUrl :
73+ "https://media.test.dev-gutools.co.uk/images/24733ea386c7fcb37496c55cc86e8f1468b9dfcf" ,
74+ } ,
75+ } ,
76+ } ,
77+ } ,
78+ } ,
79+ ] ,
5980 } ) ;
6081
6182 console . log ( JSON . stringify ( await handler ( inputPayload ) , null , 2 ) ) ;
0 commit comments