@miso.ai/server-wordpress 0.6.3-beta.12 → 0.6.3-beta.14

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/cli/entities.js CHANGED
@@ -64,7 +64,7 @@ export async function runGet(client, name, { transform, ...options }) {
64
64
  export async function runIds(client, name, { update, transform, resolve, fields, ...options }) {
65
65
  if (update) {
66
66
  await stream.pipeline(
67
- await buildUpdateStream(client, name, update, { ...options, fields: ['id', 'modified_gmt'] }),
67
+ await buildUpdateStream(client, name, update, { ...options, fields: ['id'] }),
68
68
  new Transform({
69
69
  objectMode: true,
70
70
  transform({ id }, _, callback) {
package/package.json CHANGED
@@ -17,9 +17,9 @@
17
17
  "simonpai <simon.pai@askmiso.com>"
18
18
  ],
19
19
  "dependencies": {
20
- "@miso.ai/server-commons": "0.6.3-beta.12",
20
+ "@miso.ai/server-commons": "0.6.3-beta.14",
21
21
  "axios": "^1.6.2",
22
22
  "axios-retry": "^3.3.1"
23
23
  },
24
- "version": "0.6.3-beta.12"
24
+ "version": "0.6.3-beta.14"
25
25
  }
@@ -50,7 +50,7 @@ export default class EntityIndex {
50
50
  if (this.hierarchical) {
51
51
  return; // already all fetched
52
52
  }
53
- ids = asArray(ids);
53
+ ids = asArray(ids).filter(id => id); // discard 0, null, undefined
54
54
 
55
55
  const promises = []
56
56
  const idsToFetch = [];
@@ -85,8 +85,11 @@ export default class EntityIndex {
85
85
  }
86
86
 
87
87
  _resolveFetch(id) {
88
- this._fetching.get(id).resolve();
89
- this._fetching.delete(id);
88
+ const res = this._fetching.get(id);
89
+ if (res) {
90
+ res.resolve();
91
+ this._fetching.delete(id);
92
+ }
90
93
  }
91
94
 
92
95
  async get(id) {
@@ -96,13 +99,14 @@ export default class EntityIndex {
96
99
  }
97
100
 
98
101
  async getAll(ids) {
102
+ ids = ids.filter(id => id); // discard 0, null, undefined
99
103
  await this._dataReady();
100
104
  await this.fetch(ids);
101
105
  return ids.map(id => this._index.get(id));
102
106
  }
103
107
 
104
108
  async getValue(id) {
105
- if (id === undefined) {
109
+ if (!id) { // 0, null, undefined
106
110
  return undefined;
107
111
  }
108
112
  return this._value(await this.get(id));
@@ -62,12 +62,7 @@ export default class Entities {
62
62
  }
63
63
 
64
64
  async ids(options = {}) {
65
- const { before, after, u } = options;
66
- const fields = ['id'];
67
- if (before || after) {
68
- fields.push('modified_gmt');
69
- }
70
- return (await this._client._helpers.stream(this.name, { ...options, fields }))
65
+ return (await this._client._helpers.stream(this.name, { ...options, fields: ['id'] }))
71
66
  .pipe(new Transform({
72
67
  objectMode: true,
73
68
  transform({ id }, _, callback) {
package/src/helpers.js CHANGED
@@ -185,6 +185,7 @@ class Url {
185
185
  has(include) && include.length && params.push(`include=${joinIds(include)}`);
186
186
  has(exclude) && exclude.length && params.push(`exclude=${joinIds(exclude)}`);
187
187
  if (has(fields) && fields.length) {
188
+ // TODO: is this unused?
188
189
  if (has(before) && !fields.includes('modified_gmt')) {
189
190
  fields = [...fields, 'modified_gmt'];
190
191
  }
package/src/version.js CHANGED
@@ -1 +1 @@
1
- export default '0.6.3-beta.12';
1
+ export default '0.6.3-beta.14';