@or-sdk/views 0.27.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/README.md +1 -1
- package/dist/cjs/Views.js +64 -121
- package/dist/cjs/Views.js.map +1 -1
- package/dist/cjs/constants.js +3 -13
- package/dist/cjs/constants.js.map +1 -1
- package/dist/esm/Views.js +47 -92
- package/dist/esm/Views.js.map +1 -1
- package/dist/esm/constants.js +1 -331
- package/dist/esm/constants.js.map +1 -1
- package/dist/types/Views.d.ts +5 -6
- package/dist/types/Views.d.ts.map +1 -1
- package/dist/types/constants.d.ts +1 -11
- package/dist/types/constants.d.ts.map +1 -1
- package/dist/types/types.d.ts +13 -1
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/Views.ts +64 -131
- package/src/constants.ts +1 -341
- package/src/types.ts +16 -2
- package/dist/cjs/utils/addTagsIds.js +0 -20
- package/dist/cjs/utils/addTagsIds.js.map +0 -1
- package/dist/cjs/utils/filterTagIds.js +0 -25
- package/dist/cjs/utils/filterTagIds.js.map +0 -1
- package/dist/cjs/utils/index.js +0 -13
- package/dist/cjs/utils/index.js.map +0 -1
- package/dist/cjs/utils/removeTagIds.js +0 -11
- package/dist/cjs/utils/removeTagIds.js.map +0 -1
- package/dist/esm/utils/addTagsIds.js +0 -9
- package/dist/esm/utils/addTagsIds.js.map +0 -1
- package/dist/esm/utils/filterTagIds.js +0 -23
- package/dist/esm/utils/filterTagIds.js.map +0 -1
- package/dist/esm/utils/index.js +0 -4
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/esm/utils/removeTagIds.js +0 -9
- package/dist/esm/utils/removeTagIds.js.map +0 -1
- package/dist/types/utils/addTagsIds.d.ts +0 -4
- package/dist/types/utils/addTagsIds.d.ts.map +0 -1
- package/dist/types/utils/filterTagIds.d.ts +0 -7
- package/dist/types/utils/filterTagIds.d.ts.map +0 -1
- package/dist/types/utils/index.d.ts +0 -4
- package/dist/types/utils/index.d.ts.map +0 -1
- package/dist/types/utils/removeTagIds.d.ts +0 -4
- package/dist/types/utils/removeTagIds.d.ts.map +0 -1
- package/src/utils/addTagsIds.ts +0 -15
- package/src/utils/filterTagIds.ts +0 -27
- package/src/utils/index.ts +0 -6
- package/src/utils/removeTagIds.ts +0 -15
package/src/Views.ts
CHANGED
|
@@ -1,75 +1,47 @@
|
|
|
1
|
-
import { List } from '@or-sdk/base';
|
|
2
|
-
import {
|
|
3
|
-
import { ViewsConfig, View } from './types';
|
|
4
|
-
import {
|
|
5
|
-
ENTITY_NAME,
|
|
6
|
-
QUERY_LIST,
|
|
7
|
-
QUERY_GET,
|
|
8
|
-
QUERY_CREATE,
|
|
9
|
-
QUERY_UPDATE,
|
|
10
|
-
QUERY_DELETE,
|
|
11
|
-
QUERY_GET_CROSSACCOUNT,
|
|
12
|
-
QUERY_LIST_CROSSACCOUNT,
|
|
13
|
-
QUERY_CREATE_CROSSACCOUNT,
|
|
14
|
-
QUERY_UPDATE_CROSSACCOUNT,
|
|
15
|
-
} from './constants';
|
|
1
|
+
import { List, makeList } from '@or-sdk/base';
|
|
2
|
+
import { DataHubSvc, setDiff } from '@or-sdk/data-hub-svc';
|
|
3
|
+
import { ViewsConfig, View, ListViewParams, PaginationOptions } from './types';
|
|
16
4
|
import { Tags, Taggable, filterTagIds, addTagsIds, removeTagIds } from '@or-sdk/tags';
|
|
17
5
|
|
|
18
6
|
export class Views implements Taggable<View> {
|
|
19
|
-
private readonly
|
|
7
|
+
private readonly dataHubSvc: DataHubSvc;
|
|
20
8
|
private readonly tags: Tags;
|
|
21
9
|
|
|
22
10
|
constructor(params: ViewsConfig) {
|
|
23
|
-
const { token, discoveryUrl, accountId,
|
|
11
|
+
const { token, discoveryUrl, accountId, dataHubSvcUrl } = params;
|
|
24
12
|
|
|
25
|
-
this.
|
|
13
|
+
this.dataHubSvc = new DataHubSvc({
|
|
26
14
|
token,
|
|
27
15
|
discoveryUrl,
|
|
28
16
|
accountId,
|
|
29
|
-
|
|
17
|
+
dataHubSvcUrl,
|
|
30
18
|
});
|
|
31
19
|
this.tags = new Tags({
|
|
32
20
|
token,
|
|
33
21
|
discoveryUrl,
|
|
34
22
|
accountId,
|
|
35
|
-
|
|
23
|
+
dataHubSvcUrl,
|
|
36
24
|
});
|
|
37
25
|
}
|
|
38
26
|
|
|
39
|
-
async init() {
|
|
40
|
-
await Promise.all([
|
|
41
|
-
this.dataHub.init(),
|
|
42
|
-
this.tags.init(),
|
|
43
|
-
]);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
27
|
/**
|
|
47
28
|
* List views
|
|
48
29
|
* ```typescript
|
|
49
30
|
* const viewList = await views.listViews();
|
|
50
31
|
* ```
|
|
51
32
|
*/
|
|
52
|
-
public async listViews(): Promise<List<View>> {
|
|
53
|
-
const
|
|
54
|
-
|
|
33
|
+
public async listViews(params: ListViewParams = {}, paginationOptions: PaginationOptions = {}): Promise<List<View>> {
|
|
34
|
+
const result = await this.dataHubSvc.makeRequest<View[]>({
|
|
35
|
+
method: 'GET',
|
|
36
|
+
route: 'views',
|
|
55
37
|
params: {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
limit: 30,
|
|
38
|
+
...params,
|
|
39
|
+
...paginationOptions,
|
|
40
|
+
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
60
41
|
},
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const operationName = this.dataHub.getOperationName(OperationNames.LIST);
|
|
65
|
-
|
|
66
|
-
const data = {
|
|
67
|
-
operationName,
|
|
68
|
-
query: this.dataHub.isCrossAccount ? QUERY_LIST_CROSSACCOUNT : QUERY_LIST,
|
|
69
|
-
variables,
|
|
70
|
-
};
|
|
42
|
+
});
|
|
71
43
|
|
|
72
|
-
return
|
|
44
|
+
return makeList<View>(result);
|
|
73
45
|
}
|
|
74
46
|
|
|
75
47
|
/**
|
|
@@ -79,31 +51,13 @@ export class Views implements Taggable<View> {
|
|
|
79
51
|
* ```
|
|
80
52
|
*/
|
|
81
53
|
public async getView(id: string): Promise<View> {
|
|
82
|
-
|
|
83
|
-
|
|
54
|
+
return this.dataHubSvc.makeRequest<View>({
|
|
55
|
+
method: 'GET',
|
|
56
|
+
route: `views/${id}`,
|
|
84
57
|
params: {
|
|
85
|
-
|
|
86
|
-
includeDeleted: false,
|
|
87
|
-
includeExisting: true,
|
|
58
|
+
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
88
59
|
},
|
|
89
|
-
... this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {},
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
const operationName = this.dataHub.getOperationName(OperationNames.GET);
|
|
93
|
-
|
|
94
|
-
const data = {
|
|
95
|
-
operationName,
|
|
96
|
-
query: this.dataHub.isCrossAccount ? QUERY_GET_CROSSACCOUNT : QUERY_GET,
|
|
97
|
-
variables,
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const result = await this.dataHub.makeRequest<GraphqlResponse<View>>({
|
|
101
|
-
method: 'POST',
|
|
102
|
-
route: '/graphql',
|
|
103
|
-
data,
|
|
104
60
|
});
|
|
105
|
-
|
|
106
|
-
return result.data[operationName] as View;
|
|
107
61
|
}
|
|
108
62
|
|
|
109
63
|
/**
|
|
@@ -115,7 +69,7 @@ export class Views implements Taggable<View> {
|
|
|
115
69
|
* ```
|
|
116
70
|
*/
|
|
117
71
|
public async saveView(source: View): Promise<View> {
|
|
118
|
-
return source.id ? this.updateView(source) : this.createView(source);
|
|
72
|
+
return (source.id && source.id !== 'new') ? this.updateView(source) : this.createView(source);
|
|
119
73
|
}
|
|
120
74
|
|
|
121
75
|
/**
|
|
@@ -125,29 +79,21 @@ export class Views implements Taggable<View> {
|
|
|
125
79
|
* ```
|
|
126
80
|
*/
|
|
127
81
|
public async createView(source: View): Promise<View> {
|
|
128
|
-
const
|
|
129
|
-
|
|
82
|
+
const result = await this.dataHubSvc.makeRequest<{ id: string; }>({
|
|
83
|
+
method: 'POST',
|
|
84
|
+
route: 'views/new',
|
|
130
85
|
data: {
|
|
131
|
-
|
|
86
|
+
view: {
|
|
87
|
+
...source,
|
|
88
|
+
id: 'new', //TODO: remove later
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
params: {
|
|
92
|
+
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
132
93
|
},
|
|
133
|
-
... this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {},
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
const operationName = this.dataHub.getOperationName(OperationNames.CREATE);
|
|
137
|
-
|
|
138
|
-
const data = {
|
|
139
|
-
operationName,
|
|
140
|
-
query: this.dataHub.isCrossAccount ? QUERY_CREATE_CROSSACCOUNT : QUERY_CREATE,
|
|
141
|
-
variables,
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
const result = await this.dataHub.makeRequest<GraphqlResponse<View>>({
|
|
145
|
-
method: 'POST',
|
|
146
|
-
route: '/graphql',
|
|
147
|
-
data,
|
|
148
94
|
});
|
|
149
95
|
|
|
150
|
-
return result
|
|
96
|
+
return setDiff<View>(source, result);
|
|
151
97
|
}
|
|
152
98
|
|
|
153
99
|
/**
|
|
@@ -157,30 +103,18 @@ export class Views implements Taggable<View> {
|
|
|
157
103
|
* ```
|
|
158
104
|
*/
|
|
159
105
|
public async updateView(source: View): Promise<View> {
|
|
160
|
-
const
|
|
161
|
-
|
|
106
|
+
const result = await this.dataHubSvc.makeRequest<{ id: string; }>({
|
|
107
|
+
method: 'POST',
|
|
108
|
+
route: `views/${source.id}`,
|
|
162
109
|
data: {
|
|
163
|
-
|
|
164
|
-
|
|
110
|
+
view: source,
|
|
111
|
+
},
|
|
112
|
+
params: {
|
|
113
|
+
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
165
114
|
},
|
|
166
|
-
... this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {},
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
const operationName = this.dataHub.getOperationName(OperationNames.UPDATE);
|
|
170
|
-
|
|
171
|
-
const data = {
|
|
172
|
-
operationName,
|
|
173
|
-
query: this.dataHub.isCrossAccount ? QUERY_UPDATE_CROSSACCOUNT : QUERY_UPDATE,
|
|
174
|
-
variables,
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
const result = await this.dataHub.makeRequest<GraphqlResponse<View>>({
|
|
178
|
-
method: 'POST',
|
|
179
|
-
route: '/graphql',
|
|
180
|
-
data,
|
|
181
115
|
});
|
|
182
116
|
|
|
183
|
-
return result
|
|
117
|
+
return setDiff<View>(source, result);
|
|
184
118
|
}
|
|
185
119
|
|
|
186
120
|
/**
|
|
@@ -189,34 +123,33 @@ export class Views implements Taggable<View> {
|
|
|
189
123
|
* await views.deleteView('view-id');
|
|
190
124
|
* ```
|
|
191
125
|
*/
|
|
192
|
-
public async deleteView(viewId: string): Promise<
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
const variables = {
|
|
198
|
-
entity: ENTITY_NAME,
|
|
126
|
+
public async deleteView(viewId: string, temporarily = true): Promise<void> {
|
|
127
|
+
return this.dataHubSvc.makeRequest<void>({
|
|
128
|
+
method: 'DELETE',
|
|
129
|
+
route: `views/${viewId}`,
|
|
199
130
|
data: {
|
|
200
|
-
|
|
201
|
-
|
|
131
|
+
temporarily,
|
|
132
|
+
},
|
|
133
|
+
params: {
|
|
134
|
+
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
202
135
|
},
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
const operationName = this.dataHub.getOperationName(OperationNames.DELETE_TEMPORARILY);
|
|
206
|
-
|
|
207
|
-
const data = {
|
|
208
|
-
operationName,
|
|
209
|
-
query: QUERY_DELETE,
|
|
210
|
-
variables,
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
const result = await this.dataHub.makeRequest<GraphqlResponse<void>>({
|
|
214
|
-
method: 'POST',
|
|
215
|
-
route: '/graphql',
|
|
216
|
-
data,
|
|
217
136
|
});
|
|
137
|
+
}
|
|
218
138
|
|
|
219
|
-
|
|
139
|
+
/**
|
|
140
|
+
* Recover view
|
|
141
|
+
* ```typescript
|
|
142
|
+
* await views.recoverView('view-id');
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
public async recoverView(viewId: string): Promise<void> {
|
|
146
|
+
return this.dataHubSvc.makeRequest<void>({
|
|
147
|
+
method: 'PATCH',
|
|
148
|
+
route: `views/${viewId}`,
|
|
149
|
+
params: {
|
|
150
|
+
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
151
|
+
},
|
|
152
|
+
});
|
|
220
153
|
}
|
|
221
154
|
|
|
222
155
|
/**
|
package/src/constants.ts
CHANGED
|
@@ -1,341 +1 @@
|
|
|
1
|
-
export {
|
|
2
|
-
|
|
3
|
-
export const QUERY_LIST = `query list($entity: EntityType!, $params: ListInput!, $sandbox: Boolean) {
|
|
4
|
-
list(entity: $entity, params: $params, sandbox: $sandbox) {
|
|
5
|
-
records {
|
|
6
|
-
... on View {
|
|
7
|
-
id
|
|
8
|
-
data {
|
|
9
|
-
data
|
|
10
|
-
}
|
|
11
|
-
cardIds
|
|
12
|
-
mirrorCardIds
|
|
13
|
-
linkId
|
|
14
|
-
linkType
|
|
15
|
-
template {
|
|
16
|
-
category
|
|
17
|
-
description
|
|
18
|
-
help
|
|
19
|
-
icon
|
|
20
|
-
iconUrl
|
|
21
|
-
implicitly
|
|
22
|
-
label
|
|
23
|
-
publishedBy
|
|
24
|
-
tags
|
|
25
|
-
type
|
|
26
|
-
version
|
|
27
|
-
}
|
|
28
|
-
reference
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
last
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
35
|
-
|
|
36
|
-
export const QUERY_LIST_CROSSACCOUNT = `query listCrossAccount($entity: EntityType!, $params: ListInput!, $accountId: String!) {
|
|
37
|
-
listCrossAccount(entity: $entity, params: $params, accountId: $accountId) {
|
|
38
|
-
records {
|
|
39
|
-
... on View {
|
|
40
|
-
id
|
|
41
|
-
data {
|
|
42
|
-
data
|
|
43
|
-
}
|
|
44
|
-
cardIds
|
|
45
|
-
mirrorCardIds
|
|
46
|
-
linkId
|
|
47
|
-
linkType
|
|
48
|
-
template {
|
|
49
|
-
category
|
|
50
|
-
description
|
|
51
|
-
help
|
|
52
|
-
icon
|
|
53
|
-
iconUrl
|
|
54
|
-
implicitly
|
|
55
|
-
label
|
|
56
|
-
publishedBy
|
|
57
|
-
tags
|
|
58
|
-
type
|
|
59
|
-
version
|
|
60
|
-
}
|
|
61
|
-
reference
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
last
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
`;
|
|
68
|
-
|
|
69
|
-
export const QUERY_GET = `query get($entity: EntityType!, $params: GetInput!) {
|
|
70
|
-
get(entity: $entity, params: $params) {
|
|
71
|
-
... on View {
|
|
72
|
-
id
|
|
73
|
-
cardIds
|
|
74
|
-
linkId
|
|
75
|
-
mirrorCardIds
|
|
76
|
-
schemaVersion
|
|
77
|
-
dateCreated
|
|
78
|
-
dateModified
|
|
79
|
-
data {
|
|
80
|
-
data
|
|
81
|
-
form {
|
|
82
|
-
code
|
|
83
|
-
data
|
|
84
|
-
style
|
|
85
|
-
template
|
|
86
|
-
}
|
|
87
|
-
presentation {
|
|
88
|
-
code
|
|
89
|
-
data
|
|
90
|
-
style
|
|
91
|
-
template
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
linkType
|
|
95
|
-
reference
|
|
96
|
-
template {
|
|
97
|
-
category
|
|
98
|
-
description
|
|
99
|
-
help
|
|
100
|
-
icon
|
|
101
|
-
iconUrl
|
|
102
|
-
implicitly
|
|
103
|
-
label
|
|
104
|
-
publishedBy
|
|
105
|
-
tags
|
|
106
|
-
type
|
|
107
|
-
version
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}`;
|
|
112
|
-
|
|
113
|
-
export const QUERY_GET_CROSSACCOUNT = `query getCrossAccount($entity: EntityType!, $params: GetInput!, $accountId: String!) {
|
|
114
|
-
getCrossAccount(entity: $entity, params: $params, accountId: $accountId) {
|
|
115
|
-
... on View {
|
|
116
|
-
id
|
|
117
|
-
cardIds
|
|
118
|
-
linkId
|
|
119
|
-
mirrorCardIds
|
|
120
|
-
schemaVersion
|
|
121
|
-
dateCreated
|
|
122
|
-
dateModified
|
|
123
|
-
data {
|
|
124
|
-
data
|
|
125
|
-
form {
|
|
126
|
-
code
|
|
127
|
-
data
|
|
128
|
-
style
|
|
129
|
-
template
|
|
130
|
-
}
|
|
131
|
-
presentation {
|
|
132
|
-
code
|
|
133
|
-
data
|
|
134
|
-
style
|
|
135
|
-
template
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
linkType
|
|
139
|
-
reference
|
|
140
|
-
template {
|
|
141
|
-
category
|
|
142
|
-
description
|
|
143
|
-
help
|
|
144
|
-
icon
|
|
145
|
-
iconUrl
|
|
146
|
-
implicitly
|
|
147
|
-
label
|
|
148
|
-
publishedBy
|
|
149
|
-
tags
|
|
150
|
-
type
|
|
151
|
-
version
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}`;
|
|
156
|
-
|
|
157
|
-
export const QUERY_CREATE = `mutation create($entity: EntityType!, $data: CreateInput!) {
|
|
158
|
-
create(entity: $entity, data: $data) {
|
|
159
|
-
... on View {
|
|
160
|
-
id
|
|
161
|
-
cardIds
|
|
162
|
-
linkId
|
|
163
|
-
mirrorCardIds
|
|
164
|
-
schemaVersion
|
|
165
|
-
dateCreated
|
|
166
|
-
dateModified
|
|
167
|
-
data {
|
|
168
|
-
data
|
|
169
|
-
form {
|
|
170
|
-
code
|
|
171
|
-
data
|
|
172
|
-
style
|
|
173
|
-
template
|
|
174
|
-
}
|
|
175
|
-
presentation {
|
|
176
|
-
code
|
|
177
|
-
data
|
|
178
|
-
style
|
|
179
|
-
template
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
linkType
|
|
183
|
-
reference
|
|
184
|
-
template {
|
|
185
|
-
category
|
|
186
|
-
description
|
|
187
|
-
help
|
|
188
|
-
icon
|
|
189
|
-
iconUrl
|
|
190
|
-
implicitly
|
|
191
|
-
label
|
|
192
|
-
publishedBy
|
|
193
|
-
tags
|
|
194
|
-
type
|
|
195
|
-
version
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
}`;
|
|
200
|
-
|
|
201
|
-
export const QUERY_CREATE_CROSSACCOUNT = `mutation createCrossAccount($entity: EntityType!, $data: CreateInput!, $accountId: String!) {
|
|
202
|
-
createCrossAccount(entity: $entity, data: $data, accountId: $accountId) {
|
|
203
|
-
... on View {
|
|
204
|
-
id
|
|
205
|
-
cardIds
|
|
206
|
-
linkId
|
|
207
|
-
mirrorCardIds
|
|
208
|
-
schemaVersion
|
|
209
|
-
dateCreated
|
|
210
|
-
dateModified
|
|
211
|
-
data {
|
|
212
|
-
data
|
|
213
|
-
form {
|
|
214
|
-
code
|
|
215
|
-
data
|
|
216
|
-
style
|
|
217
|
-
template
|
|
218
|
-
}
|
|
219
|
-
presentation {
|
|
220
|
-
code
|
|
221
|
-
data
|
|
222
|
-
style
|
|
223
|
-
template
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
linkType
|
|
227
|
-
reference
|
|
228
|
-
template {
|
|
229
|
-
category
|
|
230
|
-
description
|
|
231
|
-
help
|
|
232
|
-
icon
|
|
233
|
-
iconUrl
|
|
234
|
-
implicitly
|
|
235
|
-
label
|
|
236
|
-
publishedBy
|
|
237
|
-
tags
|
|
238
|
-
type
|
|
239
|
-
version
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}`;
|
|
244
|
-
|
|
245
|
-
export const QUERY_UPDATE = `mutation update($entity: EntityType!, $data: UpdateInput!) {
|
|
246
|
-
update(entity: $entity, data: $data) {
|
|
247
|
-
... on View {
|
|
248
|
-
id
|
|
249
|
-
cardIds
|
|
250
|
-
linkId
|
|
251
|
-
mirrorCardIds
|
|
252
|
-
schemaVersion
|
|
253
|
-
dateCreated
|
|
254
|
-
dateModified
|
|
255
|
-
data {
|
|
256
|
-
data
|
|
257
|
-
form {
|
|
258
|
-
code
|
|
259
|
-
data
|
|
260
|
-
style
|
|
261
|
-
template
|
|
262
|
-
}
|
|
263
|
-
presentation {
|
|
264
|
-
code
|
|
265
|
-
data
|
|
266
|
-
style
|
|
267
|
-
template
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
linkType
|
|
271
|
-
reference
|
|
272
|
-
template {
|
|
273
|
-
category
|
|
274
|
-
description
|
|
275
|
-
help
|
|
276
|
-
icon
|
|
277
|
-
iconUrl
|
|
278
|
-
implicitly
|
|
279
|
-
label
|
|
280
|
-
publishedBy
|
|
281
|
-
tags
|
|
282
|
-
type
|
|
283
|
-
version
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}`;
|
|
288
|
-
|
|
289
|
-
export const QUERY_UPDATE_CROSSACCOUNT = `mutation updateCrossAccount($entity: EntityType!, $data: UpdateInput!, $accountId: String!) {
|
|
290
|
-
updateCrossAccount(entity: $entity, data: $data, accountId: $accountId) {
|
|
291
|
-
... on View {
|
|
292
|
-
id
|
|
293
|
-
cardIds
|
|
294
|
-
linkId
|
|
295
|
-
mirrorCardIds
|
|
296
|
-
schemaVersion
|
|
297
|
-
dateCreated
|
|
298
|
-
dateModified
|
|
299
|
-
data {
|
|
300
|
-
data
|
|
301
|
-
form {
|
|
302
|
-
code
|
|
303
|
-
data
|
|
304
|
-
style
|
|
305
|
-
template
|
|
306
|
-
}
|
|
307
|
-
presentation {
|
|
308
|
-
code
|
|
309
|
-
data
|
|
310
|
-
style
|
|
311
|
-
template
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
linkType
|
|
315
|
-
reference
|
|
316
|
-
template {
|
|
317
|
-
category
|
|
318
|
-
description
|
|
319
|
-
help
|
|
320
|
-
icon
|
|
321
|
-
iconUrl
|
|
322
|
-
implicitly
|
|
323
|
-
label
|
|
324
|
-
publishedBy
|
|
325
|
-
tags
|
|
326
|
-
type
|
|
327
|
-
version
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}`;
|
|
332
|
-
|
|
333
|
-
export const QUERY_DELETE = `mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {
|
|
334
|
-
deleteTemporarily(entity: $entity, data: $data) {
|
|
335
|
-
... on AsyncRequest {
|
|
336
|
-
requestId
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
}`;
|
|
340
|
-
|
|
341
|
-
export const ENTITY_NAME = 'VIEW';
|
|
1
|
+
export { DATA_HUB_SVC_SERVICE_KEY } from '@or-sdk/data-hub-svc';
|
package/src/types.ts
CHANGED
|
@@ -17,9 +17,9 @@ export type ViewsConfig = {
|
|
|
17
17
|
accountId?: string;
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
|
-
* Url of OneReach
|
|
20
|
+
* Url of OneReach DataHubSvc api
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
dataHubSvcUrl?: string;
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export type View = {
|
|
@@ -104,3 +104,17 @@ export type View = {
|
|
|
104
104
|
template: null;
|
|
105
105
|
deletedDate?: string;
|
|
106
106
|
};
|
|
107
|
+
|
|
108
|
+
export type ListViewParams = {
|
|
109
|
+
query?: {
|
|
110
|
+
[key: string]: unknown;
|
|
111
|
+
};
|
|
112
|
+
projection?: string[];
|
|
113
|
+
group?: string[];
|
|
114
|
+
sandbox?: boolean;
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
export type PaginationOptions = {
|
|
118
|
+
limit?: number;
|
|
119
|
+
offset?: number;
|
|
120
|
+
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
3
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
4
|
-
if (ar || !(i in from)) {
|
|
5
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
6
|
-
ar[i] = from[i];
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
function addTagIds(source, tagIds) {
|
|
13
|
-
if (!Array.isArray(source.data.data.filterByTagIds)) {
|
|
14
|
-
source.data.data.filterByTagIds = [];
|
|
15
|
-
}
|
|
16
|
-
source.data.data.filterByTagIds = __spreadArray(__spreadArray([], source.data.data.filterByTagIds, true), tagIds, true);
|
|
17
|
-
return source;
|
|
18
|
-
}
|
|
19
|
-
exports.default = addTagIds;
|
|
20
|
-
//# sourceMappingURL=addTagsIds.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"addTagsIds.js","sourceRoot":"","sources":["../../../src/utils/addTagsIds.ts"],"names":[],"mappings":";;;;;;;;;;;AAIA,SAAS,SAAS,CAAC,MAAY,EAAE,MAAgB;IAC/C,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;QACnD,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;KACtC;IAED,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,mCAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,SAAK,MAAM,OAAC,CAAC;IAElF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,kBAAe,SAAS,CAAC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
function filterTagIds(source, tagIdsToFilter) {
|
|
4
|
-
var newIds = [];
|
|
5
|
-
var existingIds = [];
|
|
6
|
-
if (!Array.isArray(source.data.data.filterByTagIds)) {
|
|
7
|
-
newIds = tagIdsToFilter;
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
tagIdsToFilter.forEach(function (tagId) {
|
|
11
|
-
if (source.data.data.filterByTagIds.indexOf(tagId) !== -1) {
|
|
12
|
-
existingIds.push(tagId);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
newIds.push(tagId);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
return {
|
|
20
|
-
newIds: newIds,
|
|
21
|
-
existingIds: existingIds,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
exports.default = filterTagIds;
|
|
25
|
-
//# sourceMappingURL=filterTagIds.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"filterTagIds.js","sourceRoot":"","sources":["../../../src/utils/filterTagIds.ts"],"names":[],"mappings":";;AAIA,SAAS,YAAY,CAAC,MAAY,EAAE,cAAwB;IAC1D,IAAI,MAAM,GAAa,EAAE,CAAC;IAC1B,IAAM,WAAW,GAAa,EAAE,CAAC;IAEjC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,EAAE;QACnD,MAAM,GAAG,cAAc,CAAC;KACzB;SAAM;QACL,cAAc,CAAC,OAAO,CAAC,UAAA,KAAK;YAC1B,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,cAAe,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE;gBAC1D,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACzB;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACpB;QACH,CAAC,CAAC,CAAC;KACJ;IAED,OAAO;QACL,MAAM,QAAA;QACN,WAAW,aAAA;KACZ,CAAC;AACJ,CAAC;AAED,kBAAe,YAAY,CAAC"}
|
package/dist/cjs/utils/index.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.removeTagIds = exports.addTagsIds = exports.filterTagIds = void 0;
|
|
7
|
-
var filterTagIds_1 = require("./filterTagIds");
|
|
8
|
-
Object.defineProperty(exports, "filterTagIds", { enumerable: true, get: function () { return __importDefault(filterTagIds_1).default; } });
|
|
9
|
-
var addTagsIds_1 = require("./addTagsIds");
|
|
10
|
-
Object.defineProperty(exports, "addTagsIds", { enumerable: true, get: function () { return __importDefault(addTagsIds_1).default; } });
|
|
11
|
-
var removeTagIds_1 = require("./removeTagIds");
|
|
12
|
-
Object.defineProperty(exports, "removeTagIds", { enumerable: true, get: function () { return __importDefault(removeTagIds_1).default; } });
|
|
13
|
-
//# sourceMappingURL=index.js.map
|