@or-sdk/view-templates 1.2.1 → 1.2.2-beta.557.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.
Files changed (40) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/ViewTemplates.js +46 -112
  3. package/dist/cjs/ViewTemplates.js.map +1 -1
  4. package/dist/cjs/constants.js +3 -58
  5. package/dist/cjs/constants.js.map +1 -1
  6. package/dist/cjs/utils/index.js +1 -5
  7. package/dist/cjs/utils/index.js.map +1 -1
  8. package/dist/esm/ViewTemplates.js +34 -87
  9. package/dist/esm/ViewTemplates.js.map +1 -1
  10. package/dist/esm/constants.js +1 -106
  11. package/dist/esm/constants.js.map +1 -1
  12. package/dist/esm/utils/index.js +0 -2
  13. package/dist/esm/utils/index.js.map +1 -1
  14. package/dist/types/ViewTemplates.d.ts +6 -8
  15. package/dist/types/ViewTemplates.d.ts.map +1 -1
  16. package/dist/types/constants.d.ts +1 -6
  17. package/dist/types/constants.d.ts.map +1 -1
  18. package/dist/types/types.d.ts +20 -28
  19. package/dist/types/types.d.ts.map +1 -1
  20. package/dist/types/utils/index.d.ts +0 -2
  21. package/dist/types/utils/index.d.ts.map +1 -1
  22. package/package.json +3 -4
  23. package/src/ViewTemplates.ts +50 -101
  24. package/src/constants.ts +1 -111
  25. package/src/types.ts +25 -32
  26. package/src/utils/index.ts +0 -2
  27. package/dist/cjs/utils/getGetByIdQuery.js +0 -10
  28. package/dist/cjs/utils/getGetByIdQuery.js.map +0 -1
  29. package/dist/cjs/utils/getListQuery.js +0 -10
  30. package/dist/cjs/utils/getListQuery.js.map +0 -1
  31. package/dist/esm/utils/getGetByIdQuery.js +0 -12
  32. package/dist/esm/utils/getGetByIdQuery.js.map +0 -1
  33. package/dist/esm/utils/getListQuery.js +0 -15
  34. package/dist/esm/utils/getListQuery.js.map +0 -1
  35. package/dist/types/utils/getGetByIdQuery.d.ts +0 -5
  36. package/dist/types/utils/getGetByIdQuery.d.ts.map +0 -1
  37. package/dist/types/utils/getListQuery.d.ts +0 -5
  38. package/dist/types/utils/getListQuery.d.ts.map +0 -1
  39. package/src/utils/getGetByIdQuery.ts +0 -13
  40. package/src/utils/getListQuery.ts +0 -16
