@snowtop/ent 0.1.5 → 0.1.6

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/core/clause.d.ts CHANGED
@@ -115,6 +115,7 @@ export declare function JSONObjectFieldKeyASJSON<T extends Data, K = keyof T>(co
115
115
  export declare function JSONObjectFieldKeyAsText<T extends Data, K = keyof T>(col: K, field: string): keyof T;
116
116
  type predicate = "==" | ">" | "<" | "!=" | ">=" | "<=";
117
117
  export declare function JSONPathValuePredicate<T extends Data, K = keyof T>(dbCol: K, path: string, val: any, pred: predicate): Clause<T, K>;
118
+ export declare function JSONKeyExists<T extends Data, K = keyof T>(dbCol: K, val: any): Clause<T, K>;
118
119
  export declare function PaginationMultipleColsSubQuery<T extends Data, K = keyof T>(col: K, op: string, tableName: string, uniqueCol: K, val: any): Clause<T, K>;
119
120
  export declare function Add<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
120
121
  export declare function Subtract<T extends Data, K = keyof T>(col: K, value: any): Clause<T, K>;
package/core/clause.js CHANGED
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.getCombinedClause = exports.Modulo = exports.Divide = exports.Multiply = exports.Subtract = exports.Add = exports.PaginationMultipleColsSubQuery = exports.JSONPathValuePredicate = exports.JSONObjectFieldKeyAsText = exports.JSONObjectFieldKeyASJSON = exports.sensitiveValue = exports.TsVectorWebsearchToTsQuery = exports.TsVectorPhraseToTsQuery = exports.TsVectorPlainToTsQuery = exports.TsVectorColTsQuery = exports.WebsearchToTsQuery = exports.PhraseToTsQuery = exports.PlainToTsQuery = exports.TsQuery = exports.DBTypeNotIn = exports.TextNotIn = exports.IntegerNotIn = exports.UuidNotIn = exports.DBTypeIn = exports.TextIn = exports.IntegerIn = exports.UuidIn = exports.In = exports.OrOptional = exports.Or = exports.AndOptional = exports.And = exports.LessEq = exports.GreaterEq = exports.Less = exports.Greater = exports.NotEq = exports.Eq = exports.ArrayNotEq = exports.ArrayEq = exports.PostgresArrayNotOverlaps = exports.PostgresArrayOverlaps = exports.PostgresArrayNotContains = exports.PostgresArrayNotContainsValue = exports.PostgresArrayContains = exports.PostgresArrayContainsValue = exports.notInClause = exports.inClause = void 0;
26
+ exports.getCombinedClause = exports.Modulo = exports.Divide = exports.Multiply = exports.Subtract = exports.Add = exports.PaginationMultipleColsSubQuery = exports.JSONKeyExists = exports.JSONPathValuePredicate = exports.JSONObjectFieldKeyAsText = exports.JSONObjectFieldKeyASJSON = exports.sensitiveValue = exports.TsVectorWebsearchToTsQuery = exports.TsVectorPhraseToTsQuery = exports.TsVectorPlainToTsQuery = exports.TsVectorColTsQuery = exports.WebsearchToTsQuery = exports.PhraseToTsQuery = exports.PlainToTsQuery = exports.TsQuery = exports.DBTypeNotIn = exports.TextNotIn = exports.IntegerNotIn = exports.UuidNotIn = exports.DBTypeIn = exports.TextIn = exports.IntegerIn = exports.UuidIn = exports.In = exports.OrOptional = exports.Or = exports.AndOptional = exports.And = exports.LessEq = exports.GreaterEq = exports.Less = exports.Greater = exports.NotEq = exports.Eq = exports.ArrayNotEq = exports.ArrayEq = exports.PostgresArrayNotOverlaps = exports.PostgresArrayOverlaps = exports.PostgresArrayNotContains = exports.PostgresArrayNotContainsValue = exports.PostgresArrayContains = exports.PostgresArrayContainsValue = exports.notInClause = exports.inClause = void 0;
27
27
  const db_1 = __importStar(require("./db"));
28
28
  function isSensitive(val) {
29
29
  return (val !== null &&
@@ -725,6 +725,10 @@ function JSONPathValuePredicate(dbCol, path, val, pred) {
725
725
  return new jSONPathValuePredicateClause(dbCol, path, val, pred);
726
726
  }
727
727
  exports.JSONPathValuePredicate = JSONPathValuePredicate;
728
+ function JSONKeyExists(dbCol, val) {
729
+ return new simpleClause(dbCol, val, "?", new isNullClause(dbCol));
730
+ }
731
+ exports.JSONKeyExists = JSONKeyExists;
728
732
  // TODO need a better name for this lol
729
733
  // this assumes we're doing the same direction twice which isn't necessarily accurate in the future...
730
734
  class paginationMultipleColumnsSubQueryClause {
@@ -193,6 +193,10 @@ class GQLCapture {
193
193
  if (fd.nullable === undefined) {
194
194
  return res;
195
195
  }
196
+ if (fd.nullable === false) {
197
+ delete res.nullable;
198
+ return res;
199
+ }
196
200
  if (fd.nullable === "contents") {
197
201
  res.nullable = NullableResult.CONTENTS;
198
202
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snowtop/ent",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "snowtop ent framework",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",