pict-section-form 1.0.77 → 1.0.78
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/package.json +1 -1
- package/harness/Harness.js +0 -118
- package/harness/package.json +0 -14
- package/harness/tsconfig.json +0 -16
package/package.json
CHANGED
package/harness/Harness.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const Pict = require('pict');
|
|
3
|
-
const Provider = require('../source/providers/inputs/Pict-Provider-Input-EntityBundleRequest.js');
|
|
4
|
-
|
|
5
|
-
const main = async (projectID) =>
|
|
6
|
-
{
|
|
7
|
-
const pict = new Pict({ RestClientURLPrefix: 'https://api.qa.headlight.com', PictDefaultURLPrefix: '/1.0/' });
|
|
8
|
-
pict.LogNoisiness = 1;
|
|
9
|
-
const preRequestOptions = pict.RestClient.prepareRequestOptions;
|
|
10
|
-
let token = '';
|
|
11
|
-
pict.RestClient.prepareRequestOptions = (pOptions) =>
|
|
12
|
-
{
|
|
13
|
-
if (!pOptions.headers)
|
|
14
|
-
{
|
|
15
|
-
pOptions.headers = { };
|
|
16
|
-
}
|
|
17
|
-
if (token)
|
|
18
|
-
{
|
|
19
|
-
pOptions.headers.Authorization = `Bearer ${token}`;
|
|
20
|
-
}
|
|
21
|
-
pict.log.info(`Requesting ${pOptions.url} with token ${token}`);
|
|
22
|
-
return preRequestOptions(pOptions);
|
|
23
|
-
};
|
|
24
|
-
await new Promise((resolve, reject) => pict.RestClient.postJSON({ url: '/1.0/Authenticate', body: { UserName: 'ladotd', Password: 'emerald guppy' } }, (err, response, result) =>
|
|
25
|
-
{
|
|
26
|
-
if (err)
|
|
27
|
-
{
|
|
28
|
-
return reject(err);
|
|
29
|
-
}
|
|
30
|
-
token = result.SessionID;
|
|
31
|
-
pict.log.info(`Received token ${token}`);
|
|
32
|
-
resolve(result);
|
|
33
|
-
}));
|
|
34
|
-
pict.AppData.IDProject = projectID;
|
|
35
|
-
const provider = pict.addProvider('EntityBundleRequest', {}, Provider);
|
|
36
|
-
await provider.gatherDataFromServer({},
|
|
37
|
-
{
|
|
38
|
-
PictForm:
|
|
39
|
-
{
|
|
40
|
-
EntitiesBundle:
|
|
41
|
-
[
|
|
42
|
-
{
|
|
43
|
-
"Entity": "Project",
|
|
44
|
-
"Filter": "FBV~IDProject~EQ~{~D:Record.Value.IDProject~}",
|
|
45
|
-
"Destination": "AppData.Project",
|
|
46
|
-
"SingleRecord": true
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"Entity": "Document",
|
|
50
|
-
"Filter": "FBV~IDProject~EQ~{~D:Record.Value.IDProject~}~FBV~DocumentType~EQ~LADOTD-PartialPayment~FSF~DocumentDate~DESC~0~FSF~IDDocument~DESC~0",
|
|
51
|
-
"Destination": "AppData.PaymentForms"
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"Entity": "Document",
|
|
55
|
-
"Filter": "FBV~IDProject~EQ~{~D:Record.Value.IDProject~}~FBV~DocumentType~EQ~ProjectProgressUpdate-LADOTD~FSF~DocumentDate~DESC~0~FSF~IDDocument~DESC~0",
|
|
56
|
-
"Destination": "AppData.ProgressForms"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"Entity": "Contract",
|
|
60
|
-
"Filter": "FBV~IDContract~EQ~{~D:AppData.Project.IDContract~}",
|
|
61
|
-
"Destination": "AppData.Contract"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
"Entity": "ContractDate",
|
|
65
|
-
"Filter": "FBV~IDContract~EQ~{~D:AppData.Project.IDContract~}~FBV~Hash~EQ~NTPD",
|
|
66
|
-
"Destination": "AppData.NTPDate",
|
|
67
|
-
"SingleRecord": true
|
|
68
|
-
},
|
|
69
|
-
{
|
|
70
|
-
"Entity": "LineItem",
|
|
71
|
-
"Filter": "FBV~IDProject~EQ~{~D:Record.Value.IDProject~}",
|
|
72
|
-
"Destination": "AppData.LineItems"
|
|
73
|
-
},
|
|
74
|
-
]
|
|
75
|
-
}
|
|
76
|
-
}, { IDProject: projectID });
|
|
77
|
-
const data =
|
|
78
|
-
{
|
|
79
|
-
ProjectID: pict.AppData.Project.IDProject,
|
|
80
|
-
ContractID: pict.AppData.Project.IDContract,
|
|
81
|
-
Project: pict.AppData.Project.Name,
|
|
82
|
-
ContractedDays: pict.AppData.Project.ContractedDays,
|
|
83
|
-
SumOfLineItemAmounts: pict.AppData.LineItems.reduce((sum, lineItem) => sum + lineItem.ExpectedQuantity * lineItem.CostPerUnit, 0),
|
|
84
|
-
TotalBidAmount: pict.AppData.Contract.TotalBidAmount,
|
|
85
|
-
NetChangeOrderAmount: pict.AppData.Contract.NetChangeOrderAmount,
|
|
86
|
-
NTPDate: pict.AppData.NTPDate ? pict.AppData.NTPDate.Date : null,
|
|
87
|
-
};
|
|
88
|
-
if (pict.AppData.PaymentForms.length > 0)
|
|
89
|
-
{
|
|
90
|
-
data.PaymentDaysTotalPaidIncludingThisPayment = pict.AppData.PaymentForms[0].FormData.PaymentDaysTotalPaidIncludingThisPayment;
|
|
91
|
-
data.WorkingDaysTotal = pict.AppData.PaymentForms[0].FormData.WorkingDaysTotal;
|
|
92
|
-
for (const total of pict.AppData.PaymentForms[0].FormData.Totals)
|
|
93
|
-
{
|
|
94
|
-
if (total.name == 'Grand Total Paid to Date this Contract - Including this Payment')
|
|
95
|
-
{
|
|
96
|
-
data.PaidTotal = total.amount;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (pict.AppData.ProgressForms.length > 0)
|
|
101
|
-
{
|
|
102
|
-
const progressData = pict.AppData.ProgressForms[0].FormData?.EstimatedCompletion;
|
|
103
|
-
if (progressData)
|
|
104
|
-
{
|
|
105
|
-
data.EstimatedCompletionDate = `${progressData.Month}, ${progressData.Year}`;
|
|
106
|
-
data.ECDNotes = progressData.Notes;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
pict.log.info('Data gathered from server', data);
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
main(7323).then(() =>
|
|
113
|
-
{
|
|
114
|
-
console.info('Done');
|
|
115
|
-
}).catch((err) =>
|
|
116
|
-
{
|
|
117
|
-
console.error(err);
|
|
118
|
-
});
|
package/harness/package.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "harness",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"main": "Harness.js",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
|
-
},
|
|
8
|
-
"author": "",
|
|
9
|
-
"license": "ISC",
|
|
10
|
-
"description": "",
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"pict": "^1.0.241"
|
|
13
|
-
}
|
|
14
|
-
}
|
package/harness/tsconfig.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"include": ["*.js", "../source"],
|
|
3
|
-
"compilerOptions":
|
|
4
|
-
{
|
|
5
|
-
"target": "es2019",
|
|
6
|
-
"esModuleInterop": true,
|
|
7
|
-
"allowJs": true,
|
|
8
|
-
"checkJs": true,
|
|
9
|
-
"declaration": true,
|
|
10
|
-
"emitDeclarationOnly": true,
|
|
11
|
-
"outDir": "types",
|
|
12
|
-
"declarationMap": true,
|
|
13
|
-
"module": "commonjs",
|
|
14
|
-
"resolveJsonModule": true
|
|
15
|
-
}
|
|
16
|
-
}
|