npm.io
2.1.23 • Published 6 years ago

@furystack/odata

Licence
GPL-2.0
Version
2.1.23
Deps
7
Size
299 kB
Vulns
0
Weekly
0

@furystack/odata

odata v4 implementation for FuryStack. This package is in an early and experimental state. More info coming soon...

Usage example

You can use OData in a similar way:

class MyEntityType {
  public id!: number
  public value!: string
}

const myInjector = new Injector()

myInjector
  .useLogging()
  .useHttpApi()
  .useOdata('odata.svc', model =>
    model.addNameSpace('default', namespace =>
      namespace
        .setupEntities(e =>
          e.addEntityType({
            model: MyEntityType,
            primaryKey: 'id',
            properties: [{ property: 'id', type: EdmType.Int16 }, { property: 'value', type: EdmType.String }],
          }),
        )
        .setupCollections(collections => collections.addCollection({ model: MyEntityType, name: 'MyEntities' })),
    ),
  )
  .listenHttp()