gitsheets 0.21.4 → 0.22.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/commands/query.js CHANGED
@@ -28,15 +28,23 @@ exports.builder = {
28
28
  describe: 'Truncate results to given count',
29
29
  type: 'number'
30
30
  },
31
- 'filter.<field>': {
31
+ 'filter': {
32
+ group: 'Filtering',
32
33
  describe: 'Filter results by one or more field values',
34
+ type: 'array'
35
+ },
36
+ 'filter.<field>[=<value>]': {
37
+ group: 'Filtering',
38
+ describe: 'Field to filter by'
33
39
  },
34
40
  fields: {
41
+ group: 'Field selection',
35
42
  describe: 'List of fields to order/limit output columns with',
36
43
  type: 'array'
37
44
  },
38
- 'fields.<from>': {
39
- describe: 'Fields to remap',
45
+ 'fields.<from>=<to>': {
46
+ group: 'Field selection',
47
+ describe: 'Field to remap',
40
48
  type: 'array'
41
49
  }
42
50
  };
@@ -125,11 +133,25 @@ async function* limitResult(result, limit) {
125
133
  }
126
134
 
127
135
  async function* mapResult(result, fields) {
136
+ if (!Array.isArray(fields)) {
137
+ const fieldsObject = fields;
138
+ fields = [];
139
+ for (const fromKey in fieldsObject) {
140
+ const fieldMap = {};
141
+ fieldMap[fromKey] = fieldsObject[fromKey];
142
+ fields.push(fieldMap);
143
+ }
144
+ }
145
+
128
146
  for await (const record of result) {
129
147
  const output = {};
130
148
 
131
149
  for (const field of fields) {
132
- if (typeof field == 'object') {
150
+ if (Array.isArray(field)) {
151
+ for (const fieldValue of field) {
152
+ output[fieldValue] = record[fieldValue];
153
+ }
154
+ } else if (typeof field == 'object') {
133
155
  for (const from in field) {
134
156
  output[field[from]] = record[from];
135
157
  }
@@ -104,9 +104,9 @@ exports.handler = async function singerTarget({
104
104
  console.log(`${type}\t${stream}`, message);
105
105
 
106
106
 
107
- // ignore state for now
108
- if (type == 'STATE') {
109
- console.warn('ignoring STATE message');
107
+ // ignore unhandled message types for now
108
+ if (type == 'STATE' || type == 'ACTIVATE_VERSION') {
109
+ console.warn(`ignoring ${type} message`);
110
110
  continue;
111
111
  }
112
112
 
@@ -142,7 +142,7 @@ exports.handler = async function upsert({
142
142
 
143
143
  if (existingBlob) {
144
144
  const existingRecord = await inputSheet.readRecord(existingBlob);
145
- inputRecord = deepmerge(inputRecord, existingRecord);
145
+ inputRecord = deepmerge(existingRecord, inputRecord);
146
146
  }
147
147
  }
148
148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gitsheets",
3
- "version": "0.21.4",
3
+ "version": "0.22.0",
4
4
  "description": "A toolkit for using a git repository to store low-volume, high-touch, human-scale data",
5
5
  "main": "lib/GitSheets.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@
26
26
  "fast-csv": "^4.3.6",
27
27
  "fast-json-patch": "^2.2.1",
28
28
  "get-stream": "^5.2.0",
29
- "hologit": "^0.40.5",
29
+ "hologit": "^0.41.3",
30
30
  "http-assert": "^1.4.1",
31
31
  "koa": "^2.13.1",
32
32
  "koa-bodyparser": "^4.3.0",
@@ -39,7 +39,7 @@
39
39
  "tmp": "^0.2.1",
40
40
  "to-readable-stream": "^2.1.0",
41
41
  "winston": "^3.3.3",
42
- "yargs": "^13.3.2"
42
+ "yargs": "^17.5.1"
43
43
  },
44
44
  "devDependencies": {
45
45
  "common-tags": "^1.8.0",