@or-sdk/cards 0.25.1 → 0.25.2-beta.540.0
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/README.md +21 -0
- package/dist/cjs/Cards.js +79 -121
- package/dist/cjs/Cards.js.map +1 -1
- package/dist/cjs/constants.js +3 -13
- package/dist/cjs/constants.js.map +1 -1
- package/dist/esm/Cards.js +59 -92
- package/dist/esm/Cards.js.map +1 -1
- package/dist/esm/constants.js +1 -367
- package/dist/esm/constants.js.map +1 -1
- package/dist/types/Cards.d.ts +6 -6
- package/dist/types/Cards.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 -5
- package/src/Cards.ts +83 -144
- package/src/constants.ts +1 -376
- package/src/types.ts +16 -2
package/src/Cards.ts
CHANGED
|
@@ -1,60 +1,27 @@
|
|
|
1
|
-
import { List } from '@or-sdk/base';
|
|
2
|
-
import {
|
|
3
|
-
import { CardsConfig, Card } from './types';
|
|
4
|
-
import {
|
|
5
|
-
ENTITY_NAME,
|
|
6
|
-
QUERY_LIST,
|
|
7
|
-
QUERY_GET,
|
|
8
|
-
QUERY_CREATE,
|
|
9
|
-
QUERY_UPDATE,
|
|
10
|
-
QUERY_DELETE,
|
|
11
|
-
QUERY_LIST_CROSSACCOUNT,
|
|
12
|
-
QUERY_GET_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 { CardsConfig, Card, ListCardsParams, PaginationOptions } from './types';
|
|
16
4
|
import { Tags, Taggable, filterTagIds, addTagsIds, removeTagIds } from '@or-sdk/tags';
|
|
17
5
|
|
|
18
|
-
/**
|
|
19
|
-
* OneReach Cards service client
|
|
20
|
-
* ## Installation:
|
|
21
|
-
* ```
|
|
22
|
-
* $ npm i @or-sdk/cards
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
6
|
export class Cards implements Taggable<Card> {
|
|
26
|
-
private readonly
|
|
7
|
+
private readonly dataHubSvc: DataHubSvc;
|
|
27
8
|
private readonly tags: Tags;
|
|
28
9
|
|
|
29
|
-
/**
|
|
30
|
-
* ```typescript
|
|
31
|
-
* import { Cards } from '@or-sdk/cards'
|
|
32
|
-
* const cards = new Cards({token: 'my-account-token-string', discoveryUrl: 'http://example.cards/endpoint'});
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
10
|
constructor(params: CardsConfig) {
|
|
36
|
-
const { token, discoveryUrl, accountId,
|
|
11
|
+
const { token, discoveryUrl, accountId, dataHubSvcUrl } = params;
|
|
37
12
|
|
|
38
|
-
this.
|
|
13
|
+
this.dataHubSvc = new DataHubSvc({
|
|
39
14
|
token,
|
|
40
15
|
discoveryUrl,
|
|
41
16
|
accountId,
|
|
42
|
-
|
|
17
|
+
dataHubSvcUrl,
|
|
43
18
|
});
|
|
44
19
|
this.tags = new Tags({
|
|
45
20
|
token,
|
|
46
21
|
discoveryUrl,
|
|
47
22
|
accountId,
|
|
48
|
-
|
|
23
|
+
dataHubSvcUrl,
|
|
49
24
|
});
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async init() {
|
|
54
|
-
await Promise.all([
|
|
55
|
-
this.dataHub.init(),
|
|
56
|
-
this.tags.init(),
|
|
57
|
-
]);
|
|
58
25
|
}
|
|
59
26
|
|
|
60
27
|
/**
|
|
@@ -63,27 +30,18 @@ export class Cards implements Taggable<Card> {
|
|
|
63
30
|
* const cardList = await cards.listCards();
|
|
64
31
|
* ```
|
|
65
32
|
*/
|
|
66
|
-
public async listCards(): Promise<List<Card>> {
|
|
67
|
-
const
|
|
68
|
-
|
|
33
|
+
public async listCards(params: ListCardsParams = {}, paginationOptions: PaginationOptions = {}): Promise<List<Card>> {
|
|
34
|
+
const result = await this.dataHubSvc.makeRequest<Card[]>({
|
|
35
|
+
method: 'GET',
|
|
36
|
+
route: 'cards',
|
|
69
37
|
params: {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
limit: 30,
|
|
38
|
+
...params,
|
|
39
|
+
...paginationOptions,
|
|
40
|
+
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
74
41
|
},
|
|
75
|
-
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
const operationName = this.dataHub.getOperationName(OperationNames.LIST);
|
|
79
|
-
|
|
80
|
-
const data = {
|
|
81
|
-
operationName,
|
|
82
|
-
query: this.dataHub.isCrossAccount ? QUERY_LIST_CROSSACCOUNT : QUERY_LIST,
|
|
83
|
-
variables,
|
|
84
|
-
};
|
|
42
|
+
});
|
|
85
43
|
|
|
86
|
-
return
|
|
44
|
+
return makeList<Card>(result);
|
|
87
45
|
}
|
|
88
46
|
|
|
89
47
|
/**
|
|
@@ -93,31 +51,13 @@ export class Cards implements Taggable<Card> {
|
|
|
93
51
|
* ```
|
|
94
52
|
*/
|
|
95
53
|
public async getCard(id: string): Promise<Card> {
|
|
96
|
-
|
|
97
|
-
|
|
54
|
+
return this.dataHubSvc.makeRequest<Card>({
|
|
55
|
+
method: 'GET',
|
|
56
|
+
route: `cards/${id}`,
|
|
98
57
|
params: {
|
|
99
|
-
|
|
100
|
-
includeDeleted: false,
|
|
101
|
-
includeExisting: true,
|
|
58
|
+
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
102
59
|
},
|
|
103
|
-
... this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {},
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const operationName = this.dataHub.getOperationName(OperationNames.GET);
|
|
107
|
-
|
|
108
|
-
const data = {
|
|
109
|
-
operationName,
|
|
110
|
-
query: this.dataHub.isCrossAccount ? QUERY_GET_CROSSACCOUNT : QUERY_GET,
|
|
111
|
-
variables,
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const result = await this.dataHub.makeRequest<GraphqlResponse<Card>>({
|
|
115
|
-
method: 'POST',
|
|
116
|
-
route: '/graphql',
|
|
117
|
-
data,
|
|
118
60
|
});
|
|
119
|
-
|
|
120
|
-
return result.data[operationName] as Card;
|
|
121
61
|
}
|
|
122
62
|
|
|
123
63
|
/**
|
|
@@ -129,7 +69,7 @@ export class Cards implements Taggable<Card> {
|
|
|
129
69
|
* ```
|
|
130
70
|
*/
|
|
131
71
|
public async saveCard(source: Card): Promise<Card> {
|
|
132
|
-
return source.id ? this.updateCard(source) : this.createCard(source);
|
|
72
|
+
return (source.id && source.id !== 'new') ? this.updateCard(source) : this.createCard(source);
|
|
133
73
|
}
|
|
134
74
|
|
|
135
75
|
/**
|
|
@@ -139,29 +79,21 @@ export class Cards implements Taggable<Card> {
|
|
|
139
79
|
* ```
|
|
140
80
|
*/
|
|
141
81
|
public async createCard(source: Card): Promise<Card> {
|
|
142
|
-
const
|
|
143
|
-
|
|
82
|
+
const result = await this.dataHubSvc.makeRequest<{ id: string; }>({
|
|
83
|
+
method: 'POST',
|
|
84
|
+
route: 'cards/new',
|
|
144
85
|
data: {
|
|
145
|
-
|
|
86
|
+
card: {
|
|
87
|
+
...source,
|
|
88
|
+
id: 'new', //TODO: remove later
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
params: {
|
|
92
|
+
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
146
93
|
},
|
|
147
|
-
... this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {},
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
const operationName = this.dataHub.getOperationName(OperationNames.CREATE);
|
|
151
|
-
|
|
152
|
-
const data = {
|
|
153
|
-
operationName,
|
|
154
|
-
query: this.dataHub.isCrossAccount ? QUERY_CREATE_CROSSACCOUNT : QUERY_CREATE,
|
|
155
|
-
variables,
|
|
156
|
-
};
|
|
157
|
-
|
|
158
|
-
const result = await this.dataHub.makeRequest<GraphqlResponse<Card>>({
|
|
159
|
-
method: 'POST',
|
|
160
|
-
route: '/graphql',
|
|
161
|
-
data,
|
|
162
94
|
});
|
|
163
95
|
|
|
164
|
-
return result
|
|
96
|
+
return setDiff<Card>(source, result);
|
|
165
97
|
}
|
|
166
98
|
|
|
167
99
|
/**
|
|
@@ -171,30 +103,18 @@ export class Cards implements Taggable<Card> {
|
|
|
171
103
|
* ```
|
|
172
104
|
*/
|
|
173
105
|
public async updateCard(source: Card): Promise<Card> {
|
|
174
|
-
const
|
|
175
|
-
|
|
106
|
+
const result = await this.dataHubSvc.makeRequest<{ id: string; }>({
|
|
107
|
+
method: 'POST',
|
|
108
|
+
route: `cards/${source.id}`,
|
|
176
109
|
data: {
|
|
177
|
-
|
|
178
|
-
|
|
110
|
+
card: source,
|
|
111
|
+
},
|
|
112
|
+
params: {
|
|
113
|
+
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
179
114
|
},
|
|
180
|
-
... this.dataHub.isCrossAccount ? { accountId: this.dataHub.currentAccountId } : {},
|
|
181
|
-
};
|
|
182
|
-
|
|
183
|
-
const operationName = this.dataHub.getOperationName(OperationNames.UPDATE);
|
|
184
|
-
|
|
185
|
-
const data = {
|
|
186
|
-
operationName,
|
|
187
|
-
query: this.dataHub.isCrossAccount ? QUERY_UPDATE_CROSSACCOUNT : QUERY_UPDATE,
|
|
188
|
-
variables,
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
const result = await this.dataHub.makeRequest<GraphqlResponse<Card>>({
|
|
192
|
-
method: 'POST',
|
|
193
|
-
route: '/graphql',
|
|
194
|
-
data,
|
|
195
115
|
});
|
|
196
116
|
|
|
197
|
-
return result
|
|
117
|
+
return setDiff<Card>(source, result);
|
|
198
118
|
}
|
|
199
119
|
|
|
200
120
|
/**
|
|
@@ -203,34 +123,52 @@ export class Cards implements Taggable<Card> {
|
|
|
203
123
|
* await cards.deleteCard('card-id');
|
|
204
124
|
* ```
|
|
205
125
|
*/
|
|
206
|
-
public async deleteCard(cardId: string): Promise<
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const variables = {
|
|
212
|
-
entity: ENTITY_NAME,
|
|
126
|
+
public async deleteCard(cardId: string, temporarily = true): Promise<void> {
|
|
127
|
+
return this.dataHubSvc.makeRequest<void>({
|
|
128
|
+
method: 'DELETE',
|
|
129
|
+
route: `cards/${cardId}`,
|
|
213
130
|
data: {
|
|
214
|
-
|
|
215
|
-
subscribe: true,
|
|
131
|
+
temporarily,
|
|
216
132
|
},
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
operationName,
|
|
223
|
-
query: QUERY_DELETE,
|
|
224
|
-
variables,
|
|
225
|
-
};
|
|
133
|
+
params: {
|
|
134
|
+
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
135
|
+
},
|
|
136
|
+
});
|
|
137
|
+
}
|
|
226
138
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
139
|
+
/**
|
|
140
|
+
* Recover card
|
|
141
|
+
* ```typescript
|
|
142
|
+
* await cards.recoverCard('card-id');
|
|
143
|
+
* ```
|
|
144
|
+
*/
|
|
145
|
+
public async recoverCard(cardId: string): Promise<void> {
|
|
146
|
+
return this.dataHubSvc.makeRequest<void>({
|
|
147
|
+
method: 'PATCH',
|
|
148
|
+
route: `cards/${cardId}`,
|
|
149
|
+
params: {
|
|
150
|
+
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
151
|
+
},
|
|
231
152
|
});
|
|
153
|
+
}
|
|
232
154
|
|
|
233
|
-
|
|
155
|
+
/**
|
|
156
|
+
* Clone card
|
|
157
|
+
* ```typescript
|
|
158
|
+
* const result = await cards.cloneCard('card-id');
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
public async cloneCard(cardId: string, keepTemplateDetails = true): Promise<Card> {
|
|
162
|
+
return this.dataHubSvc.makeRequest<Card>({
|
|
163
|
+
method: 'PUT',
|
|
164
|
+
route: `cards/${cardId}`,
|
|
165
|
+
data: {
|
|
166
|
+
keepTemplateDetails,
|
|
167
|
+
},
|
|
168
|
+
params: {
|
|
169
|
+
... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
|
|
170
|
+
},
|
|
171
|
+
});
|
|
234
172
|
}
|
|
235
173
|
|
|
236
174
|
/**
|
|
@@ -282,4 +220,5 @@ export class Cards implements Taggable<Card> {
|
|
|
282
220
|
},
|
|
283
221
|
});
|
|
284
222
|
}
|
|
223
|
+
|
|
285
224
|
}
|
package/src/constants.ts
CHANGED
|
@@ -1,376 +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 Card {
|
|
7
|
-
id
|
|
8
|
-
schemaVersion
|
|
9
|
-
dateCreated
|
|
10
|
-
dateModified
|
|
11
|
-
data {
|
|
12
|
-
data
|
|
13
|
-
form {
|
|
14
|
-
code
|
|
15
|
-
data
|
|
16
|
-
style
|
|
17
|
-
template
|
|
18
|
-
}
|
|
19
|
-
presentation {
|
|
20
|
-
code
|
|
21
|
-
data
|
|
22
|
-
style
|
|
23
|
-
template
|
|
24
|
-
}
|
|
25
|
-
tagIds
|
|
26
|
-
}
|
|
27
|
-
reference {
|
|
28
|
-
id
|
|
29
|
-
type
|
|
30
|
-
}
|
|
31
|
-
template {
|
|
32
|
-
category
|
|
33
|
-
description
|
|
34
|
-
help
|
|
35
|
-
icon
|
|
36
|
-
iconUrl
|
|
37
|
-
implicitly
|
|
38
|
-
label
|
|
39
|
-
publishedBy
|
|
40
|
-
tags
|
|
41
|
-
type
|
|
42
|
-
version
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
last
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
`;
|
|
50
|
-
|
|
51
|
-
export const QUERY_LIST_CROSSACCOUNT = `query listCrossAccount($entity: EntityType!, $params: ListInput!, $accountId: String!) {
|
|
52
|
-
listCrossAccount(entity: $entity, params: $params, accountId: $accountId) {
|
|
53
|
-
records {
|
|
54
|
-
... on Card {
|
|
55
|
-
id
|
|
56
|
-
schemaVersion
|
|
57
|
-
dateCreated
|
|
58
|
-
dateModified
|
|
59
|
-
data {
|
|
60
|
-
data
|
|
61
|
-
form {
|
|
62
|
-
code
|
|
63
|
-
data
|
|
64
|
-
style
|
|
65
|
-
template
|
|
66
|
-
}
|
|
67
|
-
presentation {
|
|
68
|
-
code
|
|
69
|
-
data
|
|
70
|
-
style
|
|
71
|
-
template
|
|
72
|
-
}
|
|
73
|
-
tagIds
|
|
74
|
-
}
|
|
75
|
-
reference {
|
|
76
|
-
id
|
|
77
|
-
type
|
|
78
|
-
}
|
|
79
|
-
template {
|
|
80
|
-
category
|
|
81
|
-
description
|
|
82
|
-
help
|
|
83
|
-
icon
|
|
84
|
-
iconUrl
|
|
85
|
-
implicitly
|
|
86
|
-
label
|
|
87
|
-
publishedBy
|
|
88
|
-
tags
|
|
89
|
-
type
|
|
90
|
-
version
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
last
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
`;
|
|
98
|
-
|
|
99
|
-
export const QUERY_GET = `query get($entity: EntityType!, $params: GetInput!) {
|
|
100
|
-
get(entity: $entity, params: $params) {
|
|
101
|
-
... on Card {
|
|
102
|
-
id
|
|
103
|
-
schemaVersion
|
|
104
|
-
dateCreated
|
|
105
|
-
dateModified
|
|
106
|
-
data {
|
|
107
|
-
data
|
|
108
|
-
form {
|
|
109
|
-
code
|
|
110
|
-
data
|
|
111
|
-
style
|
|
112
|
-
template
|
|
113
|
-
}
|
|
114
|
-
presentation {
|
|
115
|
-
code
|
|
116
|
-
data
|
|
117
|
-
style
|
|
118
|
-
template
|
|
119
|
-
}
|
|
120
|
-
tagIds
|
|
121
|
-
}
|
|
122
|
-
reference {
|
|
123
|
-
id
|
|
124
|
-
type
|
|
125
|
-
}
|
|
126
|
-
template {
|
|
127
|
-
category
|
|
128
|
-
description
|
|
129
|
-
help
|
|
130
|
-
icon
|
|
131
|
-
iconUrl
|
|
132
|
-
implicitly
|
|
133
|
-
label
|
|
134
|
-
publishedBy
|
|
135
|
-
tags
|
|
136
|
-
type
|
|
137
|
-
version
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
`;
|
|
143
|
-
|
|
144
|
-
export const QUERY_GET_CROSSACCOUNT = `query getCrossAccount($entity: EntityType!, $params: GetInput!, $accountId: String!) {
|
|
145
|
-
getCrossAccount(entity: $entity, params: $params, accountId: $accountId) {
|
|
146
|
-
... on Card {
|
|
147
|
-
id
|
|
148
|
-
schemaVersion
|
|
149
|
-
dateCreated
|
|
150
|
-
dateModified
|
|
151
|
-
data {
|
|
152
|
-
data
|
|
153
|
-
form {
|
|
154
|
-
code
|
|
155
|
-
data
|
|
156
|
-
style
|
|
157
|
-
template
|
|
158
|
-
}
|
|
159
|
-
presentation {
|
|
160
|
-
code
|
|
161
|
-
data
|
|
162
|
-
style
|
|
163
|
-
template
|
|
164
|
-
}
|
|
165
|
-
tagIds
|
|
166
|
-
}
|
|
167
|
-
reference {
|
|
168
|
-
id
|
|
169
|
-
type
|
|
170
|
-
}
|
|
171
|
-
template {
|
|
172
|
-
category
|
|
173
|
-
description
|
|
174
|
-
help
|
|
175
|
-
icon
|
|
176
|
-
iconUrl
|
|
177
|
-
implicitly
|
|
178
|
-
label
|
|
179
|
-
publishedBy
|
|
180
|
-
tags
|
|
181
|
-
type
|
|
182
|
-
version
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
`;
|
|
188
|
-
|
|
189
|
-
export const QUERY_CREATE = `mutation create($entity: EntityType!, $data: CreateInput!) {
|
|
190
|
-
create(entity: $entity, data: $data) {
|
|
191
|
-
... on Card {
|
|
192
|
-
id
|
|
193
|
-
schemaVersion
|
|
194
|
-
dateCreated
|
|
195
|
-
dateModified
|
|
196
|
-
data {
|
|
197
|
-
data
|
|
198
|
-
form {
|
|
199
|
-
code
|
|
200
|
-
data
|
|
201
|
-
style
|
|
202
|
-
template
|
|
203
|
-
}
|
|
204
|
-
presentation {
|
|
205
|
-
code
|
|
206
|
-
data
|
|
207
|
-
style
|
|
208
|
-
template
|
|
209
|
-
}
|
|
210
|
-
tagIds
|
|
211
|
-
}
|
|
212
|
-
reference {
|
|
213
|
-
id
|
|
214
|
-
type
|
|
215
|
-
}
|
|
216
|
-
template {
|
|
217
|
-
category
|
|
218
|
-
description
|
|
219
|
-
help
|
|
220
|
-
icon
|
|
221
|
-
iconUrl
|
|
222
|
-
implicitly
|
|
223
|
-
label
|
|
224
|
-
publishedBy
|
|
225
|
-
tags
|
|
226
|
-
type
|
|
227
|
-
version
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
`;
|
|
233
|
-
|
|
234
|
-
export const QUERY_CREATE_CROSSACCOUNT = `mutation createCrossAccount($entity: EntityType!, $data: CreateInput!, $accountId: String!) {
|
|
235
|
-
createCrossAccount(entity: $entity, data: $data, accountId: $accountId) {
|
|
236
|
-
... on Card {
|
|
237
|
-
id
|
|
238
|
-
schemaVersion
|
|
239
|
-
dateCreated
|
|
240
|
-
dateModified
|
|
241
|
-
data {
|
|
242
|
-
data
|
|
243
|
-
form {
|
|
244
|
-
code
|
|
245
|
-
data
|
|
246
|
-
style
|
|
247
|
-
template
|
|
248
|
-
}
|
|
249
|
-
presentation {
|
|
250
|
-
code
|
|
251
|
-
data
|
|
252
|
-
style
|
|
253
|
-
template
|
|
254
|
-
}
|
|
255
|
-
tagIds
|
|
256
|
-
}
|
|
257
|
-
reference {
|
|
258
|
-
id
|
|
259
|
-
type
|
|
260
|
-
}
|
|
261
|
-
template {
|
|
262
|
-
category
|
|
263
|
-
description
|
|
264
|
-
help
|
|
265
|
-
icon
|
|
266
|
-
iconUrl
|
|
267
|
-
implicitly
|
|
268
|
-
label
|
|
269
|
-
publishedBy
|
|
270
|
-
tags
|
|
271
|
-
type
|
|
272
|
-
version
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
`;
|
|
278
|
-
|
|
279
|
-
export const QUERY_UPDATE = `mutation update($entity: EntityType!, $data: UpdateInput!) {
|
|
280
|
-
update(entity: $entity, data: $data) {
|
|
281
|
-
... on Card {
|
|
282
|
-
id
|
|
283
|
-
schemaVersion
|
|
284
|
-
dateCreated
|
|
285
|
-
dateModified
|
|
286
|
-
data {
|
|
287
|
-
data
|
|
288
|
-
form {
|
|
289
|
-
code
|
|
290
|
-
data
|
|
291
|
-
style
|
|
292
|
-
template
|
|
293
|
-
}
|
|
294
|
-
presentation {
|
|
295
|
-
code
|
|
296
|
-
data
|
|
297
|
-
style
|
|
298
|
-
template
|
|
299
|
-
}
|
|
300
|
-
tagIds
|
|
301
|
-
}
|
|
302
|
-
reference {
|
|
303
|
-
id
|
|
304
|
-
type
|
|
305
|
-
}
|
|
306
|
-
template {
|
|
307
|
-
category
|
|
308
|
-
description
|
|
309
|
-
help
|
|
310
|
-
icon
|
|
311
|
-
iconUrl
|
|
312
|
-
implicitly
|
|
313
|
-
label
|
|
314
|
-
publishedBy
|
|
315
|
-
tags
|
|
316
|
-
type
|
|
317
|
-
version
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
`;
|
|
323
|
-
export const QUERY_UPDATE_CROSSACCOUNT = `mutation updateCrossAccount($entity: EntityType!, $data: UpdateInput!, $accountId: String!) {
|
|
324
|
-
updateCrossAccount(entity: $entity, data: $data, accountId: $accountId) {
|
|
325
|
-
... on Card {
|
|
326
|
-
id
|
|
327
|
-
schemaVersion
|
|
328
|
-
dateCreated
|
|
329
|
-
dateModified
|
|
330
|
-
data {
|
|
331
|
-
data
|
|
332
|
-
form {
|
|
333
|
-
code
|
|
334
|
-
data
|
|
335
|
-
style
|
|
336
|
-
template
|
|
337
|
-
}
|
|
338
|
-
presentation {
|
|
339
|
-
code
|
|
340
|
-
data
|
|
341
|
-
style
|
|
342
|
-
template
|
|
343
|
-
}
|
|
344
|
-
tagIds
|
|
345
|
-
}
|
|
346
|
-
reference {
|
|
347
|
-
id
|
|
348
|
-
type
|
|
349
|
-
}
|
|
350
|
-
template {
|
|
351
|
-
category
|
|
352
|
-
description
|
|
353
|
-
help
|
|
354
|
-
icon
|
|
355
|
-
iconUrl
|
|
356
|
-
implicitly
|
|
357
|
-
label
|
|
358
|
-
publishedBy
|
|
359
|
-
tags
|
|
360
|
-
type
|
|
361
|
-
version
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
`;
|
|
367
|
-
|
|
368
|
-
export const QUERY_DELETE = `mutation deleteTemporarily($entity: EntityType!, $data: DeleteInput!) {
|
|
369
|
-
deleteTemporarily(entity: $entity, data: $data) {
|
|
370
|
-
... on AsyncRequest {
|
|
371
|
-
requestId
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}`;
|
|
375
|
-
|
|
376
|
-
export const ENTITY_NAME = 'CARD';
|
|
1
|
+
export { DATA_HUB_SVC_SERVICE_KEY } from '@or-sdk/data-hub-svc';
|
package/src/types.ts
CHANGED
|
@@ -17,9 +17,9 @@ export type CardsConfig = {
|
|
|
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 Card = {
|
|
@@ -58,3 +58,17 @@ export type Card = {
|
|
|
58
58
|
reference?: string | null;
|
|
59
59
|
template?: string | null;
|
|
60
60
|
};
|
|
61
|
+
|
|
62
|
+
export type ListCardsParams = {
|
|
63
|
+
query?: {
|
|
64
|
+
[key: string]: unknown;
|
|
65
|
+
};
|
|
66
|
+
projection?: string[];
|
|
67
|
+
group?: string[];
|
|
68
|
+
sandbox?: boolean;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type PaginationOptions = {
|
|
72
|
+
limit?: number;
|
|
73
|
+
offset?: number;
|
|
74
|
+
};
|