Skip to content

Commit 5e5e65a

Browse files
author
Vlad Balin
committed
IO Mixin TS type fixes
1 parent 61920af commit 5e5e65a

File tree

12 files changed

+18
-38
lines changed

12 files changed

+18
-38
lines changed

dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/record/io-mixin.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ export interface IORecord extends IONode {
1010
set(json: object, options: object): any;
1111
}
1212
export declare const IORecordMixin: {
13-
getEndpoint(this: IORecord): IOEndpoint;
1413
save(this: IORecord, options?: IOOptions): IOPromise<any>;
1514
fetch(options?: IOOptions): IOPromise<any>;
1615
destroy(options?: IOOptions): IOPromise<any>;

lib/record/io-mixin.js

Lines changed: 1 addition & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/record/io-mixin.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/record/record.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export declare class Record extends Transactional implements IORecord, Attribute
2424
_endpoints: {
2525
[name: string]: IOEndpoint;
2626
};
27-
save: (options?: object) => IOPromise<any>;
28-
destroy: (options?: object) => IOPromise<any>;
27+
save(options?: object): IOPromise<any>;
28+
destroy(options?: object): IOPromise<any>;
2929
_previousAttributes: {};
3030
previousAttributes(): AttributesValues;
3131
attributes: AttributesValues;

lib/record/record.js

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/record/record.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/record/io-mixin.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@ export interface IORecord extends IONode {
1212
}
1313

1414
export const IORecordMixin = {
15-
getEndpoint( this : IORecord ) : IOEndpoint {
16-
return getOwnerEndpoint( this ) || this._endpoint;
17-
},
18-
1915
save( this : IORecord, options : IOOptions = {} ){
2016
const endpoint = this.getEndpoint(),
2117
json = this.toJSON();

src/record/record.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ export interface RecordDefinition extends TransactionalDefinition {
5050
// Default id attribute name
5151
idAttribute : 'id'
5252
})
53-
@mixins( IORecordMixin )
5453
@definitions({
5554
defaults : mixinRules.merge,
5655
attributes : mixinRules.merge,
@@ -79,10 +78,10 @@ export class Record extends Transactional implements IORecord, AttributesContain
7978
_endpoints : { [ name : string ] : IOEndpoint }
8079

8180
// Save record
82-
save : ( options? : object ) => IOPromise<any>
81+
save( options? : object ) : IOPromise<any> { throw new Error( 'Implemented by mixin' ); }
8382

8483
// Destroy record
85-
destroy : ( options? : object ) => IOPromise<any>
84+
destroy( options? : object ) : IOPromise<any> { throw new Error( 'Implemented by mixin' ); }
8685

8786
/***********************************
8887
* Core Members
@@ -459,7 +458,7 @@ export class Record extends Transactional implements IORecord, AttributesContain
459458
_onChildrenChange : ( child : Transactional, options : TransactionOptions ) => void
460459
};
461460

462-
assign( Record.prototype, UpdateRecordMixin );
461+
assign( Record.prototype, UpdateRecordMixin, IORecordMixin );
463462

464463
/***********************************************
465464
* Helper functions

tests/typescript/dist/index.js

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -909,16 +909,6 @@ function resolveReference(root, reference, action) {
909909
return action(self, path[skip]);
910910
}
911911

912-
function getOwnerEndpoint$1(self) {
913-
var collection = self.collection;
914-
if (collection) {
915-
return getOwnerEndpoint$1(collection);
916-
}
917-
if (self._owner) {
918-
var _endpoints = self._owner._endpoints;
919-
return _endpoints && _endpoints[self._ownerKey];
920-
}
921-
}
922912
function createIOPromise(initialize) {
923913
var resolve, reject, onAbort;
924914
function abort(fn) {
@@ -2082,9 +2072,6 @@ function createWatcherFromRef(ref, key) {
20822072
}
20832073

20842074
var IORecordMixin = {
2085-
getEndpoint: function () {
2086-
return getOwnerEndpoint$1(this) || this._endpoint;
2087-
},
20882075
save: function (options) {
20892076
var _this = this;
20902077
if (options === void 0) { options = {}; }
@@ -2138,6 +2125,8 @@ var Record = (function (_super) {
21382125
Record.defaults = function (attrs) {
21392126
return this.extend({ attributes: attrs });
21402127
};
2128+
Record.prototype.save = function (options) { throw new Error('Implemented by mixin'); };
2129+
Record.prototype.destroy = function (options) { throw new Error('Implemented by mixin'); };
21412130
Record.prototype.previousAttributes = function () { return new this.AttributesCopy(this._previousAttributes); };
21422131
Object.defineProperty(Record.prototype, "__inner_state__", {
21432132
get: function () { return this.attributes; },
@@ -2371,7 +2360,6 @@ var Record = (function (_super) {
23712360
_changeEventName: 'change',
23722361
idAttribute: 'id'
23732362
}),
2374-
mixins(IORecordMixin),
23752363
definitions({
23762364
defaults: mixinRules.merge,
23772365
attributes: mixinRules.merge,
@@ -2384,7 +2372,7 @@ var Record = (function (_super) {
23842372
var Record_1;
23852373
}(Transactional));
23862374

2387-
assign$4(Record.prototype, UpdateRecordMixin);
2375+
assign$4(Record.prototype, UpdateRecordMixin, IORecordMixin);
23882376
var BaseRecordAttributes = (function () {
23892377
function BaseRecordAttributes(record, x, options) {
23902378
this.id = x.id;

tests/typescript/dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)