@kumologica/sdk 4.0.0-beta4 → 4.0.0-beta6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kumologica/sdk",
3
- "version": "4.0.0-beta4",
3
+ "version": "4.0.0-beta6",
4
4
  "productName": "Kumologica Designer",
5
5
  "copyright": "Copyright 2020 Kumologica Pty Ltd, All Rights Reserved.",
6
6
  "author": "Kumologica Pty Ltd <contact@kumologica.com>",
@@ -84,9 +84,9 @@
84
84
  "@aws-sdk/credential-providers": "^3.556.0",
85
85
  "@aws-sdk/lib-dynamodb": "^3.549.0",
86
86
  "@electron/remote": "^2.0.8",
87
- "@kumologica/builder": "4.0.0-beta4",
88
- "@kumologica/devkit": "4.0.0-beta4",
89
- "@kumologica/runtime": "4.0.0-beta4",
87
+ "@kumologica/builder": "4.0.0-beta6",
88
+ "@kumologica/devkit": "4.0.0-beta6",
89
+ "@kumologica/runtime": "4.0.0-beta6",
90
90
  "adm-zip": "0.4.13",
91
91
  "ajv": "8.10.0",
92
92
  "archive-type": "^4.0.0",
@@ -511,7 +511,10 @@ if (s.cwevents && s.cwevents.length > 0) {
511
511
  settings.flowName
512
512
  );
513
513
 
514
- // NEW
514
+ if (!params.environment.some(e => e.key === "KUMOLOGICA_LICENSE")) {
515
+ params.environment.push({ key: "KUMOLOGICA_LICENSE", value: process.env.KUMOLOGICA_LICENSE });
516
+ }
517
+
515
518
  const args = this.mapParams(params);
516
519
  args.region = this.region;
517
520
  args["bucket-name"] = settings.deploymentBucketName;
@@ -519,7 +522,6 @@ if (s.cwevents && s.cwevents.length > 0) {
519
522
  args["flow-file-name"] = projectInfo.projectFlowName;
520
523
  args["zip-file-name"] = settings.zipFileName;
521
524
 
522
- console.log(`args: ${JSON.stringify(args)}`);
523
525
  const scriptFileName = exp("cloudformation", "aws", args);
524
526
 
525
527
  this.log(`Cloudformation script has been created: ${scriptFileName}`);
@@ -562,6 +564,10 @@ if (s.cwevents && s.cwevents.length > 0) {
562
564
  Body: body
563
565
  });
564
566
 
567
+ if (!params.environment.some(e => e.key === "KUMOLOGICA_LICENSE")) {
568
+ params.environment.push({ key: "KUMOLOGICA_LICENSE", value: process.env.KUMOLOGICA_LICENSE });
569
+ }
570
+
565
571
  const args = this.mapParams(params);
566
572
  args.region = this.region;
567
573
  args["bucket-name"] = settings.deploymentBucketName;
