Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
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
14 changes: 13 additions & 1 deletion 14 packages/adapter-commons/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ export class AdapterService<T = any> implements ServiceMethods<T> {
return callMethod(this, '_get', id, params);
}

create (data: Partial<T>, params?: Params): Promise<T>;

create (data: Partial<T>[], params?: Params): Promise<T[]>;

create (data: Partial<T> | Partial<T>[], params?: Params): Promise<T | T[]> {
if (Array.isArray(data) && !this.allowsMulti('create')) {
return Promise.reject(new MethodNotAllowed(`Can not create multiple entries`));
Expand All @@ -112,6 +116,10 @@ export class AdapterService<T = any> implements ServiceMethods<T> {
return callMethod(this, '_update', id, data, params);
}

patch (id: Id, data: Partial<T>, params?: Params): Promise<T>;

patch (id: null, data: Partial<T>, params?: Params): Promise<T[]>;

patch (id: NullableId, data: Partial<T>, params?: Params): Promise<T | T[]> {
if (id === null && !this.allowsMulti('patch')) {
return Promise.reject(new MethodNotAllowed(`Can not patch multiple entries`));
Expand All @@ -120,11 +128,15 @@ export class AdapterService<T = any> implements ServiceMethods<T> {
return callMethod(this, '_patch', id, data, params);
}

remove (id: Id, params?: Params): Promise<T>;

remove (id: null, params?: Params): Promise<T[]>;

remove (id: NullableId, params?: Params): Promise<T | T[]> {
if (id === null && !this.allowsMulti('remove')) {
return Promise.reject(new MethodNotAllowed(`Can not remove multiple entries`));
}

return callMethod(this, '_remove', id, params);
}
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.