Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "functional-models",
"version": "3.0.7",
"version": "3.0.8",
"description": "Functional models is ooey gooey framework for building and using awesome models EVERYWHERE.",
"main": "index.js",
"types": "index.d.ts",
Expand Down
14 changes: 9 additions & 5 deletions src/orm/query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import merge from 'lodash/merge'
import omit from 'lodash/omit'
import {
AllowableEqualitySymbols,
BooleanQuery,
BuilderV2Link,
DatastoreValueType,
DatesAfterQuery,
Expand All @@ -13,6 +14,7 @@ import {
PaginationQuery,
PropertyOptions,
PropertyQuery,
Query,
QueryBuilder,
QueryTokens,
SortOrder,
Expand Down Expand Up @@ -293,23 +295,25 @@ const queryBuilder = (): QueryBuilder => {
}

/**
* Determines if the value is an Orm Property based statement
* Determines if the token is an Orm Property based statement
* @param value
*/
const isPropertyBasedQuery = (value: string | undefined) => {
if (!value) {
const isPropertyBasedQuery = (value: any): value is Query => {
if (!value || !value.type) {
return false
}
return (
value === 'property' || value === 'datesBefore' || value === 'datesAfter'
value.type === 'property' ||
value.type === 'datesBefore' ||
value.type === 'datesAfter'
)
}

/**
* Determines if the value is a boolean
* @param value - The value to examine.
*/
const isALinkToken = (value: string) => {
const isALinkToken = (value: any): value is BooleanQuery => {
if (!value) {
return false
}
Expand Down
6 changes: 3 additions & 3 deletions test/src/orm/query.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ describe('/src/orm/query.ts', () => {
})
describe('#isOrmValueStatement()', () => {
it('should return true if it is a property', () => {
const actual = isPropertyBasedQuery('property')
const actual = isPropertyBasedQuery({ type: 'property' })
assert.isTrue(actual)
})
it('should return true if it is a datesBefore', () => {
const actual = isPropertyBasedQuery('datesBefore')
const actual = isPropertyBasedQuery({ type: 'datesBefore' })
assert.isTrue(actual)
})
it('should return true if it is a datesAfter', () => {
const actual = isPropertyBasedQuery('datesAfter')
const actual = isPropertyBasedQuery({ type: 'datesAfter' })
assert.isTrue(actual)
})
it('should return false if it is a anything', () => {
Expand Down
Loading