@or-sdk/view-templates 1.2.2-next.578.0 → 1.2.3

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 (41) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/ViewTemplates.js +112 -46
  4. package/dist/cjs/ViewTemplates.js.map +1 -1
  5. package/dist/cjs/constants.js +58 -3
  6. package/dist/cjs/constants.js.map +1 -1
  7. package/dist/cjs/utils/getGetByIdQuery.js +10 -0
  8. package/dist/cjs/utils/getGetByIdQuery.js.map +1 -0
  9. package/dist/cjs/utils/getListQuery.js +10 -0
  10. package/dist/cjs/utils/getListQuery.js.map +1 -0
  11. package/dist/cjs/utils/index.js +5 -1
  12. package/dist/cjs/utils/index.js.map +1 -1
  13. package/dist/esm/ViewTemplates.js +87 -34
  14. package/dist/esm/ViewTemplates.js.map +1 -1
  15. package/dist/esm/constants.js +106 -1
  16. package/dist/esm/constants.js.map +1 -1
  17. package/dist/esm/utils/getGetByIdQuery.js +12 -0
  18. package/dist/esm/utils/getGetByIdQuery.js.map +1 -0
  19. package/dist/esm/utils/getListQuery.js +15 -0
  20. package/dist/esm/utils/getListQuery.js.map +1 -0
  21. package/dist/esm/utils/index.js +2 -0
  22. package/dist/esm/utils/index.js.map +1 -1
  23. package/dist/types/ViewTemplates.d.ts +8 -6
  24. package/dist/types/ViewTemplates.d.ts.map +1 -1
  25. package/dist/types/constants.d.ts +6 -1
  26. package/dist/types/constants.d.ts.map +1 -1
  27. package/dist/types/types.d.ts +28 -20
  28. package/dist/types/types.d.ts.map +1 -1
  29. package/dist/types/utils/getGetByIdQuery.d.ts +5 -0
  30. package/dist/types/utils/getGetByIdQuery.d.ts.map +1 -0
  31. package/dist/types/utils/getListQuery.d.ts +5 -0
  32. package/dist/types/utils/getListQuery.d.ts.map +1 -0
  33. package/dist/types/utils/index.d.ts +2 -0
  34. package/dist/types/utils/index.d.ts.map +1 -1
  35. package/package.json +5 -4
  36. package/src/ViewTemplates.ts +101 -50
  37. package/src/constants.ts +111 -1
  38. package/src/types.ts +32 -25
  39. package/src/utils/getGetByIdQuery.ts +13 -0
  40. package/src/utils/getListQuery.ts +16 -0
  41. package/src/utils/index.ts +2 -0
package/src/types.ts CHANGED
@@ -17,9 +17,39 @@ export type ViewTemplatesConfig = {
17
17
  accountId?: string;
18
18
 
19
19
  /**
20
- * Url of OneReach DataHubSvc api
20
+ * Url of OneReach DataHub api
21
21
  */
22
- dataHubSvcUrl?: string;
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[];
23
53
  };
24
54
 
25
55
  export type View = {
@@ -104,26 +134,3 @@ export type View = {
104
134
  template: null;
105
135
  deletedDate?: string;
106
136
  };
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
- };
@@ -0,0 +1,13 @@
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;
@@ -0,0 +1,16 @@
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;
@@ -2,4 +2,6 @@
2
2
  * @internal
3
3
  */
4
4
 
5
+ export { default as getListQuery } from './getListQuery';
6
+ export { default as getGetByIdQuery } from './getGetByIdQuery';
5
7
  export { default as getNewViewTemplate } from './getNewViewTemplate';