Replies: 7 comments 1 reply
-
Here is PoC. import { query } from 'faunadb';
// Note Date, Function, Map, Object, Range are also JavaScript objects.
export const Abort = query.Abort;
export const Abs = query.Abs;
export const Acos = query.Acos;
export const Add = query.Add;
export const All = query.All;
export const And = query.And;
export const Any = query.Any;
export const Append = query.Append;
export const Asin = query.Asin;
export const At = query.At;
export const Atan = query.Atan;
export const BitAnd = query.BitAnd;
export const BitNot = query.BitNot;
export const BitOr = query.BitOr;
export const BitXor = query.BitXor;
export const Bytes = query.Bytes;
export const Call = query.Call;
export const Casefold = query.Casefold;
export const Ceil = query.Ceil;
export const Class = query.Class;
export const Classes = query.Classes;
export const Collection = query.Collection;
export const Collections = query.Collections;
export const Concat = query.Concat;
export const Contains = query.Contains;
export const ContainsStr = query.ContainsStr;
export const ContainsStrRegex = query.ContainsStrRegex;
export const Cos = query.Cos;
export const Cosh = query.Cosh;
export const Count = query.Count;
export const Create = query.Create;
export const CreateClass = query.CreateClass;
export const CreateCollection = query.CreateCollection;
export const CreateDatabase = query.CreateDatabase;
export const CreateFunction = query.CreateFunction;
export const CreateIndex = query.CreateIndex;
export const CreateKey = query.CreateKey;
export const CreateRole = query.CreateRole;
export const Credentials = query.Credentials;
export const Database = query.Database;
export const Databases = query.Databases;
export const Date = query.Date;
export const DayOfMonth = query.DayOfMonth;
export const DayOfWeek = query.DayOfWeek;
export const DayOfYear = query.DayOfYear;
export const Degrees = query.Degrees;
export const Delete = query.Delete;
export const Difference = query.Difference;
export const Distinct = query.Distinct;
export const Divide = query.Divide;
export const Do = query.Do;
export const Documents = query.Documents;
export const Drop = query.Drop;
export const EndsWith = query.EndsWith;
export const Epoch = query.Epoch;
export const Equals = query.Equals;
export const Events = query.Events;
export const Exists = query.Exists;
export const Exp = query.Exp;
export const Filter = query.Filter;
export const FindStr = query.FindStr;
export const FindStrRegex = query.FindStrRegex;
export const Floor = query.Floor;
export const Foreach = query.Foreach;
export const Format = query.Format;
export const Function = query.Function;
export const Functions = query.Functions;
export const Get = query.Get;
export const GT = query.GT;
export const GTE = query.GTE;
export const HasIdentity = query.HasIdentity;
export const Hour = query.Hour;
export const Hypot = query.Hypot;
export const Identify = query.Identify;
export const Identity = query.Identity;
export const If = query.If;
export const Index = query.Index;
export const Indexes = query.Indexes;
export const Insert = query.Insert;
export const Intersection = query.Intersection;
export const IsArray = query.IsArray;
export const IsBoolean = query.IsBoolean;
export const IsBytes = query.IsBytes;
export const IsCollection = query.IsCollection;
export const IsCredentials = query.IsCredentials;
export const IsDatabase = query.IsDatabase;
export const IsDate = query.IsDate;
export const IsDoc = query.IsDoc;
export const IsDouble = query.IsDouble;
export const IsEmpty = query.IsEmpty;
export const IsFunction = query.IsFunction;
export const IsIndex = query.IsIndex;
export const IsInteger = query.IsInteger;
export const IsKey = query.IsKey;
export const IsLambda = query.IsLambda;
export const IsNonEmpty = query.IsNonEmpty;
export const IsNull = query.IsNull;
export const IsNumber = query.IsNumber;
export const IsObject = query.IsObject;
export const IsRef = query.IsRef;
export const IsRole = query.IsRole;
export const IsSet = query.IsSet;
export const IsString = query.IsString;
export const IsTimestamp = query.IsTimestamp;
export const IsToken = query.IsToken;
export const Join = query.Join;
export const KeyFromSecret = query.KeyFromSecret;
export const Keys = query.Keys;
export const Lambda = query.Lambda;
export const Length = query.Length;
export const Let = query.Let;
export const Ln = query.Ln;
export const Log = query.Log;
export const Login = query.Login;
export const Logout = query.Logout;
export const LowerCase = query.LowerCase;
export const LT = query.LT;
export const LTE = query.LTE;
export const LTrim = query.LTrim;
export const Map = query.Map;
export const Match = query.Match;
export const Max = query.Max;
export const Mean = query.Mean;
export const Merge = query.Merge;
export const Min = query.Min;
export const Minute = query.Minute;
export const Modulo = query.Modulo;
export const Month = query.Month;
export const MoveDatabase = query.MoveDatabase;
export const Multiply = query.Multiply;
export const NewId = query.NewId;
export const NextId = query.NextId;
export const NGram = query.NGram;
export const Not = query.Not;
export const Now = query.Now;
export const Object = query.Object;
export const Or = query.Or;
export const Paginate = query.Paginate;
export const Pow = query.Pow;
export const Prepend = query.Prepend;
export const Query = query.Query;
export const Radians = query.Radians;
export const Range = query.Range;
export const Reduce = query.Reduce;
export const Ref = query.Ref;
export const RegexEscape = query.RegexEscape;
export const Remove = query.Remove;
export const Repeat = query.Repeat;
export const Replace = query.Replace;
export const ReplaceStr = query.ReplaceStr;
export const ReplaceStrRegex = query.ReplaceStrRegex;
export const Role = query.Role;
export const Roles = query.Roles;
export const Round = query.Round;
export const RTrim = query.RTrim;
export const Second = query.Second;
export const Select = query.Select;
export const SelectAll = query.SelectAll;
export const Sign = query.Sign;
export const Sin = query.Sin;
export const Singleton = query.Singleton;
export const Sinh = query.Sinh;
export const Space = query.Space;
export const Sqrt = query.Sqrt;
export const StartsWith = query.StartsWith;
export const SubString = query.SubString;
export const Subtract = query.Subtract;
export const Sum = query.Sum;
export const Take = query.Take;
export const Tan = query.Tan;
export const Tanh = query.Tanh;
export const Time = query.Time;
export const TimeAdd = query.TimeAdd;
export const TimeDiff = query.TimeDiff;
export const TimeSubtract = query.TimeSubtract;
export const TitleCase = query.TitleCase;
export const ToArray = query.ToArray;
export const ToDate = query.ToDate;
export const ToDouble = query.ToDouble;
export const ToInteger = query.ToInteger;
export const Tokens = query.Tokens;
export const ToMicros = query.ToMicros;
export const ToMillis = query.ToMillis;
export const ToNumber = query.ToNumber;
export const ToObject = query.ToObject;
export const ToSeconds = query.ToSeconds;
export const ToString = query.ToString;
export const ToTime = query.ToTime;
export const Trim = query.Trim;
export const Trunc = query.Trunc;
export const Union = query.Union;
export const Update = query.Update;
export const UpperCase = query.UpperCase;
export const Var = query.Var;
export const Year = query.Year; |
Beta Was this translation helpful? Give feedback.
-
I have to say, PascalCase was a good idea, because, it's more like DSL, and, therefore, custom functions should be written in JS camelCase as usual. It's similar how React components are written, only the opposite :-) |
Beta Was this translation helpful? Give feedback.
-
Also, I would make aliases for Date, Function, Map, Object, Range, which are also JavaScript objects. It's so boring to write them into import manually, auto-import can't work. F prefix should be good enough. FObject, FMap, etc. // Export aliases to Date, Function, Map, Object, Range to enable auto-import.
export const FDate = query.Date;
export const FFunction = query.Function;
export const FMap = query.Map;
export const FObject = query.Object;
export const FRange = query.Range; And potential clashes (Date, Function, Map, Object, Range) should not be exported at all. |
Beta Was this translation helpful? Give feedback.
-
As for aliases, I changed my mind. For some names like Therefore, aliases are unnecessary. |
Beta Was this translation helpful? Give feedback.
-
I wish this would be Fauna lib default mode with ES6 tree shaking supported. |
Beta Was this translation helpful? Give feedback.
-
As for API discoverability aka VSCode autocomplete, it should be still possible to |
Beta Was this translation helpful? Give feedback.
-
@steida thank you very much for this suggestion. We've got an alpha version available here and would love your feedback: #469 |
Beta Was this translation helpful? Give feedback.
-
Now we have use
import { query as q } from 'faunadb'
Or
const { Do, Create } = query
But it would be nice to leverage named exports with VSCode auto-import:
import { Do, Create } from 'faunadb/query'
WDYT?
Beta Was this translation helpful? Give feedback.
All reactions