proto.io 0.0.170 → 0.0.171

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.
@@ -2266,8 +2266,12 @@ const encodeFieldExpression = (compiler, parent, field, expr) => {
2266
2266
  }[expr.type];
2267
2267
  if (!_.isArray(expr.value))
2268
2268
  break;
2269
- if (_.isEmpty(expr.value))
2270
- return sql `true`;
2269
+ if (_.isEmpty(expr.value)) {
2270
+ switch (expr.type) {
2271
+ case '$superset': return sql `true`;
2272
+ case '$intersect': return sql `false`;
2273
+ }
2274
+ }
2271
2275
  if (dataType === 'array' || (!_.isString(dataType) && dataType?.type === 'array')) {
2272
2276
  return sql `${element} ${{ literal: op }} ${{ value: index._encodeValue(expr.value) }}`;
2273
2277
  }
@@ -2279,7 +2283,7 @@ const encodeFieldExpression = (compiler, parent, field, expr) => {
2279
2283
  return sql `ARRAY(
2280
2284
  SELECT ${{ identifier: '_id' }}
2281
2285
  FROM (${populate}) AS ${{ identifier: tempName }}
2282
- ) ${{ literal: op }} ARRAY[${_.map(expr.value, (x) => sql `${{ value: x.objectId }}`)}]`;
2286
+ ) ${{ literal: op }} ARRAY[${_.map(expr.value, (x) => sql `${{ value: x.objectId }}`)}]::TEXT[]`;
2283
2287
  }
2284
2288
  if (!dataType) {
2285
2289
  return sql `jsonb_typeof(${element}) ${nullSafeEqual()} 'array' AND ${element} ${{ literal: op }} ${_encodeJsonValue(index._encodeValue(expr.value))}`;