furystack-core
Advanced tools
Comparing version
@@ -80,3 +80,3 @@ import { ODataFilterBuilder } from './ODataFilterBuilder'; | ||
*/ | ||
static FromString<T>(): ODataFilterExpression<T>; | ||
static FromString<T>(filterExpression: string): ODataFilterExpression<T>; | ||
} |
@@ -38,3 +38,3 @@ "use strict"; | ||
NotEquals(field, value) { | ||
this.value = `${field} ne ${this.getFilterValueSegment(value)}'`; | ||
this.value = `${field} ne ${this.getFilterValueSegment(value)}`; | ||
return this.Finialize(); | ||
@@ -99,3 +99,3 @@ } | ||
const builder = ODataFilterBuilder_1.ODataFilterBuilder.Create(); | ||
build(ODataFilterBuilder_1.ODataFilterBuilder.Create()); | ||
build(builder); | ||
this.value = `not (${builder.toString()})`; | ||
@@ -111,4 +111,5 @@ return this.Finialize(); | ||
const builder = ODataFilterBuilder_1.ODataFilterBuilder.Create(); | ||
build(ODataFilterBuilder_1.ODataFilterBuilder.Create()); | ||
this.value = `(${builder.toString()})`; | ||
build(builder); | ||
const filterString = builder.filterBuilderRef.filterSegments.map((a) => a.toString()).join(' '); | ||
this.value = `(${filterString})`; | ||
return this.Finialize(); | ||
@@ -128,3 +129,3 @@ } | ||
*/ | ||
static FromString() { | ||
static FromString(filterExpression) { | ||
throw new Error('Implement me pls :('); | ||
@@ -131,0 +132,0 @@ } |
@@ -7,2 +7,4 @@ "use strict"; | ||
this['@odata.count'] = count; | ||
this['@odata.context'] = context; | ||
this['@odata.nextlink'] = nextlink; | ||
} | ||
@@ -9,0 +11,0 @@ } |
{ | ||
"name": "furystack-core", | ||
"version": "1.0.0-alpha-10", | ||
"version": "1.0.0-alpha-11", | ||
"description": "FuryStack framework, Core package", | ||
@@ -42,3 +42,3 @@ "main": "dist/index.js", | ||
"chai": "^3.5.0", | ||
"codecov": "^1.0.1", | ||
"codecov": "^2.1.0", | ||
"istanbul": "^0.4.5", | ||
@@ -45,0 +45,0 @@ "mocha": "^3.3.0", |
# furystack-core | ||
[](https://greenkeeper.io/) | ||
[](https://travis-ci.org/FuryTechs/furystack-core) | ||
@@ -5,0 +7,0 @@ [](https://codecov.io/gh/FuryTechs/furystack-core) |
@@ -43,3 +43,3 @@ import { ODataFilterBuilder } from './ODataFilterBuilder'; | ||
public NotEquals<K extends keyof T>(field: K, value: any) { | ||
this.value = `${field} ne ${this.getFilterValueSegment(value)}'`; | ||
this.value = `${field} ne ${this.getFilterValueSegment(value)}`; | ||
return this.Finialize(); | ||
@@ -110,3 +110,3 @@ } | ||
const builder = ODataFilterBuilder.Create<T>(); | ||
build(ODataFilterBuilder.Create<T>()); | ||
build(builder); | ||
this.value = `not (${builder.toString()})`; | ||
@@ -123,4 +123,5 @@ return this.Finialize(); | ||
const builder = ODataFilterBuilder.Create<T>(); | ||
build(ODataFilterBuilder.Create<T>()); | ||
this.value = `(${builder.toString()})`; | ||
build(builder); | ||
const filterString = builder.filterBuilderRef.filterSegments.map((a) => a.toString()).join(' '); | ||
this.value = `(${filterString})`; | ||
return this.Finialize(); | ||
@@ -142,3 +143,3 @@ } | ||
*/ | ||
public static FromString<T>(): ODataFilterExpression<T> { | ||
public static FromString<T>(filterExpression: string): ODataFilterExpression<T> { | ||
throw new Error('Implement me pls :('); | ||
@@ -145,0 +146,0 @@ } |
@@ -7,3 +7,5 @@ export class CollectionResult<T> { | ||
this['@odata.count'] = count; | ||
this['@odata.context'] = context; | ||
this['@odata.nextlink'] = nextlink; | ||
} | ||
} |
@@ -56,18 +56,27 @@ import { ModelDescriptorStore } from '../model/ModelDescriptorStore'; | ||
*/ | ||
public EntitySet<T>(entityTypeClass: { new (): T }, entitySetName: string): EndpointEntitySet { | ||
public EntitySet<T>(entityTypeClass: { new (): T }, entitySetName?: string): EndpointEntitySet { | ||
const entityTypeName = ModelDescriptorStore.GetName(entityTypeClass); | ||
if (!entitySetName) { | ||
const entitySetsWithType = this.EntitySets.filter((a) => | ||
a.EndpointEntityType.Name === entityTypeName); | ||
if (entitySetsWithType.length === 1) { | ||
return entitySetsWithType[0]; | ||
} else { | ||
throw Error(`Cannot get EntitySet for type ${entityTypeName}. There are '${entitySetsWithType.length}' sets defined with the same on this endpoint`); | ||
} | ||
} | ||
const existing = this.EntitySets.find((s) => s.Name === entitySetName); | ||
const entityTypeName = ModelDescriptorStore.GetName(entityTypeClass); | ||
if (existing) { | ||
if (existing.EndpointEntityType.Name !== entityTypeName) { | ||
throw new Error(`Mismatch on registering entitySet '${entitySetName}', with type '${entityTypeName}. | ||
Already registered to type '${existing.EndpointEntityType.Name}'`); | ||
throw new Error(`Mismatch on registering entitySet '${entitySetName}', with type '${entityTypeName}. Already registered to type '${existing.EndpointEntityType.Name}'`); | ||
} | ||
return existing; | ||
} | ||
const entityType = this.EntityTypes.find((e) => e.Name === entityTypeName); | ||
let entityType = this.EntityTypes.find((e) => e.Name === entityTypeName); | ||
if (!entityType) { | ||
throw new Error(`Entity type not yet added for type '${entityTypeName}', please add it first.`); | ||
entityType = this.EntityType(entityTypeClass); | ||
} | ||
@@ -74,0 +83,0 @@ const newEntitySet = new EndpointEntitySet(entitySetName, entityType); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
136776
20.19%128
4.92%1891
15.38%77
2.67%0
-100%