@devbro/pashmak 0.1.56 → 0.1.58

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.
Files changed (35) hide show
  1. package/dist/cjs/app/console/DefaultCommand.js +52 -0
  2. package/dist/cjs/app/console/KeyGenerateCommand.js +52 -0
  3. package/dist/cjs/app/console/StartCommand.js +52 -0
  4. package/dist/cjs/app/console/generate/GenerateApiDocsCommand.js +52 -0
  5. package/dist/cjs/app/console/generate/GenerateControllerCommand.js +52 -0
  6. package/dist/cjs/app/console/generate/index.js +52 -0
  7. package/dist/cjs/app/console/index.js +265 -7
  8. package/dist/cjs/app/console/migrate/GenerateMigrateCommand.js +52 -0
  9. package/dist/cjs/app/console/migrate/MigrateCommand.js +52 -0
  10. package/dist/cjs/app/console/migrate/MigrateRollbackCommand.js +52 -0
  11. package/dist/cjs/app/console/migrate/index.js +52 -0
  12. package/dist/cjs/app/console/project/CreateProjectCommand.js +213 -7
  13. package/dist/cjs/app/console/queue/GenerateQueueMigrateCommand.js +52 -0
  14. package/dist/cjs/bin/pashmak_cli.js +213 -7
  15. package/dist/cjs/cache/MultiCache.js +71 -0
  16. package/dist/cjs/{cache.js → cache/cache.js} +54 -2
  17. package/dist/cjs/facades.js +52 -0
  18. package/dist/cjs/factories.js +52 -0
  19. package/dist/cjs/http.js +52 -0
  20. package/dist/cjs/index.js +265 -7
  21. package/dist/cjs/middlewares.js +52 -0
  22. package/dist/cjs/queue.js +52 -0
  23. package/dist/esm/app/console/project/CreateProjectCommand.d.mts +7 -2
  24. package/dist/esm/app/console/project/CreateProjectCommand.mjs +214 -8
  25. package/dist/esm/app/console/project/CreateProjectCommand.mjs.map +1 -1
  26. package/dist/esm/cache/MultiCache.d.mts +14 -0
  27. package/dist/esm/cache/MultiCache.mjs +47 -0
  28. package/dist/esm/cache/MultiCache.mjs.map +1 -0
  29. package/dist/esm/{cache.mjs → cache/cache.mjs} +1 -1
  30. package/dist/esm/cache/cache.mjs.map +1 -0
  31. package/dist/esm/factories.mjs +9 -0
  32. package/dist/esm/factories.mjs.map +1 -1
  33. package/package.json +1 -1
  34. package/dist/esm/cache.mjs.map +0 -1
  35. /package/dist/esm/{cache.d.mts → cache/cache.d.mts} +0 -0
