furystack-core
Advanced tools
Comparing version
{ | ||
"name": "furystack-core", | ||
"version": "1.0.0-alpha-1", | ||
"version": "1.0.0-alpha-10", | ||
"description": "FuryStack framework, Core package", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"scripts": { | ||
@@ -28,2 +29,6 @@ "build": "tsc", | ||
], | ||
"files":[ | ||
"dist", | ||
"src" | ||
], | ||
"author": "Gallay Lajos", | ||
@@ -36,12 +41,12 @@ "license": "MIT", | ||
"devDependencies": { | ||
"@types/chai": "^3.5.1", | ||
"@types/chai": "^3.5.2", | ||
"chai": "^3.5.0", | ||
"codecov": "^1.0.1", | ||
"istanbul": "^0.4.5", | ||
"mocha": "^3.2.0", | ||
"mocha-typescript": "^1.0.23", | ||
"nyc": "^10.2.0", | ||
"tslint": "^5.1.0", | ||
"typescript": "^2.3.0" | ||
"mocha": "^3.3.0", | ||
"mocha-typescript": "^1.1.2", | ||
"nyc": "10.2.0", | ||
"tslint": "^5.2.0", | ||
"typescript": "^2.3.2" | ||
} | ||
} |
@@ -10,1 +10,66 @@ # furystack-core | ||
FuryStack framework, core package. | ||
Model declaration with _@PrimaryKey_, _@Property_ and _@ForeignKey_ decorators: | ||
``` ts | ||
class RefExample { | ||
@PrimaryKey | ||
public Id; | ||
@Property | ||
public Value: string; | ||
} | ||
class MyModel { | ||
@PrimaryKey | ||
public Id: number; | ||
@Property | ||
public MyPropertyA: string; | ||
@Property | ||
public MyPropertyB: string; | ||
@ForeignKey(RefExample, 'RefExample') | ||
public RefExampleId: number; | ||
public RefExample: RefExample; | ||
} | ||
``` | ||
Accessing model metadata via Global ModelDescriptorStore, usage: | ||
``` ts | ||
const descriptor = ModelDescriptorStore.GetDescriptor(MyModel); | ||
/* | ||
descriptor.Object = {constructor: class MyModel { … }} | ||
descriptor.Entries = [ | ||
PrimaryKeyDescriptorEntry {PrimaryKey: "Id"} | ||
ODataPropertyDesrciptorEntry {PropertyName: "MyPropertyA", EdmType: 0} | ||
ODataPropertyDesrciptorEntry {PropertyName: "MyPropertyB", EdmType: 0} | ||
ForeignKeyDescriptorEntry {ForeignKeyField: "RefExample", ReferenceName: "RefExample"} | ||
] | ||
descriptor..PrimaryKey = PrimaryKeyDescriptorEntry {PrimaryKey: "Id"} | ||
descriptor.Properties = [ | ||
ODataPropertyDesrciptorEntry {PropertyName: "MyPropertyA", EdmType: 0} | ||
ODataPropertyDesrciptorEntry {PropertyName: "MyPropertyB", EdmType: 0} | ||
] | ||
descriptor.ForeignKeys = [ | ||
ForeignKeyDescriptorEntry {ForeignKeyField: "RefExample", ReferenceName: "RefExample"} | ||
] | ||
*/ | ||
``` | ||
Setup and endpoint with the EndpointBuilder class: | ||
``` ts | ||
const builder = new EndpointBuilder('api'); | ||
builder.EntityType(MyModel); | ||
builder.EntityType(RefExample); | ||
builder.EntitySet(MyModel, 'mymodels'); | ||
``` |
export class CollectionResult<T> { | ||
public '@odata.context': string; | ||
public '@odata.nextlink': string; | ||
public value: T[]; | ||
public '@odata.context'?: string; | ||
public '@odata.nextlink'?: string; | ||
public '@odata.count'?: number; | ||
constructor(public value: T[], count?: number, context?: string, nextlink?: string) { | ||
this['@odata.count'] = count; | ||
} | ||
} |
export * from './CollectionResult'; | ||
export * from './SingleResult'; | ||
export * from './RequestMethod'; |
export * from './filter'; | ||
export * from './http-models'; | ||
export * from './query'; |
import { ModelDescriptorStore } from '../model/ModelDescriptorStore'; | ||
import { ActionOwnerAbstract } from './'; | ||
import { EndpointEntitySet } from './EndpointEntitySet'; | ||
@@ -8,7 +9,16 @@ import { EndpointEntityType } from './EndpointEntityType'; | ||
*/ | ||
export class EndpointBuilder { | ||
export class EndpointBuilder extends ActionOwnerAbstract { | ||
private EntityTypes: EndpointEntityType[] = []; | ||
public GetAllEntityTypes() { | ||
return this.EntityTypes.slice(); | ||
} | ||
private EntitySets: EndpointEntitySet[] = []; | ||
public GetAllEntitySets() { | ||
return this.EntitySets.slice(); | ||
} | ||
/** | ||
@@ -18,3 +28,5 @@ * The Builder class provides you an API to create OData ShcemaTypes | ||
*/ | ||
constructor(public NameSpaceRoot: string) { } | ||
constructor(public NameSpaceRoot: string) { | ||
super(); | ||
} | ||
@@ -21,0 +33,0 @@ /** |
@@ -0,9 +1,10 @@ | ||
import { ActionOwnerAbstract } from './'; | ||
import {EndpointEntityType} from './EndpointEntityType'; | ||
export class EndpointEntitySet { | ||
export class EndpointEntitySet extends ActionOwnerAbstract { | ||
constructor(public readonly Name: string, | ||
public readonly EndpointEntityType: EndpointEntityType) { | ||
super(); | ||
} | ||
} |
import { ModelDescriptor } from '../model/ModelDescriptor'; | ||
import { ActionOwnerAbstract } from './'; | ||
export class EndpointEntityType { | ||
export class EndpointEntityType extends ActionOwnerAbstract { | ||
constructor(public readonly Name: string, public readonly ModelDescriptor: ModelDescriptor) { | ||
super(); | ||
} | ||
} |
@@ -0,3 +1,5 @@ | ||
export * from './ActionOwnerAbstract'; | ||
export * from './EdmTypes'; | ||
export * from './EndpointBuilder'; | ||
export * from './EndpointEntitySet'; | ||
export * from './EndpointEntityType'; |
@@ -10,1 +10,2 @@ export * from './PrimaryKey'; | ||
export * from './ModelDescriptorStore'; | ||
export * from './CustomAction'; |
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
113802
268.58%122
221.05%1639
135.15%75
650%1
Infinity%