1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.getApplication = getApplication;
|
7 | exports.getApplicationSource = getApplicationSource;
|
8 | exports.getApplicationProtections = getApplicationProtections;
|
9 | exports.getApplicationProtectionsCount = getApplicationProtectionsCount;
|
10 | exports.getTemplates = getTemplates;
|
11 | exports.getApplications = getApplications;
|
12 | exports.getProtection = getProtection;
|
13 | var getApplicationDefaultFragments = '\n _id,\n name,\n createdAt,\n sources {\n _id,\n filename,\n extension\n }\n';
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | function getApplication(applicationId) {
|
22 | var fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getApplicationDefaultFragments;
|
23 | var params = arguments[2];
|
24 |
|
25 | return {
|
26 | query: '\n query getApplication ($applicationId: String!, $protectionsVersion: String, $protectionsLimit: Int) {\n application(_id: $applicationId, protectionsVersion: $protectionsVersion, protectionsLimit: $protectionsLimit) {\n ' + fragments + '\n }\n }\n ',
|
27 | params: JSON.stringify(Object.assign({
|
28 | applicationId: applicationId
|
29 | }, params))
|
30 | };
|
31 | }
|
32 |
|
33 | var getApplicationSourceDefaultFragments = '\n _id,\n filename,\n extension\n';
|
34 |
|
35 | function getApplicationSource(sourceId) {
|
36 | var fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getApplicationSourceDefaultFragments;
|
37 | var limits = arguments[2];
|
38 |
|
39 | return {
|
40 | query: '\n query getApplicationSource ($sourceId: String!, $contentLimit: Int, $transformedLimit: Int) {\n applicationSource(_id: $sourceId, contentLimit: $contentLimit, transformedLimit: $transformedLimit) {\n ' + fragments + '\n }\n }\n ',
|
41 | params: JSON.stringify(Object.assign({
|
42 | sourceId: sourceId
|
43 | }, limits))
|
44 | };
|
45 | }
|
46 |
|
47 | var getApplicationProtectionsDefaultFragments = '\n _id,\n sources,\n parameters,\n finishedAt,\n randomizationSeed\n';
|
48 |
|
49 | function getApplicationProtections(applicationId, params) {
|
50 | var fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getApplicationProtectionsDefaultFragments;
|
51 |
|
52 | return {
|
53 | query: '\n query getApplicationProtections ($applicationId: String!, $sort: String, $order: String, $limit: Int, $page: Int) {\n applicationProtections(_id: $applicationId, sort: $sort, order: $order, limit: $limit, page: $page) {\n ' + fragments + '\n }\n }\n ',
|
54 | params: JSON.stringify(Object.assign({
|
55 | applicationId: applicationId
|
56 | }, params))
|
57 | };
|
58 | }
|
59 |
|
60 | var getApplicationProtectionsCountDefaultFragments = '\n count\n';
|
61 |
|
62 | function getApplicationProtectionsCount(applicationId) {
|
63 | var fragments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : getApplicationProtectionsCountDefaultFragments;
|
64 |
|
65 | return {
|
66 | query: '\n query getApplicationProtectionsCount ($applicationId: String!) {\n applicationProtectionsCount(_id: $applicationId) {\n ' + fragments + '\n }\n }\n ',
|
67 | params: JSON.stringify({
|
68 | applicationId: applicationId
|
69 | })
|
70 | };
|
71 | }
|
72 |
|
73 | var getTemplatesDefaultFragments = '\n _id,\n parameters\n';
|
74 |
|
75 | function getTemplates() {
|
76 | var fragments = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getTemplatesDefaultFragments;
|
77 |
|
78 | return {
|
79 | query: '\n query getTemplates {\n templates {\n ' + fragments + '\n }\n }\n ',
|
80 | params: '{}'
|
81 | };
|
82 | }
|
83 |
|
84 | var getApplicationsDefaultFragments = '\n _id,\n name,\n protections,\n parameters\n';
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 | function getApplications() {
|
92 | var fragments = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getApplicationsDefaultFragments;
|
93 | var params = arguments[1];
|
94 |
|
95 | return {
|
96 | query: '\n query getApplications($protectionsVersion:String, $protectionsLimit: Int) {\n applications(protectionsVersion: $protectionsVersion, protectionsLimit: $protectionsLimit) {\n ' + fragments + '\n }\n }\n ',
|
97 | params: JSON.stringify(Object.assign({}, params))
|
98 | };
|
99 | }
|
100 |
|
101 | var getProtectionDefaultFragments = {
|
102 | application: '\n name\n ',
|
103 | applicationProtection: '\n _id,\n state,\n bail,\n deprecations {\n type,\n entity\n },\n errorMessage,\n sources {\n filename,\n errorMessages {\n message,\n line,\n column,\n fatal\n }\n }\n '
|
104 | };
|
105 |
|
106 | function getProtection(applicationId, protectionId) {
|
107 | var fragments = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : getProtectionDefaultFragments;
|
108 |
|
109 | return {
|
110 | query: '\n query getProtection ($applicationId: String!, $protectionId: String!) {\n application (_id: $applicationId) {\n ' + fragments.application + '\n }\n applicationProtection (_id: $protectionId) {\n ' + fragments.applicationProtection + '\n }\n }\n ',
|
111 | params: JSON.stringify({
|
112 | applicationId: applicationId,
|
113 | protectionId: protectionId
|
114 | })
|
115 | };
|
116 | } |
\ | No newline at end of file |