@baadal-sdk/dapi 0.27.0 → 0.28.3
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/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types/aws/db-client.d.ts +7 -0
- package/dist/types/aws/db-client.d.ts.map +1 -0
- package/dist/types/aws/db.d.ts +2 -1
- package/dist/types/aws/db.d.ts.map +1 -1
- package/dist/types/aws/index.d.ts +3 -2
- package/dist/types/aws/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/aws/db-client.ts +6 -0
- package/src/aws/db.ts +23 -19
- package/src/aws/index.ts +8 -4
package/dist/cjs/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(()=>{"use strict";var e={76:e=>{e.exports=require("rimraf")}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var u=r[n]={exports:{}};return e[n](u,u.exports,t),u.exports}t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{t.r(n),t.d(n,{aws:()=>o,default:()=>Se,fs:()=>e,gh:()=>u});var e={};t.r(e),t.d(e,{appendToFile:()=>V,createDir:()=>$,deleteDir:()=>L,deleteFile:()=>J,existsDirSync:()=>N,existsFileSync:()=>A,readDir:()=>G,readDirDirs:()=>z,readDirFiles:()=>K,readDirFilesRec:()=>H,readFile:()=>M,readFileSync:()=>B,renameFile:()=>W,writeFile:()=>Q});var r={};t.r(r),t.d(r,{deleteItem:()=>ve,init:()=>ie,queryItems:()=>de,readItem:()=>me,scanItems:()=>be,updateItem:()=>fe,writeItem:()=>pe,writeItemForce:()=>le});var o={};t.r(o),t.d(o,{db:()=>he,init:()=>xe});var u={};t.r(u),t.d(u,{getContent:()=>Oe,init:()=>qe}),require("regenerator-runtime/runtime.js"),require("core-js/modules/es.string.starts-with.js"),require("core-js/modules/es.array.for-each.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.array.last-index-of.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.array.from.js"),require("core-js/modules/es.array.slice.js");const a=require("path");var c=t.n(a);const i=require("util");var s=t.n(i);const l=require("fs");var p=t.n(l);const f=require("fs/promises");var m=t.n(f);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function b(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function v(e,r){if(r&&("object"===d(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){var r="function"==typeof Map?new Map:void 0;return h=function(e){if(null===e||(t=e,-1===Function.toString.call(t).indexOf("[native code]")))return e;var t;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,n)}function n(){return x(e,arguments,g(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),j(n,e)},h(e)}function x(e,r,t){return x=w()?Reflect.construct:function(e,r,t){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(e,n));return t&&j(o,t.prototype),o},x.apply(null,arguments)}function w(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function j(e,r){return j=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},j(e,r)}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.array.index-of.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.reflect.construct.js"),require("core-js/modules/es.map.js"),require("core-js/modules/esnext.map.delete-all.js"),require("core-js/modules/esnext.map.every.js"),require("core-js/modules/esnext.map.filter.js"),require("core-js/modules/esnext.map.find.js"),require("core-js/modules/esnext.map.find-key.js"),require("core-js/modules/esnext.map.includes.js"),require("core-js/modules/esnext.map.key-of.js"),require("core-js/modules/esnext.map.map-keys.js"),require("core-js/modules/esnext.map.map-values.js"),require("core-js/modules/esnext.map.merge.js"),require("core-js/modules/esnext.map.reduce.js"),require("core-js/modules/esnext.map.some.js"),require("core-js/modules/esnext.map.update.js");var k=function(e){!function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&j(e,r)}(o,e);var r,t,n=(r=o,t=w(),function(){var e,n=g(r);if(t){var o=g(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return v(this,e)});function o(e){var r,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return b(this,o),r=n.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(y(r),o),r.name=t.name||"CustomError",r}return o}(h(Error));const R=require("chalk");var q=t.n(R);function O(e){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O(e)}console.log;var S=console.warn,E=console.error;"undefined"===("undefined"==typeof window?"undefined":O(window))&&(S=function(){return console.warn(q().yellow.apply(q(),arguments))},E=function(){return console.error(q().red.apply(q(),arguments))});var P=S,C=E;function D(e){return function(e){if(Array.isArray(e))return I(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(e){if("string"==typeof e)return I(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?I(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function F(e,r,t,n,o,u,a){try{var c=e[u](a),i=c.value}catch(e){return void t(e)}c.done?r(i):Promise.resolve(i).then(n,o)}function T(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var u=e.apply(r,t);function a(e){F(u,n,o,a,c,"next",e)}function c(e){F(u,n,o,a,c,"throw",e)}a(void 0)}))}}var _=function(e){return!e||e.startsWith("/")?e:c().resolve(process.cwd(),e)},A=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return!1;e=_(e);try{if(!p().existsSync(e)){if(!r)return!1;throw new k("File does not exist: ".concat(e))}}catch(t){if(!r)return!1;throw t instanceof k?t:new k("Error while accessing file: ".concat(e))}return!0},N=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return!1;e=_(e);try{if(!p().existsSync(e)){if(!r)return!1;throw new k("Directory does not exist: ".concat(e))}}catch(t){if(!r)return!1;throw t instanceof k?t:new k("Error while accessing directory: ".concat(e))}return!0},M=function(){var e=T(regeneratorRuntime.mark((function e(r){var t,n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>1&&void 0!==o[1]&&o[1],r){e.next=3;break}return e.abrupt("return",null);case 3:return r=_(r),n=null,e.prev=5,e.next=8,m().readFile(r,"utf8");case 8:n=e.sent,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(5),t&&P("Cannot read file: ".concat(r));case 14:return e.abrupt("return",n);case 15:case"end":return e.stop()}}),e,null,[[5,11]])})));return function(r){return e.apply(this,arguments)}}(),B=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;e=_(e);var t=null;try{t=p().readFileSync(e,"utf8")}catch(t){r&&P("Cannot read file: ".concat(e))}return t},G=function(){var e=T(regeneratorRuntime.mark((function e(r){var t,n,o,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=u.length>1&&void 0!==u[1]&&u[1],r){e.next=3;break}return e.abrupt("return",{dirs:null,files:null});case 3:return r=_(r),n=null,o=null,e.prev=6,e.next=9,m().readdir(r,{withFileTypes:!0});case 9:e.sent.forEach((function(e){e.isDirectory()?o?o.push(e.name):o=[e.name]:e.isFile()&&(n?n.push(e.name):n=[e.name])})),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(6),t&&P("Cannot read dir: ".concat(r));case 16:return e.abrupt("return",{dirs:o,files:n});case 17:case"end":return e.stop()}}),e,null,[[6,13]])})));return function(r){return e.apply(this,arguments)}}(),K=function(){var e=T(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>1&&void 0!==n[1]&&n[1],r){e.next=3;break}return e.abrupt("return",null);case 3:return r=_(r),e.next=6,G(r,t);case 6:return e.abrupt("return",e.sent.files);case 7:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),z=function(){var e=T(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>1&&void 0!==n[1]&&n[1],r){e.next=3;break}return e.abrupt("return",null);case 3:return r=_(r),e.next=6,G(r,t);case 6:return e.abrupt("return",e.sent.dirs);case 7:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),U=function(){var e=T(regeneratorRuntime.mark((function e(r){var t,n,o,u,a,c,i,s,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=l.length>1&&void 0!==l[1]?l[1]:"",r){e.next=3;break}return e.abrupt("return",null);case 3:return r=_(r),n=t?"".concat(r,"/").concat(t):r,e.next=7,G(n);case 7:return o=e.sent,u=o.dirs,a=o.files,c=(c=a||[]).map((function(e){return t?"".concat(t,"/").concat(e):e})),i=(u||[]).map((function(e){return t?"".concat(t,"/").concat(e):e})),s=i.map((function(e){return U(r,e)})),e.next=16,Promise.all(s);case 16:return e.sent.forEach((function(e){e&&(c=[].concat(D(c),D(e)))})),e.abrupt("return",c.length?c:null);case 19:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),H=function(e){return U(e)},Q=function(){var e=T(regeneratorRuntime.mark((function e(r,t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&t){e.next=2;break}return e.abrupt("return",!1);case 2:return r=_(r),e.prev=3,n=r.substring(0,r.lastIndexOf("/")),e.next=7,m().mkdir(n,{recursive:!0});case 7:return e.next=9,m().writeFile(r,t);case 9:e.next=15;break;case 11:return e.prev=11,e.t0=e.catch(3),console.error("Error while writing to ".concat(r),e.t0),e.abrupt("return",!1);case 15:return e.abrupt("return",!0);case 16:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(r,t){return e.apply(this,arguments)}}(),V=function(){var e=T(regeneratorRuntime.mark((function e(r,t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&t){e.next=2;break}return e.abrupt("return",!1);case 2:return r=_(r),e.prev=3,n=r.substring(0,r.lastIndexOf("/")),e.next=7,m().mkdir(n,{recursive:!0});case 7:return e.next=9,m().appendFile(r,t+"\n");case 9:e.next=15;break;case 11:return e.prev=11,e.t0=e.catch(3),console.error("Error while appending to ".concat(r),e.t0),e.abrupt("return",!1);case 15:return e.abrupt("return",!0);case 16:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(r,t){return e.apply(this,arguments)}}(),W=function(){var e=T(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&t){e.next=2;break}return e.abrupt("return",!1);case 2:return r=_(r),t=_(t),e.prev=4,e.next=7,m().rename(r,t);case 7:e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(4),console.error("Error while renaming file ".concat(r," to ").concat(t),e.t0),e.abrupt("return",!1);case 13:return e.abrupt("return",!0);case 14:case"end":return e.stop()}}),e,null,[[4,9]])})));return function(r,t){return e.apply(this,arguments)}}(),$=function(){var e=T(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return",!1);case 2:if(r=_(r),e.prev=3,N(r)){e.next=7;break}return e.next=7,m().mkdir(r,{recursive:!0});case 7:e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(3),console.error("Error while creating directory: ".concat(r),e.t0),e.abrupt("return",!1);case 13:return e.abrupt("return",!0);case 14:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(r){return e.apply(this,arguments)}}(),J=function(){var e=T(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return",!1);case 2:return r=_(r),e.prev=3,e.next=6,m().unlink(r);case 6:e.next=12;break;case 8:return e.prev=8,e.t0=e.catch(3),console.error("Error while deleting file ".concat(r),e.t0),e.abrupt("return",!1);case 12:return e.abrupt("return",!0);case 13:case"end":return e.stop()}}),e,null,[[3,8]])})));return function(r){return e.apply(this,arguments)}}(),L=function(){var e=T(regeneratorRuntime.mark((function e(r){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return",!1);case 2:return r=_(r),e.prev=3,n=t(76),o=s().promisify(n),e.next=8,o(r);case 8:e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(3),console.error("Error while deleting dir ".concat(r),e.t0),e.abrupt("return",!1);case 14:return e.abrupt("return",!0);case 15:case"end":return e.stop()}}),e,null,[[3,10]])})));return function(r){return e.apply(this,arguments)}}();require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/es.object.get-own-property-descriptors.js");const X=require("@aws-sdk/client-dynamodb"),Y=require("@aws-sdk/lib-dynamodb"),Z=require("short-uuid");var ee=t.n(Z);function re(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function te(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?re(Object(t),!0).forEach((function(r){ne(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):re(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function ne(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function oe(e,r,t,n,o,u,a){try{var c=e[u](a),i=c.value}catch(e){return void t(e)}c.done?r(i):Promise.resolve(i).then(n,o)}function ue(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var u=e.apply(r,t);function a(e){oe(u,n,o,a,c,"next",e)}function c(e){oe(u,n,o,a,c,"throw",e)}a(void 0)}))}}var ae=null,ce=function(){throw new k("DynamoDB is possibly uninitialized!",{name:"DynamoDBError"})},ie=function(e){var r=new X.DynamoDBClient({region:e});ae||(ae=Y.DynamoDBDocumentClient.from(r))},se=function(){var e=ue(regeneratorRuntime.mark((function e(r,t,n,o){var u,a,c,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ae){e.next=2;break}return e.abrupt("return",ce());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return t[n]||(t[n]=ee().uuid()),u={TableName:r,Item:t,ConditionExpression:"attribute_not_exists(".concat(n,")")},a=new Y.PutCommand(u),c=3,e.prev=8,e.next=11,ae.send(a);case 11:e.next=25;break;case 13:if(e.prev=13,e.t0=e.catch(8),"ConditionalCheckFailedException"!==e.t0.name){e.next=24;break}if(!(o<c-1)){e.next=22;break}return t[n]=ee().uuid(),e.next=20,se(r,t,n,o+1);case 20:return i=e.sent,e.abrupt("return",i);case 22:console.error("PutCommandInput:",u),console.error("[ERROR] Maximum attempts overflow!");case 24:return e.abrupt("return",null);case 25:return e.abrupt("return",t);case 26:case"end":return e.stop()}}),e,null,[[8,13]])})));return function(r,t,n,o){return e.apply(this,arguments)}}(),le=function(){var e=ue(regeneratorRuntime.mark((function e(r,t){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:"id",e.abrupt("return",se(r,t,n,0));case 2:case"end":return e.stop()}}),e)})));return function(r,t){return e.apply(this,arguments)}}(),pe=function(){var e=ue(regeneratorRuntime.mark((function e(r,t){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ae){e.next=2;break}return e.abrupt("return",ce());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return n={TableName:r,Item:t},o=new Y.PutCommand(n),e.prev=6,e.next=9,ae.send(o);case 9:e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(6),console.error("PutCommandInput:",n),console.error(e.t0),e.abrupt("return",null);case 16:return e.abrupt("return",!0);case 17:case"end":return e.stop()}}),e,null,[[6,11]])})));return function(r,t){return e.apply(this,arguments)}}(),fe=function(){var e=ue(regeneratorRuntime.mark((function e(r,t,n,o,u){var a,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ae){e.next=2;break}return e.abrupt("return",ce());case 2:if(r&&t&&n&&o){e.next=4;break}return e.abrupt("return",null);case 4:return a={TableName:r,Key:t,UpdateExpression:n,ExpressionAttributeValues:o},u&&(a=te(te({},a),{},{ExpressionAttributeNames:u})),c=new Y.UpdateCommand(a),e.prev=7,e.next=10,ae.send(c);case 10:e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(7),console.error("UpdateCommandInput:",a),console.error(e.t0),e.abrupt("return",null);case 17:return e.abrupt("return",!0);case 18:case"end":return e.stop()}}),e,null,[[7,12]])})));return function(r,t,n,o,u){return e.apply(this,arguments)}}(),me=function(){var e=ue(regeneratorRuntime.mark((function e(r,t,n,o){var u,a,c,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ae){e.next=2;break}return e.abrupt("return",ce());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return u=null,a={TableName:r,Key:t},n&&(a=te(te({},a),{},{ProjectionExpression:n})),o&&(a=te(te({},a),{},{ExpressionAttributeNames:o})),c=new Y.GetCommand(a),e.prev=9,e.next=12,ae.send(c);case 12:i=e.sent,(s=i.Item)&&(u=s),e.next=21;break;case 17:e.prev=17,e.t0=e.catch(9),console.error("GetCommandInput:",a),console.error(e.t0);case 21:return e.abrupt("return",u);case 22:case"end":return e.stop()}}),e,null,[[9,17]])})));return function(r,t,n,o){return e.apply(this,arguments)}}(),de=function(){var e=ue(regeneratorRuntime.mark((function e(r,t,n,o){var u,a,c,i,s,l,p,f=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=f.length>4&&void 0!==f[4]?f[4]:"",a=f.length>5&&void 0!==f[5]&&f[5],ae){e.next=4;break}return e.abrupt("return",ce());case 4:if(r&&n&&o){e.next=6;break}return e.abrupt("return",null);case 6:return c=null,i={TableName:r,KeyConditionExpression:n,ExpressionAttributeValues:o},t&&(i=te(te({},i),{},{IndexName:t})),u&&(i=te(te({},i),{},{ProjectionExpression:u})),a&&(i=te(te({},i),{},{ScanIndexForward:!1})),s=new Y.QueryCommand(i),e.prev=12,e.next=15,ae.send(s);case 15:l=e.sent,(p=l.Items)&&(c=p),e.next=24;break;case 20:e.prev=20,e.t0=e.catch(12),console.error("QueryCommandInput:",s.input),console.error(e.t0);case 24:return e.abrupt("return",c);case 25:case"end":return e.stop()}}),e,null,[[12,20]])})));return function(r,t,n,o){return e.apply(this,arguments)}}(),be=function(){var e=ue(regeneratorRuntime.mark((function e(r){var t,n,o,u,a,c,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>1&&void 0!==i[1]?i[1]:"",ae){e.next=3;break}return e.abrupt("return",ce());case 3:if(r){e.next=5;break}return e.abrupt("return",null);case 5:return n=null,o={TableName:r},t&&(o=te(te({},o),{},{ProjectionExpression:t})),u=new Y.ScanCommand(o),e.prev=9,e.next=12,ae.send(u);case 12:a=e.sent,(c=a.Items)&&(n=c),e.next=21;break;case 17:e.prev=17,e.t0=e.catch(9),console.error("ScanCommandInput:",o),console.error(e.t0);case 21:return e.abrupt("return",n);case 22:case"end":return e.stop()}}),e,null,[[9,17]])})));return function(r){return e.apply(this,arguments)}}(),ve=function(){var e=ue(regeneratorRuntime.mark((function e(r,t){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ae){e.next=2;break}return e.abrupt("return",ce());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return n={TableName:r,Key:t},o=new Y.DeleteCommand(n),e.prev=6,e.next=9,ae.send(o);case 9:e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(6),console.error("DeleteCommandInput:",n),console.error(e.t0),e.abrupt("return",!1);case 16:return e.abrupt("return",!0);case 17:case"end":return e.stop()}}),e,null,[[6,11]])})));return function(r,t){return e.apply(this,arguments)}}(),ye=ie,he=function(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(r,["init"]),xe=function(e){e?ye(e):C("AWS initialization error! Missing region: ".concat(e))};const we=require("@octokit/core");function je(e,r,t,n,o,u,a){try{var c=e[u](a),i=c.value}catch(e){return void t(e)}c.done?r(i):Promise.resolve(i).then(n,o)}var ge=null,ke=null,Re=function(){throw new k("GitHub SDK is possibly uninitialized!",{name:"GitHubError"})},qe=function(e,r){e&&r?(ge=new we.Octokit({auth:e}),ke=r):C("GitHub initialization error! authToken: ".concat(!!e,", account: ").concat(!!r))},Oe=function(){var e,r=(e=regeneratorRuntime.mark((function e(r,t){var n,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ge&&ke){e.next=2;break}return e.abrupt("return",Re());case 2:return e.prev=2,e.next=5,ge.request("GET /repos/{owner}/{repo}/contents/{path}",{owner:ke,repo:r,path:t});case 5:return n=e.sent,o=n.data,u=n.headers,e.abrupt("return",{response:o,headers:u});case 11:e.prev=11,e.t0=e.catch(2),C("[ERROR:gh.getContent]",e.t0);case 14:return e.abrupt("return",null);case 15:case"end":return e.stop()}}),e,null,[[2,11]])})),function(){var r=this,t=arguments;return new Promise((function(n,o){var u=e.apply(r,t);function a(e){je(u,n,o,a,c,"next",e)}function c(e){je(u,n,o,a,c,"throw",e)}a(void 0)}))});return function(e,t){return r.apply(this,arguments)}}();const Se={fs:e,aws:o,gh:u}})(),module.exports=n})();
|
|
1
|
+
(()=>{"use strict";var e={76:e=>{e.exports=require("rimraf")}},r={};function t(n){var o=r[n];if(void 0!==o)return o.exports;var u=r[n]={exports:{}};return e[n](u,u.exports,t),u.exports}t.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return t.d(r,{a:r}),r},t.d=(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{t.r(n),t.d(n,{aws:()=>o,default:()=>Ee,fs:()=>e,gh:()=>u});var e={};t.r(e),t.d(e,{appendToFile:()=>V,createDir:()=>$,deleteDir:()=>L,deleteFile:()=>J,existsDirSync:()=>N,existsFileSync:()=>A,readDir:()=>G,readDirDirs:()=>z,readDirFiles:()=>K,readDirFilesRec:()=>H,readFile:()=>M,readFileSync:()=>B,renameFile:()=>W,writeFile:()=>Q});var r={};t.r(r),t.d(r,{deleteItem:()=>ye,init:()=>ie,queryItems:()=>be,readItem:()=>de,scanItems:()=>ve,status:()=>se,updateItem:()=>me,writeItem:()=>fe,writeItemForce:()=>pe});var o={};t.r(o),t.d(o,{db:()=>we,init:()=>je,status:()=>ge});var u={};t.r(u),t.d(u,{getContent:()=>Se,init:()=>De}),require("regenerator-runtime/runtime.js"),require("core-js/modules/es.string.starts-with.js"),require("core-js/modules/es.array.for-each.js"),require("core-js/modules/web.dom-collections.for-each.js"),require("core-js/modules/es.array.concat.js"),require("core-js/modules/es.array.map.js"),require("core-js/modules/es.array.iterator.js"),require("core-js/modules/es.object.to-string.js"),require("core-js/modules/es.promise.js"),require("core-js/modules/es.string.iterator.js"),require("core-js/modules/web.dom-collections.iterator.js"),require("core-js/modules/es.array.last-index-of.js"),require("core-js/modules/es.symbol.js"),require("core-js/modules/es.symbol.description.js"),require("core-js/modules/es.symbol.iterator.js"),require("core-js/modules/es.array.from.js"),require("core-js/modules/es.array.slice.js");const a=require("path");var c=t.n(a);const i=require("util");var s=t.n(i);const l=require("fs");var p=t.n(l);const f=require("fs/promises");var m=t.n(f);function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function b(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function v(e,r){if(r&&("object"===d(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return y(e)}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){var r="function"==typeof Map?new Map:void 0;return h=function(e){if(null===e||(t=e,-1===Function.toString.call(t).indexOf("[native code]")))return e;var t;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,n)}function n(){return x(e,arguments,g(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),j(n,e)},h(e)}function x(e,r,t){return x=w()?Reflect.construct:function(e,r,t){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(e,n));return t&&j(o,t.prototype),o},x.apply(null,arguments)}function w(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function j(e,r){return j=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},j(e,r)}function g(e){return g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},g(e)}require("core-js/modules/es.object.set-prototype-of.js"),require("core-js/modules/es.object.get-prototype-of.js"),require("core-js/modules/es.array.index-of.js"),require("core-js/modules/es.regexp.to-string.js"),require("core-js/modules/es.reflect.construct.js"),require("core-js/modules/es.map.js"),require("core-js/modules/esnext.map.delete-all.js"),require("core-js/modules/esnext.map.every.js"),require("core-js/modules/esnext.map.filter.js"),require("core-js/modules/esnext.map.find.js"),require("core-js/modules/esnext.map.find-key.js"),require("core-js/modules/esnext.map.includes.js"),require("core-js/modules/esnext.map.key-of.js"),require("core-js/modules/esnext.map.map-keys.js"),require("core-js/modules/esnext.map.map-values.js"),require("core-js/modules/esnext.map.merge.js"),require("core-js/modules/esnext.map.reduce.js"),require("core-js/modules/esnext.map.some.js"),require("core-js/modules/esnext.map.update.js");var k=function(e){!function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&j(e,r)}(o,e);var r,t,n=(r=o,t=w(),function(){var e,n=g(r);if(t){var o=g(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return v(this,e)});function o(e){var r,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return b(this,o),r=n.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(y(r),o),r.name=t.name||"CustomError",r}return o}(h(Error));const R=require("chalk");var q=t.n(R);function O(e){return O="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O(e)}console.log;var C=console.warn,D=console.error;"undefined"===("undefined"==typeof window?"undefined":O(window))&&(C=function(){return console.warn(q().yellow.apply(q(),arguments))},D=function(){return console.error(q().red.apply(q(),arguments))});var S=C,E=D;function P(e){return function(e){if(Array.isArray(e))return I(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(e){if("string"==typeof e)return I(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?I(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function F(e,r,t,n,o,u,a){try{var c=e[u](a),i=c.value}catch(e){return void t(e)}c.done?r(i):Promise.resolve(i).then(n,o)}function T(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var u=e.apply(r,t);function a(e){F(u,n,o,a,c,"next",e)}function c(e){F(u,n,o,a,c,"throw",e)}a(void 0)}))}}var _=function(e){return!e||e.startsWith("/")?e:c().resolve(process.cwd(),e)},A=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return!1;e=_(e);try{if(!p().existsSync(e)){if(!r)return!1;throw new k("File does not exist: ".concat(e))}}catch(t){if(!r)return!1;throw t instanceof k?t:new k("Error while accessing file: ".concat(e))}return!0},N=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return!1;e=_(e);try{if(!p().existsSync(e)){if(!r)return!1;throw new k("Directory does not exist: ".concat(e))}}catch(t){if(!r)return!1;throw t instanceof k?t:new k("Error while accessing directory: ".concat(e))}return!0},M=function(){var e=T(regeneratorRuntime.mark((function e(r){var t,n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>1&&void 0!==o[1]&&o[1],r){e.next=3;break}return e.abrupt("return",null);case 3:return r=_(r),n=null,e.prev=5,e.next=8,m().readFile(r,"utf8");case 8:n=e.sent,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(5),t&&S("Cannot read file: ".concat(r));case 14:return e.abrupt("return",n);case 15:case"end":return e.stop()}}),e,null,[[5,11]])})));return function(r){return e.apply(this,arguments)}}(),B=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;e=_(e);var t=null;try{t=p().readFileSync(e,"utf8")}catch(t){r&&S("Cannot read file: ".concat(e))}return t},G=function(){var e=T(regeneratorRuntime.mark((function e(r){var t,n,o,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=u.length>1&&void 0!==u[1]&&u[1],r){e.next=3;break}return e.abrupt("return",{dirs:null,files:null});case 3:return r=_(r),n=null,o=null,e.prev=6,e.next=9,m().readdir(r,{withFileTypes:!0});case 9:e.sent.forEach((function(e){e.isDirectory()?o?o.push(e.name):o=[e.name]:e.isFile()&&(n?n.push(e.name):n=[e.name])})),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(6),t&&S("Cannot read dir: ".concat(r));case 16:return e.abrupt("return",{dirs:o,files:n});case 17:case"end":return e.stop()}}),e,null,[[6,13]])})));return function(r){return e.apply(this,arguments)}}(),K=function(){var e=T(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>1&&void 0!==n[1]&&n[1],r){e.next=3;break}return e.abrupt("return",null);case 3:return r=_(r),e.next=6,G(r,t);case 6:return e.abrupt("return",e.sent.files);case 7:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),z=function(){var e=T(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>1&&void 0!==n[1]&&n[1],r){e.next=3;break}return e.abrupt("return",null);case 3:return r=_(r),e.next=6,G(r,t);case 6:return e.abrupt("return",e.sent.dirs);case 7:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),U=function(){var e=T(regeneratorRuntime.mark((function e(r){var t,n,o,u,a,c,i,s,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=l.length>1&&void 0!==l[1]?l[1]:"",r){e.next=3;break}return e.abrupt("return",null);case 3:return r=_(r),n=t?"".concat(r,"/").concat(t):r,e.next=7,G(n);case 7:return o=e.sent,u=o.dirs,a=o.files,c=(c=a||[]).map((function(e){return t?"".concat(t,"/").concat(e):e})),i=(u||[]).map((function(e){return t?"".concat(t,"/").concat(e):e})),s=i.map((function(e){return U(r,e)})),e.next=16,Promise.all(s);case 16:return e.sent.forEach((function(e){e&&(c=[].concat(P(c),P(e)))})),e.abrupt("return",c.length?c:null);case 19:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),H=function(e){return U(e)},Q=function(){var e=T(regeneratorRuntime.mark((function e(r,t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&t){e.next=2;break}return e.abrupt("return",!1);case 2:return r=_(r),e.prev=3,n=r.substring(0,r.lastIndexOf("/")),e.next=7,m().mkdir(n,{recursive:!0});case 7:return e.next=9,m().writeFile(r,t);case 9:e.next=15;break;case 11:return e.prev=11,e.t0=e.catch(3),console.error("Error while writing to ".concat(r),e.t0),e.abrupt("return",!1);case 15:return e.abrupt("return",!0);case 16:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(r,t){return e.apply(this,arguments)}}(),V=function(){var e=T(regeneratorRuntime.mark((function e(r,t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&t){e.next=2;break}return e.abrupt("return",!1);case 2:return r=_(r),e.prev=3,n=r.substring(0,r.lastIndexOf("/")),e.next=7,m().mkdir(n,{recursive:!0});case 7:return e.next=9,m().appendFile(r,t+"\n");case 9:e.next=15;break;case 11:return e.prev=11,e.t0=e.catch(3),console.error("Error while appending to ".concat(r),e.t0),e.abrupt("return",!1);case 15:return e.abrupt("return",!0);case 16:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(r,t){return e.apply(this,arguments)}}(),W=function(){var e=T(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&t){e.next=2;break}return e.abrupt("return",!1);case 2:return r=_(r),t=_(t),e.prev=4,e.next=7,m().rename(r,t);case 7:e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(4),console.error("Error while renaming file ".concat(r," to ").concat(t),e.t0),e.abrupt("return",!1);case 13:return e.abrupt("return",!0);case 14:case"end":return e.stop()}}),e,null,[[4,9]])})));return function(r,t){return e.apply(this,arguments)}}(),$=function(){var e=T(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return",!1);case 2:if(r=_(r),e.prev=3,N(r)){e.next=7;break}return e.next=7,m().mkdir(r,{recursive:!0});case 7:e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(3),console.error("Error while creating directory: ".concat(r),e.t0),e.abrupt("return",!1);case 13:return e.abrupt("return",!0);case 14:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(r){return e.apply(this,arguments)}}(),J=function(){var e=T(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return",!1);case 2:return r=_(r),e.prev=3,e.next=6,m().unlink(r);case 6:e.next=12;break;case 8:return e.prev=8,e.t0=e.catch(3),console.error("Error while deleting file ".concat(r),e.t0),e.abrupt("return",!1);case 12:return e.abrupt("return",!0);case 13:case"end":return e.stop()}}),e,null,[[3,8]])})));return function(r){return e.apply(this,arguments)}}(),L=function(){var e=T(regeneratorRuntime.mark((function e(r){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return",!1);case 2:return r=_(r),e.prev=3,n=t(76),o=s().promisify(n),e.next=8,o(r);case 8:e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(3),console.error("Error while deleting dir ".concat(r),e.t0),e.abrupt("return",!1);case 14:return e.abrupt("return",!0);case 15:case"end":return e.stop()}}),e,null,[[3,10]])})));return function(r){return e.apply(this,arguments)}}();require("core-js/modules/es.object.keys.js"),require("core-js/modules/es.array.filter.js"),require("core-js/modules/es.object.get-own-property-descriptor.js"),require("core-js/modules/es.object.get-own-property-descriptors.js");const X=require("@aws-sdk/client-dynamodb"),Y=require("@aws-sdk/lib-dynamodb"),Z=require("short-uuid");var ee=t.n(Z);const re={dbDocClient:null,id:null};function te(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function ne(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?te(Object(t),!0).forEach((function(r){oe(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):te(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function oe(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ue(e,r,t,n,o,u,a){try{var c=e[u](a),i=c.value}catch(e){return void t(e)}c.done?r(i):Promise.resolve(i).then(n,o)}function ae(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var u=e.apply(r,t);function a(e){ue(u,n,o,a,c,"next",e)}function c(e){ue(u,n,o,a,c,"throw",e)}a(void 0)}))}}var ce=function(){throw new k("DynamoDB is possibly uninitialized!",{name:"DynamoDBError"})},ie=function(e){var r=new X.DynamoDBClient({region:e});return!re.dbDocClient&&(re.dbDocClient=Y.DynamoDBDocumentClient.from(r),re.id=ee().uuid(),!0)},se=function(){return re.id},le=function(){var e=ae(regeneratorRuntime.mark((function e(r,t,n,o){var u,a,c,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(re.dbDocClient){e.next=2;break}return e.abrupt("return",ce());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return t[n]||(t[n]=ee().uuid()),u={TableName:r,Item:t,ConditionExpression:"attribute_not_exists(".concat(n,")")},a=new Y.PutCommand(u),c=3,e.prev=8,e.next=11,re.dbDocClient.send(a);case 11:e.next=25;break;case 13:if(e.prev=13,e.t0=e.catch(8),"ConditionalCheckFailedException"!==e.t0.name){e.next=24;break}if(!(o<c-1)){e.next=22;break}return t[n]=ee().uuid(),e.next=20,le(r,t,n,o+1);case 20:return i=e.sent,e.abrupt("return",i);case 22:console.error("PutCommandInput:",u),console.error("[ERROR] Maximum attempts overflow!");case 24:return e.abrupt("return",null);case 25:return e.abrupt("return",t);case 26:case"end":return e.stop()}}),e,null,[[8,13]])})));return function(r,t,n,o){return e.apply(this,arguments)}}(),pe=function(){var e=ae(regeneratorRuntime.mark((function e(r,t){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:"id",e.abrupt("return",le(r,t,n,0));case 2:case"end":return e.stop()}}),e)})));return function(r,t){return e.apply(this,arguments)}}(),fe=function(){var e=ae(regeneratorRuntime.mark((function e(r,t){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(re.dbDocClient){e.next=2;break}return e.abrupt("return",ce());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return n={TableName:r,Item:t},o=new Y.PutCommand(n),e.prev=6,e.next=9,re.dbDocClient.send(o);case 9:e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(6),console.error("PutCommandInput:",n),console.error(e.t0),e.abrupt("return",null);case 16:return e.abrupt("return",!0);case 17:case"end":return e.stop()}}),e,null,[[6,11]])})));return function(r,t){return e.apply(this,arguments)}}(),me=function(){var e=ae(regeneratorRuntime.mark((function e(r,t,n,o,u){var a,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(re.dbDocClient){e.next=2;break}return e.abrupt("return",ce());case 2:if(r&&t&&n&&o){e.next=4;break}return e.abrupt("return",null);case 4:return a={TableName:r,Key:t,UpdateExpression:n,ExpressionAttributeValues:o},u&&(a=ne(ne({},a),{},{ExpressionAttributeNames:u})),c=new Y.UpdateCommand(a),e.prev=7,e.next=10,re.dbDocClient.send(c);case 10:e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(7),console.error("UpdateCommandInput:",a),console.error(e.t0),e.abrupt("return",null);case 17:return e.abrupt("return",!0);case 18:case"end":return e.stop()}}),e,null,[[7,12]])})));return function(r,t,n,o,u){return e.apply(this,arguments)}}(),de=function(){var e=ae(regeneratorRuntime.mark((function e(r,t,n,o){var u,a,c,i,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(re.dbDocClient){e.next=2;break}return e.abrupt("return",ce());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return u=null,a={TableName:r,Key:t},n&&(a=ne(ne({},a),{},{ProjectionExpression:n})),o&&(a=ne(ne({},a),{},{ExpressionAttributeNames:o})),c=new Y.GetCommand(a),e.prev=9,e.next=12,re.dbDocClient.send(c);case 12:i=e.sent,(s=i.Item)&&(u=s),e.next=21;break;case 17:e.prev=17,e.t0=e.catch(9),console.error("GetCommandInput:",a),console.error(e.t0);case 21:return e.abrupt("return",u);case 22:case"end":return e.stop()}}),e,null,[[9,17]])})));return function(r,t,n,o){return e.apply(this,arguments)}}(),be=function(){var e=ae(regeneratorRuntime.mark((function e(r,t,n,o){var u,a,c,i,s,l,p,f=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=f.length>4&&void 0!==f[4]?f[4]:"",a=f.length>5&&void 0!==f[5]&&f[5],re.dbDocClient){e.next=4;break}return e.abrupt("return",ce());case 4:if(r&&n&&o){e.next=6;break}return e.abrupt("return",null);case 6:return c=null,i={TableName:r,KeyConditionExpression:n,ExpressionAttributeValues:o},t&&(i=ne(ne({},i),{},{IndexName:t})),u&&(i=ne(ne({},i),{},{ProjectionExpression:u})),a&&(i=ne(ne({},i),{},{ScanIndexForward:!1})),s=new Y.QueryCommand(i),e.prev=12,e.next=15,re.dbDocClient.send(s);case 15:l=e.sent,(p=l.Items)&&(c=p),e.next=24;break;case 20:e.prev=20,e.t0=e.catch(12),console.error("QueryCommandInput:",s.input),console.error(e.t0);case 24:return e.abrupt("return",c);case 25:case"end":return e.stop()}}),e,null,[[12,20]])})));return function(r,t,n,o){return e.apply(this,arguments)}}(),ve=function(){var e=ae(regeneratorRuntime.mark((function e(r){var t,n,o,u,a,c,i=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>1&&void 0!==i[1]?i[1]:"",re.dbDocClient){e.next=3;break}return e.abrupt("return",ce());case 3:if(r){e.next=5;break}return e.abrupt("return",null);case 5:return n=null,o={TableName:r},t&&(o=ne(ne({},o),{},{ProjectionExpression:t})),u=new Y.ScanCommand(o),e.prev=9,e.next=12,re.dbDocClient.send(u);case 12:a=e.sent,(c=a.Items)&&(n=c),e.next=21;break;case 17:e.prev=17,e.t0=e.catch(9),console.error("ScanCommandInput:",o),console.error(e.t0);case 21:return e.abrupt("return",n);case 22:case"end":return e.stop()}}),e,null,[[9,17]])})));return function(r){return e.apply(this,arguments)}}(),ye=function(){var e=ae(regeneratorRuntime.mark((function e(r,t){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(re.dbDocClient){e.next=2;break}return e.abrupt("return",ce());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return n={TableName:r,Key:t},o=new Y.DeleteCommand(n),e.prev=6,e.next=9,re.dbDocClient.send(o);case 9:e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(6),console.error("DeleteCommandInput:",n),console.error(e.t0),e.abrupt("return",!1);case 16:return e.abrupt("return",!0);case 17:case"end":return e.stop()}}),e,null,[[6,11]])})));return function(r,t){return e.apply(this,arguments)}}(),he=ie,xe=se,we=function(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(r,["init","status"]),je=function(e){return e?he(e):(E("AWS initialization error! Missing region: ".concat(e)),!1)},ge=function(){return xe()};const ke=require("@octokit/core");function Re(e,r,t,n,o,u,a){try{var c=e[u](a),i=c.value}catch(e){return void t(e)}c.done?r(i):Promise.resolve(i).then(n,o)}var qe=null,Oe=null,Ce=function(){throw new k("GitHub SDK is possibly uninitialized!",{name:"GitHubError"})},De=function(e,r){e&&r?(qe=new ke.Octokit({auth:e}),Oe=r):E("GitHub initialization error! authToken: ".concat(!!e,", account: ").concat(!!r))},Se=function(){var e,r=(e=regeneratorRuntime.mark((function e(r,t){var n,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(qe&&Oe){e.next=2;break}return e.abrupt("return",Ce());case 2:return e.prev=2,e.next=5,qe.request("GET /repos/{owner}/{repo}/contents/{path}",{owner:Oe,repo:r,path:t});case 5:return n=e.sent,o=n.data,u=n.headers,e.abrupt("return",{response:o,headers:u});case 11:e.prev=11,e.t0=e.catch(2),E("[ERROR:gh.getContent]",e.t0);case 14:return e.abrupt("return",null);case 15:case"end":return e.stop()}}),e,null,[[2,11]])})),function(){var r=this,t=arguments;return new Promise((function(n,o){var u=e.apply(r,t);function a(e){Re(u,n,o,a,c,"next",e)}function c(e){Re(u,n,o,a,c,"throw",e)}a(void 0)}))});return function(e,t){return r.apply(this,arguments)}}();const Ee={fs:e,aws:o,gh:u}})(),module.exports=n})();
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","mappings":"iCAAAA,EAAOC,QAAUC,QAAQ,YCCrBC,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaL,QAGrB,IAAID,EAASG,EAAyBE,GAAY,CAGjDJ,QAAS,IAOV,OAHAO,EAAoBH,GAAUL,EAAQA,EAAOC,QAASG,GAG/CJ,EAAOC,QCpBfG,EAAoBK,EAAKT,IACxB,IAAIU,EAASV,GAAUA,EAAOW,WAC7B,IAAOX,EAAiB,QACxB,IAAM,EAEP,OADAI,EAAoBQ,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRN,EAAoBQ,EAAI,CAACX,EAASa,KACjC,IAAI,IAAIC,KAAOD,EACXV,EAAoBY,EAAEF,EAAYC,KAASX,EAAoBY,EAAEf,EAASc,IAC5EE,OAAOC,eAAejB,EAASc,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EX,EAAoBY,EAAI,CAACK,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFlB,EAAoBsB,EAAKzB,IACH,oBAAX0B,QAA0BA,OAAOC,aAC1CX,OAAOC,eAAejB,EAAS0B,OAAOC,YAAa,CAAEC,MAAO,WAE7DZ,OAAOC,eAAejB,EAAS,aAAc,CAAE4B,OAAO,K,qmBCLlB3B,QAAQ,kCCARA,QAAQ,4CCARA,QAAQ,wCCARA,QAAQ,mDCARA,QAAQ,sCCARA,QAAQ,mCCARA,QAAQ,wCCARA,QAAQ,0CCARA,QAAQ,iCCARA,QAAQ,yCCARA,QAAQ,mDCARA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,MADN,gCAIDsD,GAAOQ,QAAQ,4CAA6C,CAC/EP,MAAAA,GACAM,KAAAA,EACAlH,KAAAA,IAPoB,cAIhBoH,EAJgB,OAShBC,EAAWD,EAAOvD,KAChByD,EAAYF,EAAZE,QAVc,kBAWf,CAAED,SAAAA,EAAUC,QAAAA,IAXG,kCAatB5H,EAAM,wBAAD,MAbiB,iCAgBjB,MAhBiB,yD,iLAAH,wDC5BvB,UAAiBY,GAAAA,EAAIiH,IAAAA,EAAKC,GAAAA,I","sources":["webpack://@baadal-sdk/dapi/external commonjs \"rimraf\"","webpack://@baadal-sdk/dapi/webpack/bootstrap","webpack://@baadal-sdk/dapi/webpack/runtime/compat get default export","webpack://@baadal-sdk/dapi/webpack/runtime/define property getters","webpack://@baadal-sdk/dapi/webpack/runtime/hasOwnProperty shorthand","webpack://@baadal-sdk/dapi/webpack/runtime/make namespace object","webpack://@baadal-sdk/dapi/external commonjs \"regenerator-runtime/runtime.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.string.starts-with.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.for-each.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/web.dom-collections.for-each.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.concat.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.map.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.to-string.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.promise.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.string.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/web.dom-collections.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.last-index-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.symbol.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.symbol.description.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.symbol.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.from.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.slice.js\"","webpack://@baadal-sdk/dapi/external node-commonjs \"path\"","webpack://@baadal-sdk/dapi/external node-commonjs \"util\"","webpack://@baadal-sdk/dapi/external node-commonjs \"fs\"","webpack://@baadal-sdk/dapi/external node-commonjs \"fs/promises\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.set-prototype-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.get-prototype-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.index-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.regexp.to-string.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.reflect.construct.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.map.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.delete-all.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.every.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.filter.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.find.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.find-key.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.includes.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.key-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.map-keys.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.map-values.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.merge.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.reduce.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.some.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.update.js\"","webpack://@baadal-sdk/dapi/./src/common/error.ts","webpack://@baadal-sdk/dapi/external commonjs \"chalk\"","webpack://@baadal-sdk/dapi/./src/common/logger.ts","webpack://@baadal-sdk/dapi/./src/fs/index.ts","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.keys.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.filter.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.get-own-property-descriptor.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.get-own-property-descriptors.js\"","webpack://@baadal-sdk/dapi/external commonjs \"@aws-sdk/client-dynamodb\"","webpack://@baadal-sdk/dapi/external commonjs \"@aws-sdk/lib-dynamodb\"","webpack://@baadal-sdk/dapi/external commonjs \"short-uuid\"","webpack://@baadal-sdk/dapi/./src/aws/db.ts","webpack://@baadal-sdk/dapi/./src/aws/index.ts","webpack://@baadal-sdk/dapi/external commonjs \"@octokit/core\"","webpack://@baadal-sdk/dapi/./src/gh/index.ts","webpack://@baadal-sdk/dapi/./src/index.ts"],"sourcesContent":["module.exports = require(\"rimraf\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"regenerator-runtime/runtime.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.string.starts-with.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.for-each.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/web.dom-collections.for-each.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.concat.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.map.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.to-string.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.promise.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.string.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/web.dom-collections.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.last-index-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.symbol.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.symbol.description.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.symbol.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.from.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.slice.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"path\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"util\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"fs\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"fs/promises\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.set-prototype-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.get-prototype-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.index-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.regexp.to-string.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.reflect.construct.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.map.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.delete-all.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.every.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.filter.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.find.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.find-key.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.includes.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.key-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.map-keys.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.map-values.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.merge.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.reduce.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.some.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.update.js\");","export class CustomError extends Error {\n constructor(message: string, options: any = {}) {\n super(message);\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, CustomError);\n }\n\n this.name = options.name || 'CustomError';\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"chalk\");","import chalk from 'chalk';\n\nlet clog = console.log;\nlet cwarn = console.warn;\nlet cerror = console.error;\n\nif (typeof window === typeof undefined) {\n clog = (...args: any[]) => console.log(chalk.green(...args));\n cwarn = (...args: any[]) => console.warn(chalk.yellow(...args));\n cerror = (...args: any[]) => console.error(chalk.red(...args));\n}\n\nconst log = clog;\nconst warn = cwarn;\nconst error = cerror;\n\nexport { log, warn, error };\nexport default { log, warn, error };\n","import path from 'path';\nimport util from 'util';\nimport fs from 'fs';\nimport fsa from 'fs/promises';\n\nimport { CustomError } from '../common/error';\nimport { warn as cwarn } from '../common/logger';\n\nconst assertPath = (p: string) => {\n if (!p || p.startsWith('/')) return p;\n return path.resolve(process.cwd(), p);\n};\n\n/**\n * Check whether a file exists\n * @param file file path\n * @param loud whether to throw errors [default: false]\n * @returns true if it exists, false otherwise\n */\nexport const existsFileSync = (file: string, loud = false) => {\n if (!file) return false;\n file = assertPath(file);\n try {\n if (!fs.existsSync(file)) {\n if (!loud) return false;\n throw new CustomError(`File does not exist: ${file}`);\n }\n } catch (e) {\n if (!loud) return false;\n if (e instanceof CustomError) {\n throw e;\n } else {\n throw new CustomError(`Error while accessing file: ${file}`);\n }\n }\n return true;\n};\n\n/**\n * Check whether a directory exists\n * @param dir directory path\n * @param loud whether to throw errors [default: false]\n * @returns true if it exists, false otherwise\n */\nexport const existsDirSync = (dir: string, loud = false) => {\n if (!dir) return false;\n dir = assertPath(dir);\n try {\n if (!fs.existsSync(dir)) {\n if (!loud) return false;\n throw new CustomError(`Directory does not exist: ${dir}`);\n }\n } catch (e) {\n if (!loud) return false;\n if (e instanceof CustomError) {\n throw e;\n } else {\n throw new CustomError(`Error while accessing directory: ${dir}`);\n }\n }\n return true;\n};\n\n/**\n * Read contents of a file\n * @param file file path\n * @param warn whether to show warnings [default: false]\n * @returns contents of the file, null in case of error\n */\nexport const readFile = async (file: string, warn = false) => {\n if (!file) return null;\n file = assertPath(file);\n let contents = null;\n try {\n contents = await fsa.readFile(file, 'utf8');\n } catch (e) {\n if (warn) cwarn(`Cannot read file: ${file}`);\n }\n return contents;\n};\n\n/**\n * Read contents of a file\n * @param file file path\n * @param warn whether to show warnings [default: false]\n * @returns contents of the file, null in case of error\n */\nexport const readFileSync = (file: string, warn = false) => {\n if (!file) return null;\n file = assertPath(file);\n let contents = null;\n try {\n contents = fs.readFileSync(file, 'utf8');\n } catch (e) {\n if (warn) cwarn(`Cannot read file: ${file}`);\n }\n return contents;\n};\n\n/**\n * Get the list of files/directories in a directory\n * @param dir directory path\n * @param warn whether to show warnings [default: false]\n * @returns an object {dirs,files} containing list of directories & files\n */\nexport const readDir = async (dir: string, warn = false) => {\n if (!dir) return { dirs: null, files: null };\n dir = assertPath(dir);\n\n let files: string[] | null = null;\n let dirs: string[] | null = null;\n\n try {\n const items = await fsa.readdir(dir, { withFileTypes: true });\n items.forEach(item => {\n if (item.isDirectory()) {\n if (!dirs) {\n dirs = [item.name];\n } else {\n dirs.push(item.name);\n }\n } else if (item.isFile()) {\n if (!files) {\n files = [item.name];\n } else {\n files.push(item.name);\n }\n }\n });\n } catch (e) {\n if (warn) cwarn(`Cannot read dir: ${dir}`);\n }\n\n return { dirs, files } as { dirs: string[] | null; files: string[] | null };\n};\n\n/**\n * Get the list of files in a directory\n * @param dir directory path\n * @param warn whether to show warnings [default: false]\n * @returns list of files, null in case of error or no items\n */\nexport const readDirFiles = async (dir: string, warn = false) => {\n if (!dir) return null;\n dir = assertPath(dir);\n return (await readDir(dir, warn)).files;\n};\n\n/**\n * Get the list of directories in a directory\n * @param dir directory path\n * @param warn whether to show warnings [default: false]\n * @returns list of directories, null in case of error or no items\n */\nexport const readDirDirs = async (dir: string, warn = false) => {\n if (!dir) return null;\n dir = assertPath(dir);\n return (await readDir(dir, warn)).dirs;\n};\n\nconst readDirFilesRecHelper = async (dir: string, basePath = ''): Promise<string[] | null> => {\n if (!dir) return null;\n dir = assertPath(dir);\n\n const dirPath = basePath ? `${dir}/${basePath}` : dir;\n const { dirs, files } = await readDir(dirPath);\n let allFiles: string[] = files || [];\n allFiles = allFiles.map(file => (basePath ? `${basePath}/${file}` : file));\n const absDirs = (dirs || []).map(d => (basePath ? `${basePath}/${d}` : d));\n\n const pList = absDirs.map(dirx => readDirFilesRecHelper(dir, dirx));\n const filesxList = await Promise.all(pList);\n filesxList.forEach(filesx => {\n if (filesx) {\n allFiles = [...allFiles, ...filesx];\n }\n });\n\n return allFiles.length ? allFiles : null;\n};\n\n/**\n * Get the (recursive) list of files in a directory\n * @param dir directory path\n * @returns complete (recursive) list of files, null in case of error or no items\n */\nexport const readDirFilesRec = (dir: string) => readDirFilesRecHelper(dir);\n\n/**\n * Write contents to a file (creates the file path if it doesn't exist)\n * @param file file path\n * @param contents contents to write\n * @returns true if successful, false on error\n */\nexport const writeFile = async (file: string, contents: string) => {\n if (!file || !contents) return false;\n file = assertPath(file);\n try {\n const dir = file.substring(0, file.lastIndexOf('/'));\n await fsa.mkdir(dir, { recursive: true });\n await fsa.writeFile(file, contents);\n } catch (e) {\n console.error(`Error while writing to ${file}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Append contents to a file\n * @param file file path\n * @param contents contents to append\n * @returns true if successful, false on error\n */\nexport const appendToFile = async (file: string, contents: string) => {\n if (!file || !contents) return false;\n file = assertPath(file);\n try {\n const dir = file.substring(0, file.lastIndexOf('/'));\n await fsa.mkdir(dir, { recursive: true });\n\n await fsa.appendFile(file, contents + '\\n');\n\n // Ref: https://stackoverflow.com/a/43370201\n // const stream = fs.createWriteStream(file, { flags: 'a' });\n // stream.write(contents + '\\n');\n // stream.end();\n } catch (e) {\n console.error(`Error while appending to ${file}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Rename a file\n * @param oldpath old file path\n * @param newpath new file path\n * @returns true if successful, false on error\n */\nexport const renameFile = async (oldpath: string, newpath: string) => {\n if (!oldpath || !newpath) return false;\n oldpath = assertPath(oldpath);\n newpath = assertPath(newpath);\n try {\n await fsa.rename(oldpath, newpath);\n } catch (e) {\n console.error(`Error while renaming file ${oldpath} to ${newpath}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Create a directory, if it doesn't exist\n * @param dir directory path\n * @returns true if successful, false in case of failure\n */\nexport const createDir = async (dir: string) => {\n if (!dir) return false;\n dir = assertPath(dir);\n try {\n if (!existsDirSync(dir)) {\n await fsa.mkdir(dir, { recursive: true });\n }\n } catch (e) {\n console.error(`Error while creating directory: ${dir}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Delete a file\n * @param file file path\n * @returns true if successful, false on error\n */\nexport const deleteFile = async (file: string) => {\n if (!file) return false;\n file = assertPath(file);\n try {\n await fsa.unlink(file);\n } catch (e) {\n console.error(`Error while deleting file ${file}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Delete a directory\n * @param dir directory path\n * @returns true if successful, false on error\n */\nexport const deleteDir = async (dir: string) => {\n if (!dir) return false;\n dir = assertPath(dir);\n try {\n const rimraf = require('rimraf');\n const rimrafPr = util.promisify(rimraf);\n await rimrafPr(dir);\n\n // Added in: v14.14.0\n // await fsa.rm(dir, { recursive: true, force: true });\n } catch (e) {\n console.error(`Error while deleting dir ${dir}`, e);\n return false;\n }\n return true;\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.keys.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.filter.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.get-own-property-descriptor.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.get-own-property-descriptors.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@aws-sdk/client-dynamodb\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@aws-sdk/lib-dynamodb\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"short-uuid\");","/**\n * Partition key vs Composite primary key:\n * Ref: https://aws.amazon.com/premiumsupport/knowledge-center/primary-key-dynamodb-table/\n */\n\nimport { DynamoDBClient } from '@aws-sdk/client-dynamodb';\nimport {\n DynamoDBDocumentClient,\n GetCommand,\n GetCommandInput,\n PutCommand,\n PutCommandInput,\n UpdateCommand,\n UpdateCommandInput,\n QueryCommand,\n QueryCommandInput,\n ScanCommand,\n ScanCommandInput,\n DeleteCommand,\n DeleteCommandInput,\n} from '@aws-sdk/lib-dynamodb';\nimport short from 'short-uuid';\n\nimport { StringIndexable } from '../common/common.model';\nimport { CustomError } from '../common/error';\n\nlet dbDocClient: DynamoDBDocumentClient | null = null;\n\nconst DynamoDBError = (msg: string) => new CustomError(msg, { name: 'DynamoDBError' });\n\nconst initializationError = () => {\n throw DynamoDBError('DynamoDB is possibly uninitialized!');\n};\n\nexport const init = (region: string) => {\n const dbClient = new DynamoDBClient({ region });\n\n // Ref: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html#configuration\n if (!dbDocClient) {\n dbDocClient = DynamoDBDocumentClient.from(dbClient);\n }\n};\n\nconst writeItemForceHelper = async <T = any>(table: string, data: T, key: string, i: number): Promise<T | null> => {\n if (!dbDocClient) return initializationError();\n if (!table || !data) return null;\n\n if (!(data as any)[key]) {\n (data as any)[key] = short.uuid();\n }\n const cmdParams: PutCommandInput = { TableName: table, Item: data, ConditionExpression: `attribute_not_exists(${key})` };\n const command = new PutCommand(cmdParams);\n const numberOfAttempts = 3;\n\n try {\n await dbDocClient.send(command);\n } catch (err: any) {\n // console.error('PutCommandInput:', cmdParams);\n // console.error(err);\n if (err.name === 'ConditionalCheckFailedException') {\n if (i < numberOfAttempts - 1) {\n (data as any)[key] = short.uuid(); // new primary key\n const ret: T | null = await writeItemForceHelper(table, data, key, i + 1);\n return ret;\n }\n console.error('PutCommandInput:', cmdParams);\n console.error('[ERROR] Maximum attempts overflow!');\n }\n return null;\n }\n\n return data;\n};\n\nexport const writeItemForce = async <T = any>(table: string, data: T, key = 'id'): Promise<T | null> => {\n return writeItemForceHelper<T>(table, data, key, 0);\n};\n\nexport const writeItem = async (table: string, data: StringIndexable) => {\n if (!dbDocClient) return initializationError();\n if (!table || !data) return null;\n\n const cmdParams: PutCommandInput = { TableName: table, Item: data };\n const command = new PutCommand(cmdParams);\n\n try {\n await dbDocClient.send(command);\n } catch (err) {\n console.error('PutCommandInput:', cmdParams);\n console.error(err);\n return null;\n // throw err;\n }\n\n return true;\n};\n\nexport const updateItem = async (\n table: string,\n key: StringIndexable,\n update: string,\n attr: StringIndexable,\n attrNames?: StringIndexable\n) => {\n if (!dbDocClient) return initializationError();\n if (!table || !key || !update || !attr) return null;\n\n let cmdParams: UpdateCommandInput = {\n TableName: table,\n Key: key,\n UpdateExpression: update,\n ExpressionAttributeValues: attr,\n };\n if (attrNames) cmdParams = { ...cmdParams, ExpressionAttributeNames: attrNames };\n const command = new UpdateCommand(cmdParams);\n\n try {\n await dbDocClient.send(command);\n } catch (err) {\n console.error('UpdateCommandInput:', cmdParams);\n console.error(err);\n return null;\n // throw err;\n }\n\n return true;\n};\n\nexport const readItem = async <T = any>(\n table: string,\n key: StringIndexable,\n projection?: string,\n attrNames?: StringIndexable\n) => {\n if (!dbDocClient) return initializationError();\n if (!table || !key) return null;\n\n let contents: T | null = null;\n let cmdParams: GetCommandInput = { TableName: table, Key: key };\n\n // Ref: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ProjectionExpressions.html\n if (projection) cmdParams = { ...cmdParams, ProjectionExpression: projection };\n if (attrNames) cmdParams = { ...cmdParams, ExpressionAttributeNames: attrNames };\n\n const command = new GetCommand(cmdParams);\n\n try {\n const results = await dbDocClient.send(command);\n const item = results.Item;\n\n if (item) {\n contents = item as T;\n }\n } catch (err) {\n console.error('GetCommandInput:', cmdParams);\n console.error(err);\n // throw err;\n }\n\n return contents;\n};\n\nexport const queryItems = async (\n table: string,\n indexName: string,\n cond: string,\n attr: StringIndexable,\n projection = '',\n desc = false\n) => {\n if (!dbDocClient) return initializationError();\n if (!table || !cond || !attr) return null;\n\n let contents: StringIndexable[] | null = null;\n\n // Ref: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html\n // Ref: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/dynamodb-example-query-scan.html\n // Ref: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SQLtoNoSQL.Indexes.QueryAndScan.html#SQLtoNoSQL.Indexes.QueryAndScan.DynamoDB\n let cmdParams: QueryCommandInput = {\n TableName: table,\n KeyConditionExpression: cond,\n ExpressionAttributeValues: attr,\n // FilterExpression: \"contains (category_id, :cid)\",\n };\n\n if (indexName) cmdParams = { ...cmdParams, IndexName: indexName };\n if (projection) cmdParams = { ...cmdParams, ProjectionExpression: projection };\n if (desc) cmdParams = { ...cmdParams, ScanIndexForward: false };\n\n const command = new QueryCommand(cmdParams);\n\n try {\n const results = await dbDocClient.send(command);\n const items = results.Items;\n\n if (items) {\n contents = items;\n }\n } catch (err) {\n console.error('QueryCommandInput:', command.input);\n console.error(err);\n // throw err;\n }\n\n return contents;\n};\n\nexport const scanItems = async (table: string, projection = '') => {\n if (!dbDocClient) return initializationError();\n if (!table) return null;\n\n let contents: StringIndexable[] | null = null;\n\n // Ref: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/dynamodb-example-query-scan.html\n let cmdParams: ScanCommandInput = {\n TableName: table,\n };\n\n if (projection) cmdParams = { ...cmdParams, ProjectionExpression: projection };\n\n const command = new ScanCommand(cmdParams);\n\n try {\n const results = await dbDocClient.send(command);\n const items = results.Items;\n\n if (items) {\n contents = items;\n }\n } catch (err) {\n console.error('ScanCommandInput:', cmdParams);\n console.error(err);\n // throw err;\n }\n\n return contents;\n};\n\nexport const deleteItem = async (table: string, key: StringIndexable) => {\n if (!dbDocClient) return initializationError();\n if (!table || !key) return null;\n\n const cmdParams: DeleteCommandInput = { TableName: table, Key: key };\n const command = new DeleteCommand(cmdParams);\n\n try {\n await dbDocClient.send(command);\n } catch (err) {\n console.error('DeleteCommandInput:', cmdParams);\n console.error(err);\n // throw err;\n return false;\n }\n\n return true;\n};\n\n// ----------------\n\n// await dbWriteItem('lesson_list', { id: 'id_001', title: 'My Lesson' });\n\n// const contents = await dbReadItem('lesson_list', { id: 'id_001' });\n// console.log(contents);\n\n// await dbUpdateItem(\n// 'lesson_list',\n// { id: 'id_001' },\n// 'set #a = :a, #b = :b',\n// { ':a': 'abhi@raj.me', ':b': 'Abhishek Raj' },\n// { '#a': 'email', '#b': 'name' }\n// );\n\n// ----------------\n","import * as dbAll from './db';\nimport { error } from '../common/logger';\n\nconst { init: dbInit, ...db } = dbAll;\n\nconst init = (region: string) => {\n if (!region) {\n error(`AWS initialization error! Missing region: ${region}`);\n return;\n }\n\n dbInit(region);\n};\n\nexport { db, init }; // named exports\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@octokit/core\");","import { Octokit } from '@octokit/core';\n\nimport { CustomError } from '../common/error';\nimport { error } from '../common/logger';\n\nlet github: Octokit | null = null;\nlet owner: string | null = null;\n\nconst GitHubError = (msg: string) => new CustomError(msg, { name: 'GitHubError' });\n\nconst initializationError = () => {\n throw GitHubError('GitHub SDK is possibly uninitialized!');\n};\n\n/**\n * Initialize GitHub SDK\n * @param authToken GitHub auth token for the user account [GITHUB_TOKEN]\n * @param account account id for the GitHub user account [GITHUB_ACCOUNT]\n */\nexport const init = (authToken: string, account: string) => {\n if (!authToken || !account) {\n error(`GitHub initialization error! authToken: ${!!authToken}, account: ${!!account}`);\n return;\n }\n github = new Octokit({ auth: authToken });\n owner = account;\n};\n\n/**\n * Get contents of a particular file in a repo\n * @param repo name of the repo\n * @param path path of a file in the repo\n * @returns an object {response,headers} containing response and response headers, null in case of error\n */\nexport const getContent = async (repo: string, path: string) => {\n if (!github || !owner) return initializationError();\n\n try {\n const ghResp = await github.request('GET /repos/{owner}/{repo}/contents/{path}', {\n owner,\n repo,\n path,\n });\n const response = ghResp.data as GitHubContent;\n const { headers } = ghResp;\n return { response, headers };\n } catch (e) {\n error(`[ERROR:gh.getContent]`, e);\n }\n\n return null;\n};\n\n// --------------\n\nexport interface GitHubContent {\n path: string;\n content: string;\n sha: string;\n}\n","import * as fs from './fs';\nimport * as aws from './aws';\nimport * as gh from './gh';\n\n// Ref: https://stackoverflow.com/a/41283945\nexport { fs, aws, gh }; // named exports\nexport default { fs, aws, gh }; // default export\n"],"names":["module","exports","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","CustomError","message","options","Error","captureStackTrace","name","console","log","cwarn","warn","cerror","error","window","chalk","assertPath","p","startsWith","path","process","cwd","existsFileSync","file","loud","fs","e","existsDirSync","dir","readFile","contents","fsa","readFileSync","readDir","dirs","files","withFileTypes","forEach","item","isDirectory","push","isFile","readDirFiles","readDirDirs","readDirFilesRecHelper","basePath","dirPath","allFiles","map","absDirs","pList","dirx","Promise","all","filesx","length","readDirFilesRec","writeFile","substring","lastIndexOf","recursive","appendToFile","renameFile","oldpath","newpath","createDir","deleteFile","deleteDir","rimraf","rimrafPr","util","dbDocClient","initializationError","init","region","dbClient","DynamoDBClient","DynamoDBDocumentClient","writeItemForceHelper","table","data","i","short","cmdParams","TableName","Item","ConditionExpression","command","PutCommand","numberOfAttempts","send","ret","writeItemForce","writeItem","updateItem","update","attr","attrNames","Key","UpdateExpression","ExpressionAttributeValues","ExpressionAttributeNames","UpdateCommand","readItem","projection","ProjectionExpression","GetCommand","results","queryItems","indexName","cond","desc","KeyConditionExpression","IndexName","ScanIndexForward","QueryCommand","items","Items","input","scanItems","ScanCommand","deleteItem","DeleteCommand","dbInit","dbAll","db","github","owner","authToken","account","Octokit","auth","getContent","repo","request","ghResp","response","headers","aws","gh"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"index.js","mappings":"iCAAAA,EAAOC,QAAUC,QAAQ,YCCrBC,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaL,QAGrB,IAAID,EAASG,EAAyBE,GAAY,CAGjDJ,QAAS,IAOV,OAHAO,EAAoBH,GAAUL,EAAQA,EAAOC,QAASG,GAG/CJ,EAAOC,QCpBfG,EAAoBK,EAAKT,IACxB,IAAIU,EAASV,GAAUA,EAAOW,WAC7B,IAAOX,EAAiB,QACxB,IAAM,EAEP,OADAI,EAAoBQ,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRN,EAAoBQ,EAAI,CAACX,EAASa,KACjC,IAAI,IAAIC,KAAOD,EACXV,EAAoBY,EAAEF,EAAYC,KAASX,EAAoBY,EAAEf,EAASc,IAC5EE,OAAOC,eAAejB,EAASc,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EX,EAAoBY,EAAI,CAACK,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFlB,EAAoBsB,EAAKzB,IACH,oBAAX0B,QAA0BA,OAAOC,aAC1CX,OAAOC,eAAejB,EAAS0B,OAAOC,YAAa,CAAEC,MAAO,WAE7DZ,OAAOC,eAAejB,EAAS,aAAc,C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9D,EAAM,6CAAD,OAA8C8D,KAC5C,IAMLM,GAAS,WACb,OAAO8C,MCfT,MAAM,GAA+BzJ,QAAQ,iB,0HCK7C,IAAI2J,GAAyB,KACzBC,GAAuB,KAIrBzD,GAAsB,WAC1B,MAHmC,IAAIvE,EAGrB,wCAHsC,CAAEK,KAAM,iBAWrDmE,GAAO,SAACyD,EAAmBC,GACjCD,GAAcC,GAInBH,GAAS,IAAII,GAAAA,QAAQ,CAAEC,KAAMH,IAC7BD,GAAQE,GAJNvH,EAAM,2CAAD,SAA8CsH,EAA9C,wBAAuEC,KAanEG,GAAU,e,EAAA,G,EAAA,yBAAG,WAAOC,EAAcrH,GAArB,6FACnB8G,IAAWC,GADQ,yCACMzD,MADN,gCAIDwD,GAAOQ,QAAQ,4CAA6C,CAC/EP,MAAAA,GACAM,KAAAA,EACArH,KAAAA,IAPoB,cAIhBuH,EAJgB,OAShBC,EAAWD,EAAOtD,KAChBwD,EAAYF,EAAZE,QAVc,kBAWf,CAAED,SAAAA,EAAUC,QAAAA,IAXG,kCAatB/H,EAAM,wBAAD,MAbiB,iCAgBjB,MAhBiB,yD,iLAAH,wDC5BvB,UAAiBY,GAAAA,EAAIoH,IAAAA,EAAKC,GAAAA,I","sources":["webpack://@baadal-sdk/dapi/external commonjs \"rimraf\"","webpack://@baadal-sdk/dapi/webpack/bootstrap","webpack://@baadal-sdk/dapi/webpack/runtime/compat get default export","webpack://@baadal-sdk/dapi/webpack/runtime/define property getters","webpack://@baadal-sdk/dapi/webpack/runtime/hasOwnProperty shorthand","webpack://@baadal-sdk/dapi/webpack/runtime/make namespace object","webpack://@baadal-sdk/dapi/external commonjs \"regenerator-runtime/runtime.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.string.starts-with.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.for-each.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/web.dom-collections.for-each.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.concat.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.map.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.to-string.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.promise.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.string.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/web.dom-collections.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.last-index-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.symbol.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.symbol.description.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.symbol.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.from.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.slice.js\"","webpack://@baadal-sdk/dapi/external node-commonjs \"path\"","webpack://@baadal-sdk/dapi/external node-commonjs \"util\"","webpack://@baadal-sdk/dapi/external node-commonjs \"fs\"","webpack://@baadal-sdk/dapi/external node-commonjs \"fs/promises\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.set-prototype-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.get-prototype-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.index-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.regexp.to-string.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.reflect.construct.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.map.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.delete-all.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.every.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.filter.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.find.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.find-key.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.includes.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.key-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.map-keys.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.map-values.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.merge.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.reduce.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.some.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.update.js\"","webpack://@baadal-sdk/dapi/./src/common/error.ts","webpack://@baadal-sdk/dapi/external commonjs \"chalk\"","webpack://@baadal-sdk/dapi/./src/common/logger.ts","webpack://@baadal-sdk/dapi/./src/fs/index.ts","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.keys.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.filter.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.get-own-property-descriptor.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.get-own-property-descriptors.js\"","webpack://@baadal-sdk/dapi/external commonjs \"@aws-sdk/client-dynamodb\"","webpack://@baadal-sdk/dapi/external commonjs \"@aws-sdk/lib-dynamodb\"","webpack://@baadal-sdk/dapi/external commonjs \"short-uuid\"","webpack://@baadal-sdk/dapi/./src/aws/db-client.ts","webpack://@baadal-sdk/dapi/./src/aws/db.ts","webpack://@baadal-sdk/dapi/./src/aws/index.ts","webpack://@baadal-sdk/dapi/external commonjs \"@octokit/core\"","webpack://@baadal-sdk/dapi/./src/gh/index.ts","webpack://@baadal-sdk/dapi/./src/index.ts"],"sourcesContent":["module.exports = require(\"rimraf\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"regenerator-runtime/runtime.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.string.starts-with.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.for-each.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/web.dom-collections.for-each.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.concat.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.map.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.to-string.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.promise.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.string.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/web.dom-collections.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.last-index-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.symbol.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.symbol.description.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.symbol.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.from.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.slice.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"path\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"util\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"fs\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"fs/promises\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.set-prototype-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.get-prototype-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.index-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.regexp.to-string.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.reflect.construct.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.map.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.delete-all.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.every.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.filter.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.find.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.find-key.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.includes.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.key-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.map-keys.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.map-values.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.merge.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.reduce.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.some.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.update.js\");","export class CustomError extends Error {\n constructor(message: string, options: any = {}) {\n super(message);\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, CustomError);\n }\n\n this.name = options.name || 'CustomError';\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"chalk\");","import chalk from 'chalk';\n\nlet clog = console.log;\nlet cwarn = console.warn;\nlet cerror = console.error;\n\nif (typeof window === typeof undefined) {\n clog = (...args: any[]) => console.log(chalk.green(...args));\n cwarn = (...args: any[]) => console.warn(chalk.yellow(...args));\n cerror = (...args: any[]) => console.error(chalk.red(...args));\n}\n\nconst log = clog;\nconst warn = cwarn;\nconst error = cerror;\n\nexport { log, warn, error };\nexport default { log, warn, error };\n","import path from 'path';\nimport util from 'util';\nimport fs from 'fs';\nimport fsa from 'fs/promises';\n\nimport { CustomError } from '../common/error';\nimport { warn as cwarn } from '../common/logger';\n\nconst assertPath = (p: string) => {\n if (!p || p.startsWith('/')) return p;\n return path.resolve(process.cwd(), p);\n};\n\n/**\n * Check whether a file exists\n * @param file file path\n * @param loud whether to throw errors [default: false]\n * @returns true if it exists, false otherwise\n */\nexport const existsFileSync = (file: string, loud = false) => {\n if (!file) return false;\n file = assertPath(file);\n try {\n if (!fs.existsSync(file)) {\n if (!loud) return false;\n throw new CustomError(`File does not exist: ${file}`);\n }\n } catch (e) {\n if (!loud) return false;\n if (e instanceof CustomError) {\n throw e;\n } else {\n throw new CustomError(`Error while accessing file: ${file}`);\n }\n }\n return true;\n};\n\n/**\n * Check whether a directory exists\n * @param dir directory path\n * @param loud whether to throw errors [default: false]\n * @returns true if it exists, false otherwise\n */\nexport const existsDirSync = (dir: string, loud = false) => {\n if (!dir) return false;\n dir = assertPath(dir);\n try {\n if (!fs.existsSync(dir)) {\n if (!loud) return false;\n throw new CustomError(`Directory does not exist: ${dir}`);\n }\n } catch (e) {\n if (!loud) return false;\n if (e instanceof CustomError) {\n throw e;\n } else {\n throw new CustomError(`Error while accessing directory: ${dir}`);\n }\n }\n return true;\n};\n\n/**\n * Read contents of a file\n * @param file file path\n * @param warn whether to show warnings [default: false]\n * @returns contents of the file, null in case of error\n */\nexport const readFile = async (file: string, warn = false) => {\n if (!file) return null;\n file = assertPath(file);\n let contents = null;\n try {\n contents = await fsa.readFile(file, 'utf8');\n } catch (e) {\n if (warn) cwarn(`Cannot read file: ${file}`);\n }\n return contents;\n};\n\n/**\n * Read contents of a file\n * @param file file path\n * @param warn whether to show warnings [default: false]\n * @returns contents of the file, null in case of error\n */\nexport const readFileSync = (file: string, warn = false) => {\n if (!file) return null;\n file = assertPath(file);\n let contents = null;\n try {\n contents = fs.readFileSync(file, 'utf8');\n } catch (e) {\n if (warn) cwarn(`Cannot read file: ${file}`);\n }\n return contents;\n};\n\n/**\n * Get the list of files/directories in a directory\n * @param dir directory path\n * @param warn whether to show warnings [default: false]\n * @returns an object {dirs,files} containing list of directories & files\n */\nexport const readDir = async (dir: string, warn = false) => {\n if (!dir) return { dirs: null, files: null };\n dir = assertPath(dir);\n\n let files: string[] | null = null;\n let dirs: string[] | null = null;\n\n try {\n const items = await fsa.readdir(dir, { withFileTypes: true });\n items.forEach(item => {\n if (item.isDirectory()) {\n if (!dirs) {\n dirs = [item.name];\n } else {\n dirs.push(item.name);\n }\n } else if (item.isFile()) {\n if (!files) {\n files = [item.name];\n } else {\n files.push(item.name);\n }\n }\n });\n } catch (e) {\n if (warn) cwarn(`Cannot read dir: ${dir}`);\n }\n\n return { dirs, files } as { dirs: string[] | null; files: string[] | null };\n};\n\n/**\n * Get the list of files in a directory\n * @param dir directory path\n * @param warn whether to show warnings [default: false]\n * @returns list of files, null in case of error or no items\n */\nexport const readDirFiles = async (dir: string, warn = false) => {\n if (!dir) return null;\n dir = assertPath(dir);\n return (await readDir(dir, warn)).files;\n};\n\n/**\n * Get the list of directories in a directory\n * @param dir directory path\n * @param warn whether to show warnings [default: false]\n * @returns list of directories, null in case of error or no items\n */\nexport const readDirDirs = async (dir: string, warn = false) => {\n if (!dir) return null;\n dir = assertPath(dir);\n return (await readDir(dir, warn)).dirs;\n};\n\nconst readDirFilesRecHelper = async (dir: string, basePath = ''): Promise<string[] | null> => {\n if (!dir) return null;\n dir = assertPath(dir);\n\n const dirPath = basePath ? `${dir}/${basePath}` : dir;\n const { dirs, files } = await readDir(dirPath);\n let allFiles: string[] = files || [];\n allFiles = allFiles.map(file => (basePath ? `${basePath}/${file}` : file));\n const absDirs = (dirs || []).map(d => (basePath ? `${basePath}/${d}` : d));\n\n const pList = absDirs.map(dirx => readDirFilesRecHelper(dir, dirx));\n const filesxList = await Promise.all(pList);\n filesxList.forEach(filesx => {\n if (filesx) {\n allFiles = [...allFiles, ...filesx];\n }\n });\n\n return allFiles.length ? allFiles : null;\n};\n\n/**\n * Get the (recursive) list of files in a directory\n * @param dir directory path\n * @returns complete (recursive) list of files, null in case of error or no items\n */\nexport const readDirFilesRec = (dir: string) => readDirFilesRecHelper(dir);\n\n/**\n * Write contents to a file (creates the file path if it doesn't exist)\n * @param file file path\n * @param contents contents to write\n * @returns true if successful, false on error\n */\nexport const writeFile = async (file: string, contents: string) => {\n if (!file || !contents) return false;\n file = assertPath(file);\n try {\n const dir = file.substring(0, file.lastIndexOf('/'));\n await fsa.mkdir(dir, { recursive: true });\n await fsa.writeFile(file, contents);\n } catch (e) {\n console.error(`Error while writing to ${file}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Append contents to a file\n * @param file file path\n * @param contents contents to append\n * @returns true if successful, false on error\n */\nexport const appendToFile = async (file: string, contents: string) => {\n if (!file || !contents) return false;\n file = assertPath(file);\n try {\n const dir = file.substring(0, file.lastIndexOf('/'));\n await fsa.mkdir(dir, { recursive: true });\n\n await fsa.appendFile(file, contents + '\\n');\n\n // Ref: https://stackoverflow.com/a/43370201\n // const stream = fs.createWriteStream(file, { flags: 'a' });\n // stream.write(contents + '\\n');\n // stream.end();\n } catch (e) {\n console.error(`Error while appending to ${file}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Rename a file\n * @param oldpath old file path\n * @param newpath new file path\n * @returns true if successful, false on error\n */\nexport const renameFile = async (oldpath: string, newpath: string) => {\n if (!oldpath || !newpath) return false;\n oldpath = assertPath(oldpath);\n newpath = assertPath(newpath);\n try {\n await fsa.rename(oldpath, newpath);\n } catch (e) {\n console.error(`Error while renaming file ${oldpath} to ${newpath}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Create a directory, if it doesn't exist\n * @param dir directory path\n * @returns true if successful, false in case of failure\n */\nexport const createDir = async (dir: string) => {\n if (!dir) return false;\n dir = assertPath(dir);\n try {\n if (!existsDirSync(dir)) {\n await fsa.mkdir(dir, { recursive: true });\n }\n } catch (e) {\n console.error(`Error while creating directory: ${dir}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Delete a file\n * @param file file path\n * @returns true if successful, false on error\n */\nexport const deleteFile = async (file: string) => {\n if (!file) return false;\n file = assertPath(file);\n try {\n await fsa.unlink(file);\n } catch (e) {\n console.error(`Error while deleting file ${file}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Delete a directory\n * @param dir directory path\n * @returns true if successful, false on error\n */\nexport const deleteDir = async (dir: string) => {\n if (!dir) return false;\n dir = assertPath(dir);\n try {\n const rimraf = require('rimraf');\n const rimrafPr = util.promisify(rimraf);\n await rimrafPr(dir);\n\n // Added in: v14.14.0\n // await fsa.rm(dir, { recursive: true, force: true });\n } catch (e) {\n console.error(`Error while deleting dir ${dir}`, e);\n return false;\n }\n return true;\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.keys.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.filter.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.get-own-property-descriptor.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.get-own-property-descriptors.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@aws-sdk/client-dynamodb\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@aws-sdk/lib-dynamodb\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"short-uuid\");","import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';\n\nconst dbDocClient: DynamoDBDocumentClient | null = null;\nconst id: string | null = null;\n\nexport default { dbDocClient, id } as { dbDocClient: DynamoDBDocumentClient | null; id: string | null };\n","/**\n * Partition key vs Composite primary key:\n * Ref: https://aws.amazon.com/premiumsupport/knowledge-center/primary-key-dynamodb-table/\n */\n\nimport { DynamoDBClient } from '@aws-sdk/client-dynamodb';\nimport {\n DynamoDBDocumentClient,\n GetCommand,\n GetCommandInput,\n PutCommand,\n PutCommandInput,\n UpdateCommand,\n UpdateCommandInput,\n QueryCommand,\n QueryCommandInput,\n ScanCommand,\n ScanCommandInput,\n DeleteCommand,\n DeleteCommandInput,\n} from '@aws-sdk/lib-dynamodb';\nimport short from 'short-uuid';\n\nimport dbClient from './db-client';\nimport { StringIndexable } from '../common/common.model';\nimport { CustomError } from '../common/error';\n\nconst DynamoDBError = (msg: string) => new CustomError(msg, { name: 'DynamoDBError' });\n\nconst initializationError = () => {\n throw DynamoDBError('DynamoDB is possibly uninitialized!');\n};\n\nexport const init = (region: string) => {\n const dydbClient = new DynamoDBClient({ region });\n\n // Ref: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html#configuration\n if (!dbClient.dbDocClient) {\n dbClient.dbDocClient = DynamoDBDocumentClient.from(dydbClient);\n dbClient.id = short.uuid();\n return true;\n }\n return false;\n};\n\nexport const status = () => dbClient.id;\n\nconst writeItemForceHelper = async <T = any>(table: string, data: T, key: string, i: number): Promise<T | null> => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table || !data) return null;\n\n if (!(data as any)[key]) {\n (data as any)[key] = short.uuid();\n }\n const cmdParams: PutCommandInput = { TableName: table, Item: data, ConditionExpression: `attribute_not_exists(${key})` };\n const command = new PutCommand(cmdParams);\n const numberOfAttempts = 3;\n\n try {\n await dbClient.dbDocClient.send(command);\n } catch (err: any) {\n // console.error('PutCommandInput:', cmdParams);\n // console.error(err);\n if (err.name === 'ConditionalCheckFailedException') {\n if (i < numberOfAttempts - 1) {\n (data as any)[key] = short.uuid(); // new primary key\n const ret: T | null = await writeItemForceHelper(table, data, key, i + 1);\n return ret;\n }\n console.error('PutCommandInput:', cmdParams);\n console.error('[ERROR] Maximum attempts overflow!');\n }\n return null;\n }\n\n return data;\n};\n\nexport const writeItemForce = async <T = any>(table: string, data: T, key = 'id'): Promise<T | null> => {\n return writeItemForceHelper<T>(table, data, key, 0);\n};\n\nexport const writeItem = async (table: string, data: StringIndexable) => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table || !data) return null;\n\n const cmdParams: PutCommandInput = { TableName: table, Item: data };\n const command = new PutCommand(cmdParams);\n\n try {\n await dbClient.dbDocClient.send(command);\n } catch (err) {\n console.error('PutCommandInput:', cmdParams);\n console.error(err);\n return null;\n // throw err;\n }\n\n return true;\n};\n\nexport const updateItem = async (\n table: string,\n key: StringIndexable,\n update: string,\n attr: StringIndexable,\n attrNames?: StringIndexable\n) => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table || !key || !update || !attr) return null;\n\n let cmdParams: UpdateCommandInput = {\n TableName: table,\n Key: key,\n UpdateExpression: update,\n ExpressionAttributeValues: attr,\n };\n if (attrNames) cmdParams = { ...cmdParams, ExpressionAttributeNames: attrNames };\n const command = new UpdateCommand(cmdParams);\n\n try {\n await dbClient.dbDocClient.send(command);\n } catch (err) {\n console.error('UpdateCommandInput:', cmdParams);\n console.error(err);\n return null;\n // throw err;\n }\n\n return true;\n};\n\nexport const readItem = async <T = any>(\n table: string,\n key: StringIndexable,\n projection?: string,\n attrNames?: StringIndexable\n) => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table || !key) return null;\n\n let contents: T | null = null;\n let cmdParams: GetCommandInput = { TableName: table, Key: key };\n\n // Ref: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ProjectionExpressions.html\n if (projection) cmdParams = { ...cmdParams, ProjectionExpression: projection };\n if (attrNames) cmdParams = { ...cmdParams, ExpressionAttributeNames: attrNames };\n\n const command = new GetCommand(cmdParams);\n\n try {\n const results = await dbClient.dbDocClient.send(command);\n const item = results.Item;\n\n if (item) {\n contents = item as T;\n }\n } catch (err) {\n console.error('GetCommandInput:', cmdParams);\n console.error(err);\n // throw err;\n }\n\n return contents;\n};\n\nexport const queryItems = async (\n table: string,\n indexName: string,\n cond: string,\n attr: StringIndexable,\n projection = '',\n desc = false\n) => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table || !cond || !attr) return null;\n\n let contents: StringIndexable[] | null = null;\n\n // Ref: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html\n // Ref: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/dynamodb-example-query-scan.html\n // Ref: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SQLtoNoSQL.Indexes.QueryAndScan.html#SQLtoNoSQL.Indexes.QueryAndScan.DynamoDB\n let cmdParams: QueryCommandInput = {\n TableName: table,\n KeyConditionExpression: cond,\n ExpressionAttributeValues: attr,\n // FilterExpression: \"contains (category_id, :cid)\",\n };\n\n if (indexName) cmdParams = { ...cmdParams, IndexName: indexName };\n if (projection) cmdParams = { ...cmdParams, ProjectionExpression: projection };\n if (desc) cmdParams = { ...cmdParams, ScanIndexForward: false };\n\n const command = new QueryCommand(cmdParams);\n\n try {\n const results = await dbClient.dbDocClient.send(command);\n const items = results.Items;\n\n if (items) {\n contents = items;\n }\n } catch (err) {\n console.error('QueryCommandInput:', command.input);\n console.error(err);\n // throw err;\n }\n\n return contents;\n};\n\nexport const scanItems = async (table: string, projection = '') => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table) return null;\n\n let contents: StringIndexable[] | null = null;\n\n // Ref: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/dynamodb-example-query-scan.html\n let cmdParams: ScanCommandInput = {\n TableName: table,\n };\n\n if (projection) cmdParams = { ...cmdParams, ProjectionExpression: projection };\n\n const command = new ScanCommand(cmdParams);\n\n try {\n const results = await dbClient.dbDocClient.send(command);\n const items = results.Items;\n\n if (items) {\n contents = items;\n }\n } catch (err) {\n console.error('ScanCommandInput:', cmdParams);\n console.error(err);\n // throw err;\n }\n\n return contents;\n};\n\nexport const deleteItem = async (table: string, key: StringIndexable) => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table || !key) return null;\n\n const cmdParams: DeleteCommandInput = { TableName: table, Key: key };\n const command = new DeleteCommand(cmdParams);\n\n try {\n await dbClient.dbDocClient.send(command);\n } catch (err) {\n console.error('DeleteCommandInput:', cmdParams);\n console.error(err);\n // throw err;\n return false;\n }\n\n return true;\n};\n\n// ----------------\n\n// await dbWriteItem('lesson_list', { id: 'id_001', title: 'My Lesson' });\n\n// const contents = await dbReadItem('lesson_list', { id: 'id_001' });\n// console.log(contents);\n\n// await dbUpdateItem(\n// 'lesson_list',\n// { id: 'id_001' },\n// 'set #a = :a, #b = :b',\n// { ':a': 'abhi@raj.me', ':b': 'Abhishek Raj' },\n// { '#a': 'email', '#b': 'name' }\n// );\n\n// ----------------\n","import * as dbAll from './db';\nimport { error } from '../common/logger';\n\nconst { init: dbInit, status: dbStatus, ...db } = dbAll;\n\nconst init = (region: string) => {\n if (!region) {\n error(`AWS initialization error! Missing region: ${region}`);\n return false;\n }\n\n return dbInit(region);\n};\n\nconst status = () => {\n return dbStatus();\n};\n\nexport { db, init, status }; // named exports\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@octokit/core\");","import { Octokit } from '@octokit/core';\n\nimport { CustomError } from '../common/error';\nimport { error } from '../common/logger';\n\nlet github: Octokit | null = null;\nlet owner: string | null = null;\n\nconst GitHubError = (msg: string) => new CustomError(msg, { name: 'GitHubError' });\n\nconst initializationError = () => {\n throw GitHubError('GitHub SDK is possibly uninitialized!');\n};\n\n/**\n * Initialize GitHub SDK\n * @param authToken GitHub auth token for the user account [GITHUB_TOKEN]\n * @param account account id for the GitHub user account [GITHUB_ACCOUNT]\n */\nexport const init = (authToken: string, account: string) => {\n if (!authToken || !account) {\n error(`GitHub initialization error! authToken: ${!!authToken}, account: ${!!account}`);\n return;\n }\n github = new Octokit({ auth: authToken });\n owner = account;\n};\n\n/**\n * Get contents of a particular file in a repo\n * @param repo name of the repo\n * @param path path of a file in the repo\n * @returns an object {response,headers} containing response and response headers, null in case of error\n */\nexport const getContent = async (repo: string, path: string) => {\n if (!github || !owner) return initializationError();\n\n try {\n const ghResp = await github.request('GET /repos/{owner}/{repo}/contents/{path}', {\n owner,\n repo,\n path,\n });\n const response = ghResp.data as GitHubContent;\n const { headers } = ghResp;\n return { response, headers };\n } catch (e) {\n error(`[ERROR:gh.getContent]`, e);\n }\n\n return null;\n};\n\n// --------------\n\nexport interface GitHubContent {\n path: string;\n content: string;\n sha: string;\n}\n","import * as fs from './fs';\nimport * as aws from './aws';\nimport * as gh from './gh';\n\n// Ref: https://stackoverflow.com/a/41283945\nexport { fs, aws, gh }; // named exports\nexport default { fs, aws, gh }; // default export\n"],"names":["module","exports","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","CustomError","message","options","Error","captureStackTrace","name","console","log","cwarn","warn","cerror","error","window","chalk","assertPath","p","startsWith","path","process","cwd","existsFileSync","file","loud","fs","e","existsDirSync","dir","readFile","contents","fsa","readFileSync","readDir","dirs","files","withFileTypes","forEach","item","isDirectory","push","isFile","readDirFiles","readDirDirs","readDirFilesRecHelper","basePath","dirPath","allFiles","map","absDirs","pList","dirx","Promise","all","filesx","length","readDirFilesRec","writeFile","substring","lastIndexOf","recursive","appendToFile","renameFile","oldpath","newpath","createDir","deleteFile","deleteDir","rimraf","rimrafPr","util","dbDocClient","id","initializationError","init","region","dydbClient","DynamoDBClient","dbClient","DynamoDBDocumentClient","short","status","writeItemForceHelper","table","data","i","cmdParams","TableName","Item","ConditionExpression","command","PutCommand","numberOfAttempts","ret","writeItemForce","writeItem","updateItem","update","attr","attrNames","Key","UpdateExpression","ExpressionAttributeValues","ExpressionAttributeNames","UpdateCommand","readItem","projection","ProjectionExpression","GetCommand","results","queryItems","indexName","cond","desc","KeyConditionExpression","IndexName","ScanIndexForward","QueryCommand","items","Items","input","scanItems","ScanCommand","deleteItem","DeleteCommand","dbInit","dbAll","dbStatus","db","github","owner","authToken","account","Octokit","auth","getContent","repo","request","ghResp","response","headers","aws","gh"],"sourceRoot":""}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{createRequire as e}from"module";let r=e(import.meta.url);import{createRequire as t}from"module";var n={76:e=>{e.exports=r("rimraf")}},o={};function u(e){var r=o[e];if(void 0!==r)return r.exports;var t=o[e]={exports:{}};return n[e](t,t.exports,u),t.exports}u.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return u.d(r,{a:r}),r},u.d=(e,r)=>{for(var t in r)u.o(r,t)&&!u.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},u.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{u.d(a,{r:()=>o,Z:()=>Ce,fs:()=>e,gh:()=>c});var e={};u.r(e),u.d(e,{appendToFile:()=>Z,createDir:()=>J,deleteDir:()=>X,deleteFile:()=>L,existsDirSync:()=>G,existsFileSync:()=>B,readDir:()=>U,readDirDirs:()=>H,readDirFiles:()=>q,readDirFilesRec:()=>V,readFile:()=>K,readFileSync:()=>z,renameFile:()=>$,writeFile:()=>W});var n={};u.r(n),u.d(n,{deleteItem:()=>he,init:()=>le,queryItems:()=>ve,readItem:()=>be,scanItems:()=>ye,updateItem:()=>de,writeItem:()=>me,writeItemForce:()=>fe});var o={};u.r(o),u.d(o,{db:()=>we,init:()=>je});var c={};u.r(c),u.d(c,{getContent:()=>Pe,init:()=>Ee}),r("regenerator-runtime/runtime.js"),r("core-js/modules/es.string.starts-with.js"),r("core-js/modules/es.array.for-each.js"),r("core-js/modules/web.dom-collections.for-each.js"),r("core-js/modules/es.array.concat.js"),r("core-js/modules/es.array.map.js"),r("core-js/modules/es.array.iterator.js"),r("core-js/modules/es.object.to-string.js"),r("core-js/modules/es.promise.js"),r("core-js/modules/es.string.iterator.js"),r("core-js/modules/web.dom-collections.iterator.js"),r("core-js/modules/es.array.last-index-of.js"),r("core-js/modules/es.symbol.js"),r("core-js/modules/es.symbol.description.js"),r("core-js/modules/es.symbol.iterator.js"),r("core-js/modules/es.array.from.js"),r("core-js/modules/es.array.slice.js");const s=t(import.meta.url)("path");var i=u.n(s);const l=t(import.meta.url)("util");var p=u.n(l);const f=t(import.meta.url)("fs");var m=u.n(f);const d=t(import.meta.url)("fs/promises");var b=u.n(d);function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function y(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function h(e,r){if(r&&("object"===v(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return x(e)}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w(e){var r="function"==typeof Map?new Map:void 0;return w=function(e){if(null===e||(t=e,-1===Function.toString.call(t).indexOf("[native code]")))return e;var t;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,n)}function n(){return j(e,arguments,R(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),k(n,e)},w(e)}function j(e,r,t){return j=g()?Reflect.construct:function(e,r,t){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(e,n));return t&&k(o,t.prototype),o},j.apply(null,arguments)}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function k(e,r){return k=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},k(e,r)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}r("core-js/modules/es.object.set-prototype-of.js"),r("core-js/modules/es.object.get-prototype-of.js"),r("core-js/modules/es.array.index-of.js"),r("core-js/modules/es.regexp.to-string.js"),r("core-js/modules/es.reflect.construct.js"),r("core-js/modules/es.map.js"),r("core-js/modules/esnext.map.delete-all.js"),r("core-js/modules/esnext.map.every.js"),r("core-js/modules/esnext.map.filter.js"),r("core-js/modules/esnext.map.find.js"),r("core-js/modules/esnext.map.find-key.js"),r("core-js/modules/esnext.map.includes.js"),r("core-js/modules/esnext.map.key-of.js"),r("core-js/modules/esnext.map.map-keys.js"),r("core-js/modules/esnext.map.map-values.js"),r("core-js/modules/esnext.map.merge.js"),r("core-js/modules/esnext.map.reduce.js"),r("core-js/modules/esnext.map.some.js"),r("core-js/modules/esnext.map.update.js");var O=function(e){!function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&k(e,r)}(o,e);var r,t,n=(r=o,t=g(),function(){var e,n=R(r);if(t){var o=R(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return h(this,e)});function o(e){var r,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return y(this,o),r=n.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(x(r),o),r.name=t.name||"CustomError",r}return o}(w(Error));const S=r("chalk");var E=u.n(S);function P(e){return P="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P(e)}console.log;var C=console.warn,D=console.error;"undefined"===("undefined"==typeof window?"undefined":P(window))&&(C=function(){return console.warn(E().yellow.apply(E(),arguments))},D=function(){return console.error(E().red.apply(E(),arguments))});var I=C,F=D;function T(e){return function(e){if(Array.isArray(e))return _(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(e){if("string"==typeof e)return _(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function A(e,r,t,n,o,u,a){try{var c=e[u](a),s=c.value}catch(e){return void t(e)}c.done?r(s):Promise.resolve(s).then(n,o)}function N(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var u=e.apply(r,t);function a(e){A(u,n,o,a,c,"next",e)}function c(e){A(u,n,o,a,c,"throw",e)}a(void 0)}))}}var M=function(e){return!e||e.startsWith("/")?e:i().resolve(process.cwd(),e)},B=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return!1;e=M(e);try{if(!m().existsSync(e)){if(!r)return!1;throw new O("File does not exist: ".concat(e))}}catch(t){if(!r)return!1;throw t instanceof O?t:new O("Error while accessing file: ".concat(e))}return!0},G=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return!1;e=M(e);try{if(!m().existsSync(e)){if(!r)return!1;throw new O("Directory does not exist: ".concat(e))}}catch(t){if(!r)return!1;throw t instanceof O?t:new O("Error while accessing directory: ".concat(e))}return!0},K=function(){var e=N(regeneratorRuntime.mark((function e(r){var t,n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>1&&void 0!==o[1]&&o[1],r){e.next=3;break}return e.abrupt("return",null);case 3:return r=M(r),n=null,e.prev=5,e.next=8,b().readFile(r,"utf8");case 8:n=e.sent,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(5),t&&I("Cannot read file: ".concat(r));case 14:return e.abrupt("return",n);case 15:case"end":return e.stop()}}),e,null,[[5,11]])})));return function(r){return e.apply(this,arguments)}}(),z=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;e=M(e);var t=null;try{t=m().readFileSync(e,"utf8")}catch(t){r&&I("Cannot read file: ".concat(e))}return t},U=function(){var e=N(regeneratorRuntime.mark((function e(r){var t,n,o,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=u.length>1&&void 0!==u[1]&&u[1],r){e.next=3;break}return e.abrupt("return",{dirs:null,files:null});case 3:return r=M(r),n=null,o=null,e.prev=6,e.next=9,b().readdir(r,{withFileTypes:!0});case 9:e.sent.forEach((function(e){e.isDirectory()?o?o.push(e.name):o=[e.name]:e.isFile()&&(n?n.push(e.name):n=[e.name])})),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(6),t&&I("Cannot read dir: ".concat(r));case 16:return e.abrupt("return",{dirs:o,files:n});case 17:case"end":return e.stop()}}),e,null,[[6,13]])})));return function(r){return e.apply(this,arguments)}}(),q=function(){var e=N(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>1&&void 0!==n[1]&&n[1],r){e.next=3;break}return e.abrupt("return",null);case 3:return r=M(r),e.next=6,U(r,t);case 6:return e.abrupt("return",e.sent.files);case 7:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),H=function(){var e=N(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>1&&void 0!==n[1]&&n[1],r){e.next=3;break}return e.abrupt("return",null);case 3:return r=M(r),e.next=6,U(r,t);case 6:return e.abrupt("return",e.sent.dirs);case 7:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),Q=function(){var e=N(regeneratorRuntime.mark((function e(r){var t,n,o,u,a,c,s,i,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=l.length>1&&void 0!==l[1]?l[1]:"",r){e.next=3;break}return e.abrupt("return",null);case 3:return r=M(r),n=t?"".concat(r,"/").concat(t):r,e.next=7,U(n);case 7:return o=e.sent,u=o.dirs,a=o.files,c=(c=a||[]).map((function(e){return t?"".concat(t,"/").concat(e):e})),s=(u||[]).map((function(e){return t?"".concat(t,"/").concat(e):e})),i=s.map((function(e){return Q(r,e)})),e.next=16,Promise.all(i);case 16:return e.sent.forEach((function(e){e&&(c=[].concat(T(c),T(e)))})),e.abrupt("return",c.length?c:null);case 19:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),V=function(e){return Q(e)},W=function(){var e=N(regeneratorRuntime.mark((function e(r,t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&t){e.next=2;break}return e.abrupt("return",!1);case 2:return r=M(r),e.prev=3,n=r.substring(0,r.lastIndexOf("/")),e.next=7,b().mkdir(n,{recursive:!0});case 7:return e.next=9,b().writeFile(r,t);case 9:e.next=15;break;case 11:return e.prev=11,e.t0=e.catch(3),console.error("Error while writing to ".concat(r),e.t0),e.abrupt("return",!1);case 15:return e.abrupt("return",!0);case 16:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(r,t){return e.apply(this,arguments)}}(),Z=function(){var e=N(regeneratorRuntime.mark((function e(r,t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&t){e.next=2;break}return e.abrupt("return",!1);case 2:return r=M(r),e.prev=3,n=r.substring(0,r.lastIndexOf("/")),e.next=7,b().mkdir(n,{recursive:!0});case 7:return e.next=9,b().appendFile(r,t+"\n");case 9:e.next=15;break;case 11:return e.prev=11,e.t0=e.catch(3),console.error("Error while appending to ".concat(r),e.t0),e.abrupt("return",!1);case 15:return e.abrupt("return",!0);case 16:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(r,t){return e.apply(this,arguments)}}(),$=function(){var e=N(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&t){e.next=2;break}return e.abrupt("return",!1);case 2:return r=M(r),t=M(t),e.prev=4,e.next=7,b().rename(r,t);case 7:e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(4),console.error("Error while renaming file ".concat(r," to ").concat(t),e.t0),e.abrupt("return",!1);case 13:return e.abrupt("return",!0);case 14:case"end":return e.stop()}}),e,null,[[4,9]])})));return function(r,t){return e.apply(this,arguments)}}(),J=function(){var e=N(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return",!1);case 2:if(r=M(r),e.prev=3,G(r)){e.next=7;break}return e.next=7,b().mkdir(r,{recursive:!0});case 7:e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(3),console.error("Error while creating directory: ".concat(r),e.t0),e.abrupt("return",!1);case 13:return e.abrupt("return",!0);case 14:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(r){return e.apply(this,arguments)}}(),L=function(){var e=N(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return",!1);case 2:return r=M(r),e.prev=3,e.next=6,b().unlink(r);case 6:e.next=12;break;case 8:return e.prev=8,e.t0=e.catch(3),console.error("Error while deleting file ".concat(r),e.t0),e.abrupt("return",!1);case 12:return e.abrupt("return",!0);case 13:case"end":return e.stop()}}),e,null,[[3,8]])})));return function(r){return e.apply(this,arguments)}}(),X=function(){var e=N(regeneratorRuntime.mark((function e(r){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return",!1);case 2:return r=M(r),e.prev=3,t=u(76),n=p().promisify(t),e.next=8,n(r);case 8:e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(3),console.error("Error while deleting dir ".concat(r),e.t0),e.abrupt("return",!1);case 14:return e.abrupt("return",!0);case 15:case"end":return e.stop()}}),e,null,[[3,10]])})));return function(r){return e.apply(this,arguments)}}();r("core-js/modules/es.object.keys.js"),r("core-js/modules/es.array.filter.js"),r("core-js/modules/es.object.get-own-property-descriptor.js"),r("core-js/modules/es.object.get-own-property-descriptors.js");const Y=r("@aws-sdk/client-dynamodb"),ee=r("@aws-sdk/lib-dynamodb"),re=r("short-uuid");var te=u.n(re);function ne(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function oe(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ne(Object(t),!0).forEach((function(r){ue(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ne(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function ue(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ae(e,r,t,n,o,u,a){try{var c=e[u](a),s=c.value}catch(e){return void t(e)}c.done?r(s):Promise.resolve(s).then(n,o)}function ce(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var u=e.apply(r,t);function a(e){ae(u,n,o,a,c,"next",e)}function c(e){ae(u,n,o,a,c,"throw",e)}a(void 0)}))}}var se=null,ie=function(){throw new O("DynamoDB is possibly uninitialized!",{name:"DynamoDBError"})},le=function(e){var r=new Y.DynamoDBClient({region:e});se||(se=ee.DynamoDBDocumentClient.from(r))},pe=function(){var e=ce(regeneratorRuntime.mark((function e(r,t,n,o){var u,a,c,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(se){e.next=2;break}return e.abrupt("return",ie());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return t[n]||(t[n]=te().uuid()),u={TableName:r,Item:t,ConditionExpression:"attribute_not_exists(".concat(n,")")},a=new ee.PutCommand(u),c=3,e.prev=8,e.next=11,se.send(a);case 11:e.next=25;break;case 13:if(e.prev=13,e.t0=e.catch(8),"ConditionalCheckFailedException"!==e.t0.name){e.next=24;break}if(!(o<c-1)){e.next=22;break}return t[n]=te().uuid(),e.next=20,pe(r,t,n,o+1);case 20:return s=e.sent,e.abrupt("return",s);case 22:console.error("PutCommandInput:",u),console.error("[ERROR] Maximum attempts overflow!");case 24:return e.abrupt("return",null);case 25:return e.abrupt("return",t);case 26:case"end":return e.stop()}}),e,null,[[8,13]])})));return function(r,t,n,o){return e.apply(this,arguments)}}(),fe=function(){var e=ce(regeneratorRuntime.mark((function e(r,t){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:"id",e.abrupt("return",pe(r,t,n,0));case 2:case"end":return e.stop()}}),e)})));return function(r,t){return e.apply(this,arguments)}}(),me=function(){var e=ce(regeneratorRuntime.mark((function e(r,t){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(se){e.next=2;break}return e.abrupt("return",ie());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return n={TableName:r,Item:t},o=new ee.PutCommand(n),e.prev=6,e.next=9,se.send(o);case 9:e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(6),console.error("PutCommandInput:",n),console.error(e.t0),e.abrupt("return",null);case 16:return e.abrupt("return",!0);case 17:case"end":return e.stop()}}),e,null,[[6,11]])})));return function(r,t){return e.apply(this,arguments)}}(),de=function(){var e=ce(regeneratorRuntime.mark((function e(r,t,n,o,u){var a,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(se){e.next=2;break}return e.abrupt("return",ie());case 2:if(r&&t&&n&&o){e.next=4;break}return e.abrupt("return",null);case 4:return a={TableName:r,Key:t,UpdateExpression:n,ExpressionAttributeValues:o},u&&(a=oe(oe({},a),{},{ExpressionAttributeNames:u})),c=new ee.UpdateCommand(a),e.prev=7,e.next=10,se.send(c);case 10:e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(7),console.error("UpdateCommandInput:",a),console.error(e.t0),e.abrupt("return",null);case 17:return e.abrupt("return",!0);case 18:case"end":return e.stop()}}),e,null,[[7,12]])})));return function(r,t,n,o,u){return e.apply(this,arguments)}}(),be=function(){var e=ce(regeneratorRuntime.mark((function e(r,t,n,o){var u,a,c,s,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(se){e.next=2;break}return e.abrupt("return",ie());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return u=null,a={TableName:r,Key:t},n&&(a=oe(oe({},a),{},{ProjectionExpression:n})),o&&(a=oe(oe({},a),{},{ExpressionAttributeNames:o})),c=new ee.GetCommand(a),e.prev=9,e.next=12,se.send(c);case 12:s=e.sent,(i=s.Item)&&(u=i),e.next=21;break;case 17:e.prev=17,e.t0=e.catch(9),console.error("GetCommandInput:",a),console.error(e.t0);case 21:return e.abrupt("return",u);case 22:case"end":return e.stop()}}),e,null,[[9,17]])})));return function(r,t,n,o){return e.apply(this,arguments)}}(),ve=function(){var e=ce(regeneratorRuntime.mark((function e(r,t,n,o){var u,a,c,s,i,l,p,f=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=f.length>4&&void 0!==f[4]?f[4]:"",a=f.length>5&&void 0!==f[5]&&f[5],se){e.next=4;break}return e.abrupt("return",ie());case 4:if(r&&n&&o){e.next=6;break}return e.abrupt("return",null);case 6:return c=null,s={TableName:r,KeyConditionExpression:n,ExpressionAttributeValues:o},t&&(s=oe(oe({},s),{},{IndexName:t})),u&&(s=oe(oe({},s),{},{ProjectionExpression:u})),a&&(s=oe(oe({},s),{},{ScanIndexForward:!1})),i=new ee.QueryCommand(s),e.prev=12,e.next=15,se.send(i);case 15:l=e.sent,(p=l.Items)&&(c=p),e.next=24;break;case 20:e.prev=20,e.t0=e.catch(12),console.error("QueryCommandInput:",i.input),console.error(e.t0);case 24:return e.abrupt("return",c);case 25:case"end":return e.stop()}}),e,null,[[12,20]])})));return function(r,t,n,o){return e.apply(this,arguments)}}(),ye=function(){var e=ce(regeneratorRuntime.mark((function e(r){var t,n,o,u,a,c,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>1&&void 0!==s[1]?s[1]:"",se){e.next=3;break}return e.abrupt("return",ie());case 3:if(r){e.next=5;break}return e.abrupt("return",null);case 5:return n=null,o={TableName:r},t&&(o=oe(oe({},o),{},{ProjectionExpression:t})),u=new ee.ScanCommand(o),e.prev=9,e.next=12,se.send(u);case 12:a=e.sent,(c=a.Items)&&(n=c),e.next=21;break;case 17:e.prev=17,e.t0=e.catch(9),console.error("ScanCommandInput:",o),console.error(e.t0);case 21:return e.abrupt("return",n);case 22:case"end":return e.stop()}}),e,null,[[9,17]])})));return function(r){return e.apply(this,arguments)}}(),he=function(){var e=ce(regeneratorRuntime.mark((function e(r,t){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(se){e.next=2;break}return e.abrupt("return",ie());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return n={TableName:r,Key:t},o=new ee.DeleteCommand(n),e.prev=6,e.next=9,se.send(o);case 9:e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(6),console.error("DeleteCommandInput:",n),console.error(e.t0),e.abrupt("return",!1);case 16:return e.abrupt("return",!0);case 17:case"end":return e.stop()}}),e,null,[[6,11]])})));return function(r,t){return e.apply(this,arguments)}}(),xe=le,we=function(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(n,["init"]),je=function(e){e?xe(e):F("AWS initialization error! Missing region: ".concat(e))};const ge=r("@octokit/core");function ke(e,r,t,n,o,u,a){try{var c=e[u](a),s=c.value}catch(e){return void t(e)}c.done?r(s):Promise.resolve(s).then(n,o)}var Re=null,Oe=null,Se=function(){throw new O("GitHub SDK is possibly uninitialized!",{name:"GitHubError"})},Ee=function(e,r){e&&r?(Re=new ge.Octokit({auth:e}),Oe=r):F("GitHub initialization error! authToken: ".concat(!!e,", account: ").concat(!!r))},Pe=function(){var e,r=(e=regeneratorRuntime.mark((function e(r,t){var n,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Re&&Oe){e.next=2;break}return e.abrupt("return",Se());case 2:return e.prev=2,e.next=5,Re.request("GET /repos/{owner}/{repo}/contents/{path}",{owner:Oe,repo:r,path:t});case 5:return n=e.sent,o=n.data,u=n.headers,e.abrupt("return",{response:o,headers:u});case 11:e.prev=11,e.t0=e.catch(2),F("[ERROR:gh.getContent]",e.t0);case 14:return e.abrupt("return",null);case 15:case"end":return e.stop()}}),e,null,[[2,11]])})),function(){var r=this,t=arguments;return new Promise((function(n,o){var u=e.apply(r,t);function a(e){ke(u,n,o,a,c,"next",e)}function c(e){ke(u,n,o,a,c,"throw",e)}a(void 0)}))});return function(e,t){return r.apply(this,arguments)}}();const Ce={fs:e,aws:o,gh:c}})();var c=a.r,s=a.Z,i=a.fs,l=a.gh;export{c as aws,s as default,i as fs,l as gh};
|
|
1
|
+
import{createRequire as e}from"module";let r=e(import.meta.url);import{createRequire as t}from"module";var n={76:e=>{e.exports=r("rimraf")}},o={};function u(e){var r=o[e];if(void 0!==r)return r.exports;var t=o[e]={exports:{}};return n[e](t,t.exports,u),t.exports}u.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return u.d(r,{a:r}),r},u.d=(e,r)=>{for(var t in r)u.o(r,t)&&!u.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},u.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),u.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};(()=>{u.d(a,{r:()=>o,Z:()=>Fe,fs:()=>e,gh:()=>c});var e={};u.r(e),u.d(e,{appendToFile:()=>Z,createDir:()=>J,deleteDir:()=>X,deleteFile:()=>L,existsDirSync:()=>G,existsFileSync:()=>B,readDir:()=>U,readDirDirs:()=>H,readDirFiles:()=>q,readDirFilesRec:()=>V,readFile:()=>K,readFileSync:()=>z,renameFile:()=>$,writeFile:()=>W});var n={};u.r(n),u.d(n,{deleteItem:()=>xe,init:()=>le,queryItems:()=>ye,readItem:()=>ve,scanItems:()=>he,status:()=>pe,updateItem:()=>be,writeItem:()=>de,writeItemForce:()=>me});var o={};u.r(o),u.d(o,{db:()=>ge,init:()=>ke,status:()=>Re});var c={};u.r(c),u.d(c,{getContent:()=>Ie,init:()=>Pe}),r("regenerator-runtime/runtime.js"),r("core-js/modules/es.string.starts-with.js"),r("core-js/modules/es.array.for-each.js"),r("core-js/modules/web.dom-collections.for-each.js"),r("core-js/modules/es.array.concat.js"),r("core-js/modules/es.array.map.js"),r("core-js/modules/es.array.iterator.js"),r("core-js/modules/es.object.to-string.js"),r("core-js/modules/es.promise.js"),r("core-js/modules/es.string.iterator.js"),r("core-js/modules/web.dom-collections.iterator.js"),r("core-js/modules/es.array.last-index-of.js"),r("core-js/modules/es.symbol.js"),r("core-js/modules/es.symbol.description.js"),r("core-js/modules/es.symbol.iterator.js"),r("core-js/modules/es.array.from.js"),r("core-js/modules/es.array.slice.js");const s=t(import.meta.url)("path");var i=u.n(s);const l=t(import.meta.url)("util");var p=u.n(l);const f=t(import.meta.url)("fs");var m=u.n(f);const d=t(import.meta.url)("fs/promises");var b=u.n(d);function v(e){return v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},v(e)}function y(e,r){if(!(e instanceof r))throw new TypeError("Cannot call a class as a function")}function h(e,r){if(r&&("object"===v(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return x(e)}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function w(e){var r="function"==typeof Map?new Map:void 0;return w=function(e){if(null===e||(t=e,-1===Function.toString.call(t).indexOf("[native code]")))return e;var t;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==r){if(r.has(e))return r.get(e);r.set(e,n)}function n(){return j(e,arguments,R(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),k(n,e)},w(e)}function j(e,r,t){return j=g()?Reflect.construct:function(e,r,t){var n=[null];n.push.apply(n,r);var o=new(Function.bind.apply(e,n));return t&&k(o,t.prototype),o},j.apply(null,arguments)}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function k(e,r){return k=Object.setPrototypeOf||function(e,r){return e.__proto__=r,e},k(e,r)}function R(e){return R=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},R(e)}r("core-js/modules/es.object.set-prototype-of.js"),r("core-js/modules/es.object.get-prototype-of.js"),r("core-js/modules/es.array.index-of.js"),r("core-js/modules/es.regexp.to-string.js"),r("core-js/modules/es.reflect.construct.js"),r("core-js/modules/es.map.js"),r("core-js/modules/esnext.map.delete-all.js"),r("core-js/modules/esnext.map.every.js"),r("core-js/modules/esnext.map.filter.js"),r("core-js/modules/esnext.map.find.js"),r("core-js/modules/esnext.map.find-key.js"),r("core-js/modules/esnext.map.includes.js"),r("core-js/modules/esnext.map.key-of.js"),r("core-js/modules/esnext.map.map-keys.js"),r("core-js/modules/esnext.map.map-values.js"),r("core-js/modules/esnext.map.merge.js"),r("core-js/modules/esnext.map.reduce.js"),r("core-js/modules/esnext.map.some.js"),r("core-js/modules/esnext.map.update.js");var O=function(e){!function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(r&&r.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),r&&k(e,r)}(o,e);var r,t,n=(r=o,t=g(),function(){var e,n=R(r);if(t){var o=R(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return h(this,e)});function o(e){var r,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return y(this,o),r=n.call(this,e),Error.captureStackTrace&&Error.captureStackTrace(x(r),o),r.name=t.name||"CustomError",r}return o}(w(Error));const C=r("chalk");var D=u.n(C);function S(e){return S="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S(e)}console.log;var E=console.warn,P=console.error;"undefined"===("undefined"==typeof window?"undefined":S(window))&&(E=function(){return console.warn(D().yellow.apply(D(),arguments))},P=function(){return console.error(D().red.apply(D(),arguments))});var I=E,F=P;function T(e){return function(e){if(Array.isArray(e))return _(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,r){if(e){if("string"==typeof e)return _(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_(e,r):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,n=new Array(r);t<r;t++)n[t]=e[t];return n}function A(e,r,t,n,o,u,a){try{var c=e[u](a),s=c.value}catch(e){return void t(e)}c.done?r(s):Promise.resolve(s).then(n,o)}function N(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var u=e.apply(r,t);function a(e){A(u,n,o,a,c,"next",e)}function c(e){A(u,n,o,a,c,"throw",e)}a(void 0)}))}}var M=function(e){return!e||e.startsWith("/")?e:i().resolve(process.cwd(),e)},B=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return!1;e=M(e);try{if(!m().existsSync(e)){if(!r)return!1;throw new O("File does not exist: ".concat(e))}}catch(t){if(!r)return!1;throw t instanceof O?t:new O("Error while accessing file: ".concat(e))}return!0},G=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return!1;e=M(e);try{if(!m().existsSync(e)){if(!r)return!1;throw new O("Directory does not exist: ".concat(e))}}catch(t){if(!r)return!1;throw t instanceof O?t:new O("Error while accessing directory: ".concat(e))}return!0},K=function(){var e=N(regeneratorRuntime.mark((function e(r){var t,n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=o.length>1&&void 0!==o[1]&&o[1],r){e.next=3;break}return e.abrupt("return",null);case 3:return r=M(r),n=null,e.prev=5,e.next=8,b().readFile(r,"utf8");case 8:n=e.sent,e.next=14;break;case 11:e.prev=11,e.t0=e.catch(5),t&&I("Cannot read file: ".concat(r));case 14:return e.abrupt("return",n);case 15:case"end":return e.stop()}}),e,null,[[5,11]])})));return function(r){return e.apply(this,arguments)}}(),z=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e)return null;e=M(e);var t=null;try{t=m().readFileSync(e,"utf8")}catch(t){r&&I("Cannot read file: ".concat(e))}return t},U=function(){var e=N(regeneratorRuntime.mark((function e(r){var t,n,o,u=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=u.length>1&&void 0!==u[1]&&u[1],r){e.next=3;break}return e.abrupt("return",{dirs:null,files:null});case 3:return r=M(r),n=null,o=null,e.prev=6,e.next=9,b().readdir(r,{withFileTypes:!0});case 9:e.sent.forEach((function(e){e.isDirectory()?o?o.push(e.name):o=[e.name]:e.isFile()&&(n?n.push(e.name):n=[e.name])})),e.next=16;break;case 13:e.prev=13,e.t0=e.catch(6),t&&I("Cannot read dir: ".concat(r));case 16:return e.abrupt("return",{dirs:o,files:n});case 17:case"end":return e.stop()}}),e,null,[[6,13]])})));return function(r){return e.apply(this,arguments)}}(),q=function(){var e=N(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>1&&void 0!==n[1]&&n[1],r){e.next=3;break}return e.abrupt("return",null);case 3:return r=M(r),e.next=6,U(r,t);case 6:return e.abrupt("return",e.sent.files);case 7:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),H=function(){var e=N(regeneratorRuntime.mark((function e(r){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=n.length>1&&void 0!==n[1]&&n[1],r){e.next=3;break}return e.abrupt("return",null);case 3:return r=M(r),e.next=6,U(r,t);case 6:return e.abrupt("return",e.sent.dirs);case 7:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),Q=function(){var e=N(regeneratorRuntime.mark((function e(r){var t,n,o,u,a,c,s,i,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=l.length>1&&void 0!==l[1]?l[1]:"",r){e.next=3;break}return e.abrupt("return",null);case 3:return r=M(r),n=t?"".concat(r,"/").concat(t):r,e.next=7,U(n);case 7:return o=e.sent,u=o.dirs,a=o.files,c=(c=a||[]).map((function(e){return t?"".concat(t,"/").concat(e):e})),s=(u||[]).map((function(e){return t?"".concat(t,"/").concat(e):e})),i=s.map((function(e){return Q(r,e)})),e.next=16,Promise.all(i);case 16:return e.sent.forEach((function(e){e&&(c=[].concat(T(c),T(e)))})),e.abrupt("return",c.length?c:null);case 19:case"end":return e.stop()}}),e)})));return function(r){return e.apply(this,arguments)}}(),V=function(e){return Q(e)},W=function(){var e=N(regeneratorRuntime.mark((function e(r,t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&t){e.next=2;break}return e.abrupt("return",!1);case 2:return r=M(r),e.prev=3,n=r.substring(0,r.lastIndexOf("/")),e.next=7,b().mkdir(n,{recursive:!0});case 7:return e.next=9,b().writeFile(r,t);case 9:e.next=15;break;case 11:return e.prev=11,e.t0=e.catch(3),console.error("Error while writing to ".concat(r),e.t0),e.abrupt("return",!1);case 15:return e.abrupt("return",!0);case 16:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(r,t){return e.apply(this,arguments)}}(),Z=function(){var e=N(regeneratorRuntime.mark((function e(r,t){var n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&t){e.next=2;break}return e.abrupt("return",!1);case 2:return r=M(r),e.prev=3,n=r.substring(0,r.lastIndexOf("/")),e.next=7,b().mkdir(n,{recursive:!0});case 7:return e.next=9,b().appendFile(r,t+"\n");case 9:e.next=15;break;case 11:return e.prev=11,e.t0=e.catch(3),console.error("Error while appending to ".concat(r),e.t0),e.abrupt("return",!1);case 15:return e.abrupt("return",!0);case 16:case"end":return e.stop()}}),e,null,[[3,11]])})));return function(r,t){return e.apply(this,arguments)}}(),$=function(){var e=N(regeneratorRuntime.mark((function e(r,t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r&&t){e.next=2;break}return e.abrupt("return",!1);case 2:return r=M(r),t=M(t),e.prev=4,e.next=7,b().rename(r,t);case 7:e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(4),console.error("Error while renaming file ".concat(r," to ").concat(t),e.t0),e.abrupt("return",!1);case 13:return e.abrupt("return",!0);case 14:case"end":return e.stop()}}),e,null,[[4,9]])})));return function(r,t){return e.apply(this,arguments)}}(),J=function(){var e=N(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return",!1);case 2:if(r=M(r),e.prev=3,G(r)){e.next=7;break}return e.next=7,b().mkdir(r,{recursive:!0});case 7:e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(3),console.error("Error while creating directory: ".concat(r),e.t0),e.abrupt("return",!1);case 13:return e.abrupt("return",!0);case 14:case"end":return e.stop()}}),e,null,[[3,9]])})));return function(r){return e.apply(this,arguments)}}(),L=function(){var e=N(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return",!1);case 2:return r=M(r),e.prev=3,e.next=6,b().unlink(r);case 6:e.next=12;break;case 8:return e.prev=8,e.t0=e.catch(3),console.error("Error while deleting file ".concat(r),e.t0),e.abrupt("return",!1);case 12:return e.abrupt("return",!0);case 13:case"end":return e.stop()}}),e,null,[[3,8]])})));return function(r){return e.apply(this,arguments)}}(),X=function(){var e=N(regeneratorRuntime.mark((function e(r){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return",!1);case 2:return r=M(r),e.prev=3,t=u(76),n=p().promisify(t),e.next=8,n(r);case 8:e.next=14;break;case 10:return e.prev=10,e.t0=e.catch(3),console.error("Error while deleting dir ".concat(r),e.t0),e.abrupt("return",!1);case 14:return e.abrupt("return",!0);case 15:case"end":return e.stop()}}),e,null,[[3,10]])})));return function(r){return e.apply(this,arguments)}}();r("core-js/modules/es.object.keys.js"),r("core-js/modules/es.array.filter.js"),r("core-js/modules/es.object.get-own-property-descriptor.js"),r("core-js/modules/es.object.get-own-property-descriptors.js");const Y=r("@aws-sdk/client-dynamodb"),ee=r("@aws-sdk/lib-dynamodb"),re=r("short-uuid");var te=u.n(re);const ne={dbDocClient:null,id:null};function oe(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function ue(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?oe(Object(t),!0).forEach((function(r){ae(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):oe(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}function ae(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function ce(e,r,t,n,o,u,a){try{var c=e[u](a),s=c.value}catch(e){return void t(e)}c.done?r(s):Promise.resolve(s).then(n,o)}function se(e){return function(){var r=this,t=arguments;return new Promise((function(n,o){var u=e.apply(r,t);function a(e){ce(u,n,o,a,c,"next",e)}function c(e){ce(u,n,o,a,c,"throw",e)}a(void 0)}))}}var ie=function(){throw new O("DynamoDB is possibly uninitialized!",{name:"DynamoDBError"})},le=function(e){var r=new Y.DynamoDBClient({region:e});return!ne.dbDocClient&&(ne.dbDocClient=ee.DynamoDBDocumentClient.from(r),ne.id=te().uuid(),!0)},pe=function(){return ne.id},fe=function(){var e=se(regeneratorRuntime.mark((function e(r,t,n,o){var u,a,c,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ne.dbDocClient){e.next=2;break}return e.abrupt("return",ie());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return t[n]||(t[n]=te().uuid()),u={TableName:r,Item:t,ConditionExpression:"attribute_not_exists(".concat(n,")")},a=new ee.PutCommand(u),c=3,e.prev=8,e.next=11,ne.dbDocClient.send(a);case 11:e.next=25;break;case 13:if(e.prev=13,e.t0=e.catch(8),"ConditionalCheckFailedException"!==e.t0.name){e.next=24;break}if(!(o<c-1)){e.next=22;break}return t[n]=te().uuid(),e.next=20,fe(r,t,n,o+1);case 20:return s=e.sent,e.abrupt("return",s);case 22:console.error("PutCommandInput:",u),console.error("[ERROR] Maximum attempts overflow!");case 24:return e.abrupt("return",null);case 25:return e.abrupt("return",t);case 26:case"end":return e.stop()}}),e,null,[[8,13]])})));return function(r,t,n,o){return e.apply(this,arguments)}}(),me=function(){var e=se(regeneratorRuntime.mark((function e(r,t){var n,o=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=o.length>2&&void 0!==o[2]?o[2]:"id",e.abrupt("return",fe(r,t,n,0));case 2:case"end":return e.stop()}}),e)})));return function(r,t){return e.apply(this,arguments)}}(),de=function(){var e=se(regeneratorRuntime.mark((function e(r,t){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ne.dbDocClient){e.next=2;break}return e.abrupt("return",ie());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return n={TableName:r,Item:t},o=new ee.PutCommand(n),e.prev=6,e.next=9,ne.dbDocClient.send(o);case 9:e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(6),console.error("PutCommandInput:",n),console.error(e.t0),e.abrupt("return",null);case 16:return e.abrupt("return",!0);case 17:case"end":return e.stop()}}),e,null,[[6,11]])})));return function(r,t){return e.apply(this,arguments)}}(),be=function(){var e=se(regeneratorRuntime.mark((function e(r,t,n,o,u){var a,c;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ne.dbDocClient){e.next=2;break}return e.abrupt("return",ie());case 2:if(r&&t&&n&&o){e.next=4;break}return e.abrupt("return",null);case 4:return a={TableName:r,Key:t,UpdateExpression:n,ExpressionAttributeValues:o},u&&(a=ue(ue({},a),{},{ExpressionAttributeNames:u})),c=new ee.UpdateCommand(a),e.prev=7,e.next=10,ne.dbDocClient.send(c);case 10:e.next=17;break;case 12:return e.prev=12,e.t0=e.catch(7),console.error("UpdateCommandInput:",a),console.error(e.t0),e.abrupt("return",null);case 17:return e.abrupt("return",!0);case 18:case"end":return e.stop()}}),e,null,[[7,12]])})));return function(r,t,n,o,u){return e.apply(this,arguments)}}(),ve=function(){var e=se(regeneratorRuntime.mark((function e(r,t,n,o){var u,a,c,s,i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ne.dbDocClient){e.next=2;break}return e.abrupt("return",ie());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return u=null,a={TableName:r,Key:t},n&&(a=ue(ue({},a),{},{ProjectionExpression:n})),o&&(a=ue(ue({},a),{},{ExpressionAttributeNames:o})),c=new ee.GetCommand(a),e.prev=9,e.next=12,ne.dbDocClient.send(c);case 12:s=e.sent,(i=s.Item)&&(u=i),e.next=21;break;case 17:e.prev=17,e.t0=e.catch(9),console.error("GetCommandInput:",a),console.error(e.t0);case 21:return e.abrupt("return",u);case 22:case"end":return e.stop()}}),e,null,[[9,17]])})));return function(r,t,n,o){return e.apply(this,arguments)}}(),ye=function(){var e=se(regeneratorRuntime.mark((function e(r,t,n,o){var u,a,c,s,i,l,p,f=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=f.length>4&&void 0!==f[4]?f[4]:"",a=f.length>5&&void 0!==f[5]&&f[5],ne.dbDocClient){e.next=4;break}return e.abrupt("return",ie());case 4:if(r&&n&&o){e.next=6;break}return e.abrupt("return",null);case 6:return c=null,s={TableName:r,KeyConditionExpression:n,ExpressionAttributeValues:o},t&&(s=ue(ue({},s),{},{IndexName:t})),u&&(s=ue(ue({},s),{},{ProjectionExpression:u})),a&&(s=ue(ue({},s),{},{ScanIndexForward:!1})),i=new ee.QueryCommand(s),e.prev=12,e.next=15,ne.dbDocClient.send(i);case 15:l=e.sent,(p=l.Items)&&(c=p),e.next=24;break;case 20:e.prev=20,e.t0=e.catch(12),console.error("QueryCommandInput:",i.input),console.error(e.t0);case 24:return e.abrupt("return",c);case 25:case"end":return e.stop()}}),e,null,[[12,20]])})));return function(r,t,n,o){return e.apply(this,arguments)}}(),he=function(){var e=se(regeneratorRuntime.mark((function e(r){var t,n,o,u,a,c,s=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>1&&void 0!==s[1]?s[1]:"",ne.dbDocClient){e.next=3;break}return e.abrupt("return",ie());case 3:if(r){e.next=5;break}return e.abrupt("return",null);case 5:return n=null,o={TableName:r},t&&(o=ue(ue({},o),{},{ProjectionExpression:t})),u=new ee.ScanCommand(o),e.prev=9,e.next=12,ne.dbDocClient.send(u);case 12:a=e.sent,(c=a.Items)&&(n=c),e.next=21;break;case 17:e.prev=17,e.t0=e.catch(9),console.error("ScanCommandInput:",o),console.error(e.t0);case 21:return e.abrupt("return",n);case 22:case"end":return e.stop()}}),e,null,[[9,17]])})));return function(r){return e.apply(this,arguments)}}(),xe=function(){var e=se(regeneratorRuntime.mark((function e(r,t){var n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ne.dbDocClient){e.next=2;break}return e.abrupt("return",ie());case 2:if(r&&t){e.next=4;break}return e.abrupt("return",null);case 4:return n={TableName:r,Key:t},o=new ee.DeleteCommand(n),e.prev=6,e.next=9,ne.dbDocClient.send(o);case 9:e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(6),console.error("DeleteCommandInput:",n),console.error(e.t0),e.abrupt("return",!1);case 16:return e.abrupt("return",!0);case 17:case"end":return e.stop()}}),e,null,[[6,11]])})));return function(r,t){return e.apply(this,arguments)}}(),we=le,je=pe,ge=function(e,r){if(null==e)return{};var t,n,o=function(e,r){if(null==e)return{};var t,n,o={},u=Object.keys(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n<u.length;n++)t=u[n],r.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}(n,["init","status"]),ke=function(e){return e?we(e):(F("AWS initialization error! Missing region: ".concat(e)),!1)},Re=function(){return je()};const Oe=r("@octokit/core");function Ce(e,r,t,n,o,u,a){try{var c=e[u](a),s=c.value}catch(e){return void t(e)}c.done?r(s):Promise.resolve(s).then(n,o)}var De=null,Se=null,Ee=function(){throw new O("GitHub SDK is possibly uninitialized!",{name:"GitHubError"})},Pe=function(e,r){e&&r?(De=new Oe.Octokit({auth:e}),Se=r):F("GitHub initialization error! authToken: ".concat(!!e,", account: ").concat(!!r))},Ie=function(){var e,r=(e=regeneratorRuntime.mark((function e(r,t){var n,o,u;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(De&&Se){e.next=2;break}return e.abrupt("return",Ee());case 2:return e.prev=2,e.next=5,De.request("GET /repos/{owner}/{repo}/contents/{path}",{owner:Se,repo:r,path:t});case 5:return n=e.sent,o=n.data,u=n.headers,e.abrupt("return",{response:o,headers:u});case 11:e.prev=11,e.t0=e.catch(2),F("[ERROR:gh.getContent]",e.t0);case 14:return e.abrupt("return",null);case 15:case"end":return e.stop()}}),e,null,[[2,11]])})),function(){var r=this,t=arguments;return new Promise((function(n,o){var u=e.apply(r,t);function a(e){Ce(u,n,o,a,c,"next",e)}function c(e){Ce(u,n,o,a,c,"throw",e)}a(void 0)}))});return function(e,t){return r.apply(this,arguments)}}();const Fe={fs:e,aws:o,gh:c}})();var c=a.r,s=a.Z,i=a.fs,l=a.gh;export{c as aws,s as default,i as fs,l as gh};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","mappings":"qHAAAA,EAAOC,QAAUC,E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OvD,KAChByD,EAAYF,EAAZE,QAVc,kBAWf,CAAED,SAAAA,EAAUC,QAAAA,IAXG,kCAatB5H,EAAM,wBAAD,MAbiB,iCAgBjB,MAhBiB,yD,iLAAH,wDC5BvB,UAAiBY,GAAAA,EAAIiH,IAAAA,EAAKC,GAAAA,I","sources":["webpack://@baadal-sdk/dapi/external commonjs \"rimraf\"","webpack://@baadal-sdk/dapi/webpack/bootstrap","webpack://@baadal-sdk/dapi/webpack/runtime/compat get default export","webpack://@baadal-sdk/dapi/webpack/runtime/define property getters","webpack://@baadal-sdk/dapi/webpack/runtime/hasOwnProperty shorthand","webpack://@baadal-sdk/dapi/webpack/runtime/make namespace object","webpack://@baadal-sdk/dapi/external commonjs \"regenerator-runtime/runtime.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.string.starts-with.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.for-each.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/web.dom-collections.for-each.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.concat.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.map.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.to-string.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.promise.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.string.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/web.dom-collections.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.last-index-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.symbol.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.symbol.description.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.symbol.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.from.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.slice.js\"","webpack://@baadal-sdk/dapi/external node-commonjs \"path\"","webpack://@baadal-sdk/dapi/external node-commonjs \"util\"","webpack://@baadal-sdk/dapi/external node-commonjs \"fs\"","webpack://@baadal-sdk/dapi/external node-commonjs \"fs/promises\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.set-prototype-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.get-prototype-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.index-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.regexp.to-string.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.reflect.construct.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.map.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.delete-all.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.every.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.filter.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.find.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.find-key.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.includes.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.key-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.map-keys.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.map-values.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.merge.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.reduce.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.some.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.update.js\"","webpack://@baadal-sdk/dapi/./src/common/error.ts","webpack://@baadal-sdk/dapi/external commonjs \"chalk\"","webpack://@baadal-sdk/dapi/./src/common/logger.ts","webpack://@baadal-sdk/dapi/./src/fs/index.ts","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.keys.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.filter.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.get-own-property-descriptor.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.get-own-property-descriptors.js\"","webpack://@baadal-sdk/dapi/external commonjs \"@aws-sdk/client-dynamodb\"","webpack://@baadal-sdk/dapi/external commonjs \"@aws-sdk/lib-dynamodb\"","webpack://@baadal-sdk/dapi/external commonjs \"short-uuid\"","webpack://@baadal-sdk/dapi/./src/aws/db.ts","webpack://@baadal-sdk/dapi/./src/aws/index.ts","webpack://@baadal-sdk/dapi/external commonjs \"@octokit/core\"","webpack://@baadal-sdk/dapi/./src/gh/index.ts","webpack://@baadal-sdk/dapi/./src/index.ts"],"sourcesContent":["module.exports = require(\"rimraf\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"regenerator-runtime/runtime.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.string.starts-with.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.for-each.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/web.dom-collections.for-each.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.concat.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.map.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.to-string.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.promise.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.string.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/web.dom-collections.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.last-index-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.symbol.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.symbol.description.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.symbol.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.from.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.slice.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = __WEBPACK_EXTERNAL_createRequire(import.meta.url)(\"path\");","const __WEBPACK_NAMESPACE_OBJECT__ = __WEBPACK_EXTERNAL_createRequire(import.meta.url)(\"util\");","const __WEBPACK_NAMESPACE_OBJECT__ = __WEBPACK_EXTERNAL_createRequire(import.meta.url)(\"fs\");","const __WEBPACK_NAMESPACE_OBJECT__ = __WEBPACK_EXTERNAL_createRequire(import.meta.url)(\"fs/promises\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.set-prototype-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.get-prototype-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.index-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.regexp.to-string.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.reflect.construct.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.map.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.delete-all.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.every.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.filter.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.find.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.find-key.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.includes.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.key-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.map-keys.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.map-values.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.merge.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.reduce.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.some.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.update.js\");","export class CustomError extends Error {\n constructor(message: string, options: any = {}) {\n super(message);\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, CustomError);\n }\n\n this.name = options.name || 'CustomError';\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"chalk\");","import chalk from 'chalk';\n\nlet clog = console.log;\nlet cwarn = console.warn;\nlet cerror = console.error;\n\nif (typeof window === typeof undefined) {\n clog = (...args: any[]) => console.log(chalk.green(...args));\n cwarn = (...args: any[]) => console.warn(chalk.yellow(...args));\n cerror = (...args: any[]) => console.error(chalk.red(...args));\n}\n\nconst log = clog;\nconst warn = cwarn;\nconst error = cerror;\n\nexport { log, warn, error };\nexport default { log, warn, error };\n","import path from 'path';\nimport util from 'util';\nimport fs from 'fs';\nimport fsa from 'fs/promises';\n\nimport { CustomError } from '../common/error';\nimport { warn as cwarn } from '../common/logger';\n\nconst assertPath = (p: string) => {\n if (!p || p.startsWith('/')) return p;\n return path.resolve(process.cwd(), p);\n};\n\n/**\n * Check whether a file exists\n * @param file file path\n * @param loud whether to throw errors [default: false]\n * @returns true if it exists, false otherwise\n */\nexport const existsFileSync = (file: string, loud = false) => {\n if (!file) return false;\n file = assertPath(file);\n try {\n if (!fs.existsSync(file)) {\n if (!loud) return false;\n throw new CustomError(`File does not exist: ${file}`);\n }\n } catch (e) {\n if (!loud) return false;\n if (e instanceof CustomError) {\n throw e;\n } else {\n throw new CustomError(`Error while accessing file: ${file}`);\n }\n }\n return true;\n};\n\n/**\n * Check whether a directory exists\n * @param dir directory path\n * @param loud whether to throw errors [default: false]\n * @returns true if it exists, false otherwise\n */\nexport const existsDirSync = (dir: string, loud = false) => {\n if (!dir) return false;\n dir = assertPath(dir);\n try {\n if (!fs.existsSync(dir)) {\n if (!loud) return false;\n throw new CustomError(`Directory does not exist: ${dir}`);\n }\n } catch (e) {\n if (!loud) return false;\n if (e instanceof CustomError) {\n throw e;\n } else {\n throw new CustomError(`Error while accessing directory: ${dir}`);\n }\n }\n return true;\n};\n\n/**\n * Read contents of a file\n * @param file file path\n * @param warn whether to show warnings [default: false]\n * @returns contents of the file, null in case of error\n */\nexport const readFile = async (file: string, warn = false) => {\n if (!file) return null;\n file = assertPath(file);\n let contents = null;\n try {\n contents = await fsa.readFile(file, 'utf8');\n } catch (e) {\n if (warn) cwarn(`Cannot read file: ${file}`);\n }\n return contents;\n};\n\n/**\n * Read contents of a file\n * @param file file path\n * @param warn whether to show warnings [default: false]\n * @returns contents of the file, null in case of error\n */\nexport const readFileSync = (file: string, warn = false) => {\n if (!file) return null;\n file = assertPath(file);\n let contents = null;\n try {\n contents = fs.readFileSync(file, 'utf8');\n } catch (e) {\n if (warn) cwarn(`Cannot read file: ${file}`);\n }\n return contents;\n};\n\n/**\n * Get the list of files/directories in a directory\n * @param dir directory path\n * @param warn whether to show warnings [default: false]\n * @returns an object {dirs,files} containing list of directories & files\n */\nexport const readDir = async (dir: string, warn = false) => {\n if (!dir) return { dirs: null, files: null };\n dir = assertPath(dir);\n\n let files: string[] | null = null;\n let dirs: string[] | null = null;\n\n try {\n const items = await fsa.readdir(dir, { withFileTypes: true });\n items.forEach(item => {\n if (item.isDirectory()) {\n if (!dirs) {\n dirs = [item.name];\n } else {\n dirs.push(item.name);\n }\n } else if (item.isFile()) {\n if (!files) {\n files = [item.name];\n } else {\n files.push(item.name);\n }\n }\n });\n } catch (e) {\n if (warn) cwarn(`Cannot read dir: ${dir}`);\n }\n\n return { dirs, files } as { dirs: string[] | null; files: string[] | null };\n};\n\n/**\n * Get the list of files in a directory\n * @param dir directory path\n * @param warn whether to show warnings [default: false]\n * @returns list of files, null in case of error or no items\n */\nexport const readDirFiles = async (dir: string, warn = false) => {\n if (!dir) return null;\n dir = assertPath(dir);\n return (await readDir(dir, warn)).files;\n};\n\n/**\n * Get the list of directories in a directory\n * @param dir directory path\n * @param warn whether to show warnings [default: false]\n * @returns list of directories, null in case of error or no items\n */\nexport const readDirDirs = async (dir: string, warn = false) => {\n if (!dir) return null;\n dir = assertPath(dir);\n return (await readDir(dir, warn)).dirs;\n};\n\nconst readDirFilesRecHelper = async (dir: string, basePath = ''): Promise<string[] | null> => {\n if (!dir) return null;\n dir = assertPath(dir);\n\n const dirPath = basePath ? `${dir}/${basePath}` : dir;\n const { dirs, files } = await readDir(dirPath);\n let allFiles: string[] = files || [];\n allFiles = allFiles.map(file => (basePath ? `${basePath}/${file}` : file));\n const absDirs = (dirs || []).map(d => (basePath ? `${basePath}/${d}` : d));\n\n const pList = absDirs.map(dirx => readDirFilesRecHelper(dir, dirx));\n const filesxList = await Promise.all(pList);\n filesxList.forEach(filesx => {\n if (filesx) {\n allFiles = [...allFiles, ...filesx];\n }\n });\n\n return allFiles.length ? allFiles : null;\n};\n\n/**\n * Get the (recursive) list of files in a directory\n * @param dir directory path\n * @returns complete (recursive) list of files, null in case of error or no items\n */\nexport const readDirFilesRec = (dir: string) => readDirFilesRecHelper(dir);\n\n/**\n * Write contents to a file (creates the file path if it doesn't exist)\n * @param file file path\n * @param contents contents to write\n * @returns true if successful, false on error\n */\nexport const writeFile = async (file: string, contents: string) => {\n if (!file || !contents) return false;\n file = assertPath(file);\n try {\n const dir = file.substring(0, file.lastIndexOf('/'));\n await fsa.mkdir(dir, { recursive: true });\n await fsa.writeFile(file, contents);\n } catch (e) {\n console.error(`Error while writing to ${file}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Append contents to a file\n * @param file file path\n * @param contents contents to append\n * @returns true if successful, false on error\n */\nexport const appendToFile = async (file: string, contents: string) => {\n if (!file || !contents) return false;\n file = assertPath(file);\n try {\n const dir = file.substring(0, file.lastIndexOf('/'));\n await fsa.mkdir(dir, { recursive: true });\n\n await fsa.appendFile(file, contents + '\\n');\n\n // Ref: https://stackoverflow.com/a/43370201\n // const stream = fs.createWriteStream(file, { flags: 'a' });\n // stream.write(contents + '\\n');\n // stream.end();\n } catch (e) {\n console.error(`Error while appending to ${file}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Rename a file\n * @param oldpath old file path\n * @param newpath new file path\n * @returns true if successful, false on error\n */\nexport const renameFile = async (oldpath: string, newpath: string) => {\n if (!oldpath || !newpath) return false;\n oldpath = assertPath(oldpath);\n newpath = assertPath(newpath);\n try {\n await fsa.rename(oldpath, newpath);\n } catch (e) {\n console.error(`Error while renaming file ${oldpath} to ${newpath}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Create a directory, if it doesn't exist\n * @param dir directory path\n * @returns true if successful, false in case of failure\n */\nexport const createDir = async (dir: string) => {\n if (!dir) return false;\n dir = assertPath(dir);\n try {\n if (!existsDirSync(dir)) {\n await fsa.mkdir(dir, { recursive: true });\n }\n } catch (e) {\n console.error(`Error while creating directory: ${dir}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Delete a file\n * @param file file path\n * @returns true if successful, false on error\n */\nexport const deleteFile = async (file: string) => {\n if (!file) return false;\n file = assertPath(file);\n try {\n await fsa.unlink(file);\n } catch (e) {\n console.error(`Error while deleting file ${file}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Delete a directory\n * @param dir directory path\n * @returns true if successful, false on error\n */\nexport const deleteDir = async (dir: string) => {\n if (!dir) return false;\n dir = assertPath(dir);\n try {\n const rimraf = require('rimraf');\n const rimrafPr = util.promisify(rimraf);\n await rimrafPr(dir);\n\n // Added in: v14.14.0\n // await fsa.rm(dir, { recursive: true, force: true });\n } catch (e) {\n console.error(`Error while deleting dir ${dir}`, e);\n return false;\n }\n return true;\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.keys.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.filter.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.get-own-property-descriptor.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.get-own-property-descriptors.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@aws-sdk/client-dynamodb\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@aws-sdk/lib-dynamodb\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"short-uuid\");","/**\n * Partition key vs Composite primary key:\n * Ref: https://aws.amazon.com/premiumsupport/knowledge-center/primary-key-dynamodb-table/\n */\n\nimport { DynamoDBClient } from '@aws-sdk/client-dynamodb';\nimport {\n DynamoDBDocumentClient,\n GetCommand,\n GetCommandInput,\n PutCommand,\n PutCommandInput,\n UpdateCommand,\n UpdateCommandInput,\n QueryCommand,\n QueryCommandInput,\n ScanCommand,\n ScanCommandInput,\n DeleteCommand,\n DeleteCommandInput,\n} from '@aws-sdk/lib-dynamodb';\nimport short from 'short-uuid';\n\nimport { StringIndexable } from '../common/common.model';\nimport { CustomError } from '../common/error';\n\nlet dbDocClient: DynamoDBDocumentClient | null = null;\n\nconst DynamoDBError = (msg: string) => new CustomError(msg, { name: 'DynamoDBError' });\n\nconst initializationError = () => {\n throw DynamoDBError('DynamoDB is possibly uninitialized!');\n};\n\nexport const init = (region: string) => {\n const dbClient = new DynamoDBClient({ region });\n\n // Ref: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html#configuration\n if (!dbDocClient) {\n dbDocClient = DynamoDBDocumentClient.from(dbClient);\n }\n};\n\nconst writeItemForceHelper = async <T = any>(table: string, data: T, key: string, i: number): Promise<T | null> => {\n if (!dbDocClient) return initializationError();\n if (!table || !data) return null;\n\n if (!(data as any)[key]) {\n (data as any)[key] = short.uuid();\n }\n const cmdParams: PutCommandInput = { TableName: table, Item: data, ConditionExpression: `attribute_not_exists(${key})` };\n const command = new PutCommand(cmdParams);\n const numberOfAttempts = 3;\n\n try {\n await dbDocClient.send(command);\n } catch (err: any) {\n // console.error('PutCommandInput:', cmdParams);\n // console.error(err);\n if (err.name === 'ConditionalCheckFailedException') {\n if (i < numberOfAttempts - 1) {\n (data as any)[key] = short.uuid(); // new primary key\n const ret: T | null = await writeItemForceHelper(table, data, key, i + 1);\n return ret;\n }\n console.error('PutCommandInput:', cmdParams);\n console.error('[ERROR] Maximum attempts overflow!');\n }\n return null;\n }\n\n return data;\n};\n\nexport const writeItemForce = async <T = any>(table: string, data: T, key = 'id'): Promise<T | null> => {\n return writeItemForceHelper<T>(table, data, key, 0);\n};\n\nexport const writeItem = async (table: string, data: StringIndexable) => {\n if (!dbDocClient) return initializationError();\n if (!table || !data) return null;\n\n const cmdParams: PutCommandInput = { TableName: table, Item: data };\n const command = new PutCommand(cmdParams);\n\n try {\n await dbDocClient.send(command);\n } catch (err) {\n console.error('PutCommandInput:', cmdParams);\n console.error(err);\n return null;\n // throw err;\n }\n\n return true;\n};\n\nexport const updateItem = async (\n table: string,\n key: StringIndexable,\n update: string,\n attr: StringIndexable,\n attrNames?: StringIndexable\n) => {\n if (!dbDocClient) return initializationError();\n if (!table || !key || !update || !attr) return null;\n\n let cmdParams: UpdateCommandInput = {\n TableName: table,\n Key: key,\n UpdateExpression: update,\n ExpressionAttributeValues: attr,\n };\n if (attrNames) cmdParams = { ...cmdParams, ExpressionAttributeNames: attrNames };\n const command = new UpdateCommand(cmdParams);\n\n try {\n await dbDocClient.send(command);\n } catch (err) {\n console.error('UpdateCommandInput:', cmdParams);\n console.error(err);\n return null;\n // throw err;\n }\n\n return true;\n};\n\nexport const readItem = async <T = any>(\n table: string,\n key: StringIndexable,\n projection?: string,\n attrNames?: StringIndexable\n) => {\n if (!dbDocClient) return initializationError();\n if (!table || !key) return null;\n\n let contents: T | null = null;\n let cmdParams: GetCommandInput = { TableName: table, Key: key };\n\n // Ref: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ProjectionExpressions.html\n if (projection) cmdParams = { ...cmdParams, ProjectionExpression: projection };\n if (attrNames) cmdParams = { ...cmdParams, ExpressionAttributeNames: attrNames };\n\n const command = new GetCommand(cmdParams);\n\n try {\n const results = await dbDocClient.send(command);\n const item = results.Item;\n\n if (item) {\n contents = item as T;\n }\n } catch (err) {\n console.error('GetCommandInput:', cmdParams);\n console.error(err);\n // throw err;\n }\n\n return contents;\n};\n\nexport const queryItems = async (\n table: string,\n indexName: string,\n cond: string,\n attr: StringIndexable,\n projection = '',\n desc = false\n) => {\n if (!dbDocClient) return initializationError();\n if (!table || !cond || !attr) return null;\n\n let contents: StringIndexable[] | null = null;\n\n // Ref: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html\n // Ref: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/dynamodb-example-query-scan.html\n // Ref: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SQLtoNoSQL.Indexes.QueryAndScan.html#SQLtoNoSQL.Indexes.QueryAndScan.DynamoDB\n let cmdParams: QueryCommandInput = {\n TableName: table,\n KeyConditionExpression: cond,\n ExpressionAttributeValues: attr,\n // FilterExpression: \"contains (category_id, :cid)\",\n };\n\n if (indexName) cmdParams = { ...cmdParams, IndexName: indexName };\n if (projection) cmdParams = { ...cmdParams, ProjectionExpression: projection };\n if (desc) cmdParams = { ...cmdParams, ScanIndexForward: false };\n\n const command = new QueryCommand(cmdParams);\n\n try {\n const results = await dbDocClient.send(command);\n const items = results.Items;\n\n if (items) {\n contents = items;\n }\n } catch (err) {\n console.error('QueryCommandInput:', command.input);\n console.error(err);\n // throw err;\n }\n\n return contents;\n};\n\nexport const scanItems = async (table: string, projection = '') => {\n if (!dbDocClient) return initializationError();\n if (!table) return null;\n\n let contents: StringIndexable[] | null = null;\n\n // Ref: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/dynamodb-example-query-scan.html\n let cmdParams: ScanCommandInput = {\n TableName: table,\n };\n\n if (projection) cmdParams = { ...cmdParams, ProjectionExpression: projection };\n\n const command = new ScanCommand(cmdParams);\n\n try {\n const results = await dbDocClient.send(command);\n const items = results.Items;\n\n if (items) {\n contents = items;\n }\n } catch (err) {\n console.error('ScanCommandInput:', cmdParams);\n console.error(err);\n // throw err;\n }\n\n return contents;\n};\n\nexport const deleteItem = async (table: string, key: StringIndexable) => {\n if (!dbDocClient) return initializationError();\n if (!table || !key) return null;\n\n const cmdParams: DeleteCommandInput = { TableName: table, Key: key };\n const command = new DeleteCommand(cmdParams);\n\n try {\n await dbDocClient.send(command);\n } catch (err) {\n console.error('DeleteCommandInput:', cmdParams);\n console.error(err);\n // throw err;\n return false;\n }\n\n return true;\n};\n\n// ----------------\n\n// await dbWriteItem('lesson_list', { id: 'id_001', title: 'My Lesson' });\n\n// const contents = await dbReadItem('lesson_list', { id: 'id_001' });\n// console.log(contents);\n\n// await dbUpdateItem(\n// 'lesson_list',\n// { id: 'id_001' },\n// 'set #a = :a, #b = :b',\n// { ':a': 'abhi@raj.me', ':b': 'Abhishek Raj' },\n// { '#a': 'email', '#b': 'name' }\n// );\n\n// ----------------\n","import * as dbAll from './db';\nimport { error } from '../common/logger';\n\nconst { init: dbInit, ...db } = dbAll;\n\nconst init = (region: string) => {\n if (!region) {\n error(`AWS initialization error! Missing region: ${region}`);\n return;\n }\n\n dbInit(region);\n};\n\nexport { db, init }; // named exports\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@octokit/core\");","import { Octokit } from '@octokit/core';\n\nimport { CustomError } from '../common/error';\nimport { error } from '../common/logger';\n\nlet github: Octokit | null = null;\nlet owner: string | null = null;\n\nconst GitHubError = (msg: string) => new CustomError(msg, { name: 'GitHubError' });\n\nconst initializationError = () => {\n throw GitHubError('GitHub SDK is possibly uninitialized!');\n};\n\n/**\n * Initialize GitHub SDK\n * @param authToken GitHub auth token for the user account [GITHUB_TOKEN]\n * @param account account id for the GitHub user account [GITHUB_ACCOUNT]\n */\nexport const init = (authToken: string, account: string) => {\n if (!authToken || !account) {\n error(`GitHub initialization error! authToken: ${!!authToken}, account: ${!!account}`);\n return;\n }\n github = new Octokit({ auth: authToken });\n owner = account;\n};\n\n/**\n * Get contents of a particular file in a repo\n * @param repo name of the repo\n * @param path path of a file in the repo\n * @returns an object {response,headers} containing response and response headers, null in case of error\n */\nexport const getContent = async (repo: string, path: string) => {\n if (!github || !owner) return initializationError();\n\n try {\n const ghResp = await github.request('GET /repos/{owner}/{repo}/contents/{path}', {\n owner,\n repo,\n path,\n });\n const response = ghResp.data as GitHubContent;\n const { headers } = ghResp;\n return { response, headers };\n } catch (e) {\n error(`[ERROR:gh.getContent]`, e);\n }\n\n return null;\n};\n\n// --------------\n\nexport interface GitHubContent {\n path: string;\n content: string;\n sha: string;\n}\n","import * as fs from './fs';\nimport * as aws from './aws';\nimport * as gh from './gh';\n\n// Ref: https://stackoverflow.com/a/41283945\nexport { fs, aws, gh }; // named exports\nexport default { fs, aws, gh }; // default export\n"],"names":["module","exports","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","__WEBPACK_EXTERNAL_createRequire","import","meta","url","CustomError","message","options","Error","captureStackTrace","name","console","log","cwarn","warn","cerror","error","window","chalk","assertPath","p","startsWith","path","process","cwd","existsFileSync","file","loud","fs","e","existsDirSync","dir","readFile","contents","fsa","readFileSync","readDir","dirs","files","withFileTypes","forEach","item","isDirectory","push","isFile","readDirFiles","readDirDirs","readDirFilesRecHelper","basePath","dirPath","allFiles","map","absDirs","pList","dirx","Promise","all","filesx","length","readDirFilesRec","writeFile","substring","lastIndexOf","recursive","appendToFile","renameFile","oldpath","newpath","createDir","deleteFile","deleteDir","rimraf","rimrafPr","util","dbDocClient","initializationError","init","region","dbClient","DynamoDBClient","DynamoDBDocumentClient","writeItemForceHelper","table","data","i","short","cmdParams","TableName","Item","ConditionExpression","command","PutCommand","numberOfAttempts","send","ret","writeItemForce","writeItem","updateItem","update","attr","attrNames","Key","UpdateExpression","ExpressionAttributeValues","ExpressionAttributeNames","UpdateCommand","readItem","projection","ProjectionExpression","GetCommand","results","queryItems","indexName","cond","desc","KeyConditionExpression","IndexName","ScanIndexForward","QueryCommand","items","Items","input","scanItems","ScanCommand","deleteItem","DeleteCommand","dbInit","dbAll","db","github","owner","authToken","account","Octokit","auth","getContent","repo","request","ghResp","response","headers","aws","gh"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"index.js","mappings":"qHAAAA,EAAOC,QAAUC,EAAQ,YCCrBC,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAaL,QAGrB,IAAID,EAASG,EAAyBE,GAAY,CAGjDJ,QAAS,IAOV,OAHAO,EAAoBH,GAAUL,EAAQA,EAAOC,QAASG,GAG/CJ,EAAOC,QCpBfG,EAAoBK,EAAKT,IACxB,IAAIU,EAASV,GAAUA,EAAOW,WAC7B,IAAOX,EAAiB,QACxB,IAAM,EAEP,OADAI,EAAoBQ,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRN,EAAoBQ,EAAI,CAACX,EAASa,KACjC,IAAI,IAAIC,KAAOD,EACXV,EAAoBY,EAAEF,EAAYC,KAASX,EAAoBY,EAAEf,EAASc,IAC5EE,OAAOC,eAAejB,EAASc,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EX,EAAoBY,EAAI,CAACK,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFlB,EAAoBsB,EAAKzB,IACH,oBAAX0B,QAA0BA,OAAOC,aAC1CX,OAAOC,eAAejB,EAAS0B,OAAOC,YAAa,CAAEC,MAAO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BAaf,GAbe,kCAgBjB,GAhBiB,0DAAH,wDC/OTgH,GAAoCC,GAApBC,GAAoBD,GAAPE,G,kXAA3C,CAAkDF,EAAlD,mBAEMpD,GAAO,SAACC,GACZ,OAAKA,EAKEkD,GAAOlD,IAJZ9D,EAAM,6CAAD,OAA8C8D,KAC5C,IAMLM,GAAS,WACb,OAAO8C,MCfT,MAAM,GAA+B7J,EAAQ,iB,0HCK7C,IAAI+J,GAAyB,KACzBC,GAAuB,KAIrBzD,GAAsB,WAC1B,MAHmC,IAAIvE,EAGrB,wCAHsC,CAAEK,KAAM,iBAWrDmE,GAAO,SAACyD,EAAmBC,GACjCD,GAAcC,GAInBH,GAAS,IAAII,GAAAA,QAAQ,CAAEC,KAAMH,IAC7BD,GAAQE,GAJNvH,EAAM,2CAAD,SAA8CsH,EAA9C,wBAAuEC,KAanEG,GAAU,e,EAAA,G,EAAA,yBAAG,WAAOC,EAAcrH,GAArB,6FACnB8G,IAAWC,GADQ,yCACMzD,MADN,gCAIDwD,GAAOQ,QAAQ,4CAA6C,CAC/EP,MAAAA,GACAM,KAAAA,EACArH,KAAAA,IAPoB,cAIhBuH,EAJgB,OAShBC,EAAWD,EAAOtD,KAChBwD,EAAYF,EAAZE,QAVc,kBAWf,CAAED,SAAAA,EAAUC,QAAAA,IAXG,kCAatB/H,EAAM,wBAAD,MAbiB,iCAgBjB,MAhBiB,yD,iLAAH,wDC5BvB,UAAiBY,GAAAA,EAAIoH,IAAAA,EAAKC,GAAAA,I","sources":["webpack://@baadal-sdk/dapi/external commonjs \"rimraf\"","webpack://@baadal-sdk/dapi/webpack/bootstrap","webpack://@baadal-sdk/dapi/webpack/runtime/compat get default export","webpack://@baadal-sdk/dapi/webpack/runtime/define property getters","webpack://@baadal-sdk/dapi/webpack/runtime/hasOwnProperty shorthand","webpack://@baadal-sdk/dapi/webpack/runtime/make namespace object","webpack://@baadal-sdk/dapi/external commonjs \"regenerator-runtime/runtime.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.string.starts-with.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.for-each.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/web.dom-collections.for-each.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.concat.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.map.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.to-string.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.promise.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.string.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/web.dom-collections.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.last-index-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.symbol.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.symbol.description.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.symbol.iterator.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.from.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.slice.js\"","webpack://@baadal-sdk/dapi/external node-commonjs \"path\"","webpack://@baadal-sdk/dapi/external node-commonjs \"util\"","webpack://@baadal-sdk/dapi/external node-commonjs \"fs\"","webpack://@baadal-sdk/dapi/external node-commonjs \"fs/promises\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.set-prototype-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.get-prototype-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.index-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.regexp.to-string.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.reflect.construct.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.map.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.delete-all.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.every.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.filter.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.find.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.find-key.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.includes.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.key-of.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.map-keys.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.map-values.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.merge.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.reduce.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.some.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/esnext.map.update.js\"","webpack://@baadal-sdk/dapi/./src/common/error.ts","webpack://@baadal-sdk/dapi/external commonjs \"chalk\"","webpack://@baadal-sdk/dapi/./src/common/logger.ts","webpack://@baadal-sdk/dapi/./src/fs/index.ts","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.keys.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.array.filter.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.get-own-property-descriptor.js\"","webpack://@baadal-sdk/dapi/external commonjs \"core-js/modules/es.object.get-own-property-descriptors.js\"","webpack://@baadal-sdk/dapi/external commonjs \"@aws-sdk/client-dynamodb\"","webpack://@baadal-sdk/dapi/external commonjs \"@aws-sdk/lib-dynamodb\"","webpack://@baadal-sdk/dapi/external commonjs \"short-uuid\"","webpack://@baadal-sdk/dapi/./src/aws/db-client.ts","webpack://@baadal-sdk/dapi/./src/aws/db.ts","webpack://@baadal-sdk/dapi/./src/aws/index.ts","webpack://@baadal-sdk/dapi/external commonjs \"@octokit/core\"","webpack://@baadal-sdk/dapi/./src/gh/index.ts","webpack://@baadal-sdk/dapi/./src/index.ts"],"sourcesContent":["module.exports = require(\"rimraf\");","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"regenerator-runtime/runtime.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.string.starts-with.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.for-each.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/web.dom-collections.for-each.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.concat.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.map.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.to-string.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.promise.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.string.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/web.dom-collections.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.last-index-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.symbol.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.symbol.description.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.symbol.iterator.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.from.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.slice.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = __WEBPACK_EXTERNAL_createRequire(import.meta.url)(\"path\");","const __WEBPACK_NAMESPACE_OBJECT__ = __WEBPACK_EXTERNAL_createRequire(import.meta.url)(\"util\");","const __WEBPACK_NAMESPACE_OBJECT__ = __WEBPACK_EXTERNAL_createRequire(import.meta.url)(\"fs\");","const __WEBPACK_NAMESPACE_OBJECT__ = __WEBPACK_EXTERNAL_createRequire(import.meta.url)(\"fs/promises\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.set-prototype-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.get-prototype-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.index-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.regexp.to-string.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.reflect.construct.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.map.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.delete-all.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.every.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.filter.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.find.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.find-key.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.includes.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.key-of.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.map-keys.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.map-values.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.merge.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.reduce.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.some.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/esnext.map.update.js\");","export class CustomError extends Error {\n constructor(message: string, options: any = {}) {\n super(message);\n\n // Maintains proper stack trace for where our error was thrown (only available on V8)\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, CustomError);\n }\n\n this.name = options.name || 'CustomError';\n }\n}\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"chalk\");","import chalk from 'chalk';\n\nlet clog = console.log;\nlet cwarn = console.warn;\nlet cerror = console.error;\n\nif (typeof window === typeof undefined) {\n clog = (...args: any[]) => console.log(chalk.green(...args));\n cwarn = (...args: any[]) => console.warn(chalk.yellow(...args));\n cerror = (...args: any[]) => console.error(chalk.red(...args));\n}\n\nconst log = clog;\nconst warn = cwarn;\nconst error = cerror;\n\nexport { log, warn, error };\nexport default { log, warn, error };\n","import path from 'path';\nimport util from 'util';\nimport fs from 'fs';\nimport fsa from 'fs/promises';\n\nimport { CustomError } from '../common/error';\nimport { warn as cwarn } from '../common/logger';\n\nconst assertPath = (p: string) => {\n if (!p || p.startsWith('/')) return p;\n return path.resolve(process.cwd(), p);\n};\n\n/**\n * Check whether a file exists\n * @param file file path\n * @param loud whether to throw errors [default: false]\n * @returns true if it exists, false otherwise\n */\nexport const existsFileSync = (file: string, loud = false) => {\n if (!file) return false;\n file = assertPath(file);\n try {\n if (!fs.existsSync(file)) {\n if (!loud) return false;\n throw new CustomError(`File does not exist: ${file}`);\n }\n } catch (e) {\n if (!loud) return false;\n if (e instanceof CustomError) {\n throw e;\n } else {\n throw new CustomError(`Error while accessing file: ${file}`);\n }\n }\n return true;\n};\n\n/**\n * Check whether a directory exists\n * @param dir directory path\n * @param loud whether to throw errors [default: false]\n * @returns true if it exists, false otherwise\n */\nexport const existsDirSync = (dir: string, loud = false) => {\n if (!dir) return false;\n dir = assertPath(dir);\n try {\n if (!fs.existsSync(dir)) {\n if (!loud) return false;\n throw new CustomError(`Directory does not exist: ${dir}`);\n }\n } catch (e) {\n if (!loud) return false;\n if (e instanceof CustomError) {\n throw e;\n } else {\n throw new CustomError(`Error while accessing directory: ${dir}`);\n }\n }\n return true;\n};\n\n/**\n * Read contents of a file\n * @param file file path\n * @param warn whether to show warnings [default: false]\n * @returns contents of the file, null in case of error\n */\nexport const readFile = async (file: string, warn = false) => {\n if (!file) return null;\n file = assertPath(file);\n let contents = null;\n try {\n contents = await fsa.readFile(file, 'utf8');\n } catch (e) {\n if (warn) cwarn(`Cannot read file: ${file}`);\n }\n return contents;\n};\n\n/**\n * Read contents of a file\n * @param file file path\n * @param warn whether to show warnings [default: false]\n * @returns contents of the file, null in case of error\n */\nexport const readFileSync = (file: string, warn = false) => {\n if (!file) return null;\n file = assertPath(file);\n let contents = null;\n try {\n contents = fs.readFileSync(file, 'utf8');\n } catch (e) {\n if (warn) cwarn(`Cannot read file: ${file}`);\n }\n return contents;\n};\n\n/**\n * Get the list of files/directories in a directory\n * @param dir directory path\n * @param warn whether to show warnings [default: false]\n * @returns an object {dirs,files} containing list of directories & files\n */\nexport const readDir = async (dir: string, warn = false) => {\n if (!dir) return { dirs: null, files: null };\n dir = assertPath(dir);\n\n let files: string[] | null = null;\n let dirs: string[] | null = null;\n\n try {\n const items = await fsa.readdir(dir, { withFileTypes: true });\n items.forEach(item => {\n if (item.isDirectory()) {\n if (!dirs) {\n dirs = [item.name];\n } else {\n dirs.push(item.name);\n }\n } else if (item.isFile()) {\n if (!files) {\n files = [item.name];\n } else {\n files.push(item.name);\n }\n }\n });\n } catch (e) {\n if (warn) cwarn(`Cannot read dir: ${dir}`);\n }\n\n return { dirs, files } as { dirs: string[] | null; files: string[] | null };\n};\n\n/**\n * Get the list of files in a directory\n * @param dir directory path\n * @param warn whether to show warnings [default: false]\n * @returns list of files, null in case of error or no items\n */\nexport const readDirFiles = async (dir: string, warn = false) => {\n if (!dir) return null;\n dir = assertPath(dir);\n return (await readDir(dir, warn)).files;\n};\n\n/**\n * Get the list of directories in a directory\n * @param dir directory path\n * @param warn whether to show warnings [default: false]\n * @returns list of directories, null in case of error or no items\n */\nexport const readDirDirs = async (dir: string, warn = false) => {\n if (!dir) return null;\n dir = assertPath(dir);\n return (await readDir(dir, warn)).dirs;\n};\n\nconst readDirFilesRecHelper = async (dir: string, basePath = ''): Promise<string[] | null> => {\n if (!dir) return null;\n dir = assertPath(dir);\n\n const dirPath = basePath ? `${dir}/${basePath}` : dir;\n const { dirs, files } = await readDir(dirPath);\n let allFiles: string[] = files || [];\n allFiles = allFiles.map(file => (basePath ? `${basePath}/${file}` : file));\n const absDirs = (dirs || []).map(d => (basePath ? `${basePath}/${d}` : d));\n\n const pList = absDirs.map(dirx => readDirFilesRecHelper(dir, dirx));\n const filesxList = await Promise.all(pList);\n filesxList.forEach(filesx => {\n if (filesx) {\n allFiles = [...allFiles, ...filesx];\n }\n });\n\n return allFiles.length ? allFiles : null;\n};\n\n/**\n * Get the (recursive) list of files in a directory\n * @param dir directory path\n * @returns complete (recursive) list of files, null in case of error or no items\n */\nexport const readDirFilesRec = (dir: string) => readDirFilesRecHelper(dir);\n\n/**\n * Write contents to a file (creates the file path if it doesn't exist)\n * @param file file path\n * @param contents contents to write\n * @returns true if successful, false on error\n */\nexport const writeFile = async (file: string, contents: string) => {\n if (!file || !contents) return false;\n file = assertPath(file);\n try {\n const dir = file.substring(0, file.lastIndexOf('/'));\n await fsa.mkdir(dir, { recursive: true });\n await fsa.writeFile(file, contents);\n } catch (e) {\n console.error(`Error while writing to ${file}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Append contents to a file\n * @param file file path\n * @param contents contents to append\n * @returns true if successful, false on error\n */\nexport const appendToFile = async (file: string, contents: string) => {\n if (!file || !contents) return false;\n file = assertPath(file);\n try {\n const dir = file.substring(0, file.lastIndexOf('/'));\n await fsa.mkdir(dir, { recursive: true });\n\n await fsa.appendFile(file, contents + '\\n');\n\n // Ref: https://stackoverflow.com/a/43370201\n // const stream = fs.createWriteStream(file, { flags: 'a' });\n // stream.write(contents + '\\n');\n // stream.end();\n } catch (e) {\n console.error(`Error while appending to ${file}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Rename a file\n * @param oldpath old file path\n * @param newpath new file path\n * @returns true if successful, false on error\n */\nexport const renameFile = async (oldpath: string, newpath: string) => {\n if (!oldpath || !newpath) return false;\n oldpath = assertPath(oldpath);\n newpath = assertPath(newpath);\n try {\n await fsa.rename(oldpath, newpath);\n } catch (e) {\n console.error(`Error while renaming file ${oldpath} to ${newpath}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Create a directory, if it doesn't exist\n * @param dir directory path\n * @returns true if successful, false in case of failure\n */\nexport const createDir = async (dir: string) => {\n if (!dir) return false;\n dir = assertPath(dir);\n try {\n if (!existsDirSync(dir)) {\n await fsa.mkdir(dir, { recursive: true });\n }\n } catch (e) {\n console.error(`Error while creating directory: ${dir}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Delete a file\n * @param file file path\n * @returns true if successful, false on error\n */\nexport const deleteFile = async (file: string) => {\n if (!file) return false;\n file = assertPath(file);\n try {\n await fsa.unlink(file);\n } catch (e) {\n console.error(`Error while deleting file ${file}`, e);\n return false;\n }\n return true;\n};\n\n/**\n * Delete a directory\n * @param dir directory path\n * @returns true if successful, false on error\n */\nexport const deleteDir = async (dir: string) => {\n if (!dir) return false;\n dir = assertPath(dir);\n try {\n const rimraf = require('rimraf');\n const rimrafPr = util.promisify(rimraf);\n await rimrafPr(dir);\n\n // Added in: v14.14.0\n // await fsa.rm(dir, { recursive: true, force: true });\n } catch (e) {\n console.error(`Error while deleting dir ${dir}`, e);\n return false;\n }\n return true;\n};\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.keys.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.array.filter.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.get-own-property-descriptor.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"core-js/modules/es.object.get-own-property-descriptors.js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@aws-sdk/client-dynamodb\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@aws-sdk/lib-dynamodb\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"short-uuid\");","import { DynamoDBDocumentClient } from '@aws-sdk/lib-dynamodb';\n\nconst dbDocClient: DynamoDBDocumentClient | null = null;\nconst id: string | null = null;\n\nexport default { dbDocClient, id } as { dbDocClient: DynamoDBDocumentClient | null; id: string | null };\n","/**\n * Partition key vs Composite primary key:\n * Ref: https://aws.amazon.com/premiumsupport/knowledge-center/primary-key-dynamodb-table/\n */\n\nimport { DynamoDBClient } from '@aws-sdk/client-dynamodb';\nimport {\n DynamoDBDocumentClient,\n GetCommand,\n GetCommandInput,\n PutCommand,\n PutCommandInput,\n UpdateCommand,\n UpdateCommandInput,\n QueryCommand,\n QueryCommandInput,\n ScanCommand,\n ScanCommandInput,\n DeleteCommand,\n DeleteCommandInput,\n} from '@aws-sdk/lib-dynamodb';\nimport short from 'short-uuid';\n\nimport dbClient from './db-client';\nimport { StringIndexable } from '../common/common.model';\nimport { CustomError } from '../common/error';\n\nconst DynamoDBError = (msg: string) => new CustomError(msg, { name: 'DynamoDBError' });\n\nconst initializationError = () => {\n throw DynamoDBError('DynamoDB is possibly uninitialized!');\n};\n\nexport const init = (region: string) => {\n const dydbClient = new DynamoDBClient({ region });\n\n // Ref: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html#configuration\n if (!dbClient.dbDocClient) {\n dbClient.dbDocClient = DynamoDBDocumentClient.from(dydbClient);\n dbClient.id = short.uuid();\n return true;\n }\n return false;\n};\n\nexport const status = () => dbClient.id;\n\nconst writeItemForceHelper = async <T = any>(table: string, data: T, key: string, i: number): Promise<T | null> => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table || !data) return null;\n\n if (!(data as any)[key]) {\n (data as any)[key] = short.uuid();\n }\n const cmdParams: PutCommandInput = { TableName: table, Item: data, ConditionExpression: `attribute_not_exists(${key})` };\n const command = new PutCommand(cmdParams);\n const numberOfAttempts = 3;\n\n try {\n await dbClient.dbDocClient.send(command);\n } catch (err: any) {\n // console.error('PutCommandInput:', cmdParams);\n // console.error(err);\n if (err.name === 'ConditionalCheckFailedException') {\n if (i < numberOfAttempts - 1) {\n (data as any)[key] = short.uuid(); // new primary key\n const ret: T | null = await writeItemForceHelper(table, data, key, i + 1);\n return ret;\n }\n console.error('PutCommandInput:', cmdParams);\n console.error('[ERROR] Maximum attempts overflow!');\n }\n return null;\n }\n\n return data;\n};\n\nexport const writeItemForce = async <T = any>(table: string, data: T, key = 'id'): Promise<T | null> => {\n return writeItemForceHelper<T>(table, data, key, 0);\n};\n\nexport const writeItem = async (table: string, data: StringIndexable) => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table || !data) return null;\n\n const cmdParams: PutCommandInput = { TableName: table, Item: data };\n const command = new PutCommand(cmdParams);\n\n try {\n await dbClient.dbDocClient.send(command);\n } catch (err) {\n console.error('PutCommandInput:', cmdParams);\n console.error(err);\n return null;\n // throw err;\n }\n\n return true;\n};\n\nexport const updateItem = async (\n table: string,\n key: StringIndexable,\n update: string,\n attr: StringIndexable,\n attrNames?: StringIndexable\n) => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table || !key || !update || !attr) return null;\n\n let cmdParams: UpdateCommandInput = {\n TableName: table,\n Key: key,\n UpdateExpression: update,\n ExpressionAttributeValues: attr,\n };\n if (attrNames) cmdParams = { ...cmdParams, ExpressionAttributeNames: attrNames };\n const command = new UpdateCommand(cmdParams);\n\n try {\n await dbClient.dbDocClient.send(command);\n } catch (err) {\n console.error('UpdateCommandInput:', cmdParams);\n console.error(err);\n return null;\n // throw err;\n }\n\n return true;\n};\n\nexport const readItem = async <T = any>(\n table: string,\n key: StringIndexable,\n projection?: string,\n attrNames?: StringIndexable\n) => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table || !key) return null;\n\n let contents: T | null = null;\n let cmdParams: GetCommandInput = { TableName: table, Key: key };\n\n // Ref: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.ProjectionExpressions.html\n if (projection) cmdParams = { ...cmdParams, ProjectionExpression: projection };\n if (attrNames) cmdParams = { ...cmdParams, ExpressionAttributeNames: attrNames };\n\n const command = new GetCommand(cmdParams);\n\n try {\n const results = await dbClient.dbDocClient.send(command);\n const item = results.Item;\n\n if (item) {\n contents = item as T;\n }\n } catch (err) {\n console.error('GetCommandInput:', cmdParams);\n console.error(err);\n // throw err;\n }\n\n return contents;\n};\n\nexport const queryItems = async (\n table: string,\n indexName: string,\n cond: string,\n attr: StringIndexable,\n projection = '',\n desc = false\n) => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table || !cond || !attr) return null;\n\n let contents: StringIndexable[] | null = null;\n\n // Ref: https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_Query.html\n // Ref: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/dynamodb-example-query-scan.html\n // Ref: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/SQLtoNoSQL.Indexes.QueryAndScan.html#SQLtoNoSQL.Indexes.QueryAndScan.DynamoDB\n let cmdParams: QueryCommandInput = {\n TableName: table,\n KeyConditionExpression: cond,\n ExpressionAttributeValues: attr,\n // FilterExpression: \"contains (category_id, :cid)\",\n };\n\n if (indexName) cmdParams = { ...cmdParams, IndexName: indexName };\n if (projection) cmdParams = { ...cmdParams, ProjectionExpression: projection };\n if (desc) cmdParams = { ...cmdParams, ScanIndexForward: false };\n\n const command = new QueryCommand(cmdParams);\n\n try {\n const results = await dbClient.dbDocClient.send(command);\n const items = results.Items;\n\n if (items) {\n contents = items;\n }\n } catch (err) {\n console.error('QueryCommandInput:', command.input);\n console.error(err);\n // throw err;\n }\n\n return contents;\n};\n\nexport const scanItems = async (table: string, projection = '') => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table) return null;\n\n let contents: StringIndexable[] | null = null;\n\n // Ref: https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/dynamodb-example-query-scan.html\n let cmdParams: ScanCommandInput = {\n TableName: table,\n };\n\n if (projection) cmdParams = { ...cmdParams, ProjectionExpression: projection };\n\n const command = new ScanCommand(cmdParams);\n\n try {\n const results = await dbClient.dbDocClient.send(command);\n const items = results.Items;\n\n if (items) {\n contents = items;\n }\n } catch (err) {\n console.error('ScanCommandInput:', cmdParams);\n console.error(err);\n // throw err;\n }\n\n return contents;\n};\n\nexport const deleteItem = async (table: string, key: StringIndexable) => {\n if (!dbClient.dbDocClient) return initializationError();\n if (!table || !key) return null;\n\n const cmdParams: DeleteCommandInput = { TableName: table, Key: key };\n const command = new DeleteCommand(cmdParams);\n\n try {\n await dbClient.dbDocClient.send(command);\n } catch (err) {\n console.error('DeleteCommandInput:', cmdParams);\n console.error(err);\n // throw err;\n return false;\n }\n\n return true;\n};\n\n// ----------------\n\n// await dbWriteItem('lesson_list', { id: 'id_001', title: 'My Lesson' });\n\n// const contents = await dbReadItem('lesson_list', { id: 'id_001' });\n// console.log(contents);\n\n// await dbUpdateItem(\n// 'lesson_list',\n// { id: 'id_001' },\n// 'set #a = :a, #b = :b',\n// { ':a': 'abhi@raj.me', ':b': 'Abhishek Raj' },\n// { '#a': 'email', '#b': 'name' }\n// );\n\n// ----------------\n","import * as dbAll from './db';\nimport { error } from '../common/logger';\n\nconst { init: dbInit, status: dbStatus, ...db } = dbAll;\n\nconst init = (region: string) => {\n if (!region) {\n error(`AWS initialization error! Missing region: ${region}`);\n return false;\n }\n\n return dbInit(region);\n};\n\nconst status = () => {\n return dbStatus();\n};\n\nexport { db, init, status }; // named exports\n","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@octokit/core\");","import { Octokit } from '@octokit/core';\n\nimport { CustomError } from '../common/error';\nimport { error } from '../common/logger';\n\nlet github: Octokit | null = null;\nlet owner: string | null = null;\n\nconst GitHubError = (msg: string) => new CustomError(msg, { name: 'GitHubError' });\n\nconst initializationError = () => {\n throw GitHubError('GitHub SDK is possibly uninitialized!');\n};\n\n/**\n * Initialize GitHub SDK\n * @param authToken GitHub auth token for the user account [GITHUB_TOKEN]\n * @param account account id for the GitHub user account [GITHUB_ACCOUNT]\n */\nexport const init = (authToken: string, account: string) => {\n if (!authToken || !account) {\n error(`GitHub initialization error! authToken: ${!!authToken}, account: ${!!account}`);\n return;\n }\n github = new Octokit({ auth: authToken });\n owner = account;\n};\n\n/**\n * Get contents of a particular file in a repo\n * @param repo name of the repo\n * @param path path of a file in the repo\n * @returns an object {response,headers} containing response and response headers, null in case of error\n */\nexport const getContent = async (repo: string, path: string) => {\n if (!github || !owner) return initializationError();\n\n try {\n const ghResp = await github.request('GET /repos/{owner}/{repo}/contents/{path}', {\n owner,\n repo,\n path,\n });\n const response = ghResp.data as GitHubContent;\n const { headers } = ghResp;\n return { response, headers };\n } catch (e) {\n error(`[ERROR:gh.getContent]`, e);\n }\n\n return null;\n};\n\n// --------------\n\nexport interface GitHubContent {\n path: string;\n content: string;\n sha: string;\n}\n","import * as fs from './fs';\nimport * as aws from './aws';\nimport * as gh from './gh';\n\n// Ref: https://stackoverflow.com/a/41283945\nexport { fs, aws, gh }; // named exports\nexport default { fs, aws, gh }; // default export\n"],"names":["module","exports","require","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","n","getter","__esModule","d","a","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value","__WEBPACK_EXTERNAL_createRequire","import","meta","url","CustomError","message","options","Error","captureStackTrace","name","console","log","cwarn","warn","cerror","error","window","chalk","assertPath","p","startsWith","path","process","cwd","existsFileSync","file","loud","fs","e","existsDirSync","dir","readFile","contents","fsa","readFileSync","readDir","dirs","files","withFileTypes","forEach","item","isDirectory","push","isFile","readDirFiles","readDirDirs","readDirFilesRecHelper","basePath","dirPath","allFiles","map","absDirs","pList","dirx","Promise","all","filesx","length","readDirFilesRec","writeFile","substring","lastIndexOf","recursive","appendToFile","renameFile","oldpath","newpath","createDir","deleteFile","deleteDir","rimraf","rimrafPr","util","dbDocClient","id","initializationError","init","region","dydbClient","DynamoDBClient","dbClient","DynamoDBDocumentClient","short","status","writeItemForceHelper","table","data","i","cmdParams","TableName","Item","ConditionExpression","command","PutCommand","numberOfAttempts","ret","writeItemForce","writeItem","updateItem","update","attr","attrNames","Key","UpdateExpression","ExpressionAttributeValues","ExpressionAttributeNames","UpdateCommand","readItem","projection","ProjectionExpression","GetCommand","results","queryItems","indexName","cond","desc","KeyConditionExpression","IndexName","ScanIndexForward","QueryCommand","items","Items","input","scanItems","ScanCommand","deleteItem","DeleteCommand","dbInit","dbAll","dbStatus","db","github","owner","authToken","account","Octokit","auth","getContent","repo","request","ghResp","response","headers","aws","gh"],"sourceRoot":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-client.d.ts","sourceRoot":"","sources":["../../../src/aws/db-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;;iBAKV,sBAAsB,GAAG,IAAI;QAAM,MAAM,GAAG,IAAI;;AAArG,wBAAwG"}
|
package/dist/types/aws/db.d.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Ref: https://aws.amazon.com/premiumsupport/knowledge-center/primary-key-dynamodb-table/
|
|
4
4
|
*/
|
|
5
5
|
import { StringIndexable } from '../common/common.model';
|
|
6
|
-
export declare const init: (region: string) =>
|
|
6
|
+
export declare const init: (region: string) => boolean;
|
|
7
|
+
export declare const status: () => string | null;
|
|
7
8
|
export declare const writeItemForce: <T = any>(table: string, data: T, key?: string) => Promise<T | null>;
|
|
8
9
|
export declare const writeItem: (table: string, data: StringIndexable) => Promise<true | null>;
|
|
9
10
|
export declare const updateItem: (table: string, key: StringIndexable, update: string, attr: StringIndexable, attrNames?: StringIndexable<any> | undefined) => Promise<true | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../../src/aws/db.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"db.d.ts","sourceRoot":"","sources":["../../../src/aws/db.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AASzD,eAAO,MAAM,IAAI,WAAY,MAAM,YAUlC,CAAC;AAEF,eAAO,MAAM,MAAM,qBAAoB,CAAC;AAiCxC,eAAO,MAAM,cAAc,mBAA0B,MAAM,6CAE1D,CAAC;AAEF,eAAO,MAAM,SAAS,UAAiB,MAAM,QAAQ,eAAe,yBAiBnE,CAAC;AAEF,eAAO,MAAM,UAAU,UACd,MAAM,OACR,eAAe,UACZ,MAAM,QACR,eAAe,uEAyBtB,CAAC;AAEF,eAAO,MAAM,QAAQ,mBACZ,MAAM,OACR,eAAe,qGA8BrB,CAAC;AAEF,eAAO,MAAM,UAAU,UACd,MAAM,aACF,MAAM,QACX,MAAM,QACN,eAAe,gFAuCtB,CAAC;AAEF,eAAO,MAAM,SAAS,UAAiB,MAAM,gEA6B5C,CAAC;AAEF,eAAO,MAAM,UAAU,UAAiB,MAAM,OAAO,eAAe,4BAiBnE,CAAC"}
|
|
@@ -7,6 +7,7 @@ declare const db: {
|
|
|
7
7
|
scanItems: (table: string, projection?: string) => Promise<import("../common/common.model").StringIndexable<any>[] | null>;
|
|
8
8
|
deleteItem: (table: string, key: import("../common/common.model").StringIndexable<any>) => Promise<boolean | null>;
|
|
9
9
|
};
|
|
10
|
-
declare const init: (region: string) =>
|
|
11
|
-
|
|
10
|
+
declare const init: (region: string) => boolean;
|
|
11
|
+
declare const status: () => string | null;
|
|
12
|
+
export { db, init, status };
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/aws/index.ts"],"names":[],"mappings":"AAGA,QAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/aws/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAA2C,EAAE;;;;;;;;CAAU,CAAC;AAExD,QAAA,MAAM,IAAI,WAAY,MAAM,YAO3B,CAAC;AAEF,QAAA,MAAM,MAAM,qBAEX,CAAC;AAEF,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC"}
|
package/package.json
CHANGED
package/src/aws/db.ts
CHANGED
|
@@ -21,11 +21,10 @@ import {
|
|
|
21
21
|
} from '@aws-sdk/lib-dynamodb';
|
|
22
22
|
import short from 'short-uuid';
|
|
23
23
|
|
|
24
|
+
import dbClient from './db-client';
|
|
24
25
|
import { StringIndexable } from '../common/common.model';
|
|
25
26
|
import { CustomError } from '../common/error';
|
|
26
27
|
|
|
27
|
-
let dbDocClient: DynamoDBDocumentClient | null = null;
|
|
28
|
-
|
|
29
28
|
const DynamoDBError = (msg: string) => new CustomError(msg, { name: 'DynamoDBError' });
|
|
30
29
|
|
|
31
30
|
const initializationError = () => {
|
|
@@ -33,16 +32,21 @@ const initializationError = () => {
|
|
|
33
32
|
};
|
|
34
33
|
|
|
35
34
|
export const init = (region: string) => {
|
|
36
|
-
const
|
|
35
|
+
const dydbClient = new DynamoDBClient({ region });
|
|
37
36
|
|
|
38
37
|
// Ref: https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/modules/_aws_sdk_lib_dynamodb.html#configuration
|
|
39
|
-
if (!dbDocClient) {
|
|
40
|
-
dbDocClient = DynamoDBDocumentClient.from(
|
|
38
|
+
if (!dbClient.dbDocClient) {
|
|
39
|
+
dbClient.dbDocClient = DynamoDBDocumentClient.from(dydbClient);
|
|
40
|
+
dbClient.id = short.uuid();
|
|
41
|
+
return true;
|
|
41
42
|
}
|
|
43
|
+
return false;
|
|
42
44
|
};
|
|
43
45
|
|
|
46
|
+
export const status = () => dbClient.id;
|
|
47
|
+
|
|
44
48
|
const writeItemForceHelper = async <T = any>(table: string, data: T, key: string, i: number): Promise<T | null> => {
|
|
45
|
-
if (!dbDocClient) return initializationError();
|
|
49
|
+
if (!dbClient.dbDocClient) return initializationError();
|
|
46
50
|
if (!table || !data) return null;
|
|
47
51
|
|
|
48
52
|
if (!(data as any)[key]) {
|
|
@@ -53,7 +57,7 @@ const writeItemForceHelper = async <T = any>(table: string, data: T, key: string
|
|
|
53
57
|
const numberOfAttempts = 3;
|
|
54
58
|
|
|
55
59
|
try {
|
|
56
|
-
await dbDocClient.send(command);
|
|
60
|
+
await dbClient.dbDocClient.send(command);
|
|
57
61
|
} catch (err: any) {
|
|
58
62
|
// console.error('PutCommandInput:', cmdParams);
|
|
59
63
|
// console.error(err);
|
|
@@ -77,14 +81,14 @@ export const writeItemForce = async <T = any>(table: string, data: T, key = 'id'
|
|
|
77
81
|
};
|
|
78
82
|
|
|
79
83
|
export const writeItem = async (table: string, data: StringIndexable) => {
|
|
80
|
-
if (!dbDocClient) return initializationError();
|
|
84
|
+
if (!dbClient.dbDocClient) return initializationError();
|
|
81
85
|
if (!table || !data) return null;
|
|
82
86
|
|
|
83
87
|
const cmdParams: PutCommandInput = { TableName: table, Item: data };
|
|
84
88
|
const command = new PutCommand(cmdParams);
|
|
85
89
|
|
|
86
90
|
try {
|
|
87
|
-
await dbDocClient.send(command);
|
|
91
|
+
await dbClient.dbDocClient.send(command);
|
|
88
92
|
} catch (err) {
|
|
89
93
|
console.error('PutCommandInput:', cmdParams);
|
|
90
94
|
console.error(err);
|
|
@@ -102,7 +106,7 @@ export const updateItem = async (
|
|
|
102
106
|
attr: StringIndexable,
|
|
103
107
|
attrNames?: StringIndexable
|
|
104
108
|
) => {
|
|
105
|
-
if (!dbDocClient) return initializationError();
|
|
109
|
+
if (!dbClient.dbDocClient) return initializationError();
|
|
106
110
|
if (!table || !key || !update || !attr) return null;
|
|
107
111
|
|
|
108
112
|
let cmdParams: UpdateCommandInput = {
|
|
@@ -115,7 +119,7 @@ export const updateItem = async (
|
|
|
115
119
|
const command = new UpdateCommand(cmdParams);
|
|
116
120
|
|
|
117
121
|
try {
|
|
118
|
-
await dbDocClient.send(command);
|
|
122
|
+
await dbClient.dbDocClient.send(command);
|
|
119
123
|
} catch (err) {
|
|
120
124
|
console.error('UpdateCommandInput:', cmdParams);
|
|
121
125
|
console.error(err);
|
|
@@ -132,7 +136,7 @@ export const readItem = async <T = any>(
|
|
|
132
136
|
projection?: string,
|
|
133
137
|
attrNames?: StringIndexable
|
|
134
138
|
) => {
|
|
135
|
-
if (!dbDocClient) return initializationError();
|
|
139
|
+
if (!dbClient.dbDocClient) return initializationError();
|
|
136
140
|
if (!table || !key) return null;
|
|
137
141
|
|
|
138
142
|
let contents: T | null = null;
|
|
@@ -145,7 +149,7 @@ export const readItem = async <T = any>(
|
|
|
145
149
|
const command = new GetCommand(cmdParams);
|
|
146
150
|
|
|
147
151
|
try {
|
|
148
|
-
const results = await dbDocClient.send(command);
|
|
152
|
+
const results = await dbClient.dbDocClient.send(command);
|
|
149
153
|
const item = results.Item;
|
|
150
154
|
|
|
151
155
|
if (item) {
|
|
@@ -168,7 +172,7 @@ export const queryItems = async (
|
|
|
168
172
|
projection = '',
|
|
169
173
|
desc = false
|
|
170
174
|
) => {
|
|
171
|
-
if (!dbDocClient) return initializationError();
|
|
175
|
+
if (!dbClient.dbDocClient) return initializationError();
|
|
172
176
|
if (!table || !cond || !attr) return null;
|
|
173
177
|
|
|
174
178
|
let contents: StringIndexable[] | null = null;
|
|
@@ -190,7 +194,7 @@ export const queryItems = async (
|
|
|
190
194
|
const command = new QueryCommand(cmdParams);
|
|
191
195
|
|
|
192
196
|
try {
|
|
193
|
-
const results = await dbDocClient.send(command);
|
|
197
|
+
const results = await dbClient.dbDocClient.send(command);
|
|
194
198
|
const items = results.Items;
|
|
195
199
|
|
|
196
200
|
if (items) {
|
|
@@ -206,7 +210,7 @@ export const queryItems = async (
|
|
|
206
210
|
};
|
|
207
211
|
|
|
208
212
|
export const scanItems = async (table: string, projection = '') => {
|
|
209
|
-
if (!dbDocClient) return initializationError();
|
|
213
|
+
if (!dbClient.dbDocClient) return initializationError();
|
|
210
214
|
if (!table) return null;
|
|
211
215
|
|
|
212
216
|
let contents: StringIndexable[] | null = null;
|
|
@@ -221,7 +225,7 @@ export const scanItems = async (table: string, projection = '') => {
|
|
|
221
225
|
const command = new ScanCommand(cmdParams);
|
|
222
226
|
|
|
223
227
|
try {
|
|
224
|
-
const results = await dbDocClient.send(command);
|
|
228
|
+
const results = await dbClient.dbDocClient.send(command);
|
|
225
229
|
const items = results.Items;
|
|
226
230
|
|
|
227
231
|
if (items) {
|
|
@@ -237,14 +241,14 @@ export const scanItems = async (table: string, projection = '') => {
|
|
|
237
241
|
};
|
|
238
242
|
|
|
239
243
|
export const deleteItem = async (table: string, key: StringIndexable) => {
|
|
240
|
-
if (!dbDocClient) return initializationError();
|
|
244
|
+
if (!dbClient.dbDocClient) return initializationError();
|
|
241
245
|
if (!table || !key) return null;
|
|
242
246
|
|
|
243
247
|
const cmdParams: DeleteCommandInput = { TableName: table, Key: key };
|
|
244
248
|
const command = new DeleteCommand(cmdParams);
|
|
245
249
|
|
|
246
250
|
try {
|
|
247
|
-
await dbDocClient.send(command);
|
|
251
|
+
await dbClient.dbDocClient.send(command);
|
|
248
252
|
} catch (err) {
|
|
249
253
|
console.error('DeleteCommandInput:', cmdParams);
|
|
250
254
|
console.error(err);
|
package/src/aws/index.ts
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import * as dbAll from './db';
|
|
2
2
|
import { error } from '../common/logger';
|
|
3
3
|
|
|
4
|
-
const { init: dbInit, ...db } = dbAll;
|
|
4
|
+
const { init: dbInit, status: dbStatus, ...db } = dbAll;
|
|
5
5
|
|
|
6
6
|
const init = (region: string) => {
|
|
7
7
|
if (!region) {
|
|
8
8
|
error(`AWS initialization error! Missing region: ${region}`);
|
|
9
|
-
return;
|
|
9
|
+
return false;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
dbInit(region);
|
|
12
|
+
return dbInit(region);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const status = () => {
|
|
16
|
+
return dbStatus();
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { db, init, status }; // named exports
|