Abort ongoing backend request on a record list block when page is switched

This commit is contained in:
Kelani Tolulope
2023-08-21 13:01:22 +01:00
parent 95cf245daa
commit 638ba17c89
22 changed files with 3893 additions and 51 deletions
@@ -40,6 +40,8 @@ export default {
processing: false,
automationScripts: [],
abortRequests: [],
}
},
@@ -49,19 +51,37 @@ export default {
},
},
beforeDestroy () {
this.abortRequests.forEach((cancel) => {
cancel()
})
},
created () {
if (this.$UIHooks.set && !!this.$UIHooks.set.length) {
return
}
this.processing = true
return this.$ComposeAPI.automationList({ eventTypes: ['onManual'], excludeInvalid: true })
.then(({ set = [] }) => {
this.automationScripts = set
})
.finally(() => {
this.processing = false
})
this.fetchAutomationLists()
},
methods: {
fetchAutomationLists () {
this.processing = true
const { response, cancel } = this.$ComposeAPI
.automationListCancellable({ eventTypes: ['onManual'], excludeInvalid: true })
this.abortRequests.push(cancel)
return response()
.then(({ set = [] }) => {
this.automationScripts = set
})
.finally(() => {
this.processing = false
})
},
},
beforeDestroy () {
@@ -102,6 +102,7 @@
<script>
import moment from 'moment'
import { mapGetters, mapActions } from 'vuex'
import axios from 'axios'
import base from './base'
import FullCalendar from '@fullcalendar/vue'
import dayGridPlugin from '@fullcalendar/daygrid'
@@ -158,6 +159,8 @@ export default {
},
refreshing: false,
cancelTokenSource: axios.CancelToken.source(),
}
},
@@ -232,6 +235,7 @@ export default {
beforeDestroy () {
this.setDefaultValues()
this.abortRequests()
},
methods: {
@@ -310,7 +314,7 @@ export default {
})
}
return compose.PageBlockCalendar.RecordFeed(this.$ComposeAPI, module, this.namespace, ff, this.loaded)
return compose.PageBlockCalendar.RecordFeed(this.$ComposeAPI, module, this.namespace, ff, this.loaded, { cancelToken: this.cancelTokenSource.token })
.then(events => {
events = this.setEventColors(events, ff)
this.events.push(...events)
@@ -391,6 +395,10 @@ export default {
this.loaded = {}
this.refreshing = false
},
abortRequests () {
this.cancelTokenSource.cancel(`cancel-record-list-request-${this.block.blockID}`)
},
},
}
</script>
@@ -123,6 +123,8 @@ export default {
title: '',
content: '',
},
abortRequests: [],
}
},
@@ -217,6 +219,10 @@ export default {
beforeDestroy () {
this.setDefaultValues()
this.abortRequests.forEach((cancel) => {
cancel()
})
},
methods: {
@@ -338,8 +344,11 @@ export default {
sort,
}
return this.$ComposeAPI
.recordList(params)
const { response, cancel } = this.$ComposeAPI
.recordListCancellable(params)
this.abortRequests.push(cancel)
return response()
.then(({ set }) => set.map(r => Object.freeze(new compose.Record(module, r))))
},
@@ -65,6 +65,7 @@
</template>
<script>
import axios from 'axios'
import { divIcon, latLng, latLngBounds } from 'leaflet'
import { LPolygon, LControl } from 'vue2-leaflet'
import { compose, NoID } from '@cortezaproject/corteza-js'
@@ -96,6 +97,8 @@ export default {
geometries: [],
colors: [],
markers: [],
cancelTokenSource: axios.CancelToken.source(),
}
},
@@ -155,6 +158,7 @@ export default {
beforeDestroy () {
this.setDefaultValues()
this.abortRequests()
},
methods: {
@@ -198,7 +202,7 @@ export default {
})
}
return compose.PageBlockGeometry.RecordFeed(this.$ComposeAPI, module, this.namespace, feed)
return compose.PageBlockGeometry.RecordFeed(this.$ComposeAPI, module, this.namespace, feed, { cancelToken: this.cancelTokenSource.token })
.then(records => {
const mapModuleField = module.fields.find(f => f.name === feed.geometryField)
@@ -312,6 +316,10 @@ export default {
this.colors = []
this.markers = []
},
abortRequests () {
this.cancelTokenSource.cancel(`abort-request-${this.block.blockID}`)
},
},
}
</script>
@@ -66,6 +66,8 @@ export default {
return {
processing: false,
reports: [],
abortRequests: [],
}
},
@@ -94,6 +96,12 @@ export default {
beforeDestroy () {
this.setDefaultValues()
this.destroyEvents()
this.$root.$off('metric.update', this.refresh)
this.$root.$off(`refetch-non-record-blocks:${this.page.pageID}`)
this.abortRequests.forEach((cancel) => {
cancel()
})
},
created () {
@@ -135,7 +143,14 @@ export default {
try {
const rtr = []
const namespaceID = this.namespace.namespaceID
const reporter = r => this.$ComposeAPI.recordReport({ ...r, namespaceID })
const reporter = r => {
const { response, cancel } = this.$ComposeAPI
.recordReportCancellable({ ...r, namespaceID })
this.abortRequests.push(cancel)
return response()
}
for (const m of this.options.metrics) {
if (m.moduleID) {
@@ -101,6 +101,7 @@
<script>
import { compose, NoID } from '@cortezaproject/corteza-js'
import { mapActions } from 'vuex'
import axios from 'axios'
import base from './base'
import FieldViewer from 'corteza-webapp-compose/src/components/ModuleFields/Viewer'
import BulkEditModal from 'corteza-webapp-compose/src/components/Public/Record/BulkEdit'
@@ -137,6 +138,8 @@ export default {
recordIDs: [],
initialRecord: {},
},
abortRequests: [],
}
},
@@ -214,6 +217,9 @@ export default {
beforeDestroy () {
this.setDefaultValues()
this.abortRequests.forEach((cancel) => {
cancel()
})
},
methods: {
@@ -256,13 +262,20 @@ export default {
return
}
this.$ComposeAPI.recordRead({ namespaceID, moduleID, recordID })
const { response, cancel } = this.$ComposeAPI
.recordReadCancellable({ namespaceID, moduleID, recordID })
this.abortRequests.push(cancel)
response()
.then(record => {
this.referenceRecord = new compose.Record(this.fieldModule, { ...record })
})
.catch((e) => {
this.referenceRecord = new compose.Record(this.fieldModule, {})
this.toastErrorHandler(this.$t('notification:record.loadFailed'))(e)
.catch(e => {
if (!axios.isCancel(e)) {
this.referenceRecord = new compose.Record(this.fieldModule, {})
this.toastErrorHandler(this.$t('notification:record.loadFailed'))(e)
}
})
},
@@ -722,6 +722,7 @@
</wrap>
</template>
<script>
import axios from 'axios'
import { debounce, isEqual } from 'lodash'
import { mapGetters, mapActions } from 'vuex'
import base from './base'
@@ -828,6 +829,8 @@ export default {
currentCustomPresetFilter: undefined,
showCustomPresetFilterModal: false,
selectedAllRecords: false,
abortRequests: [],
}
},
@@ -1093,6 +1096,10 @@ export default {
this.$root.$off(`page-block:validate:${this.uniqueID}`)
this.$root.$off(`drill-down-recordList:${this.uniqueID}`)
this.$root.$off(`refetch-non-record-blocks:${this.page.pageID}`)
this.abortRequests.forEach((cancel) => {
cancel()
})
},
onFilter (filter = []) {
@@ -1495,8 +1502,12 @@ export default {
const query = recordID ? `recordID = ${recordID}` : this.bulkQuery
const { moduleID, namespaceID } = this.filter
this.$ComposeAPI
.recordBulkUndelete({ moduleID, namespaceID, query })
const { response, cancel } = this.$ComposeAPI
.recordBulkUndeleteCancellable({ moduleID, namespaceID, query })
this.abortRequests.push(cancel)
response()
.then(() => {
this.refresh(true)
this.toastSuccess(this.$t('notification:record.restoreBulkSuccess'))
@@ -1525,8 +1536,12 @@ export default {
// Pick module and namespace ID from the filter
const { moduleID, namespaceID } = this.filter
this.$ComposeAPI
.recordBulkDelete({ moduleID, namespaceID, query })
const { response, cancel } = this.$ComposeAPI
.recordBulkDeleteCancellable({ moduleID, namespaceID, query })
this.abortRequests.push(cancel)
response()
.then(() => this.refresh(true))
.then(() => {
this.toastSuccess(this.$t('notification:record.deleteBulkSuccess'))
@@ -1585,7 +1600,10 @@ export default {
// Filter's out deleted records when filter.deleted is 2, and undeleted records when filter.deleted is 0
this.showingDeletedRecords ? this.filter.deleted = 2 : this.filter.deleted = 0
return this.$ComposeAPI.recordList({ ...this.filter, moduleID, namespaceID, query, ...paginationOptions })
const { response, cancel } = this.$ComposeAPI.recordListCancellable({ ...this.filter, moduleID, namespaceID, query, ...paginationOptions })
this.abortRequests.push(cancel)
return response()
.then(({ set, filter }) => {
const records = set.map(r => new compose.Record(r, this.recordListModule))
@@ -1631,7 +1649,11 @@ export default {
this.items = records.map(r => this.wrapRecord(r))
})
})
.catch(this.toastErrorHandler(this.$t('notification:record.listLoadFailed')))
.catch((e) => {
if (!axios.isCancel(e)) {
this.toastErrorHandler(this.$t('notification:record.listLoadFailed'))(e)
}
})
.finally(() => {
this.processing = false
})
@@ -109,6 +109,7 @@
<script>
import { mapGetters } from 'vuex'
import axios from 'axios'
import base from './base'
import draggable from 'vuedraggable'
import FieldViewer from 'corteza-webapp-compose/src/components/ModuleFields/Viewer'
@@ -144,6 +145,8 @@ export default {
},
records: [],
abortRequests: [],
}
},
@@ -253,6 +256,10 @@ export default {
beforeDestroy () {
this.setDefaultValues()
this.destroyEvents()
this.$root.$off(`refetch-non-record-blocks:${this.page.pageID}`)
this.abortRequests.forEach((cancel) => {
cancel()
})
},
methods: {
@@ -436,7 +443,12 @@ export default {
this.processing = true
return this.$ComposeAPI.recordList({ namespaceID, moduleID, query, sort })
const { response, cancel } = this.$ComposeAPI
.recordListCancellable({ namespaceID, moduleID, query, sort })
this.abortRequests.push(cancel)
return response()
.then(({ set }) => {
const fields = [this.labelField, this.descriptionField].filter(f => !!f)
this.records = set.map(r => Object.freeze(new compose.Record(this.roModule, r)))
@@ -446,7 +458,9 @@ export default {
this.fetchRecords(namespaceID, fields, this.records),
])
}).catch(e => {
console.error(e)
if (!axios.isCancel(e)) {
console.error(e)
}
}).finally(() => {
this.processing = false
})
@@ -24,6 +24,7 @@
</wrap>
</template>
<script>
import axios from 'axios'
import base from '../base'
import { system, reporter, NoID } from '@cortezaproject/corteza-js'
import DisplayElement from './DisplayElements'
@@ -42,6 +43,7 @@ export default {
processing: false,
report: undefined,
displayElement: undefined,
abortRequests: [],
}
},
@@ -59,6 +61,9 @@ export default {
beforeDestroy () {
this.setDefaultValues()
this.abortRequests.forEach((cancel) => {
cancel()
})
},
created () {
@@ -69,12 +74,21 @@ export default {
fetchReport (reportID) {
this.processing = true
return this.$SystemAPI.reportRead({ reportID })
const { response, cancel } = this.$SystemAPI
.reportReadCancellable({ reportID })
this.abortRequests.push(cancel)
return response()
.then(report => {
this.report = new system.Report(report)
return this.getDataframes()
}).catch(this.toastErrorHandler(this.$t('notification:report.fetchFailed')))
}).catch((e) => {
if (!axios.isCancel(e)) {
this.toastErrorHandler(this.$t('notification:report.fetchFailed'))(e)
}
})
.finally(() => {
this.processing = false
})
@@ -529,6 +529,8 @@ export default {
discoverySettings: {
modal: false,
},
abortRequests: [],
}
},
@@ -681,8 +683,12 @@ export default {
}
// Count existing records to see what we can do with this module
this.$ComposeAPI
.recordList({ moduleID, namespaceID, limit: 1 })
const { response, cancel } = this.$ComposeAPI
.recordListCancellable({ moduleID, namespaceID, limit: 1 })
this.abortRequests.push(cancel)
response()
.then(({ set }) => { this.hasRecords = (set.length > 0) })
})
}
@@ -710,6 +716,12 @@ export default {
this.checkUnsavedModule(next)
},
beforeDestroy () {
this.abortRequests.forEach((cancel) => {
cancel()
})
},
methods: {
...mapActions({
findModuleByID: 'module/findByID',
@@ -100,6 +100,7 @@
</template>
<script>
import axios from 'axios'
import { mapGetters } from 'vuex'
import RecordToolbar from 'corteza-webapp-compose/src/components/Common/RecordToolbar'
import record from 'corteza-webapp-compose/src/mixins/record'
@@ -146,6 +147,8 @@ export default {
boundingRect: {},
namespace: this.$attrs.namespace,
},
abortRequests: [],
}
},
@@ -227,6 +230,12 @@ export default {
},
},
beforeDestroy () {
this.abortRequests.forEach((cancel) => {
cancel()
})
},
created () {
this.createBlocks()
this.record = new compose.Record(this.module, { values: this.values })
@@ -252,12 +261,21 @@ export default {
const { namespaceID } = this.$attrs.namespace
const { moduleID, recordID } = this.$attrs
const module = Object.freeze(this.getModuleByID(moduleID).clone())
this.$ComposeAPI
.recordRead({ namespaceID, moduleID, recordID })
const { response, cancel } = this.$ComposeAPI
.recordReadCancellable({ namespaceID, moduleID, recordID })
this.abortRequests.push(cancel)
response()
.then(record => {
this.record = new compose.Record(module, record)
})
.catch(this.toastErrorHandler(this.$t('notification:record.loadFailed')))
.catch((e) => {
if (!axios.isCancel(e)) {
this.toastErrorHandler(this.$t('notification:record.loadFailed'))(e)
}
})
}
},
@@ -903,6 +903,8 @@ export default {
on: this.$t('general:label.yes'),
off: this.$t('general:label.no'),
},
abortRequests: [],
}
},
@@ -1060,6 +1062,12 @@ export default {
this.checkUnsavedComposePage(next)
},
beforeDestroy () {
this.abortRequests.forEach((cancel) => {
cancel()
})
},
created () {
this.fetchRoles()
},
@@ -1091,11 +1099,17 @@ export default {
async fetchRoles () {
this.roles.processing = true
this.$SystemAPI.roleList().then(({ set: roles = [] }) => {
this.roles.options = roles.filter(({ meta }) => !(meta.context && meta.context.resourceTypes))
}).finally(() => {
this.roles.processing = false
})
const { response, cancel } = this.$SystemAPI
.roleListCancellable({})
this.abortRequests.push(cancel)
response()
.then(({ set: roles = [] }) => {
this.roles.options = roles.filter(({ meta }) => !(meta.context && meta.context.resourceTypes))
}).finally(() => {
this.roles.processing = false
})
},
addLayout () {
@@ -93,6 +93,7 @@
</template>
<script>
import axios from 'axios'
import { mapActions } from 'vuex'
import PageTree from 'corteza-webapp-compose/src/components/Admin/Page/Tree'
import { compose } from '@cortezaproject/corteza-js'
@@ -121,6 +122,7 @@ export default {
tree: [],
page: new compose.Page({ visible: true }),
processing: false,
abortRequests: [],
}
},
@@ -130,6 +132,9 @@ export default {
beforeDestroy () {
this.setDefaultValues()
this.abortRequests.forEach((cancel) => {
cancel()
})
},
methods: {
@@ -141,9 +146,20 @@ export default {
loadTree () {
this.processing = true
const { namespaceID } = this.namespace
this.$ComposeAPI.pageTree({ namespaceID }).then((tree) => {
this.tree = tree.map(p => new compose.Page(p))
}).catch(this.toastErrorHandler(this.$t('notification:page.loadFailed')))
const { response, cancel } = this.$ComposeAPI
.pageTreeCancellable({ namespaceID })
this.abortRequests.push(cancel)
response()
.then((tree) => {
this.tree = tree.map(p => new compose.Page(p))
}).catch((e) => {
if (!axios.isCancel(e)) {
this.toastErrorHandler(this.$t('notification:page.loadFailed'))(e)
}
})
.finally(() => {
this.processing = false
})
@@ -157,7 +173,11 @@ export default {
return this.createPageLayout(pageLayout).then(() => {
this.$router.push({ name: 'admin.pages.edit', params: { pageID } })
})
}).catch(this.toastErrorHandler(this.$t('notification:page.saveFailed')))
}).catch((e) => {
if (!axios.isCancel(e)) {
this.toastErrorHandler(this.$t('notification:page.saveFailed'))(e)
}
})
},
handleReorder () {
@@ -116,6 +116,7 @@ import RecordToolbar from 'corteza-webapp-compose/src/components/Common/RecordTo
import record from 'corteza-webapp-compose/src/mixins/record'
import { compose, NoID } from '@cortezaproject/corteza-js'
import { evaluatePrefilter } from 'corteza-webapp-compose/src/lib/record-filter'
import axios from 'axios'
export default {
i18nOptions: {
@@ -192,6 +193,8 @@ export default {
prev: undefined,
next: undefined,
},
abortRequests: [],
}
},
@@ -324,6 +327,11 @@ export default {
beforeDestroy () {
this.setDefaultValues()
this.destroyEvents()
this.$root.$off('refetch-record-blocks')
this.abortRequests.forEach((cancel) => {
cancel()
})
},
// Destroy event before route leave to ensure it doesn't destroy the newly created one
@@ -349,13 +357,20 @@ export default {
const module = Object.freeze(this.getModuleByID(moduleID).clone())
if (recordID && recordID !== NoID) {
return this.$ComposeAPI.recordRead({ namespaceID, moduleID, recordID })
const { response, cancel } = this.$ComposeAPI
.recordReadCancellable({ namespaceID, moduleID, recordID })
this.abortRequests.push(cancel)
return response()
.then(record => {
this.record = new compose.Record(module, record)
})
.catch(e => {
this.toastErrorHandler(this.$t('notification:record.loadFailed'))(e)
this.handleBack()
if (!axios.isCancel(e)) {
this.toastErrorHandler(this.$t('notification:record.loadFailed'))(e)
this.handleBack()
}
})
} else {
this.record = new compose.Record(module, { values: this.values })
+336
View File
@@ -126,6 +126,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
workflowListCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.workflowList(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
workflowListEndpoint (): string {
return '/workflows/'
}
@@ -172,6 +184,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
workflowCreateCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.workflowCreate(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
workflowCreateEndpoint (): string {
return '/workflows/'
}
@@ -226,6 +250,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
workflowUpdateCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.workflowUpdate(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
workflowUpdateEndpoint (a: KV): string {
const {
workflowID,
@@ -252,6 +288,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
workflowReadCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.workflowRead(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
workflowReadEndpoint (a: KV): string {
const {
workflowID,
@@ -278,6 +326,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
workflowDeleteCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.workflowDelete(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
workflowDeleteEndpoint (a: KV): string {
const {
workflowID,
@@ -304,6 +364,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
workflowUndeleteCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.workflowUndelete(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
workflowUndeleteEndpoint (a: KV): string {
const {
workflowID,
@@ -338,6 +410,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
workflowTestCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.workflowTest(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
workflowTestEndpoint (a: KV): string {
const {
workflowID,
@@ -378,6 +462,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
workflowExecCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.workflowExec(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
workflowExecEndpoint (a: KV): string {
const {
workflowID,
@@ -422,6 +518,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
triggerListCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.triggerList(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
triggerListEndpoint (): string {
return '/triggers/'
}
@@ -475,6 +583,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
triggerCreateCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.triggerCreate(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
triggerCreateEndpoint (): string {
return '/triggers/'
}
@@ -536,6 +656,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
triggerUpdateCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.triggerUpdate(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
triggerUpdateEndpoint (a: KV): string {
const {
triggerID,
@@ -562,6 +694,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
triggerReadCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.triggerRead(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
triggerReadEndpoint (a: KV): string {
const {
triggerID,
@@ -588,6 +732,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
triggerDeleteCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.triggerDelete(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
triggerDeleteEndpoint (a: KV): string {
const {
triggerID,
@@ -614,6 +770,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
triggerUndeleteCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.triggerUndelete(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
triggerUndeleteEndpoint (a: KV): string {
const {
triggerID,
@@ -658,6 +826,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
sessionListCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.sessionList(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
sessionListEndpoint (): string {
return '/sessions/'
}
@@ -681,6 +861,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
sessionReadCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.sessionRead(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
sessionReadEndpoint (a: KV): string {
const {
sessionID,
@@ -707,6 +899,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
sessionCancelCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.sessionCancel(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
sessionCancelEndpoint (a: KV): string {
const {
sessionID,
@@ -726,6 +930,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
sessionListPromptsCancellable (extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.sessionListPrompts(options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
sessionListPromptsEndpoint (): string {
return '/sessions/prompts'
}
@@ -756,6 +972,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
sessionResumeStateCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.sessionResumeState(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
sessionResumeStateEndpoint (a: KV): string {
const {
sessionID,
@@ -776,6 +1004,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
functionListCancellable (extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.functionList(options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
functionListEndpoint (): string {
return '/functions/'
}
@@ -792,6 +1032,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
typeListCancellable (extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.typeList(options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
typeListEndpoint (): string {
return '/types/'
}
@@ -808,6 +1060,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
eventTypesListCancellable (extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.eventTypesList(options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
eventTypesListEndpoint (): string {
return '/event-types/'
}
@@ -824,6 +1088,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
permissionsListCancellable (extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.permissionsList(options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
permissionsListEndpoint (): string {
return '/permissions/'
}
@@ -845,6 +1121,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
permissionsEffectiveCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.permissionsEffective(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
permissionsEffectiveEndpoint (): string {
return '/permissions/effective'
}
@@ -870,6 +1158,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
permissionsTraceCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.permissionsTrace(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
permissionsTraceEndpoint (): string {
return '/permissions/trace'
}
@@ -897,6 +1197,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
permissionsReadCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.permissionsRead(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
permissionsReadEndpoint (a: KV): string {
const {
roleID,
@@ -923,6 +1235,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
permissionsDeleteCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.permissionsDelete(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
permissionsDeleteEndpoint (a: KV): string {
const {
roleID,
@@ -955,6 +1279,18 @@ export default class Automation {
return this.api().request(cfg).then(result => stdResolve(result))
}
permissionsUpdateCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.permissionsUpdate(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
permissionsUpdateEndpoint (a: KV): string {
const {
roleID,
File diff suppressed because it is too large Load Diff
+360
View File
@@ -126,6 +126,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
nodeHandshakeInitializeCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.nodeHandshakeInitialize(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
nodeHandshakeInitializeEndpoint (a: KV): string {
const {
nodeID,
@@ -160,6 +172,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
nodeSearchCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.nodeSearch(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
nodeSearchEndpoint (): string {
return '/nodes/'
}
@@ -186,6 +210,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
nodeCreateCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.nodeCreate(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
nodeCreateEndpoint (): string {
return '/nodes/'
}
@@ -209,6 +245,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
nodeReadCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.nodeRead(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
nodeReadEndpoint (a: KV): string {
const {
nodeID,
@@ -235,6 +283,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
nodeGenerateUriCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.nodeGenerateUri(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
nodeGenerateUriEndpoint (a: KV): string {
const {
nodeID,
@@ -268,6 +328,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
nodeUpdateCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.nodeUpdate(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
nodeUpdateEndpoint (a: KV): string {
const {
nodeID,
@@ -294,6 +366,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
nodeDeleteCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.nodeDelete(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
nodeDeleteEndpoint (a: KV): string {
const {
nodeID,
@@ -320,6 +404,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
nodeUndeleteCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.nodeUndelete(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
nodeUndeleteEndpoint (a: KV): string {
const {
nodeID,
@@ -346,6 +442,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
nodePairCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.nodePair(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
nodePairEndpoint (a: KV): string {
const {
nodeID,
@@ -372,6 +480,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
nodeHandshakeConfirmCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.nodeHandshakeConfirm(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
nodeHandshakeConfirmEndpoint (a: KV): string {
const {
nodeID,
@@ -404,6 +524,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
nodeHandshakeCompleteCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.nodeHandshakeComplete(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
nodeHandshakeCompleteEndpoint (a: KV): string {
const {
nodeID,
@@ -434,6 +566,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
manageStructureReadExposedCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.manageStructureReadExposed(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
manageStructureReadExposedEndpoint (a: KV): string {
const {
nodeID,
@@ -484,6 +628,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
manageStructureCreateExposedCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.manageStructureCreateExposed(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
manageStructureCreateExposedEndpoint (a: KV): string {
const {
nodeID,
@@ -537,6 +693,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
manageStructureUpdateExposedCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.manageStructureUpdateExposed(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
manageStructureUpdateExposedEndpoint (a: KV): string {
const {
nodeID,
@@ -568,6 +736,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
manageStructureRemoveExposedCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.manageStructureRemoveExposed(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
manageStructureRemoveExposedEndpoint (a: KV): string {
const {
nodeID,
@@ -599,6 +779,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
manageStructureReadSharedCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.manageStructureReadShared(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
manageStructureReadSharedEndpoint (a: KV): string {
const {
nodeID,
@@ -643,6 +835,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
manageStructureCreateMappingsCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.manageStructureCreateMappings(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
manageStructureCreateMappingsEndpoint (a: KV): string {
const {
nodeID,
@@ -678,6 +882,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
manageStructureReadMappingsCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.manageStructureReadMappings(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
manageStructureReadMappingsEndpoint (a: KV): string {
const {
nodeID,
@@ -713,6 +929,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
manageStructureListAllCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.manageStructureListAll(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
manageStructureListAllEndpoint (a: KV): string {
const {
nodeID,
@@ -751,6 +979,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
syncStructureReadExposedInternalCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.syncStructureReadExposedInternal(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
syncStructureReadExposedInternalEndpoint (a: KV): string {
const {
nodeID,
@@ -789,6 +1029,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
syncStructureReadExposedSocialCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.syncStructureReadExposedSocial(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
syncStructureReadExposedSocialEndpoint (a: KV): string {
const {
nodeID,
@@ -827,6 +1079,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
syncDataReadExposedAllCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.syncDataReadExposedAll(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
syncDataReadExposedAllEndpoint (a: KV): string {
const {
nodeID,
@@ -869,6 +1133,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
syncDataReadExposedInternalCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.syncDataReadExposedInternal(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
syncDataReadExposedInternalEndpoint (a: KV): string {
const {
nodeID,
@@ -912,6 +1188,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
syncDataReadExposedSocialCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.syncDataReadExposedSocial(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
syncDataReadExposedSocialEndpoint (a: KV): string {
const {
nodeID,
@@ -932,6 +1220,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
permissionsListCancellable (extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.permissionsList(options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
permissionsListEndpoint (): string {
return '/permissions/'
}
@@ -953,6 +1253,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
permissionsEffectiveCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.permissionsEffective(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
permissionsEffectiveEndpoint (): string {
return '/permissions/effective'
}
@@ -978,6 +1290,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
permissionsTraceCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.permissionsTrace(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
permissionsTraceEndpoint (): string {
return '/permissions/trace'
}
@@ -1005,6 +1329,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
permissionsReadCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.permissionsRead(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
permissionsReadEndpoint (a: KV): string {
const {
roleID,
@@ -1031,6 +1367,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
permissionsDeleteCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.permissionsDelete(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
permissionsDeleteEndpoint (a: KV): string {
const {
roleID,
@@ -1063,6 +1411,18 @@ export default class Federation {
return this.api().request(cfg).then(result => stdResolve(result))
}
permissionsUpdateCancellable (a: KV, extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.permissionsUpdate(a, options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
permissionsUpdateEndpoint (a: KV): string {
const {
roleID,
File diff suppressed because it is too large Load Diff
@@ -122,12 +122,16 @@ function recordFeedFilter (r: Readonly<Record>, field: string): boolean {
* @param {Object} range Current date range
* @returns {Promise<Array>} Resolves to a set of FC events to display
*/
export async function RecordFeed ($ComposeAPI: ComposeAPI, module: Module, namespace: Namespace, feed: Feed, range: Range): Promise<Event[]> {
export async function RecordFeed ($ComposeAPI: ComposeAPI, module: Module, namespace: Namespace, feed: Feed, range: Range, options = {}): Promise<Event[]> {
// Params for record fetching
const params = {
namespaceID: namespace.namespaceID,
moduleID: module.moduleID,
query: `(date(${feed.startField}) <= '${range.end.toISOString()}' AND '${range.start.toISOString()}' <= date(${feed.endField || feed.startField}))`,
query: `(date(${
feed.startField
}) <= '${range.end.toISOString()}' AND '${range.start.toISOString()}' <= date(${
feed.endField || feed.startField
}))`,
}
if (feed.options.prefilter) {
@@ -135,7 +139,7 @@ export async function RecordFeed ($ComposeAPI: ComposeAPI, module: Module, names
}
const events: Array<Event> = []
return $ComposeAPI.recordList(params).then(({ set }) => {
return $ComposeAPI.recordList(params, options).then(({ set }) => {
(set as Array<{ recordID: string }>)
// Removes all duplicates
@@ -29,7 +29,7 @@ interface Range {
* @param {Object} range Current date range
* @returns {Promise<Array>} Resolves to a set of FC events to display
*/
export async function ReminderFeed ($SystemAPI: SystemAPI, user: User, feed: Feed, range: Range): Promise<Event[]> {
export async function ReminderFeed ($SystemAPI: SystemAPI, user: User, feed: Feed, range: Range, options = {}): Promise<Event[]> {
feed.options.color = feed.options.color || defaultColor
return $SystemAPI.reminderList({
scheduledFrom: range.start.toISOString(),
@@ -37,7 +37,7 @@ export async function ReminderFeed ($SystemAPI: SystemAPI, user: User, feed: Fee
scheduledOnly: true,
excludeDismissed: true,
assignedTo: user.userID,
}).then(({ set }) => {
}, options).then(({ set }) => {
const { backgroundColor, borderColor, isLight } = makeColors(feed.options.color)
if (!AreObjectsOf<Reminder>(set, 'reminderID', 'assignedTo', 'remindAt', 'payload')) {
@@ -18,7 +18,7 @@ interface Range {
start: Date;
}
export async function RecordFeed ($ComposeAPI: ComposeAPI, module: Module, namespace: Namespace, feed: Feed): Promise<any[]> {
export async function RecordFeed ($ComposeAPI: ComposeAPI, module: Module, namespace: Namespace, feed: Feed, options = {}): Promise<any[]> {
// Params for record fetching
const params = {
namespaceID: namespace.namespaceID,
@@ -27,7 +27,7 @@ export async function RecordFeed ($ComposeAPI: ComposeAPI, module: Module, names
}
const events: Array<any> = []
return $ComposeAPI.recordList(params).then(({ set }) => {
return $ComposeAPI.recordList(params, options).then(({ set }) => {
return (set as Array<{ recordID: string }>)
// cast & freeze
.map(r => Object.freeze(new Record(module, r)))
+12
View File
@@ -125,6 +125,18 @@ export default class {{className}} {
}{{/hasData}}
return this.api().request(cfg).then(result => stdResolve(result))
}
{{fname}}Cancellable ({{#if fargs}}a: KV, {{/if}}extra: AxiosRequestConfig = {}): { response: (a: KV, extra?: AxiosRequestConfig) => Promise<KV>; cancel: () => void; } {
const cancelTokenSource = axios.CancelToken.source();
let options = {...extra, cancelToken: cancelTokenSource.token }
return {
response: () => this.{{fname}}({{#if fargs}}a, {{/if}}options),
cancel: () => {
cancelTokenSource.cancel();
}
}
}
{{fname}}Endpoint ({{#if pathParams}}a: KV{{/if}}): string {
{{#if pathParams}}