@altostra/core
Version:
Core library for shared types and logic
1 lines • 3.29 kB
JavaScript
;var __awaiter=this&&this.__awaiter||function(e,r,t,o){return new(t||(t=Promise))((function(n,i){function u(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var r;e.done?n(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(u,s)}c((o=o.apply(e,r||[])).next())}))},__importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.helloWorldProjectInitializer=exports.emptyProjectInitializer=void 0;const blueprint_1=require("../../blueprint"),Point_1=require("../../blueprint/Point"),Resources_1=require("../../blueprint/Resources"),Integer_1=require("../../common/CustomTypes/Integer"),cuid_1=__importDefault(require("cuid")),IProjectManager_1=require("./IProjectManager"),emptyProjectInitializer=()=>__awaiter(void 0,void 0,void 0,(function*(){return yield mkProjectWithBlueprints(void 0,(0,blueprint_1.mkBlueprint)(Object.assign(Object.assign({},IProjectManager_1.defaultBlueprintData),{id:(0,cuid_1.default)()})))}));exports.emptyProjectInitializer=emptyProjectInitializer;const helloWorldProjectInitializer=()=>__awaiter(void 0,void 0,void 0,(function*(){const e=(0,IProjectManager_1.defaultProject)(),r=(0,blueprint_1.mkBlueprint)(Object.assign(Object.assign({},getHelloWorldBlueprintData()),{id:(0,cuid_1.default)()}));return e.blueprints.push(r),e}));function mkProjectWithBlueprints(e,...r){return __awaiter(this,void 0,void 0,(function*(){return(e=null!=e?e:(0,IProjectManager_1.defaultProject)()).blueprints.push(...r),e}))}function getHelloWorldBlueprintData(){return{version:"2019-10-24",id:"hello-world",name:"hello-world",description:"My first application on Altostra",resources:{sayHelloFunc:{id:(0,Resources_1.resourceId)("sayHelloFunc"),type:"resource.compute.function",name:"say-hello",timeout:6,entryPoint:"src/say-hello.handler",runtime:"nodejs12.x",memory:512,tags:{}},getWorldFunc:{id:(0,Resources_1.resourceId)("getWorldFunc"),type:"resource.compute.function",name:"get-world",timeout:6,entryPoint:"src/get-world.handler",runtime:"nodejs12.x",memory:512,tags:{}},myTable:{id:(0,Resources_1.resourceId)("myTable"),type:"resource.table.simple",name:"my-table",tableName:"Test Table",key:"id",throughput:{readUnits:(0,Integer_1.integer)(1),writeUnits:(0,Integer_1.integer)(1)}},myQueue:{id:(0,Resources_1.resourceId)("myQueue"),type:"resource.message-queue",name:"my-queue",delay:20,maxMessageSize:1024,retentionPeriod:60}},connections:{sayHelloFunc:{myTable:{type:"connection.resource-access",from:(0,Resources_1.resourceId)("sayHelloFunc"),to:(0,Resources_1.resourceId)("myTable"),accessLevel:"read-write"},myQueue:{type:"connection.resource-access",from:(0,Resources_1.resourceId)("sayHelloFunc"),to:(0,Resources_1.resourceId)("myQueue"),accessLevel:"read-only"}},getWorldFunc:{myTable:{type:"connection.resource-access",from:(0,Resources_1.resourceId)("getWorldFunc"),to:(0,Resources_1.resourceId)("myTable"),accessLevel:"read-only"}}},metadata:{designer:{resourcePositions:{sayHelloFunc:(0,Point_1.point)(86,265,0),getWorldFunc:(0,Point_1.point)(70,32,0),myTable:(0,Point_1.point)(600,265,0),myQueue:(0,Point_1.point)(500,500,0)}}}}}exports.helloWorldProjectInitializer=helloWorldProjectInitializer;