@@ -1 +1 @@
1
- {"version":3,"file":"ViewTemplates.d.ts","sourceRoot":"","sources":["../../src/ViewTemplates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAE,yBAAyB,EAAE,uBAAuB,EAAE,IAAI,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAItH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAU;gBAEtB,MAAM,EAAE,mBAAmB;IAgB1B,iBAAiB,CAAC,MAAM,GAAE,uBAA4B,GAAG,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IAmC3F,mBAAmB,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,GAAE,yBAA8B,GAAG,OAAO,CAAC,YAAY,CAAC;IAqCnG,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IAgC7D,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,KAAK,GAAG,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;KAAE,CAAC;WA8BtE,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIjC"}
1
+ {"version":3,"file":"ViewTemplates.d.ts","sourceRoot":"","sources":["../../src/ViewTemplates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAY,MAAM,cAAc,CAAC;AAE9C,OAAO,EACL,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,IAAI,EACJ,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAGjB,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAa;gBAE5B,MAAM,EAAE,mBAAmB;IAiB1B,iBAAiB,CAAC,MAAM,GAAE,uBAA4B,EAAE,iBAAiB,GAAE,iBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAoBvH,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAgB9C,QAAQ,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,EAAE,OAAO,UAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAqB9F,OAAO,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,IAAI,CAAC;WAmB3E,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAIjC"}
@@ -1,7 +1,2 @@
1
- export { DATA_HUB_SERVICE_KEY } from '@or-sdk/data-hub';
2
- export declare const DEFAULT_PROJECTION_LIST: string[];
3
- export declare const DEFAULT_PROJECTION_GET_LIST: string[];
4
- export declare const QUERY_DOWNLOAD_TO = "mutation downloadTo($entity: TemplateType!, $data: DownloadInput!) {\n downloadTo(entity: $entity, data: $data) {\n ... on View {\n id\n cardIds\n linkId\n mirrorCardIds\n schemaVersion\n dateCreated\n dateModified\n data {\n data\n form {\n code\n data\n style\n template\n }\n presentation {\n code\n data\n style\n template\n }\n }\n linkType\n reference\n template {\n category\n description\n help\n icon\n iconUrl\n implicitly\n label\n publishedBy\n tags\n type\n version\n }\n deletedDate @include(if: false)\n }\n }\n}";
5
- export declare const QUERY_UPGRADE = "mutation upgrade($entity: TemplateType!, $id: String!, $options: UpgradeOptions) {\n upgrade(entity: $entity, id: $id, options: $options) {\n ... on View {\n id\n }\n }\n}\n";
6
- export declare const ENTITY_NAME = "VIEW";
1
+ export { DATA_HUB_SVC_SERVICE_KEY } from '@or-sdk/data-hub-svc';
7
2
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,eAAO,MAAM,uBAAuB,UAenC,CAAC;AAEF,eAAO,MAAM,2BAA2B,UAmCvC,CAAC;AAEF,eAAO,MAAM,iBAAiB,0xBA2C5B,CAAC;AAEH,eAAO,MAAM,aAAa,uMAOzB,CAAC;AAEF,eAAO,MAAM,WAAW,SAAS,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC"}
@@ -3,34 +3,7 @@ export declare type ViewTemplatesConfig = {
3
3
  token: Token;
4
4
  discoveryUrl?: string;
5
5
  accountId?: string;
6
- dataHubUrl?: string;
7
- };
8
- export declare type ViewTemplate = {
9
- id: string;
10
- template: {
11
- category: string;
12
- description: string;
13
- help: string | null;
14
- icon: string | null;
15
- iconUrl: string | null;
16
- implicitly: unknown | null;
17
- label: string;
18
- publishedBy: string;
19
- tags: string[] | null;
20
- type: unknown | null;
21
- version: string;
22
- };
23
- cardIds: string[];
24
- };
25
- export declare type ListViewTemplatesParams = {
26
- projection?: string[];
27
- limit?: number;
28
- queryParams?: {
29
- sourceId: string;
30
- };
31
- };
32
- export declare type GetViewTemplateByIdParams = {
33
- projection?: string[];
6
+ dataHubSvcUrl?: string;
34
7
  };
35
8
  export declare type View = {
36
9
  id?: string;
@@ -114,4 +87,23 @@ export declare type View = {
114
87
  template: null;
115
88
  deletedDate?: string;
116
89
  };
90
+ export declare type ListViewTemplatesParams = {
91
+ query?: {
92
+ [key: string]: unknown;
93
+ };
94
+ projection?: string[];
95
+ group?: string[];
96
+ sandbox?: boolean;
97
+ };
98
+ export declare type PaginationOptions = {
99
+ limit?: number;
100
+ offset?: number;
101
+ };
102
+ export declare type DownloadOptions = {
103
+ accountId?: string;
104
+ [key: string]: unknown;
105
+ };
106
+ export declare type UpgradeOptions = {
107
+ [key: string]: unknown;
108
+ };
117
109
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAErC,oBAAY,mBAAmB,GAAG;IAIhC,KAAK,EAAE,KAAK,CAAC;IAKb,YAAY,CAAC,EAAE,MAAM,CAAC;IAKtB,SAAS,CAAC,EAAE,MAAM,CAAC;IAKnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,oBAAY,YAAY,GAAG;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE;QACR,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;QACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;QACvB,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;QAC3B,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;QACtB,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;QACrB,OAAO,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,oBAAY,uBAAuB,GAAG;IACpC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE;QACZ,QAAQ,EAAE,MAA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C;aACxB,CAAC;YACF,KAAK,EAAE,MAAM,CAAC;YACd,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC;KACH,CAAC;IACF,QAAQ,EAAE,IAAI,CAAC;IACf,SAAS,EAAE,IAAI,CAAC;IAChB,QAAQ,EAAE,IAAI,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,oBAAY,uBAAuB,GAAG;IACpC,KAAK,CAAC,EAAE;QACN,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,oBAAY,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,eAAe,GAAG;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC;AAEF,oBAAY,cAAc,GAAG;IAC3B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB,CAAC"}
@@ -1,4 +1,2 @@
1
- export { default as getListQuery } from './getListQuery';
2
- export { default as getGetByIdQuery } from './getGetByIdQuery';
3
1
  export { default as getNewViewTemplate } from './getNewViewTemplate';
4
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.2.1",
2
+ "version": "1.2.2-beta.557.0",
3
3
  "name": "@or-sdk/view-templates",
4
4
  "main": "dist/cjs/index.js",
5
5
  "module": "dist/esm/index.js",
@@ -25,7 +25,6 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@or-sdk/base": "^0.26.3",
28
- "@or-sdk/data-hub": "^0.25.1"
29
- },
30
- "gitHead": "602563a1b681a196a8eb625896a44faa3359b6f5"
28
+ "@or-sdk/data-hub-svc": "^1.1.6-beta.557.0"
29
+ }
31
30
  }