@@ -570,6 +576,8 @@ if (s.cwevents && s.cwevents.length > 0) {
570
576
  args["zip-file-name"] = settings.zipFileName;
571
577
  args.skipPrepare = "true"; // no need for cloudformation prepare
572
578
 
579
+ this.log(`args: ${JSON.stringify(args)}`);
580
+
573
581
  const scriptFileName = exp("cloudformation", "aws", args);
574
582
 
575
583
  const lambdaCfTemplate = this.loadJsonFile(scriptFileName);
@@ -114,7 +114,7 @@ class ServerlessDeployer {
114
114
 
115
115
  provider: {
116
116
  name: "aws",
117
- runtime: "nodejs18.x",
117
+ runtime: "nodejs20.x",
118
118
  deploymentPrefix: "kumologica-sls"
119
119
  },
120
120
  functions: {},
@@ -1 +1 @@
1
- var e,o,n,t,r=require("crypto"),i=require("fs"),s=require("path");function c(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function l(){if(!o){o=1;let l="base64";e={subscribe:async function(e){console.log("Requesting developer license for email: "+e);var r=await fetch("https://api.infra.kumologica.com/p/signup?x-api-key=RjibYF3qZb2AzmTrPOnV35LfRV798e3Z87vp4izo",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})});if(r.ok)return!0;{let e=await r.text();return console.error(`License request failed: ${r.status} `+e),!1}},display:function(e){e?(console.log("--- License Details ---"),console.log("Subscriber: "+e.sub),console.log("Email: "+e.email),console.log("License Type: "+e.licenseType),console.log("Issued By: "+e.iss),console.log("Issued At: "+new Date(e.iat).toLocaleString()),console.log("Expiry: "+("perpetual"===e.exp?"Perpetual":new Date(e.exp).toLocaleString())),console.log("------------------------")):console.error("Invalid license data.")},verify:function(e){publicKeyPem=(()=>{var o=Buffer.from("XkI1bxBWOXhHBztkdXIuEXlKLBcSIWstZlEzOEADPyFCCVkUeQNIIxwWDU4QEiEyLHpfOjwHCVNlL3tTFiIvMGkcZCkOBnNgIjtybUckA3x7BRARDElXRxECPlB4OgF4aWIRDQAGLBI2Jns3eTINDkx+XSN9bAAFDHllInIdCEg8SzICC2JJJyl4CGk5JAB/EBQcLW4+dzcuMGxhLglhbHUZF2ZwFQMJEl08cAVfWGd5ADtje34SDUJCHxUlWh83aghXDnJXXwxxCFsUNANhCzJ0MHoiVyEvLlh2OC5gf2UwdGZhDxAvMllUcCgSWl1w",l).toString().split("").reverse().join("");let t="";for(let r=0;r<o.length;r++){let e="34jfd#d-cDFG23@W096ml".charCodeAt(r%21);t+=String.fromCharCode(o.charCodeAt(r)^e)}return Buffer.from(t,l).toString()})();var o=r,[e,t]=e.split(".");if(!e||!t)throw new Error("Invalid license format. License may have been tampered.");var e=Buffer.from(e,"base64url").toString("utf-8"),n=JSON.parse(e),e=Buffer.from(e,"utf-8"),t=Buffer.from(t,l),o=o.createVerify("SHA256");if(o.update(e),o.end(),!o.verify(publicKeyPem,t))throw new Error("Invalid license signature. License may have been tampered.");if(!(n&&n.sub&&n.email&&n.iss&&n.iat))throw new Error("Invalid license data. License may have been tampered.");if(n.exp&&Date.now()>n.exp)throw new Error("License has expired. Please renew your license, contact Kumologica support at contact@kumologica.com.");return n},save:function(e,r){var o=i,t=s,t=(console.log("saving key to: "+e),t.join(e,"kumologica.license"));try{o.writeFileSync(t,r,"utf-8"),console.log("License saved successfully at: "+t)}catch(e){console.error("Failed to save license: "+e.message)}},read:function(e){var r=i,o=s.join(e,"kumologica.license");try{let e=r.readFileSync(o,"utf-8");return console.log("License read successfully from: "+o),e}catch(e){return null}}}}return e}var a=(()=>{if(t)return n;t=1;var e=l();return n={license:e}})(),u=c(a);module.exports=u;
1
+ var e,o,n,t,r=require("crypto"),i=require("fs"),s=require("path");function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function c(){if(!o){o=1;let l="base64";e={subscribe:async function(e){console.log("Requesting developer license for email: "+e);var r=await fetch("https://api.infra.kumologica.com/p/signup?x-api-key=RjibYF3qZb2AzmTrPOnV35LfRV798e3Z87vp4izo",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e})});if(r.ok)return!0;{let e=await r.text();return console.error(`License request failed: ${r.status} `+e),!1}},display:function(e){e?(console.log("-------- License Details ----------"),console.log("Subscriber: "+e.sub),console.log("Email: "+e.email),console.log("License Type: "+e.licenseType),console.log("Issued By: "+e.iss),console.log("Issued At: "+new Date(e.iat).toLocaleString()),console.log("Expiry: "+("perpetual"===e.exp?"Perpetual":new Date(e.exp).toLocaleString())),console.log("-----------------------------------")):console.error("Invalid license data.")},verify:function(e){publicKeyPem=(()=>{var o=Buffer.from("XkI1bxBWOXhHBztkdXIuEXlKLBcSIWstZlEzOEADPyFCCVkUeQNIIxwWDU4QEiEyLHpfOjwHCVNlL3tTFiIvMGkcZCkOBnNgIjtybUckA3x7BRARDElXRxECPlB4OgF4aWIRDQAGLBI2Jns3eTINDkx+XSN9bAAFDHllInIdCEg8SzICC2JJJyl4CGk5JAB/EBQcLW4+dzcuMGxhLglhbHUZF2ZwFQMJEl08cAVfWGd5ADtje34SDUJCHxUlWh83aghXDnJXXwxxCFsUNANhCzJ0MHoiVyEvLlh2OC5gf2UwdGZhDxAvMllUcCgSWl1w",l).toString().split("").reverse().join("");let t="";for(let r=0;r<o.length;r++){let e="34jfd#d-cDFG23@W096ml".charCodeAt(r%21);t+=String.fromCharCode(o.charCodeAt(r)^e)}return Buffer.from(t,l).toString()})();var o=r,[e,t]=e.split(".");if(!e||!t)throw new Error("Invalid license format. License may have been tampered.");var e=Buffer.from(e,"base64url").toString("utf-8"),n=JSON.parse(e),e=Buffer.from(e,"utf-8"),t=Buffer.from(t,l),o=o.createVerify("SHA256");if(o.update(e),o.end(),!o.verify(publicKeyPem,t))throw new Error("Invalid license signature. License may have been tampered.");if(!(n&&n.sub&&n.email&&n.iss&&n.iat))throw new Error("Invalid license data. License may have been tampered.");if(n.exp&&("Perpetual"===n.exp||Date.now()>n.exp))throw new Error("License has expired. Please renew your license, contact Kumologica support at contact@kumologica.com.");return n},save:function(e,r){var o=i,t=s,t=(console.log("saving key to: "+e),t.join(e,"kumologica.license"));try{o.writeFileSync(t,r,"utf-8"),console.log("License saved successfully at: "+t)}catch(e){console.error("Failed to save license: "+e.message)}},read:function(e){var r=i,o=s.join(e,"kumologica.license");try{let e=r.readFileSync(o,"utf-8");return console.log("License read successfully from: "+o),e}catch(e){return null}}}}return e}var a=(()=>{if(t)return n;t=1;var e=c();return n={license:e}})(),u=l(a);module.exports=u;
@@ -51,19 +51,6 @@ class DesignerServer {
51
51
  return licenseData;
52
52
  }
53
53
 
54
- verifyLicense(licenseData) {
55
-
56
- if (licenseData) {
57
- const lData = tools.license.verify(licenseData);
58
- if (lData) {
59
- tools.license.display(lData);
60
- }
61
- return lData;
62
- } else {
63
- console.error("[ERROR] License data is not available. Please provide a valid license key.");
64
- return null;
65
- }
66
- }
67
54
 
68
55
  async start() {
69
56
  // Check if port passed by parameter is available otherwise allocate a new one
@@ -79,8 +66,6 @@ class DesignerServer {
79
66
  process.exit(1);
80
67
  }
81
68
 
82
- this.verifyLicense(licenseKey);
83
-
84
69
  process.env.KUMOLOGICA_LICENSE = licenseKey;
85
70
 
86
71
  this.config.port = await this.allocatePort(this.config.port);