@architect/inventory 3.4.0-RC.0 → 3.4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@architect/inventory",
3
- "version": "3.4.0-RC.0",
3
+ "version": "3.4.0",
4
4
  "description": "Architect project resource enumeration utility",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -20,6 +20,8 @@ module.exports = function configureTablesIndexes ({ arc, inventory, errors }) {
20
20
  sortKey: null,
21
21
  sortKeyType: null,
22
22
  indexName: null,
23
+ projectionType: 'ALL',
24
+ projectionAttributes: null,
23
25
  })
24
26
 
25
27
  let indexes = []
@@ -38,6 +40,7 @@ module.exports = function configureTablesIndexes ({ arc, inventory, errors }) {
38
40
  let i = indexTemplate()
39
41
  i.name = Object.keys(index)[0]
40
42
  Object.entries(index[i.name]).forEach(([ key, value ]) => {
43
+ let setting = key?.toLowerCase()
41
44
  if (is.sortKey(value)) {
42
45
  i.sortKey = key
43
46
  i.sortKeyType = value.replace('**', '').toLowerCase()
@@ -48,9 +51,27 @@ module.exports = function configureTablesIndexes ({ arc, inventory, errors }) {
48
51
  i.partitionKeyType = value.replace('*', '').toLowerCase()
49
52
  if (!i.partitionKeyType) i.partitionKeyType = 'string'
50
53
  }
51
- else if (key?.toLowerCase() === 'name') {
54
+ else if (setting === 'name') {
52
55
  i.indexName = value
53
56
  }
57
+ else if (setting === 'projection') {
58
+ let val = (is.string(value) && value.toLowerCase()) || value
59
+ if (val === 'all') {
60
+ i.projectionType = 'ALL'
61
+ }
62
+ else if (val === 'keys') {
63
+ i.projectionType = 'KEYS_ONLY'
64
+ }
65
+ else {
66
+ i.projectionType = 'INCLUDE'
67
+ if (Array.isArray(value)) {
68
+ i.projectionAttributes = value
69
+ }
70
+ else {
71
+ i.projectionAttributes = [ value ]
72
+ }
73
+ }
74
+ }
54
75
  })
55
76
  return i
56
77
  }