@@ -1,19 +1,26 @@
1
- import { List } from '@or-sdk/base';
2
- import { DataHub, GraphqlResponse, OperationNames } from '@or-sdk/data-hub';
3
- import { GetViewTemplateByIdParams, ListViewTemplatesParams, View, ViewTemplate, ViewTemplatesConfig } from './types';
4
- import { getGetByIdQuery, getListQuery, getNewViewTemplate } from './utils';
5
- import { ENTITY_NAME, QUERY_DOWNLOAD_TO, QUERY_UPGRADE } from './constants';
1
+ import { List, makeList } from '@or-sdk/base';
2
+ import { DataHubSvc } from '@or-sdk/data-hub-svc';
3
+ import {
4
+ DownloadOptions,
5
+ ListViewTemplatesParams,
6
+ PaginationOptions,
7
+ UpgradeOptions,
8
+ View,
9
+ ViewTemplatesConfig,
10
+ } from './types';
11
+ import { getNewViewTemplate } from './utils';
6
12
 
7
13
  export class ViewTemplates {
8
- private readonly dataHub: DataHub;
14
+ private readonly dataHubSvc: DataHubSvc;
9
15
 
10
16
  constructor(params: ViewTemplatesConfig) {
11
- const { token, discoveryUrl, dataHubUrl } = params;
17
+ const { token, discoveryUrl, accountId, dataHubSvcUrl } = params;
12
18
 
13
- this.dataHub = new DataHub({
19
+ this.dataHubSvc = new DataHubSvc({
14
20
  token,
15
21
  discoveryUrl,
16
- dataHubUrl,
22
+ accountId,
23
+ dataHubSvcUrl,
17
24
  });
18
25
  }
19
26
 
@@ -23,33 +30,18 @@ export class ViewTemplates {
23
30
  * const result = await viewTemplates.listViewTemplates();
24
31
  * ```
25
32
  */
26
- public async listViewTemplates(params: ListViewTemplatesParams = {}): Promise<List<ViewTemplate>> {
27
- const { projection = [], ...varPrams } = params;
28
-
29
- const variables = {
30
- entity: ENTITY_NAME,
33
+ public async listViewTemplates(params: ListViewTemplatesParams = {}, paginationOptions: PaginationOptions = {}): Promise<List<View>> {
34
+ const result = await this.dataHubSvc.makeRequest<View[]>({
35
+ method: 'GET',
36
+ route: 'view-templates',
31
37
  params: {
32
- queryParams: {},
33
- limit: 30,
34
-
35
- // overrides
36
- ...varPrams,
38
+ ...params,
39
+ ...paginationOptions,
40
+ ... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
37
41
  },
38
- forceSandbox: false,
39
- sourceId: varPrams?.queryParams?.sourceId,
40
- };
41
-
42
- const operationName = this.dataHub.getOperationName(OperationNames.LIST_TEMPLATES);
43
-
44
- const data = {
45
- operationName,
46
- query: getListQuery({
47
- projection,
48
- }),
49
- variables,
50
- };
42
+ });
51
43
 
52
- return this.dataHub.getFullList<ViewTemplate>('POST', '/graphql', data);
44
+ return makeList<View>(result);
53
45
  }
54
46
 
55
47
  /**
@@ -58,35 +50,14 @@ export class ViewTemplates {
58
50
  * const result = await viewTemplates.getViewTemplateById('card-template-id');
59
51
  * ```
60
52
  */
61
- async getViewTemplateById(viewTemplateId: string, params: GetViewTemplateByIdParams = {}): Promise<ViewTemplate> {
62
- const { projection = [], ...varPrams } = params;
63
- const variables = {
64
- entity: ENTITY_NAME,
53
+ public async getViewTemplateById(id: string): Promise<View> {
54
+ return this.dataHubSvc.makeRequest<View>({
55
+ method: 'GET',
56
+ route: `view-templates/${id}`,
65
57
  params: {
66
- id: viewTemplateId,
67
-
68
- // overrides
69
- ...varPrams,
58
+ ... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
70
59
  },
71
- };
72
-
73
- const operationName = 'getTemplate';
74
-
75
- const data = {
76
- operationName,
77
- query: getGetByIdQuery({
78
- projection,
79
- }),
80
- variables,
81
- };
82
-
83
- const result = await this.dataHub.makeRequest<GraphqlResponse<ViewTemplate>>({
84
- method: 'POST',
85
- route: '/graphql',
86
- data,
87
60
  });
88
-
89
- return result.data[operationName] as ViewTemplate;
90
61
  }
91
62
 
92
63
  /**
@@ -95,30 +66,19 @@ export class ViewTemplates {
95
66
  * const result = await viewTemplates.download('view-template-id');
96
67
  * ```
97
68
  */
98
- public async download(viewTemplateId: string, options = {}): Promise<View> {
99
- const variables = {
100
- entity: ENTITY_NAME,
69
+ public async download(viewTemplateId: string, options: DownloadOptions = {}, sandbox = true): Promise<View> {
70
+ return this.dataHubSvc.makeRequest<View>({
71
+ method: 'PUT',
72
+ route: 'view-templates',
101
73
  data: {
102
- id: viewTemplateId,
103
- body: { ...options },
74
+ viewId: viewTemplateId,
75
+ options,
76
+ sandbox,
77
+ },
78
+ params: {
79
+ ... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
104
80
  },
105
- };
106
-
107
- const operationName = 'downloadTo';
108
-
109
- const data = {
110
- operationName,
111
- query: QUERY_DOWNLOAD_TO,
112
- variables,
113
- };
114
-
115
- const result = await this.dataHub.makeRequest<GraphqlResponse<View>>({
116
- method: 'POST',
117
- route: '/graphql',
118
- data,
119
81
  });
120
-
121
- return result.data[operationName] as View;
122
82
  }
123
83
 
124
84
  /**
@@ -127,28 +87,17 @@ export class ViewTemplates {
127
87
  * const result = await viewTemplates.upgrade('view-template-id');
128
88
  * ```
129
89
  */
130
- public async upgrade(viewTemplateId: string, options = {}): Promise<{ id: string; }> {
131
- const variables = {
132
- entity: ENTITY_NAME,
133
- id: viewTemplateId,
134
- options,
135
- };
136
-
137
- const operationName = 'upgrade';
138
-
139
- const data = {
140
- operationName,
141
- query: QUERY_UPGRADE,
142
- variables,
143
- };
144
-
145
- const result = await this.dataHub.makeRequest<GraphqlResponse<{ id: string; }>>({
146
- method: 'POST',
147
- route: '/graphql',
148
- data,
90
+ public async upgrade(viewTemplateId: string, options: UpgradeOptions = {}): Promise<View> {
91
+ return this.dataHubSvc.makeRequest<View>({
92
+ method: 'PATCH',
93
+ route: `view-templates/${viewTemplateId}`,
94
+ data: {
95
+ options,
96
+ },
97
+ params: {
98
+ ... this.dataHubSvc.isCrossAccount ? { accountId: this.dataHubSvc.currentAccountId } : {},
99
+ },
149
100
  });
150
-
151
- return result.data[operationName]!;
152
101
  }
153
102
 
154
103
  /**
package/src/constants.ts CHANGED
@@ -1,111 +1 @@
1
- export { DATA_HUB_SERVICE_KEY } from '@or-sdk/data-hub';
2
-
3
- export const DEFAULT_PROJECTION_LIST = [
4
- 'id',
5
- 'template',
6
- 'template.category',
7
- 'template.description',
8
- 'template.help',
9
- 'template.icon',
10
- 'template.iconUrl',
11
- 'template.implicitly',
12
- 'template.label',
13
- 'template.publishedBy',
14
- 'template.tags',
15
- 'template.type',
16
- 'template.version',
17
- 'cardIds',
18
- ];
19
-
20
- export const DEFAULT_PROJECTION_GET_LIST = [
21
- 'id',
22
- 'cardIds',
23
- 'linkId',
24
- 'mirrorCardIds',
25
- 'schemaVersion',
26
- 'dateCreated',
27
- 'dateModified',
28
- 'data',
29
- 'data.data',
30
- 'data.form',
31
- 'data.form.code',
32
- 'data.form.data',
33
- 'data.form.style',
34
- 'data.form.template',
35
- 'data.presentation',
36
- 'data.presentation.code',
37
- 'data.presentation.data',
38
- 'data.presentation.style',
39
- 'data.presentation.template',
40
- 'linkType',
41
- 'reference',
42
- 'template',
43
- 'template.category',
44
- 'template.description',
45
- 'template.help',
46
- 'template.icon',
47
- 'template.iconUrl',
48
- 'template.implicitly',
49
- 'template.label',
50
- 'template.publishedBy',
51
- 'template.tags',
52
- 'template.type',
53
- 'template.version',
54
- 'deletedDate @include(if: false)',
55
- ];
56
-
57
- export const QUERY_DOWNLOAD_TO = `mutation downloadTo($entity: TemplateType!, $data: DownloadInput!) {
58
- downloadTo(entity: $entity, data: $data) {
59
- ... on View {
60
- id
61
- cardIds
62
- linkId
63
- mirrorCardIds
64
- schemaVersion
65
- dateCreated
66
- dateModified
67
- data {
68
- data
69
- form {
70
- code
71
- data
72
- style
73
- template
74
- }
75
- presentation {
76
- code
77
- data
78
- style
79
- template
80
- }
81
- }
82
- linkType
83
- reference
84
- template {
85
- category
86
- description
87
- help
88
- icon
89
- iconUrl
90
- implicitly
91
- label
92
- publishedBy
93
- tags
94
- type
95
- version
96
- }
97
- deletedDate @include(if: false)
98
- }
99
- }
100
- }`;
101
-
102
- export const QUERY_UPGRADE = `mutation upgrade($entity: TemplateType!, $id: String!, $options: UpgradeOptions) {
103
- upgrade(entity: $entity, id: $id, options: $options) {
104
- ... on View {
105
- id
106
- }
107
- }
108
- }
109
- `;
110
-
111
- export const ENTITY_NAME = 'VIEW';
1
+ export { DATA_HUB_SVC_SERVICE_KEY } from '@or-sdk/data-hub-svc';
package/src/types.ts CHANGED
@@ -17,39 +17,9 @@ export type ViewTemplatesConfig = {
17
17
  accountId?: string;
18
18
 
19
19
  /**
20
- * Url of OneReach DataHub api
20
+ * Url of OneReach DataHubSvc api
21
21
  */
22
- dataHubUrl?: string;
23
- };
24
-
25
- export type ViewTemplate = {
26
- id: string;
27
- template: {
28
- category: string;
29
- description: string;
30
- help: string | null;
31
- icon: string | null;
32
- iconUrl: string | null;
33
- implicitly: unknown | null;
34
- label: string;
35
- publishedBy: string;
36
- tags: string[] | null;
37
- type: unknown | null;
38
- version: string;
39
- };
40
- cardIds: string[];
41
- };
42
-
43
- export type ListViewTemplatesParams = {
44
- projection?: string[];
45
- limit?: number;
46
- queryParams?: {
47
- sourceId: string;
48
- };
49
- };
50
-
51
- export type GetViewTemplateByIdParams = {
52
- projection?: string[];
22
+ dataHubSvcUrl?: string;
53
23
  };
54
24
 
55
25
  export type View = {
@@ -134,3 +104,26 @@ export type View = {
134
104
  template: null;
135
105
  deletedDate?: string;
136
106
  };
107
+
108
+ export type ListViewTemplatesParams = {
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
+ };
121
+
122
+ export type DownloadOptions = {
123
+ accountId?: string;
124
+ [key: string]: unknown;
125
+ };
126
+
127
+ export type UpgradeOptions = {
128
+ [key: string]: unknown;
129
+ };
@@ -2,6 +2,4 @@
2
2
  * @internal
3
3
  */
4
4
 
5
- export { default as getListQuery } from './getListQuery';
6
- export { default as getGetByIdQuery } from './getGetByIdQuery';
7
5
  export { default as getNewViewTemplate } from './getNewViewTemplate';
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var data_hub_1 = require("@or-sdk/data-hub");
4
- var constants_1 = require("../constants");
5
- function getGetByIdQuery(_a) {
6
- var _b = _a.projection, projection = _b === void 0 ? [] : _b;
7
- return "query getTemplate($entity: TemplateType!, $params: GetInput!, $sourceId: String) {\n getTemplate(entity: $entity, params: $params, sourceId: $sourceId) {\n ... on View {".concat((0, data_hub_1.getQueryProjectionPart)(projection.length ? projection : constants_1.DEFAULT_PROJECTION_GET_LIST), "\n }\n }\n}");
8
- }
9
- exports.default = getGetByIdQuery;
10
- //# sourceMappingURL=getGetByIdQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getGetByIdQuery.js","sourceRoot":"","sources":["../../../src/utils/getGetByIdQuery.ts"],"names":[],"mappings":";;AAAA,6CAA0D;AAC1D,0CAA2D;AAE3D,SAAS,eAAe,CAAC,EAA8C;QAA5C,kBAAe,EAAf,UAAU,mBAAG,EAAE,KAAA;IACxC,OAAO,uLAEU,IAAA,iCAAsB,EAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,uCAA2B,CAAC,oBAGrG,CAAC;AACH,CAAC;AAED,kBAAe,eAAe,CAAC"}
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var data_hub_1 = require("@or-sdk/data-hub");
4
- var constants_1 = require("../constants");
5
- function getListQuery(_a) {
6
- var _b = _a.projection, projection = _b === void 0 ? [] : _b;
7
- return "query listTemplates($entity: TemplateType!, $params: ListInput!, $sourceId: String, $forceSandbox: Boolean) {\n listTemplates(entity: $entity, params: $params, sourceId: $sourceId, forceSandbox: $forceSandbox) {\n records {\n ... on View {".concat((0, data_hub_1.getQueryProjectionPart)(projection.length ? projection : constants_1.DEFAULT_PROJECTION_LIST), "\n }\n }\n last\n }\n}");
8
- }
9
- exports.default = getListQuery;
10
- //# sourceMappingURL=getListQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getListQuery.js","sourceRoot":"","sources":["../../../src/utils/getListQuery.ts"],"names":[],"mappings":";;AAAA,6CAA0D;AAC1D,0CAAuD;AAEvD,SAAS,YAAY,CAAC,EAA8C;QAA5C,kBAAe,EAAf,UAAU,mBAAG,EAAE,KAAA;IACrC,OAAO,kQAGY,IAAA,iCAAsB,EAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,mCAAuB,CAAC,uCAKnG,CAAC;AACH,CAAC;AAED,kBAAe,YAAY,CAAC"}
@@ -1,12 +0,0 @@
1
- import { getQueryProjectionPart } from '@or-sdk/data-hub';
2
- import { DEFAULT_PROJECTION_GET_LIST } from '../constants';
3
- function getGetByIdQuery({ projection = [] }) {
4
- return `query getTemplate($entity: TemplateType!, $params: GetInput!, $sourceId: String) {
5
- getTemplate(entity: $entity, params: $params, sourceId: $sourceId) {
6
- ... on View {${getQueryProjectionPart(projection.length ? projection : DEFAULT_PROJECTION_GET_LIST)}
7
- }
8
- }
9
- }`;
10
- }
11
- export default getGetByIdQuery;
12
- //# sourceMappingURL=getGetByIdQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getGetByIdQuery.js","sourceRoot":"","sources":["../../../src/utils/getGetByIdQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAE3D,SAAS,eAAe,CAAC,EAAE,UAAU,GAAG,EAAE,EAA6B;IACrE,OAAO;;mBAEU,sBAAsB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,2BAA2B,CAAC;;;EAGrG,CAAC;AACH,CAAC;AAED,eAAe,eAAe,CAAC"}
@@ -1,15 +0,0 @@
1
- import { getQueryProjectionPart } from '@or-sdk/data-hub';
2
- import { DEFAULT_PROJECTION_LIST } from '../constants';
3
- function getListQuery({ projection = [] }) {
4
- return `query listTemplates($entity: TemplateType!, $params: ListInput!, $sourceId: String, $forceSandbox: Boolean) {
5
- listTemplates(entity: $entity, params: $params, sourceId: $sourceId, forceSandbox: $forceSandbox) {
6
- records {
7
- ... on View {${getQueryProjectionPart(projection.length ? projection : DEFAULT_PROJECTION_LIST)}
8
- }
9
- }
10
- last
11
- }
12
- }`;
13
- }
14
- export default getListQuery;
15
- //# sourceMappingURL=getListQuery.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getListQuery.js","sourceRoot":"","sources":["../../../src/utils/getListQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAEvD,SAAS,YAAY,CAAC,EAAE,UAAU,GAAG,EAAE,EAA6B;IAClE,OAAO;;;qBAGY,sBAAsB,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,uBAAuB,CAAC;;;;;EAKnG,CAAC;AACH,CAAC;AAED,eAAe,YAAY,CAAC"}
@@ -1,5 +0,0 @@
1
- declare function getGetByIdQuery({ projection }: {
2
- projection: string[];
3
- }): string;
4
- export default getGetByIdQuery;
5
- //# sourceMappingURL=getGetByIdQuery.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getGetByIdQuery.d.ts","sourceRoot":"","sources":["../../../src/utils/getGetByIdQuery.ts"],"names":[],"mappings":"AAGA,iBAAS,eAAe,CAAC,EAAE,UAAe,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,EAAE,CAAC;CAAE,GAAG,MAAM,CAO/E;AAED,eAAe,eAAe,CAAC"}
@@ -1,5 +0,0 @@
1
- declare function getListQuery({ projection }: {
2
- projection: string[];
3
- }): string;
4
- export default getListQuery;
5
- //# sourceMappingURL=getListQuery.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getListQuery.d.ts","sourceRoot":"","sources":["../../../src/utils/getListQuery.ts"],"names":[],"mappings":"AAGA,iBAAS,YAAY,CAAC,EAAE,UAAe,EAAE,EAAE;IAAE,UAAU,EAAE,MAAM,EAAE,CAAC;CAAE,GAAG,MAAM,CAU5E;AAED,eAAe,YAAY,CAAC"}
@@ -1,13 +0,0 @@
1
- import { getQueryProjectionPart } from '@or-sdk/data-hub';
2
- import { DEFAULT_PROJECTION_GET_LIST } from '../constants';
3
-
4
- function getGetByIdQuery({ projection = [] }: { projection: string[]; }): string {
5
- return `query getTemplate($entity: TemplateType!, $params: GetInput!, $sourceId: String) {
6
- getTemplate(entity: $entity, params: $params, sourceId: $sourceId) {
7
- ... on View {${getQueryProjectionPart(projection.length ? projection : DEFAULT_PROJECTION_GET_LIST)}
8
- }
9
- }
10
- }`;
11
- }
12
-
13
- export default getGetByIdQuery;
@@ -1,16 +0,0 @@
1
- import { getQueryProjectionPart } from '@or-sdk/data-hub';
2
- import { DEFAULT_PROJECTION_LIST } from '../constants';
3
-
4
- function getListQuery({ projection = [] }: { projection: string[]; }): string {
5
- return `query listTemplates($entity: TemplateType!, $params: ListInput!, $sourceId: String, $forceSandbox: Boolean) {
6
- listTemplates(entity: $entity, params: $params, sourceId: $sourceId, forceSandbox: $forceSandbox) {
7
- records {
8
- ... on View {${getQueryProjectionPart(projection.length ? projection : DEFAULT_PROJECTION_LIST)}
9
- }
10
- }
11
- last
12
- }
13
- }`;
14
- }
15
-
16
- export default getListQuery;