@devbro/pashmak 0.1.4 → 0.1.6
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/app/console/KeyGenerateCommand.js +5 -1
- package/dist/app/console/KeyGenerateCommand.js.map +1 -1
- package/dist/app/console/generate/GenerateControllerCommand.js +1 -1
- package/dist/app/console/generate/GenerateControllerCommand.js.map +1 -1
- package/dist/app/console/migrate/MakeMigrateCommand.js +2 -1
- package/dist/app/console/migrate/MakeMigrateCommand.js.map +1 -1
- package/dist/app/console/migrate/make_migration.tpl +4 -4
- package/dist/app/console/project/base_project/package.json.tpl +1 -1
- package/dist/app/console/project/base_project/src/config/default.ts.tpl +1 -0
- package/dist/app/console/project/base_project/src/config/mailer.ts.tpl +3 -0
- package/dist/config.d.ts +1 -0
- package/dist/facades.d.ts +3 -1
- package/dist/facades.js +28 -0
- package/dist/facades.js.map +1 -1
- package/dist/mailer.d.ts +1 -0
- package/dist/mailer.js +2 -0
- package/dist/mailer.js.map +1 -0
- package/package.json +7 -1
|
@@ -49,7 +49,11 @@ class KeyGenerateCommand extends Command {
|
|
|
49
49
|
format: "pem"
|
|
50
50
|
}
|
|
51
51
|
});
|
|
52
|
-
let envfile =
|
|
52
|
+
let envfile = "";
|
|
53
|
+
try {
|
|
54
|
+
envfile = await fs.readFile(path.join(process.cwd(), ".env"), "utf-8");
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
53
57
|
let old_public_key = envfile.match(/^jwt_secret_public=(.*)/m);
|
|
54
58
|
envfile = this.addEnvParam(envfile, "jwt_secret_public", this.stripPemHeaders(publicKey));
|
|
55
59
|
envfile = this.addEnvParam(envfile, "jwt_secret_private", this.stripPemHeaders(privateKey));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/app/console/KeyGenerateCommand.ts"],"sourcesContent":["import { Command, Option } from \"clipanion\";\nimport { generateKeyPairSync } from \"crypto\";\nimport fs from \"fs/promises\";\nimport path from \"path\";\nimport { logger, cli } from \"../../facades\";\n\nexport class KeyGenerateCommand extends Command {\n static paths = [[`key`, \"generate\"]];\n\n static usage = Command.Usage({\n category: `Main`,\n description: `generate keys`,\n details: `\n This command generates RSA key pair for JWT signing.\n Use --rotate flag to preserve old public key.\n `,\n examples: [\n [`Generate new keys`, `key generate`],\n [`Rotate existing keys`, `key generate --rotate`],\n ],\n });\n\n rotate = Option.Boolean(`--rotate`, false, {\n description: `Rotate existing keys (backup old keys before replacement)`,\n });\n\n async execute() {\n logger().info(\"generating keys for jwt token and adding to .env file\");\n const { publicKey, privateKey } = generateKeyPairSync(\"rsa\", {\n modulusLength: 2048, // 2048-bit key is standard for RS256\n publicKeyEncoding: {\n type: \"spki\",\n format: \"pem\",\n },\n privateKeyEncoding: {\n type: \"pkcs8\",\n format: \"pem\",\n },\n });\n\n let envfile = await fs.readFile(path.join(process.cwd(), \".env\"), \"utf-8\");\n let old_public_key = envfile.match(/^jwt_secret_public=(.*)/m);\n\n envfile = this.addEnvParam(\n envfile,\n \"jwt_secret_public\",\n this.stripPemHeaders(publicKey),\n );\n envfile = this.addEnvParam(\n envfile,\n \"jwt_secret_private\",\n this.stripPemHeaders(privateKey),\n );\n\n if (this.rotate && old_public_key && old_public_key[1]) {\n envfile = this.addEnvParam(\n envfile,\n \"jwt_secret_public_retired\",\n old_public_key[1],\n );\n }\n\n await fs.writeFile(path.join(process.cwd(), \".env\"), envfile, \"utf-8\");\n }\n\n addEnvParam(file: string, key: string, value: string) {\n let regex = new RegExp(`^${key}=.*`, \"gm\");\n file = file.replace(regex, `${key}=${value}`);\n const match = file.match(regex);\n\n if (!match) {\n file = file + `\\n${key}=${value}`;\n }\n return file;\n }\n\n stripPemHeaders(pem: string) {\n return pem\n .replace(/-----BEGIN [\\w\\s]+-----/g, \"\")\n .replace(/-----END [\\w\\s]+-----/g, \"\")\n .replace(/\\r?\\n|\\r/g, \"\");\n }\n}\n\ncli().register(KeyGenerateCommand);\n"],"mappings":";;AAAA,SAASA,SAASC,cAAc;AAChC,SAASC,2BAA2B;AACpC,OAAOC,QAAQ;AACf,OAAOC,UAAU;AACjB,SAASC,QAAQC,WAAW;AAErB,MAAMC,2BAA2BP,QAAAA;EANxC,OAMwCA;;;EACtC,OAAOQ,QAAQ;IAAC;MAAC;MAAO;;;EAExB,OAAOC,QAAQT,QAAQU,MAAM;IAC3BC,UAAU;IACVC,aAAa;IACbC,SAAS;;;;IAITC,UAAU;MACR;QAAC;QAAqB;;MACtB;QAAC;QAAwB;;;EAE7B,CAAA;EAEAC,SAASd,OAAOe,QAAQ,YAAY,OAAO;IACzCJ,aAAa;EACf,CAAA;EAEA,MAAMK,UAAU;AACdZ,WAAAA,EAASa,KAAK,uDAAA;AACd,UAAM,EAAEC,WAAWC,WAAU,IAAKlB,oBAAoB,OAAO;MAC3DmB,eAAe;MACfC,mBAAmB;QACjBC,MAAM;QACNC,QAAQ;MACV;MACAC,oBAAoB;QAClBF,MAAM;QACNC,QAAQ;MACV;IACF,CAAA;AAEA,QAAIE,UAAU,MAAMvB,GAAGwB,SAASvB,KAAKwB,KAAKC,QAAQC,IAAG,GAAI,MAAA,GAAS,OAAA;
|
|
1
|
+
{"version":3,"sources":["../../../src/app/console/KeyGenerateCommand.ts"],"sourcesContent":["import { Command, Option } from \"clipanion\";\nimport { generateKeyPairSync } from \"crypto\";\nimport fs from \"fs/promises\";\nimport path from \"path\";\nimport { logger, cli } from \"../../facades\";\n\nexport class KeyGenerateCommand extends Command {\n static paths = [[`key`, \"generate\"]];\n\n static usage = Command.Usage({\n category: `Main`,\n description: `generate keys`,\n details: `\n This command generates RSA key pair for JWT signing.\n Use --rotate flag to preserve old public key.\n `,\n examples: [\n [`Generate new keys`, `key generate`],\n [`Rotate existing keys`, `key generate --rotate`],\n ],\n });\n\n rotate = Option.Boolean(`--rotate`, false, {\n description: `Rotate existing keys (backup old keys before replacement)`,\n });\n\n async execute() {\n logger().info(\"generating keys for jwt token and adding to .env file\");\n const { publicKey, privateKey } = generateKeyPairSync(\"rsa\", {\n modulusLength: 2048, // 2048-bit key is standard for RS256\n publicKeyEncoding: {\n type: \"spki\",\n format: \"pem\",\n },\n privateKeyEncoding: {\n type: \"pkcs8\",\n format: \"pem\",\n },\n });\n\n let envfile = \"\";\n try {\n envfile = await fs.readFile(path.join(process.cwd(), \".env\"), \"utf-8\");\n } catch {}\n let old_public_key = envfile.match(/^jwt_secret_public=(.*)/m);\n\n envfile = this.addEnvParam(\n envfile,\n \"jwt_secret_public\",\n this.stripPemHeaders(publicKey),\n );\n envfile = this.addEnvParam(\n envfile,\n \"jwt_secret_private\",\n this.stripPemHeaders(privateKey),\n );\n\n if (this.rotate && old_public_key && old_public_key[1]) {\n envfile = this.addEnvParam(\n envfile,\n \"jwt_secret_public_retired\",\n old_public_key[1],\n );\n }\n\n await fs.writeFile(path.join(process.cwd(), \".env\"), envfile, \"utf-8\");\n }\n\n addEnvParam(file: string, key: string, value: string) {\n let regex = new RegExp(`^${key}=.*`, \"gm\");\n file = file.replace(regex, `${key}=${value}`);\n const match = file.match(regex);\n\n if (!match) {\n file = file + `\\n${key}=${value}`;\n }\n return file;\n }\n\n stripPemHeaders(pem: string) {\n return pem\n .replace(/-----BEGIN [\\w\\s]+-----/g, \"\")\n .replace(/-----END [\\w\\s]+-----/g, \"\")\n .replace(/\\r?\\n|\\r/g, \"\");\n }\n}\n\ncli().register(KeyGenerateCommand);\n"],"mappings":";;AAAA,SAASA,SAASC,cAAc;AAChC,SAASC,2BAA2B;AACpC,OAAOC,QAAQ;AACf,OAAOC,UAAU;AACjB,SAASC,QAAQC,WAAW;AAErB,MAAMC,2BAA2BP,QAAAA;EANxC,OAMwCA;;;EACtC,OAAOQ,QAAQ;IAAC;MAAC;MAAO;;;EAExB,OAAOC,QAAQT,QAAQU,MAAM;IAC3BC,UAAU;IACVC,aAAa;IACbC,SAAS;;;;IAITC,UAAU;MACR;QAAC;QAAqB;;MACtB;QAAC;QAAwB;;;EAE7B,CAAA;EAEAC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A,QAAQ,aAAa,EAAA;EAC1B;AACF;AAEAnC,IAAAA,EAAMqC,SAASpC,kBAAAA;","names":["Command","Option","generateKeyPairSync","fs","path","logger","cli","KeyGenerateCommand","paths","usage","Usage","category","description","details","examples","rotate","Boolean","execute","info","publicKey","privateKey","modulusLength","publicKeyEncoding","type","format","privateKeyEncoding","envfile","readFile","join","process","cwd","old_public_key","match","addEnvParam","stripPemHeaders","writeFile","file","key","value","regex","RegExp","replace","pem","register"]}
|
|
@@ -40,7 +40,7 @@ class GenerateControllerCommand extends Command {
|
|
|
40
40
|
await fs.mkdir(config.get("migration.path"), {
|
|
41
41
|
recursive: true
|
|
42
42
|
});
|
|
43
|
-
let dirname = __dirname;
|
|
43
|
+
let dirname = typeof __dirname === "string" ? __dirname : void 0;
|
|
44
44
|
if (!dirname) {
|
|
45
45
|
dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
46
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/app/console/generate/GenerateControllerCommand.ts"],"sourcesContent":["import { cli } from \"../../../facades\";\nimport { Command, Option } from \"clipanion\";\nimport { Case } from \"change-case-all\";\nimport path from \"path\";\nimport * as fs from \"fs/promises\";\nimport { config } from \"@devbro/neko-config\";\nimport handlebars from \"handlebars\";\nimport { fileURLToPath } from \"url\";\nimport pluralize from \"pluralize\";\n\nexport class GenerateControllerCommand extends Command {\n static paths = [\n [`make`, `controller`],\n [`generate`, `controller`],\n ];\n\n name = Option.String({ required: true });\n\n async execute() {\n const rootDir = process.cwd();\n\n const date = new Date();\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n const secondsOfDay = String(\n date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds(),\n ).padStart(5, \"0\");\n\n const fixed_name = Case.snake(this.name);\n const filename = `${Case.capital(this.name)}Controller.ts`;\n this.context.stdout.write(`creating migration file ${filename}\\n`);\n\n await fs.mkdir(config.get(\"migration.path\"), { recursive: true });\n\n let dirname = __dirname;\n if (!dirname) {\n dirname = path.dirname(fileURLToPath(import.meta.url));\n }\n\n const compiledTemplate = handlebars.compile(\n (await fs.readFile(path.join(dirname, \"./controller.tpl\"))).toString(),\n );\n const template = await compiledTemplate({\n className: Case.pascal(this.name),\n routeName: Case.kebab(pluralize(this.name)),\n });\n\n await fs.writeFile(\n path.join(rootDir, \"src/app/controllers\", filename),\n template,\n );\n }\n}\n\ncli().register(GenerateControllerCommand);\n"],"mappings":";;AAAA,SAASA,WAAW;AACpB,SAASC,SAASC,cAAc;AAChC,SAASC,YAAY;AACrB,OAAOC,UAAU;AACjB,YAAYC,QAAQ;AACpB,SAASC,cAAc;AACvB,OAAOC,gBAAgB;AACvB,SAASC,qBAAqB;AAC9B,OAAOC,eAAe;AAEf,MAAMC,kCAAkCT,QAAAA;EAV/C,OAU+CA;;;EAC7C,OAAOU,QAAQ;IACb;MAAC;MAAQ;;IACT;MAAC;MAAY;;;EAGfC,OAAOV,OAAOW,OAAO;IAAEC,UAAU;EAAK,CAAA;EAEtC,MAAMC,UAAU;AACd,UAAMC,UAAUC,QAAQC,IAAG;AAE3B,UAAMC,OAAO,oBAAIC,KAAAA;AACjB,UAAMC,OAAOF,KAAKG,YAAW;AAC7B,UAAMC,QAAQV,OAAOM,KAAKK,SAAQ,IAAK,CAAA,EAAGC,SAAS,GAAG,GAAA;AACtD,UAAMC,MAAMb,OAAOM,KAAKQ,QAAO,CAAA,EAAIF,SAAS,GAAG,GAAA;AAC/C,UAAMG,eAAef,OACnBM,KAAKU,SAAQ,IAAK,OAAOV,KAAKW,WAAU,IAAK,KAAKX,KAAKY,WAAU,CAAA,EACjEN,SAAS,GAAG,GAAA;AAEd,UAAMO,aAAa7B,KAAK8B,MAAM,KAAKrB,IAAI;AACvC,UAAMsB,WAAW,GAAG/B,KAAKgC,QAAQ,KAAKvB,IAAI,CAAA;AAC1C,SAAKwB,QAAQC,OAAOC,MAAM,2BAA2BJ,QAAAA;CAAY;AAEjE,UAAM7B,GAAGkC,MAAMjC,OAAOkC,IAAI,gBAAA,GAAmB;MAAEC,WAAW;IAAK,CAAA;AAE/D,QAAIC,
|
|
1
|
+
{"version":3,"sources":["../../../../src/app/console/generate/GenerateControllerCommand.ts"],"sourcesContent":["import { cli } from \"../../../facades\";\nimport { Command, Option } from \"clipanion\";\nimport { Case } from \"change-case-all\";\nimport path from \"path\";\nimport * as fs from \"fs/promises\";\nimport { config } from \"@devbro/neko-config\";\nimport handlebars from \"handlebars\";\nimport { fileURLToPath } from \"url\";\nimport pluralize from \"pluralize\";\n\nexport class GenerateControllerCommand extends Command {\n static paths = [\n [`make`, `controller`],\n [`generate`, `controller`],\n ];\n\n name = Option.String({ required: true });\n\n async execute() {\n const rootDir = process.cwd();\n\n const date = new Date();\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n const secondsOfDay = String(\n date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds(),\n ).padStart(5, \"0\");\n\n const fixed_name = Case.snake(this.name);\n const filename = `${Case.capital(this.name)}Controller.ts`;\n this.context.stdout.write(`creating migration file ${filename}\\n`);\n\n await fs.mkdir(config.get(\"migration.path\"), { recursive: true });\n\n let dirname = typeof __dirname === \"string\" ? __dirname : undefined;\n if (!dirname) {\n dirname = path.dirname(fileURLToPath(import.meta.url));\n }\n\n const compiledTemplate = handlebars.compile(\n (await fs.readFile(path.join(dirname, \"./controller.tpl\"))).toString(),\n );\n const template = await compiledTemplate({\n className: Case.pascal(this.name),\n routeName: Case.kebab(pluralize(this.name)),\n });\n\n await fs.writeFile(\n path.join(rootDir, \"src/app/controllers\", filename),\n template,\n );\n }\n}\n\ncli().register(GenerateControllerCommand);\n"],"mappings":";;AAAA,SAASA,WAAW;AACpB,SAASC,SAASC,cAAc;AAChC,SAASC,YAAY;AACrB,OAAOC,UAAU;AACjB,YAAYC,QAAQ;AACpB,S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,IAAI;MAChC0C,WAAWnD,KAAKoD,MAAM9C,UAAU,KAAKG,IAAI,CAAA;IAC3C,CAAA;AAEA,UAAMP,GAAGmD,UACPpD,KAAK6C,KAAKjC,SAAS,uBAAuBkB,QAAAA,GAC1CiB,QAAAA;EAEJ;AACF;AAEAnD,IAAAA,EAAMyD,SAAS/C,yBAAAA;","names":["cli","Command","Option","Case","path","fs","config","handlebars","fileURLToPath","pluralize","GenerateControllerCommand","paths","name","String","required","execute","rootDir","process","cwd","date","Date","year","getFullYear","month","getMonth","padStart","day","getDate","secondsOfDay","getHours","getMinutes","getSeconds","fixed_name","snake","filename","capital","context","stdout","write","mkdir","get","recursive","dirname","__dirname","undefined","url","compiledTemplate","compile","readFile","join","toString","template","className","pascal","routeName","kebab","writeFile","register"]}
|
|
@@ -44,7 +44,8 @@ class MakeMigrateCommand extends Command {
|
|
|
44
44
|
}
|
|
45
45
|
const compiledTemplate = handlebars.compile((await fs.readFile(path.join(dirname, "./make_migration.tpl"))).toString());
|
|
46
46
|
const template = await compiledTemplate({
|
|
47
|
-
className: Case.pascal(this.name)
|
|
47
|
+
className: Case.pascal(this.name) + "Migration",
|
|
48
|
+
tableName: Case.snake(this.name)
|
|
48
49
|
});
|
|
49
50
|
await fs.writeFile(path.join(config.get("migration.path"), filename), template);
|
|
50
51
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/app/console/migrate/MakeMigrateCommand.ts"],"sourcesContent":["import { cli } from \"../../../facades\";\nimport { Command, Option } from \"clipanion\";\nimport { Case } from \"change-case-all\";\nimport path from \"path\";\nimport * as fs from \"fs/promises\";\nimport { config } from \"@devbro/neko-config\";\nimport handlebars from \"handlebars\";\nimport { fileURLToPath } from \"url\";\n\nexport class MakeMigrateCommand extends Command {\n static paths = [\n [`make`, `migrate`],\n [\"make\", \"migration\"],\n ];\n\n name = Option.String({ required: true });\n\n async execute() {\n const date = new Date();\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n const secondsOfDay = String(\n date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds(),\n ).padStart(5, \"0\");\n\n const fixed_name = Case.snake(this.name);\n const filename = `${year}_${month}_${day}_${secondsOfDay}_${fixed_name}.ts`;\n this.context.stdout.write(`creating migration file ${filename}\\n`);\n\n await fs.mkdir(config.get(\"migration.path\"), { recursive: true });\n\n let dirname = typeof __dirname === \"string\" ? __dirname : undefined;\n if (!dirname) {\n dirname = path.dirname(fileURLToPath(import.meta.url));\n }\n\n const compiledTemplate = handlebars.compile(\n (\n await fs.readFile(path.join(dirname, \"./make_migration.tpl\"))\n ).toString(),\n );\n const template = await compiledTemplate({\n className: Case.pascal(this.name),\n });\n\n await fs.writeFile(\n path.join(config.get(\"migration.path\"), filename),\n template,\n );\n }\n}\n\ncli().register(MakeMigrateCommand);\n"],"mappings":";;AAAA,SAASA,WAAW;AACpB,SAASC,SAASC,cAAc;AAChC,SAASC,YAAY;AACrB,OAAOC,UAAU;AACjB,YAAYC,QAAQ;AACpB,SAASC,cAAc;AACvB,OAAOC,gBAAgB;AACvB,SAASC,qBAAqB;
|
|
1
|
+
{"version":3,"sources":["../../../../src/app/console/migrate/MakeMigrateCommand.ts"],"sourcesContent":["import { cli } from \"../../../facades\";\nimport { Command, Option } from \"clipanion\";\nimport { Case } from \"change-case-all\";\nimport path from \"path\";\nimport * as fs from \"fs/promises\";\nimport { config } from \"@devbro/neko-config\";\nimport handlebars from \"handlebars\";\nimport { fileURLToPath } from \"url\";\nimport { table } from \"console\";\n\nexport class MakeMigrateCommand extends Command {\n static paths = [\n [`make`, `migrate`],\n [\"make\", \"migration\"],\n ];\n\n name = Option.String({ required: true });\n\n async execute() {\n const date = new Date();\n const year = date.getFullYear();\n const month = String(date.getMonth() + 1).padStart(2, \"0\");\n const day = String(date.getDate()).padStart(2, \"0\");\n const secondsOfDay = String(\n date.getHours() * 3600 + date.getMinutes() * 60 + date.getSeconds(),\n ).padStart(5, \"0\");\n\n const fixed_name = Case.snake(this.name);\n const filename = `${year}_${month}_${day}_${secondsOfDay}_${fixed_name}.ts`;\n this.context.stdout.write(`creating migration file ${filename}\\n`);\n\n await fs.mkdir(config.get(\"migration.path\"), { recursive: true });\n\n let dirname = typeof __dirname === \"string\" ? __dirname : undefined;\n if (!dirname) {\n dirname = path.dirname(fileURLToPath(import.meta.url));\n }\n\n const compiledTemplate = handlebars.compile(\n (\n await fs.readFile(path.join(dirname, \"./make_migration.tpl\"))\n ).toString(),\n );\n const template = await compiledTemplate({\n className: Case.pascal(this.name) + \"Migration\",\n tableName: Case.snake(this.name),\n });\n\n await fs.writeFile(\n path.join(config.get(\"migration.path\"), filename),\n template,\n );\n }\n}\n\ncli().register(MakeMigrateCommand);\n"],"mappings":";;AAAA,SAASA,WAAW;AACpB,SAASC,SAASC,cAAc;AAChC,SAASC,YAAY;AACrB,OAAOC,UAAU;AACjB,YAAYC,QAAQ;AACpB,SAASC,cAAc;AACvB,OAAOC,gBAAgB;AACvB,SAASC,qBAAqB;AAGvB,MAAMC,2BAA2BR,QAAAA;EAVxC,OAUwCA;;;EACtC,OAAOS,QAAQ;IACb;MAAC;MAAQ;;IACT;MAAC;MAAQ;;;EAGXC,OAAOT,OAAOU,OAAO;IAAEC,UAAU;EAAK,CAAA;EAEtC,MAAMC,UAAU;AACd,UAAMC,OAAO,oBAAIC,KAAAA;AACjB,UAAMC,OAAOF,KAAKG,YAAW;AAC7B,UAAMC,QAAQP,OAAOG,KAAKK,SAAQ,IAAK,CAAA,EAAGC,SAAS,GAAG,GAAA;AACtD,UAAMC,MAAMV,OAAOG,KAAKQ,QAAO,CAAA,EAAIF,SAAS,GAAG,GAAA;AAC/C,UAAMG,eAAeZ,OACnBG,KAAKU,SAAQ,IAAK,OAAOV,KAAKW,WAAU,IAAK,KAAKX,KAAKY,WAAU,CAAA,EACjEN,SAAS,GAAG,GAAA;AAEd,UAAMO,aAAazB,KAAK0B,MAAM,KAAKlB,IAAI;AACvC,UAAMmB,WAAW,GAAGb,IAAAA,IAAQE,KAAAA,IAASG,GAAAA,IAAOE,YAAAA,IAAgBI,UAAAA;AAC5D,SAAKG,QAAQC,OAAOC,MAAM,2BAA2BH,QAAAA;CAAY;AAEjE,UAAMzB,GAAG6B,MAAM5B,OAAO6B,IAAI,gBAAA,GAAmB;MAAEC,WAAW;IAAK,CAAA;AAE/D,QAAIC,UAAU,OAAOC,cAAc,WAAWA,YAAYC;AAC1D,QAAI,CAACF,SAAS;AACZA,gBAAUjC,KAAKiC,QAAQ7B,cAAc,YAAYgC,GAAG,CAAA;IACtD;AAEA,UAAMC,mBAAmBlC,WAAWmC,SAEhC,MAAMrC,GAAGsC,SAASvC,KAAKwC,KAAKP,SAAS,sBAAA,CAAA,GACrCQ,SAAQ,CAAA;AAEZ,UAAMC,WAAW,MAAML,iBAAiB;MACtCM,WAAW5C,KAAK6C,OAAO,KAAKrC,IAAI,IAAI;MACpCsC,WAAW9C,KAAK0B,MAAM,KAAKlB,IAAI;IACjC,CAAA;AAEA,UAAMN,GAAG6C,UACP9C,KAAKwC,KAAKtC,OAAO6B,IAAI,gBAAA,GAAmBL,QAAAA,GACxCgB,QAAAA;EAEJ;AACF;AAEA9C,IAAAA,EAAMmD,SAAS1C,kBAAAA;","names":["cli","Command","Option","Case","path","fs","config","handlebars","fileURLToPath","MakeMigrateCommand","paths","name","String","required","execute","date","Date","year","getFullYear","month","getMonth","padStart","day","getDate","secondsOfDay","getHours","getMinutes","getSeconds","fixed_name","snake","filename","context","stdout","write","mkdir","get","recursive","dirname","__dirname","undefined","url","compiledTemplate","compile","readFile","join","toString","template","className","pascal","tableName","writeFile","register"]}
|
|
@@ -3,13 +3,13 @@ import { Schema, Blueprint } from "@devbro/pashmak/sql";
|
|
|
3
3
|
|
|
4
4
|
export default class {{className}} extends Migration {
|
|
5
5
|
async up(schema: Schema) {
|
|
6
|
-
// await schema.createTable("{{
|
|
7
|
-
//
|
|
8
|
-
//
|
|
6
|
+
// await schema.createTable("{{tableName}}", (table: Blueprint) => {
|
|
7
|
+
// table.id();
|
|
8
|
+
// table.timestamps();
|
|
9
9
|
// });
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
async down(schema: Schema) {
|
|
13
|
-
// await schema.dropTable("{{
|
|
13
|
+
// await schema.dropTable("{{tableName}}");
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -10,6 +10,7 @@ const __dirname = dirname(__filename);
|
|
|
10
10
|
export default {
|
|
11
11
|
databases: await import("./databases"),
|
|
12
12
|
storages: await import("./storages"),
|
|
13
|
+
mailer: await import("./mailer"),
|
|
13
14
|
port: getEnv("PORT", 3000),
|
|
14
15
|
file_upload_path: path.join(os.tmpdir(), ""),
|
|
15
16
|
migration: {
|
package/dist/config.d.ts
CHANGED
package/dist/facades.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Router } from '@devbro/neko-router';
|
|
|
4
4
|
import { Scheduler } from '@devbro/neko-scheduler';
|
|
5
5
|
import { Connection } from '@devbro/neko-sql';
|
|
6
6
|
import { Storage } from '@devbro/neko-storage';
|
|
7
|
+
import { Mailer } from '@devbro/neko-mailer';
|
|
7
8
|
import { HttpServer } from '@devbro/neko-http';
|
|
8
9
|
import { Logger } from '@devbro/neko-logger';
|
|
9
10
|
|
|
@@ -14,5 +15,6 @@ declare const storage: (label?: string, ...args: any[]) => Storage;
|
|
|
14
15
|
declare const cli: (label?: string, ...args: any[]) => Cli<clipanion.BaseContext>;
|
|
15
16
|
declare const httpServer: (label?: string, ...args: any[]) => HttpServer;
|
|
16
17
|
declare const logger: (label?: string, ...args: any[]) => Logger;
|
|
18
|
+
declare const mailer: (label?: string, ...args: any[]) => Mailer;
|
|
17
19
|
|
|
18
|
-
export { cli, db, httpServer, logger, router, scheduler, storage };
|
|
20
|
+
export { cli, db, httpServer, logger, mailer, router, scheduler, storage };
|
package/dist/facades.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Scheduler } from "@devbro/neko-scheduler";
|
|
|
5
5
|
import { createSingleton } from "@devbro/neko-helper";
|
|
6
6
|
import { ctx, ctxSafe } from "@devbro/neko-context";
|
|
7
7
|
import { StorageFactory } from "@devbro/neko-storage";
|
|
8
|
+
import { Mailer, FunctionProvider, SESProvider, SMTPProvider, MemoryProvider } from "@devbro/neko-mailer";
|
|
8
9
|
import { config } from "@devbro/neko-config";
|
|
9
10
|
import { Cli } from "clipanion";
|
|
10
11
|
import { HttpServer } from "./http";
|
|
@@ -111,11 +112,38 @@ const logger = createSingleton((label) => {
|
|
|
111
112
|
});
|
|
112
113
|
return rc;
|
|
113
114
|
});
|
|
115
|
+
const mailer = createSingleton((label) => {
|
|
116
|
+
const mailer_config = config.get([
|
|
117
|
+
"mailer",
|
|
118
|
+
label
|
|
119
|
+
].join("."));
|
|
120
|
+
let provider;
|
|
121
|
+
if (mailer_config.provider === "logger") {
|
|
122
|
+
provider = new FunctionProvider((mail) => {
|
|
123
|
+
logger().info({
|
|
124
|
+
msg: "Sending email",
|
|
125
|
+
mail
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
} else if (mailer_config.provider === "SES") {
|
|
129
|
+
provider = new SESProvider(mailer_config.config);
|
|
130
|
+
} else if (mailer_config.provider === "SMTP") {
|
|
131
|
+
provider = new SMTPProvider(mailer_config.config);
|
|
132
|
+
} else if (mailer_config.provider === "MEMORY") {
|
|
133
|
+
provider = new MemoryProvider();
|
|
134
|
+
}
|
|
135
|
+
if (!provider) {
|
|
136
|
+
throw new Error(`cannot initiate mailer provider: ${mailer_config?.provider}`);
|
|
137
|
+
}
|
|
138
|
+
const rc = new Mailer(provider);
|
|
139
|
+
return rc;
|
|
140
|
+
});
|
|
114
141
|
export {
|
|
115
142
|
cli,
|
|
116
143
|
db,
|
|
117
144
|
httpServer,
|
|
118
145
|
logger,
|
|
146
|
+
mailer,
|
|
119
147
|
router,
|
|
120
148
|
scheduler,
|
|
121
149
|
storage
|
package/dist/facades.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/facades.ts"],"sourcesContent":["import { Router } from \"./router\";\nimport { Schedule, Scheduler } from \"@devbro/neko-scheduler\";\nimport { createSingleton } from \"@devbro/neko-helper\";\nimport { ctx, ctxSafe } from \"@devbro/neko-context\";\nimport { Connection } from \"@devbro/neko-sql\";\nimport { Storage, StorageFactory } from \"@devbro/neko-storage\";\nimport { config } from \"@devbro/neko-config\";\nimport { Cli } from \"clipanion\";\nimport { HttpServer } from \"./http\";\nimport { HttpError } from \"./http\";\nimport * as yup from \"yup\";\nimport { Logger } from \"@devbro/neko-logger\";\n\nexport const router = createSingleton<Router>(() => new Router());\nexport const scheduler = createSingleton<Scheduler>(() => {\n const rc = new Scheduler();\n rc.setErrorHandler((err: any, job: Schedule) => {\n logger().error({\n msg: \"Scheduled job error\",\n err,\n job_name: job.getName(),\n });\n });\n return rc;\n});\nexport const db = (label = \"default\") =>\n ctx().getOrThrow<Connection>([\"database\", label]);\n\nexport const storage = createSingleton<Storage>((label: string = \"default\") =>\n StorageFactory.create(config.get([\"storages\", label].join(\".\"))),\n);\n\nexport const cli = createSingleton<Cli>(() => {\n const [node, app, ...args] = process.argv;\n return new Cli({\n binaryLabel: `My Application`,\n binaryName: `${node} ${app}`,\n binaryVersion: `1.0.0`,\n });\n});\n\nexport const httpServer = createSingleton<HttpServer>(() => {\n const server = new HttpServer();\n\n server.setErrorHandler(async (err: Error, req: any, res: any) => {\n if (err instanceof HttpError) {\n res.writeHead(err.statusCode, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify({ message: err.message, error: err.code }));\n logger().warn({ msg: \"HttpError: \" + err.message, err });\n return;\n } else if (err instanceof yup.ValidationError) {\n res.writeHead(422, { \"Content-Type\": \"application/json\" });\n const errs: any = {};\n err.inner.forEach((e: yup.ValidationError) => {\n // Sanitize sensitive fields\n const sanitizedParams = { ...e.params };\n if (/passw/i.test(e.path!)) {\n sanitizedParams.value = \"******\";\n sanitizedParams.originalValue = \"******\";\n }\n\n errs[e.path!] = {\n type: e.type,\n message: e.message,\n params: sanitizedParams,\n };\n });\n\n res.end(JSON.stringify({ message: \"validation error\", errors: errs }));\n logger().warn({ msg: \"ValidationError: \" + err.message, err });\n return;\n } else {\n logger().error({ msg: \"Error: \" + err.message, err });\n }\n res.writeHead(500, { \"Content-Type\": \"\" });\n res.end(JSON.stringify({ error: \"Internal Server Error\" }));\n });\n server.setRouter(router());\n\n return server;\n});\n\nexport const logger = createSingleton<Logger>((label) => {\n const logger_config: any = config.get([\"loggers\", label].join(\".\"));\n const rc = new Logger(logger_config);\n rc.setExtrasFunction((message: any) => {\n message.requestId = ctxSafe()?.get(\"requestId\") || \"N/A\";\n return message;\n });\n\n return rc;\n});\n"],"mappings":";;AAAA,SAASA,cAAc;AACvB,SAAmBC,iBAAiB;AACpC,SAASC,uBAAuB;AAChC,SAASC,KAAKC,eAAe;AAE7B,SAAkBC,sBAAsB;AACxC,SAASC,cAAc;AACvB,SAASC,WAAW;AACpB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiB;AAC1B,YAAYC,SAAS;AACrB,SAASC,cAAc;AAEhB,MAAMC,
|
|
1
|
+
{"version":3,"sources":["../src/facades.ts"],"sourcesContent":["import { Router } from \"./router\";\nimport { Schedule, Scheduler } from \"@devbro/neko-scheduler\";\nimport { createSingleton } from \"@devbro/neko-helper\";\nimport { ctx, ctxSafe } from \"@devbro/neko-context\";\nimport { Connection } from \"@devbro/neko-sql\";\nimport { Storage, StorageFactory } from \"@devbro/neko-storage\";\nimport {\n Mailer,\n Mailable,\n MailerProvider,\n FunctionProvider,\n SESProvider,\n SMTPProvider,\n MemoryProvider,\n} from \"@devbro/neko-mailer\";\nimport { config } from \"@devbro/neko-config\";\nimport { Cli } from \"clipanion\";\nimport { HttpServer } from \"./http\";\nimport { HttpError } from \"./http\";\nimport * as yup from \"yup\";\nimport { Logger } from \"@devbro/neko-logger\";\n\nexport const router = createSingleton<Router>(() => new Router());\nexport const scheduler = createSingleton<Scheduler>(() => {\n const rc = new Scheduler();\n rc.setErrorHandler((err: any, job: Schedule) => {\n logger().error({\n msg: \"Scheduled job error\",\n err,\n job_name: job.getName(),\n });\n });\n return rc;\n});\nexport const db = (label = \"default\") =>\n ctx().getOrThrow<Connection>([\"database\", label]);\n\nexport const storage = createSingleton<Storage>((label: string = \"default\") =>\n StorageFactory.create(config.get([\"storages\", label].join(\".\"))),\n);\n\nexport const cli = createSingleton<Cli>(() => {\n const [node, app, ...args] = process.argv;\n return new Cli({\n binaryLabel: `My Application`,\n binaryName: `${node} ${app}`,\n binaryVersion: `1.0.0`,\n });\n});\n\nexport const httpServer = createSingleton<HttpServer>(() => {\n const server = new HttpServer();\n\n server.setErrorHandler(async (err: Error, req: any, res: any) => {\n if (err instanceof HttpError) {\n res.writeHead(err.statusCode, { \"Content-Type\": \"application/json\" });\n res.end(JSON.stringify({ message: err.message, error: err.code }));\n logger().warn({ msg: \"HttpError: \" + err.message, err });\n return;\n } else if (err instanceof yup.ValidationError) {\n res.writeHead(422, { \"Content-Type\": \"application/json\" });\n const errs: any = {};\n err.inner.forEach((e: yup.ValidationError) => {\n // Sanitize sensitive fields\n const sanitizedParams = { ...e.params };\n if (/passw/i.test(e.path!)) {\n sanitizedParams.value = \"******\";\n sanitizedParams.originalValue = \"******\";\n }\n\n errs[e.path!] = {\n type: e.type,\n message: e.message,\n params: sanitizedParams,\n };\n });\n\n res.end(JSON.stringify({ message: \"validation error\", errors: errs }));\n logger().warn({ msg: \"ValidationError: \" + err.message, err });\n return;\n } else {\n logger().error({ msg: \"Error: \" + err.message, err });\n }\n res.writeHead(500, { \"Content-Type\": \"\" });\n res.end(JSON.stringify({ error: \"Internal Server Error\" }));\n });\n server.setRouter(router());\n\n return server;\n});\n\nexport const logger = createSingleton<Logger>((label) => {\n const logger_config: any = config.get([\"loggers\", label].join(\".\"));\n const rc = new Logger(logger_config);\n rc.setExtrasFunction((message: any) => {\n message.requestId = ctxSafe()?.get(\"requestId\") || \"N/A\";\n return message;\n });\n\n return rc;\n});\n\nexport const mailer = createSingleton((label) => {\n const mailer_config: any = config.get([\"mailer\", label].join(\".\"));\n let provider: MailerProvider | undefined;\n\n if (mailer_config.provider === \"logger\") {\n provider = new FunctionProvider((mail: Mailable) => {\n logger().info({\n msg: \"Sending email\",\n mail,\n });\n });\n } else if (mailer_config.provider === \"SES\") {\n provider = new SESProvider(mailer_config.config);\n } else if (mailer_config.provider === \"SMTP\") {\n provider = new SMTPProvider(mailer_config.config);\n } else if (mailer_config.provider === \"MEMORY\") {\n provider = new MemoryProvider();\n }\n\n if (!provider) {\n throw new Error(\n `cannot initiate mailer provider: ${mailer_config?.provider}`,\n );\n }\n\n const rc = new Mailer(provider);\n return rc;\n});\n"],"mappings":";;AAAA,SAASA,cAAc;AACvB,SAAmBC,iBAAiB;AACpC,SAASC,uBAAuB;AAChC,SAASC,KAAKC,eAAe;AAE7B,SAAkBC,sBAAsB;AACxC,SACEC,QAGAC,kBACAC,aACAC,cACAC,sBACK;AACP,SAASC,cAAc;AACvB,SAASC,WAAW;AACpB,SAASC,kBAAkB;AAC3B,SAASC,iBAAiB;AAC1B,YAAYC,SAAS;AACrB,SAASC,cAAc;AAEhB,MAAMC,SAASf,gBAAwB,MAAM,IAAIF,OAAAA,CAAAA;AACjD,MAAMkB,YAAYhB,gBAA2B,MAAA;AAClD,QAAMiB,KAAK,IAAIlB,UAAAA;AACfkB,KAAGC,gBAAgB,CAACC,KAAUC,QAAAA;AAC5BC,WAAAA,EAASC,MAAM;MACbC,KAAK;MACLJ;MACAK,UAAUJ,IAAIK,QAAO;IACvB,CAAA;EACF,CAAA;AACA,SAAOR;AACT,CAAA;AACO,MAAMS,KAAK,wBAACC,QAAQ,cACzB1B,IAAAA,EAAM2B,WAAuB;EAAC;EAAYD;CAAM,GADhC;AAGX,MAAME,UAAU7B,gBAAyB,CAAC2B,QAAgB,cAC/DxB,eAAe2B,OAAOrB,OAAOsB,IAAI;EAAC;EAAYJ;EAAOK,KAAK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,KAAK,IAAIb,OAAOqE,QAAAA;AACtB,SAAOxD;AACT,CAAA;","names":["Router","Scheduler","createSingleton","ctx","ctxSafe","StorageFactory","Mailer","FunctionProvider","SESProvider","SMTPProvider","MemoryProvider","config","Cli","HttpServer","HttpError","yup","Logger","router","scheduler","rc","setErrorHandler","err","job","logger","error","msg","job_name","getName","db","label","getOrThrow","storage","create","get","join","cli","node","app","args","process","argv","binaryLabel","binaryName","binaryVersion","httpServer","server","req","res","writeHead","statusCode","end","JSON","stringify","message","code","warn","ValidationError","errs","inner","forEach","e","sanitizedParams","params","test","path","value","originalValue","type","errors","setRouter","logger_config","setExtrasFunction","requestId","mailer","mailer_config","provider","mail","info","Error"]}
|
package/dist/mailer.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@devbro/neko-mailer';
|
package/dist/mailer.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/mailer.ts"],"sourcesContent":["export * from \"@devbro/neko-mailer\";\n"],"mappings":"AAAA,cAAc;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devbro/pashmak",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "testing application for the entire repo",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -68,6 +68,11 @@
|
|
|
68
68
|
"import": "./dist/orm.js",
|
|
69
69
|
"require": "./dist/orm.js"
|
|
70
70
|
},
|
|
71
|
+
"./mailer": {
|
|
72
|
+
"types": "./dist/mailer.d.ts",
|
|
73
|
+
"import": "./dist/mailer.js",
|
|
74
|
+
"require": "./dist/mailer.js"
|
|
75
|
+
},
|
|
71
76
|
"./package.json": "./package.json"
|
|
72
77
|
},
|
|
73
78
|
"scripts": {
|
|
@@ -102,6 +107,7 @@
|
|
|
102
107
|
"@devbro/neko-helper": "0.1.*",
|
|
103
108
|
"@devbro/neko-http": "0.1.*",
|
|
104
109
|
"@devbro/neko-logger": "0.1.*",
|
|
110
|
+
"@devbro/neko-mailer": "0.1.*",
|
|
105
111
|
"@devbro/neko-orm": "0.1.*",
|
|
106
112
|
"@devbro/neko-scheduler": "0.1.*",
|
|
107
113
|
"@devbro/neko-sql": "0.1.*",
|