@@ -61,8 +61,34 @@ var CreateProjectCommand = class extends import_clipanion.Command {
61
61
  executor = "";
62
62
  packageManager = "";
63
63
  linter = "";
64
- validation_library = "";
65
- database_type = "";
64
+ validation_library = import_clipanion.Option.String("--validation-library", {
65
+ description: "Validation library to use (yup, zod, none)",
66
+ required: false
67
+ });
68
+ database_type = import_clipanion.Option.String("--database-type", {
69
+ description: "Database type to use (postgresql, mysql, sqlite)",
70
+ required: false
71
+ });
72
+ cache_library = import_clipanion.Option.String("--cache-library", {
73
+ description: "Cache library to use (redis, memcached, none)",
74
+ required: false
75
+ });
76
+ mailer_library = import_clipanion.Option.String("--mailer-library", {
77
+ description: "Mailer library to use (@aws-sdk/client-ses, nodemailer, none)",
78
+ required: false
79
+ });
80
+ queue_library = import_clipanion.Option.String("--queue-library", {
81
+ description: "Queue library to use (@aws-sdk/client-sqs, @azure/service-bus, @google-cloud/pubsub, amqplib, redis, none)",
82
+ required: false
83
+ });
84
+ storage_library = import_clipanion.Option.String("--storage-library", {
85
+ description: "Storage library to use (@aws-sdk/client-s3, @azure/storage-blob, @google-cloud/storage, basic-ftp, ssh2-sftp-client, none)",
86
+ required: false
87
+ });
88
+ initGit = import_clipanion.Option.Boolean("--git", {
89
+ description: "Initialize a git repository (use --no-git to skip)",
90
+ required: false
91
+ });
66
92
  async folderExists(folderPath) {
67
93
  try {
68
94
  const stats = await fs.stat(folderPath);
@@ -216,7 +242,7 @@ var CreateProjectCommand = class extends import_clipanion.Command {
216
242
  await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
217
243
  }
218
244
  async setupGeneralPackages() {
219
- this.validation_library = await (0, import_prompts.select)({
245
+ this.validation_library = this.validation_library ?? await (0, import_prompts.select)({
220
246
  message: "Select a package you want for validation",
221
247
  choices: [
222
248
  {
@@ -237,8 +263,15 @@ var CreateProjectCommand = class extends import_clipanion.Command {
237
263
  }
238
264
  ]
239
265
  });
240
- this.validation_library === "none" || await this.addPackage(this.validation_library);
241
- this.database_type = await (0, import_prompts.select)({
266
+ if (this.validation_library === "yup" || this.validation_library === "zod") {
267
+ await this.addPackage(this.validation_library);
268
+ } else if (this.validation_library === "none") {
269
+ } else {
270
+ throw new Error(
271
+ "unexpected validation library: " + this.validation_library + ". Valid options are: yup, zod, none"
272
+ );
273
+ }
274
+ this.database_type = this.database_type ?? await (0, import_prompts.select)({
242
275
  message: "Select a database type (you can add more databases later)",
243
276
  choices: [
244
277
  {
@@ -264,6 +297,179 @@ var CreateProjectCommand = class extends import_clipanion.Command {
264
297
  await this.addPackage("mysql2");
265
298
  } else if (this.database_type === "sqlite") {
266
299
  await this.addPackage("sqlite3");
300
+ } else {
301
+ throw new Error(
302
+ "unexpected database type: " + this.database_type + ". Valid options are: postgresql, mysql, sqlite"
303
+ );
304
+ }
305
+ this.cache_library = this.cache_library ?? await (0, import_prompts.select)({
306
+ message: "Select a cache library",
307
+ choices: [
308
+ {
309
+ name: "Redis",
310
+ value: "redis",
311
+ description: "Redis client for Node.js"
312
+ },
313
+ {
314
+ name: "Memcached",
315
+ value: "memcached",
316
+ description: "Memcached client for Node.js"
317
+ },
318
+ new import_prompts.Separator(),
319
+ {
320
+ name: "None",
321
+ value: "none",
322
+ disabled: false
323
+ }
324
+ ]
325
+ });
326
+ if (this.cache_library === "redis") {
327
+ await this.addPackage("redis");
328
+ } else if (this.cache_library === "memcached") {
329
+ await this.addPackage("memcached");
330
+ } else if (this.cache_library === "none") {
331
+ } else {
332
+ throw new Error(
333
+ "unexpected cache library: " + this.cache_library + ". Valid options are: redis, memcached, none"
334
+ );
335
+ }
336
+ this.mailer_library = this.mailer_library ?? await (0, import_prompts.select)({
337
+ message: "Select a mailer library",
338
+ choices: [
339
+ {
340
+ name: "AWS SES",
341
+ value: "@aws-sdk/client-ses",
342
+ description: "AWS SDK for JavaScript v3 - SES client"
343
+ },
344
+ {
345
+ name: "Nodemailer",
346
+ value: "nodemailer",
347
+ description: "Send emails with Node.js"
348
+ },
349
+ new import_prompts.Separator(),
350
+ {
351
+ name: "None",
352
+ value: "none",
353
+ disabled: false
354
+ }
355
+ ]
356
+ });
357
+ if (this.mailer_library === "@aws-sdk/client-ses") {
358
+ await this.addPackage("@aws-sdk/client-ses");
359
+ } else if (this.mailer_library === "nodemailer") {
360
+ await this.addPackage("nodemailer");
361
+ await this.addPackage("@types/nodemailer", true);
362
+ } else if (this.mailer_library === "none") {
363
+ } else {
364
+ throw new Error(
365
+ "unexpected mailer library: " + this.mailer_library + ". Valid options are: @aws-sdk/client-ses, nodemailer, none"
366
+ );
367
+ }
368
+ this.queue_library = this.queue_library ?? await (0, import_prompts.select)({
369
+ message: "Select a queue library",
370
+ choices: [
371
+ {
372
+ name: "AWS SQS",
373
+ value: "@aws-sdk/client-sqs",
374
+ description: "AWS SDK for JavaScript v3 - SQS client"
375
+ },
376
+ {
377
+ name: "Azure Service Bus",
378
+ value: "@azure/service-bus",
379
+ description: "Azure Service Bus client for Node.js"
380
+ },
381
+ {
382
+ name: "Google Cloud Pub/Sub",
383
+ value: "@google-cloud/pubsub",
384
+ description: "Google Cloud Pub/Sub client for Node.js"
385
+ },
386
+ {
387
+ name: "RabbitMQ (amqplib)",
388
+ value: "amqplib",
389
+ description: "AMQP 0-9-1 client for Node.js"
390
+ },
391
+ {
392
+ name: "Redis",
393
+ value: "redis",
394
+ description: "Redis client for Node.js"
395
+ },
396
+ new import_prompts.Separator(),
397
+ {
398
+ name: "None",
399
+ value: "none",
400
+ disabled: false
401
+ }
402
+ ]
403
+ });
404
+ if (this.queue_library === "@aws-sdk/client-sqs") {
405
+ await this.addPackage("@aws-sdk/client-sqs");
406
+ } else if (this.queue_library === "@azure/service-bus") {
407
+ await this.addPackage("@azure/service-bus");
408
+ } else if (this.queue_library === "@google-cloud/pubsub") {
409
+ await this.addPackage("@google-cloud/pubsub");
410
+ } else if (this.queue_library === "amqplib") {
411
+ await this.addPackage("amqplib");
412
+ await this.addPackage("@types/amqplib", true);
413
+ } else if (this.queue_library === "redis") {
414
+ await this.addPackage("redis");
415
+ } else if (this.queue_library === "none") {
416
+ } else {
417
+ throw new Error(
418
+ "unexpected queue library: " + this.queue_library + ". Valid options are: @aws-sdk/client-sqs, @azure/service-bus, @google-cloud/pubsub, amqplib, redis, none"
419
+ );
420
+ }
421
+ this.storage_library = this.storage_library ?? await (0, import_prompts.select)({
422
+ message: "Select a storage library",
423
+ choices: [
424
+ {
425
+ name: "@aws-sdk/client-s3",
426
+ value: "@aws-sdk/client-s3",
427
+ description: "AWS SDK for JavaScript v3 - S3 client"
428
+ },
429
+ {
430
+ name: "@azure/storage-blob",
431
+ value: "@azure/storage-blob",
432
+ description: "Azure Storage Blob client for Node.js"
433
+ },
434
+ {
435
+ name: "@google-cloud/storage",
436
+ value: "@google-cloud/storage",
437
+ description: "Google Cloud Storage client for Node.js"
438
+ },
439
+ {
440
+ name: "basic-ftp",
441
+ value: "basic-ftp",
442
+ description: "FTP client for Node.js"
443
+ },
444
+ {
445
+ name: "ssh2-sftp-client",
446
+ value: "ssh2-sftp-client",
447
+ description: "SFTP client for Node.js"
448
+ },
449
+ new import_prompts.Separator(),
450
+ {
451
+ name: "None",
452
+ value: "none",
453
+ disabled: false
454
+ }
455
+ ]
456
+ });
457
+ if (this.storage_library === "@aws-sdk/client-s3") {
458
+ await this.addPackage("@aws-sdk/client-s3");
459
+ } else if (this.storage_library === "@azure/storage-blob") {
460
+ await this.addPackage("@azure/storage-blob");
461
+ } else if (this.storage_library === "@google-cloud/storage") {
462
+ await this.addPackage("@google-cloud/storage");
463
+ } else if (this.storage_library === "basic-ftp") {
464
+ await this.addPackage("basic-ftp");
465
+ } else if (this.storage_library === "ssh2-sftp-client") {
466
+ await this.addPackage("ssh2-sftp-client");
467
+ await this.addPackage("@types/ssh2-sftp-client", true);
468
+ } else if (this.storage_library === "none") {
469
+ } else {
470
+ throw new Error(
471
+ "unexpected storage library: " + this.storage_library + " . Valid options are: @aws-sdk/client-s3, @azure/storage-blob, @google-cloud/storage, basic-ftp, ssh2-sftp-client, none"
472
+ );
267
473
  }
268
474
  await this.addPackage("@devbro/pashmak tsconfig-paths dotenv ");
269
475
  await this.addPackage(
@@ -320,7 +526,7 @@ var CreateProjectCommand = class extends import_clipanion.Command {
320
526
  });
321
527
  }
322
528
  async setupGit() {
323
- const initGit = await (0, import_prompts.select)({
529
+ this.initGit = this.initGit ?? await (0, import_prompts.select)({
324
530
  message: "Initialize a git repository?",
325
531
  choices: [
326
532
  {
@@ -335,7 +541,7 @@ var CreateProjectCommand = class extends import_clipanion.Command {
335
541
  }
336
542
  ]
337
543
  });
338
- if (initGit) {
544
+ if (this.initGit) {
339
545
  const gitignoreContent = [
340
546
  "node_modules/",
341
547
  "dist/",
@@ -592,6 +592,51 @@ var DatabaseTransport = class {
592
592
  // src/factories.mts
593
593
  var import_neko_cache = require("@devbro/neko-cache");
594
594
  var import_neko_storage = require("@devbro/neko-storage");
595
+
596
+ // src/cache/MultiCache.mts
597
+ var MultiCache = class {
598
+ constructor(caches) {
599
+ this.caches = caches;
600
+ }
601
+ static {
602
+ __name(this, "MultiCache");
603
+ }
604
+ async get(key) {
605
+ for (const cache2 of this.caches) {
606
+ const value = await cache2.get(key);
607
+ if (value !== void 0) {
608
+ return value;
609
+ }
610
+ }
611
+ return void 0;
612
+ }
613
+ async put(key, value, ttl) {
614
+ await Promise.all(this.caches.map((cache2) => cache2.put(key, value, ttl)));
615
+ }
616
+ async delete(key) {
617
+ await Promise.all(this.caches.map((cache2) => cache2.delete(key)));
618
+ }
619
+ async has(key) {
620
+ for (const cache2 of this.caches) {
621
+ if (await cache2.has(key)) {
622
+ return true;
623
+ }
624
+ }
625
+ return false;
626
+ }
627
+ async increment(key, amount) {
628
+ let rc = void 0;
629
+ for (const cache2 of this.caches) {
630
+ let rc2 = await cache2.increment(key, amount);
631
+ if (rc === void 0) {
632
+ rc = rc2;
633
+ }
634
+ }
635
+ return rc;
636
+ }
637
+ };
638
+
639
+ // src/factories.mts
595
640
  var FlexibleFactory = class {
596
641
  static {
597
642
  __name(this, "FlexibleFactory");
@@ -662,6 +707,13 @@ CacheProviderFactory.register("redis", (opt) => {
662
707
  CacheProviderFactory.register("file", (opt) => {
663
708
  return new import_neko_cache.FileCacheProvider(opt);
664
709
  });
710
+ CacheProviderFactory.register("multi", (opt) => {
711
+ const caches = [];
712
+ for (const c of opt.caches) {
713
+ caches.push(cache(c));
714
+ }
715
+ return new MultiCache(caches);
716
+ });
665
717
  CacheProviderFactory.register("disabled", (opt) => {
666
718
  return new import_neko_cache.DisabledCacheProvider();
667
719
  });
@@ -55,8 +55,34 @@ var CreateProjectCommand = class extends import_clipanion.Command {
55
55
  executor = "";
56
56
  packageManager = "";
57
57
  linter = "";
58
- validation_library = "";
59
- database_type = "";
58
+ validation_library = import_clipanion.Option.String("--validation-library", {
59
+ description: "Validation library to use (yup, zod, none)",
60
+ required: false
61
+ });
62
+ database_type = import_clipanion.Option.String("--database-type", {
63
+ description: "Database type to use (postgresql, mysql, sqlite)",
64
+ required: false
65
+ });
66
+ cache_library = import_clipanion.Option.String("--cache-library", {
67
+ description: "Cache library to use (redis, memcached, none)",
68
+ required: false
69
+ });
70
+ mailer_library = import_clipanion.Option.String("--mailer-library", {
71
+ description: "Mailer library to use (@aws-sdk/client-ses, nodemailer, none)",
72
+ required: false
73
+ });
74
+ queue_library = import_clipanion.Option.String("--queue-library", {
75
+ description: "Queue library to use (@aws-sdk/client-sqs, @azure/service-bus, @google-cloud/pubsub, amqplib, redis, none)",
76
+ required: false
77
+ });
78
+ storage_library = import_clipanion.Option.String("--storage-library", {
79
+ description: "Storage library to use (@aws-sdk/client-s3, @azure/storage-blob, @google-cloud/storage, basic-ftp, ssh2-sftp-client, none)",
80
+ required: false
81
+ });
82
+ initGit = import_clipanion.Option.Boolean("--git", {
83
+ description: "Initialize a git repository (use --no-git to skip)",
84
+ required: false
85
+ });
60
86
  async folderExists(folderPath) {
61
87
  try {
62
88
  const stats = await fs.stat(folderPath);
@@ -210,7 +236,7 @@ var CreateProjectCommand = class extends import_clipanion.Command {
210
236
  await fs.writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
211
237
  }
212
238
  async setupGeneralPackages() {
213
- this.validation_library = await (0, import_prompts.select)({
239
+ this.validation_library = this.validation_library ?? await (0, import_prompts.select)({
214
240
  message: "Select a package you want for validation",
215
241
  choices: [
216
242
  {
@@ -231,8 +257,15 @@ var CreateProjectCommand = class extends import_clipanion.Command {
231
257
  }
232
258
  ]
233
259
  });
234
- this.validation_library === "none" || await this.addPackage(this.validation_library);
235
- this.database_type = await (0, import_prompts.select)({
260
+ if (this.validation_library === "yup" || this.validation_library === "zod") {
261
+ await this.addPackage(this.validation_library);
262
+ } else if (this.validation_library === "none") {
263
+ } else {
264
+ throw new Error(
265
+ "unexpected validation library: " + this.validation_library + ". Valid options are: yup, zod, none"
266
+ );
267
+ }
268
+ this.database_type = this.database_type ?? await (0, import_prompts.select)({
236
269
  message: "Select a database type (you can add more databases later)",
237
270
  choices: [
238
271
  {
@@ -258,6 +291,179 @@ var CreateProjectCommand = class extends import_clipanion.Command {
258
291
  await this.addPackage("mysql2");
259
292
  } else if (this.database_type === "sqlite") {
260
293
  await this.addPackage("sqlite3");
294
+ } else {
295
+ throw new Error(
296
+ "unexpected database type: " + this.database_type + ". Valid options are: postgresql, mysql, sqlite"
297
+ );
298
+ }
299
+ this.cache_library = this.cache_library ?? await (0, import_prompts.select)({
300
+ message: "Select a cache library",
301
+ choices: [
302
+ {
303
+ name: "Redis",
304
+ value: "redis",
305
+ description: "Redis client for Node.js"
306
+ },
307
+ {
308
+ name: "Memcached",
309
+ value: "memcached",
310
+ description: "Memcached client for Node.js"
311
+ },
312
+ new import_prompts.Separator(),
313
+ {
314
+ name: "None",
315
+ value: "none",
316
+ disabled: false
317
+ }
318
+ ]
319
+ });
320
+ if (this.cache_library === "redis") {
321
+ await this.addPackage("redis");
322
+ } else if (this.cache_library === "memcached") {
323
+ await this.addPackage("memcached");
324
+ } else if (this.cache_library === "none") {
325
+ } else {
326
+ throw new Error(
327
+ "unexpected cache library: " + this.cache_library + ". Valid options are: redis, memcached, none"
328
+ );
329
+ }
330
+ this.mailer_library = this.mailer_library ?? await (0, import_prompts.select)({
331
+ message: "Select a mailer library",
332
+ choices: [
333
+ {
334
+ name: "AWS SES",
335
+ value: "@aws-sdk/client-ses",
336
+ description: "AWS SDK for JavaScript v3 - SES client"
337
+ },
338
+ {
339
+ name: "Nodemailer",
340
+ value: "nodemailer",
341
+ description: "Send emails with Node.js"
342
+ },
343
+ new import_prompts.Separator(),
344
+ {
345
+ name: "None",
346
+ value: "none",
347
+ disabled: false
348
+ }
349
+ ]
350
+ });
351
+ if (this.mailer_library === "@aws-sdk/client-ses") {
352
+ await this.addPackage("@aws-sdk/client-ses");
353
+ } else if (this.mailer_library === "nodemailer") {
354
+ await this.addPackage("nodemailer");
355
+ await this.addPackage("@types/nodemailer", true);
356
+ } else if (this.mailer_library === "none") {
357
+ } else {
358
+ throw new Error(
359
+ "unexpected mailer library: " + this.mailer_library + ". Valid options are: @aws-sdk/client-ses, nodemailer, none"
360
+ );
361
+ }
362
+ this.queue_library = this.queue_library ?? await (0, import_prompts.select)({
363
+ message: "Select a queue library",
364
+ choices: [
365
+ {
366
+ name: "AWS SQS",
367
+ value: "@aws-sdk/client-sqs",
368
+ description: "AWS SDK for JavaScript v3 - SQS client"
369
+ },
370
+ {
371
+ name: "Azure Service Bus",
372
+ value: "@azure/service-bus",
373
+ description: "Azure Service Bus client for Node.js"
374
+ },
375
+ {
376
+ name: "Google Cloud Pub/Sub",
377
+ value: "@google-cloud/pubsub",
378
+ description: "Google Cloud Pub/Sub client for Node.js"
379
+ },
380
+ {
381
+ name: "RabbitMQ (amqplib)",
382
+ value: "amqplib",
383
+ description: "AMQP 0-9-1 client for Node.js"
384
+ },
385
+ {
386
+ name: "Redis",
387
+ value: "redis",
388
+ description: "Redis client for Node.js"
389
+ },
390
+ new import_prompts.Separator(),
391
+ {
392
+ name: "None",
393
+ value: "none",
394
+ disabled: false
395
+ }
396
+ ]
397
+ });
398
+ if (this.queue_library === "@aws-sdk/client-sqs") {
399
+ await this.addPackage("@aws-sdk/client-sqs");
400
+ } else if (this.queue_library === "@azure/service-bus") {
401
+ await this.addPackage("@azure/service-bus");
402
+ } else if (this.queue_library === "@google-cloud/pubsub") {
403
+ await this.addPackage("@google-cloud/pubsub");
404
+ } else if (this.queue_library === "amqplib") {
405
+ await this.addPackage("amqplib");
406
+ await this.addPackage("@types/amqplib", true);
407
+ } else if (this.queue_library === "redis") {
408
+ await this.addPackage("redis");
409
+ } else if (this.queue_library === "none") {
410
+ } else {
411
+ throw new Error(
412
+ "unexpected queue library: " + this.queue_library + ". Valid options are: @aws-sdk/client-sqs, @azure/service-bus, @google-cloud/pubsub, amqplib, redis, none"
413
+ );
414
+ }
415
+ this.storage_library = this.storage_library ?? await (0, import_prompts.select)({
416
+ message: "Select a storage library",
417
+ choices: [
418
+ {
419
+ name: "@aws-sdk/client-s3",
420
+ value: "@aws-sdk/client-s3",
421
+ description: "AWS SDK for JavaScript v3 - S3 client"
422
+ },
423
+ {
424
+ name: "@azure/storage-blob",
425
+ value: "@azure/storage-blob",
426
+ description: "Azure Storage Blob client for Node.js"
427
+ },
428
+ {
429
+ name: "@google-cloud/storage",
430
+ value: "@google-cloud/storage",
431
+ description: "Google Cloud Storage client for Node.js"
432
+ },
433
+ {
434
+ name: "basic-ftp",
435
+ value: "basic-ftp",
436
+ description: "FTP client for Node.js"
437
+ },
438
+ {
439
+ name: "ssh2-sftp-client",
440
+ value: "ssh2-sftp-client",
441
+ description: "SFTP client for Node.js"
442
+ },
443
+ new import_prompts.Separator(),
444
+ {
445
+ name: "None",
446
+ value: "none",
447
+ disabled: false
448
+ }
449
+ ]
450
+ });
451
+ if (this.storage_library === "@aws-sdk/client-s3") {
452
+ await this.addPackage("@aws-sdk/client-s3");
453
+ } else if (this.storage_library === "@azure/storage-blob") {
454
+ await this.addPackage("@azure/storage-blob");
455
+ } else if (this.storage_library === "@google-cloud/storage") {
456
+ await this.addPackage("@google-cloud/storage");
457
+ } else if (this.storage_library === "basic-ftp") {
458
+ await this.addPackage("basic-ftp");
459
+ } else if (this.storage_library === "ssh2-sftp-client") {
460
+ await this.addPackage("ssh2-sftp-client");
461
+ await this.addPackage("@types/ssh2-sftp-client", true);
462
+ } else if (this.storage_library === "none") {
463
+ } else {
464
+ throw new Error(
465
+ "unexpected storage library: " + this.storage_library + " . Valid options are: @aws-sdk/client-s3, @azure/storage-blob, @google-cloud/storage, basic-ftp, ssh2-sftp-client, none"
466
+ );
261
467
  }
262
468
  await this.addPackage("@devbro/pashmak tsconfig-paths dotenv ");
263
469
  await this.addPackage(
@@ -314,7 +520,7 @@ var CreateProjectCommand = class extends import_clipanion.Command {
314
520
  });
315
521
  }
316
522
  async setupGit() {
317
- const initGit = await (0, import_prompts.select)({
523
+ this.initGit = this.initGit ?? await (0, import_prompts.select)({
318
524
  message: "Initialize a git repository?",
319
525
  choices: [
320
526
  {
@@ -329,7 +535,7 @@ var CreateProjectCommand = class extends import_clipanion.Command {
329
535
  }
330
536
  ]
331
537
  });
332
- if (initGit) {
538
+ if (this.initGit) {
333
539
  const gitignoreContent = [
334
540
  "node_modules/",
335
541
  "dist/",
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/cache/MultiCache.mts
22
+ var MultiCache_exports = {};
23
+ __export(MultiCache_exports, {
24
+ MultiCache: () => MultiCache
25
+ });
26
+ module.exports = __toCommonJS(MultiCache_exports);
27
+ var MultiCache = class {
28
+ constructor(caches) {
29
+ this.caches = caches;
30
+ }
31
+ static {
32
+ __name(this, "MultiCache");
33
+ }
34
+ async get(key) {
35
+ for (const cache of this.caches) {
36
+ const value = await cache.get(key);
37
+ if (value !== void 0) {
38
+ return value;
39
+ }
40
+ }
41
+ return void 0;
42
+ }
43
+ async put(key, value, ttl) {
44
+ await Promise.all(this.caches.map((cache) => cache.put(key, value, ttl)));
45
+ }
46
+ async delete(key) {
47
+ await Promise.all(this.caches.map((cache) => cache.delete(key)));
48
+ }
49
+ async has(key) {
50
+ for (const cache of this.caches) {
51
+ if (await cache.has(key)) {
52
+ return true;
53
+ }
54
+ }
55
+ return false;
56
+ }
57
+ async increment(key, amount) {
58
+ let rc = void 0;
59
+ for (const cache of this.caches) {
60
+ let rc2 = await cache.increment(key, amount);
61
+ if (rc === void 0) {
62
+ rc = rc2;
63
+ }
64
+ }
65
+ return rc;
66
+ }
67
+ };
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ MultiCache
71
+ });