@chevre/domain
Version:
Chevre Domain Library for Node.js
47 lines (42 loc) • 1.65 kB
text/typescript
// tslint:disable:no-console
import * as mongoose from 'mongoose';
import { call } from '../../../lib/chevre/service/task/createEvent';
import { chevre } from '../../../lib/index';
const project = { id: String(process.env.PROJECT_ID) };
async function main() {
await mongoose.connect(<string>process.env.MONGOLAB_URI, { autoIndex: false });
await call({
agent: { id: 'sample', typeOf: chevre.factory.creativeWorkType.WebApplication },
project: { id: project.id, typeOf: chevre.factory.organizationType.Project },
object: {
typeOf: chevre.factory.eventType.ScreeningEvent,
eventSchedule: { id: '672bf38b5d6d3f5642d658fc' }
},
// targetCollection: {},
typeOf: chevre.factory.actionType.CreateAction
})(
{
connection: mongoose.connection,
credentials: {
sendGrid: await chevre.credentials.SendGrid.createInstance({ apiKey: 'xxx' })
},
settings: new chevre.settings.Settings({
deliverOrderLimit: 1,
abortedTasksWithoutReport: [],
coa: { timeout: 1000 },
gmo: { timeout: 1000, timeoutBackground: 1000, useFetch: true },
movieticketReserve: { timeout: 1000, timeoutCheck: 1000, minIntervalBetweenPayAndRefund: 0 },
numTryConfirmReserveTransaction: 10,
useExperimentalFeature: false
})
},
{
executeById: true,
executeByName: false
}
);
console.log('success!');
}
main()
.then(console.log)
.catch(console.error);