|
@@ -44,6 +44,12 @@ interface ResourceFactory { |
|
|
allowPatch(): this; |
|
|
allowPatch(): this; |
|
|
allowEmplace(): this; |
|
|
allowEmplace(): this; |
|
|
allowDelete(): this; |
|
|
allowDelete(): this; |
|
|
|
|
|
revokeFetchCollection(): this; |
|
|
|
|
|
revokeFetchItem(): this; |
|
|
|
|
|
revokeCreate(): this; |
|
|
|
|
|
revokePatch(): this; |
|
|
|
|
|
revokeEmplace(): this; |
|
|
|
|
|
revokeDelete(): this; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
export interface ResourceData<T extends BaseSchema> { |
|
|
export interface ResourceData<T extends BaseSchema> { |
|
@@ -155,6 +161,30 @@ export const resource = <T extends BaseSchema>(schema: T): Resource<T> => { |
|
|
canDelete = true; |
|
|
canDelete = true; |
|
|
return this; |
|
|
return this; |
|
|
}, |
|
|
}, |
|
|
|
|
|
revokeFetchCollection() { |
|
|
|
|
|
canFetchCollection = false; |
|
|
|
|
|
return this; |
|
|
|
|
|
}, |
|
|
|
|
|
revokeFetchItem() { |
|
|
|
|
|
canFetchItem = false; |
|
|
|
|
|
return this; |
|
|
|
|
|
}, |
|
|
|
|
|
revokeCreate() { |
|
|
|
|
|
canCreate = false; |
|
|
|
|
|
return this; |
|
|
|
|
|
}, |
|
|
|
|
|
revokePatch() { |
|
|
|
|
|
canPatch = false; |
|
|
|
|
|
return this; |
|
|
|
|
|
}, |
|
|
|
|
|
revokeEmplace() { |
|
|
|
|
|
canEmplace = false; |
|
|
|
|
|
return this; |
|
|
|
|
|
}, |
|
|
|
|
|
revokeDelete() { |
|
|
|
|
|
canDelete = false; |
|
|
|
|
|
return this; |
|
|
|
|
|
}, |
|
|
get canCreate() { |
|
|
get canCreate() { |
|
|
return canCreate; |
|
|
return canCreate; |
|
|
}, |
|
|
}, |
|
|