Skip to content
Open
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
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
8 changes: 4 additions & 4 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ construct from object/array | - | `RecordOrCollectionClass.from( json, options?

Starting from version 3.X, Type-R does not modify built-in global JS objects. New `type(T)` attribute definition notation is introduced to replace `T.has.`

There's `type-r/globals` package for compatibility with version 2.x which must be imported once with `import 'type-r/globals'`.
There's `@type-r/globals` package for compatibility with version 2.x which must be imported once with `import '@type-r/globals'`.
If this package is not used, the code must be refactored according to the rules below.

| 2.x | 3.x
-|-|-
UNIX Timestamp | `Date.timestamp` | `import { Timestamp } from 'type-r/ext-types'`
Microsoft date | `Date.microsoft` | `import { MicrosoftDate } from 'type-r/ext-types'`
Integer | `Integer` and `Number.integer` | `import { Integer } from 'type-r/ext-types'`
UNIX Timestamp | `Date.timestamp` | `import { Timestamp } from '@type-r/ext-types'`
Microsoft date | `Date.microsoft` | `import { MicrosoftDate } from '@type-r/ext-types'`
Integer | `Integer` and `Number.integer` | `import { Integer } from '@type-r/ext-types'`
Create metatype from constructor | `Ctor.has` | `type(Ctor)`
Typed attribute with default value | `Ctor.value(default)` | `type(Ctor).value(default)`
Attribute "Required" check | `Ctor.isRequired` | `type(Ctor).required`
Expand Down
6 changes: 3 additions & 3 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
"name": "@type-r/docs",
"version": "4.0.0",
"scripts": {
"build" : "node build.js"
"build": "node build.js"
},
"dependencies": {
"handlebars": "*",
"highlight.js": "*",
"jest": "*",
"marked": "^0.3.0"
"marked": "^0.3.0"
}
}
}
14 changes: 7 additions & 7 deletions endpoints/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ All I/O methods append an optional `options.params` object to the URL parameters
Supports URI relative to owner (`./relative/url` resolves as `/owner/:id/relative/url/:id` ).

```javascript
import { restfulIO } from 'type-r/endpoints/restful'
import { restfulIO } from '@type-r/endpoints'

@define class Role extends Model {
static endpoint = restfulIO( '/api/roles' );
Expand All @@ -64,7 +64,7 @@ import { restfulIO } from 'type-r/endpoints/restful'
Endpoint for mock testing. Takes optional array with mock data, and optional `delay` parameter which is the simulated I/O delay in milliseconds.

```javascript
import { memoryIO } from 'type-r/endpoints/memory'
import { memoryIO } from '@type-r/endpoints'

@define class User extends Model {
static endpoint = memoryIO();
Expand All @@ -77,7 +77,7 @@ import { memoryIO } from 'type-r/endpoints/memory'
Endpoint for localStorage. Takes `key` parameter which must be unique for the persistent model's collection.

```javascript
import { localStorageIO } from 'type-r/endpoints/localStorage'
import { localStorageIO } from '@type-r/endpoints'

@define class User extends Model {
static endpoint = localStorageIO( '/users' );
Expand All @@ -92,7 +92,7 @@ Endpoint for I/O composition. Redirects model's `fetch()` request to its attribu
It's common pattern to use attributesIO endpoint in conjunction with Store to fetch all the data required by SPA page.

```javascript
import { localStorageIO } from 'type-r/endpoints/attributes'
import { attributesIO } from '@type-r/endpoints'

@define class PageStore extends Store {
static endpoint = attributesIO();
Expand All @@ -116,7 +116,7 @@ an existing Model subclass as a transport. This endpoint can be connected to the
An advantage of this approach is that JSON schema will be transparently validated on the server side by the Type-R.

```javascript
import { proxyIO } from 'type-r/endpoint/proxy'
import { proxyIO } from '@type-r/endpoints'

...

Expand Down Expand Up @@ -178,12 +178,12 @@ Service function to create an abortable version of ES6 promise (with `promise.ab
`init` function takes the third `onAbort` argument to register an optional abort handler. If no handler is registered, the default implementation of `promise.abort()` will just reject the promise.

```javascript
import { createIOPromise } from 'type-r'
import { createIOPromise } from '@type-r/models'

const abortablePromise = createIOPromise( ( resolve, reject, onAbort ) =>{
...
onAbort( () => {
reject( 'I/O Aborted' );
});
});
```
```
2 changes: 1 addition & 1 deletion endpoints/dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion endpoints/dist/index.js.map

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions endpoints/lib/fetchModel.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion endpoints/lib/fetchModel.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion endpoints/lib/localStorage.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export declare class LocalStorageEndpoint implements IOEndpoint {
update(id: any, json: any, options: IOOptions): IOPromise<any>;
read(id: any, options: IOOptions): IOPromise<any>;
destroy(id: any, options: IOOptions): IOPromise<any>;
index: (string | number)[];
get index(): (string | number)[];
set index(x: (string | number)[]);
list(options?: IOOptions): IOPromise<any>;
subscribe(events: any): any;
unsubscribe(events: any): any;
Expand Down
2 changes: 1 addition & 1 deletion endpoints/lib/localStorage.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion endpoints/lib/localStorage.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion endpoints/lib/memory.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { IOEndpoint, IOPromise } from '@type-r/models';
declare type Index = (number | string)[];
type Index = (number | string)[];
export declare function memoryIO(init?: any[], delay?: number): MemoryEndpoint;
export declare class MemoryEndpoint implements IOEndpoint {
delay: number;
Expand Down
Loading