@hiiretail/gcp-infra-generators 1.15.0 → 1.16.0

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.
@@ -80,6 +80,10 @@ module.exports = class extends BaseGenerator {
80
80
  return `Please provide backup retention in seconds (e.g., "${seconds}" is ${days}).`;
81
81
  },
82
82
  validate: required,
83
+ filter: (input) => {
84
+ const trimmed = input.trim();
85
+ return /^\d+$/.test(trimmed) ? `${trimmed}s` : trimmed;
86
+ },
83
87
  },
84
88
  {
85
89
  type: 'input',
@@ -39,19 +39,29 @@ locals {
39
39
  for db in local.all_databases : db.name => try(db.collections, [])
40
40
  }
41
41
 
42
+ # Decode each collection's schema file once (if referenced), merged over any inline definition
43
+ databases_collections_resolved = {
44
+ for db_name, collections in local.databases_collections : db_name => [
45
+ for collection in collections : merge(
46
+ collection,
47
+ merge([
48
+ for schema_path in (try(collection.schema, null) != null ? [collection.schema] : []) :
49
+ yamldecode(file("${get_terragrunt_dir()}/${schema_path}"))
50
+ ]...)
51
+ )
52
+ ]
53
+ }
54
+
42
55
  # Load collection schemas from referenced files OR inline definitions
43
56
  collection_schemas = {
44
- for db_name, collections in local.databases_collections : db_name => {
45
- for collection in collections :
46
- (try(collection.schema, null) != null ? yamldecode(file("${get_terragrunt_dir()}/${collection.schema}")).name : collection.name) => merge(
47
- {
48
- name = try(collection.schema, null) != null ? yamldecode(file("${get_terragrunt_dir()}/${collection.schema}")).name : collection.name
49
- description = try(collection.schema, null) != null ? yamldecode(file("${get_terragrunt_dir()}/${collection.schema}")).description : try(collection.description, "")
50
- ttl_field = try(collection.schema, null) != null ? try(yamldecode(file("${get_terragrunt_dir()}/${collection.schema}")).ttl_field, null) : try(collection.ttl_field, null)
51
- indexes = try(collection.schema, null) != null ? try(yamldecode(file("${get_terragrunt_dir()}/${collection.schema}")).indexes, []) : try(collection.indexes, [])
52
- fields = try(collection.schema, null) != null ? try(yamldecode(file("${get_terragrunt_dir()}/${collection.schema}")).fields, []) : try(collection.fields, [])
53
- }
54
- )
57
+ for db_name, collections in local.databases_collections_resolved : db_name => {
58
+ for collection in collections : collection.name => {
59
+ name = collection.name
60
+ description = try(collection.description, "")
61
+ ttl_field = try(collection.ttl_field, null)
62
+ indexes = try(collection.indexes, [])
63
+ fields = try(collection.fields, [])
64
+ }
55
65
  }
56
66
  }
57
67
 
@@ -91,7 +101,7 @@ locals {
91
101
  databases_composite_index_configuration = {
92
102
  for db_name, schemas in local.collection_schemas : db_name => flatten([
93
103
  for schema_name, schema in schemas : [
94
- for idx, index in try(schema.indexes, []) :
104
+ for index in try(schema.indexes, []) :
95
105
  {
96
106
  index_id = index.name
97
107
  collection = schema_name
@@ -11528,7 +11528,7 @@
11528
11528
  },
11529
11529
  "packages/generators": {
11530
11530
  "name": "@hiiretail/gcp-infra-generators",
11531
- "version": "1.15.0",
11531
+ "version": "1.16.0",
11532
11532
  "license": "MIT",
11533
11533
  "dependencies": {
11534
11534
  "@google-cloud/storage": "^7.18.0",
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiiretail/gcp-infra-generators",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "Infrastructure as code generator for GCP.",
5
5
  "scripts": {
6
6
  "build": "node esbuild.js && npm run build:deps",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hiiretail/gcp-infra-generators",
3
- "version": "1.15.0",
3
+ "version": "1.16.0",
4
4
  "description": "Infrastructure as code generator for GCP.",
5
5
  "scripts": {
6
6
  "build": "node esbuild.js && npm run build:deps",