@things-factory/survey 0.0.0-stage → 10.1.314
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/dist-client/index.d.ts +1 -0
- package/dist-client/index.js +2 -0
- package/dist-client/pages/my-surveys.d.ts +24 -0
- package/dist-client/pages/my-surveys.js +256 -0
- package/dist-client/pages/survey-editor.d.ts +62 -0
- package/dist-client/pages/survey-editor.js +668 -0
- package/dist-client/pages/survey-list.d.ts +15 -0
- package/dist-client/pages/survey-list.js +150 -0
- package/dist-client/pages/survey-trustee.d.ts +21 -0
- package/dist-client/pages/survey-trustee.js +170 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +17 -0
- package/dist-client/utils/survey-api.d.ts +16 -0
- package/dist-client/utils/survey-api.js +46 -0
- package/dist-client/utils/survey-result.d.ts +4 -0
- package/dist-client/utils/survey-result.js +79 -0
- package/dist-client/utils/survey-secret.d.ts +40 -0
- package/dist-client/utils/survey-secret.js +154 -0
- package/dist-server/index.d.ts +2 -0
- package/dist-server/index.js +27 -0
- package/dist-server/role-tasks.d.ts +2 -0
- package/dist-server/role-tasks.js +16 -0
- package/dist-server/service/index.d.ts +16 -0
- package/dist-server/service/index.js +30 -0
- package/dist-server/service/refusal.d.ts +57 -0
- package/dist-server/service/refusal.js +66 -0
- package/dist-server/service/survey/ballot-route.d.ts +1 -0
- package/dist-server/service/survey/ballot-route.js +30 -0
- package/dist-server/service/survey/ballot-worker.d.ts +1 -0
- package/dist-server/service/survey/ballot-worker.js +19 -0
- package/dist-server/service/survey/index.d.ts +10 -0
- package/dist-server/service/survey/index.js +14 -0
- package/dist-server/service/survey/survey-answer.d.ts +23 -0
- package/dist-server/service/survey/survey-answer.js +99 -0
- package/dist-server/service/survey/survey-attributes.d.ts +16 -0
- package/dist-server/service/survey/survey-attributes.js +39 -0
- package/dist-server/service/survey/survey-ballot.d.ts +14 -0
- package/dist-server/service/survey/survey-ballot.js +61 -0
- package/dist-server/service/survey/survey-class-key.d.ts +20 -0
- package/dist-server/service/survey/survey-class-key.js +92 -0
- package/dist-server/service/survey/survey-question.d.ts +27 -0
- package/dist-server/service/survey/survey-question.js +113 -0
- package/dist-server/service/survey/survey-resolver.d.ts +37 -0
- package/dist-server/service/survey/survey-resolver.js +492 -0
- package/dist-server/service/survey/survey-respondent.d.ts +17 -0
- package/dist-server/service/survey/survey-respondent.js +81 -0
- package/dist-server/service/survey/survey-rules.d.ts +169 -0
- package/dist-server/service/survey/survey-rules.js +299 -0
- package/dist-server/service/survey/survey-secret.d.ts +133 -0
- package/dist-server/service/survey/survey-secret.js +347 -0
- package/dist-server/service/survey/survey-service.d.ts +83 -0
- package/dist-server/service/survey/survey-service.js +384 -0
- package/dist-server/service/survey/survey-trustee.d.ts +25 -0
- package/dist-server/service/survey/survey-trustee.js +119 -0
- package/dist-server/service/survey/survey-types.d.ts +91 -0
- package/dist-server/service/survey/survey-types.js +319 -0
- package/dist-server/service/survey/survey.d.ts +47 -0
- package/dist-server/service/survey/survey.js +214 -0
- package/dist-shared/ballot.d.ts +54 -0
- package/dist-shared/ballot.js +146 -0
- package/dist-shared/blind-rsa.d.ts +18 -0
- package/dist-shared/blind-rsa.js +127 -0
- package/dist-shared/elgamal.d.ts +20 -0
- package/dist-shared/elgamal.js +54 -0
- package/dist-shared/group.d.ts +22 -0
- package/dist-shared/group.js +112 -0
- package/dist-shared/proofs.d.ts +20 -0
- package/dist-shared/proofs.js +94 -0
- package/dist-shared/threshold.d.ts +39 -0
- package/dist-shared/threshold.js +98 -0
- package/dist-shared/verify.d.ts +13 -0
- package/dist-shared/verify.js +73 -0
- package/package.json +63 -4
- package/things-factory.config.js +15 -0
- package/translations/en.json +202 -0
- package/translations/es.json +202 -0
- package/translations/ja.json +202 -0
- package/translations/ko.json +202 -0
- package/translations/ms.json +202 -0
- package/translations/zh.json +202 -0
- package/README.md +0 -3
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MyTrusteeSurvey = exports.SurveyBallotKit = exports.SurveyAttributeInfo = exports.SurveyAudienceChoices = exports.SurveyChoice = exports.MySurvey = exports.SurveyAnswerSheet = exports.SurveyDetail = exports.SurveyAnswerInput = exports.SurveyQuestionInput = exports.SurveyPatch = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const type_graphql_1 = require("type-graphql");
|
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
|
+
const survey_1 = require("./survey");
|
|
8
|
+
const survey_question_1 = require("./survey-question");
|
|
9
|
+
let SurveyPatch = class SurveyPatch {
|
|
10
|
+
};
|
|
11
|
+
exports.SurveyPatch = SurveyPatch;
|
|
12
|
+
tslib_1.__decorate([
|
|
13
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The title respondents see' }),
|
|
14
|
+
tslib_1.__metadata("design:type", String)
|
|
15
|
+
], SurveyPatch.prototype, "name", void 0);
|
|
16
|
+
tslib_1.__decorate([
|
|
17
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'What the survey is for and how its result is used' }),
|
|
18
|
+
tslib_1.__metadata("design:type", String)
|
|
19
|
+
], SurveyPatch.prototype, "description", void 0);
|
|
20
|
+
tslib_1.__decorate([
|
|
21
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'NAMED or SECRET' }),
|
|
22
|
+
tslib_1.__metadata("design:type", String)
|
|
23
|
+
], SurveyPatch.prototype, "level", void 0);
|
|
24
|
+
tslib_1.__decorate([
|
|
25
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'Whom it asks - [{ scope, targetId }]' }),
|
|
26
|
+
tslib_1.__metadata("design:type", Array)
|
|
27
|
+
], SurveyPatch.prototype, "audience", void 0);
|
|
28
|
+
tslib_1.__decorate([
|
|
29
|
+
(0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'People the audience names who are not asked' }),
|
|
30
|
+
tslib_1.__metadata("design:type", Array)
|
|
31
|
+
], SurveyPatch.prototype, "excludedUserIds", void 0);
|
|
32
|
+
tslib_1.__decorate([
|
|
33
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The day respondent attributes are read on - YYYY-MM-DD' }),
|
|
34
|
+
tslib_1.__metadata("design:type", String)
|
|
35
|
+
], SurveyPatch.prototype, "basisDate", void 0);
|
|
36
|
+
tslib_1.__decorate([
|
|
37
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it closes' }),
|
|
38
|
+
tslib_1.__metadata("design:type", Date)
|
|
39
|
+
], SurveyPatch.prototype, "closesAt", void 0);
|
|
40
|
+
tslib_1.__decorate([
|
|
41
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Who reads the published result - RESPONDENTS or OPERATORS' }),
|
|
42
|
+
tslib_1.__metadata("design:type", String)
|
|
43
|
+
], SurveyPatch.prototype, "resultReaders", void 0);
|
|
44
|
+
tslib_1.__decorate([
|
|
45
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'WEIGHTED or UNWEIGHTED - the one set published when weighted' }),
|
|
46
|
+
tslib_1.__metadata("design:type", String)
|
|
47
|
+
], SurveyPatch.prototype, "publishedFigure", void 0);
|
|
48
|
+
tslib_1.__decorate([
|
|
49
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'The smallest group a published figure may come from (a named survey)' }),
|
|
50
|
+
tslib_1.__metadata("design:type", Number)
|
|
51
|
+
], SurveyPatch.prototype, "minGroup", void 0);
|
|
52
|
+
tslib_1.__decorate([
|
|
53
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'The weight classes - { classes: [{ key, label, when: [{ attribute, equals | atLeast | below }], rate }] }' }),
|
|
54
|
+
tslib_1.__metadata("design:type", Object)
|
|
55
|
+
], SurveyPatch.prototype, "weighting", void 0);
|
|
56
|
+
tslib_1.__decorate([
|
|
57
|
+
(0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'A secret survey - its key holders, in order' }),
|
|
58
|
+
tslib_1.__metadata("design:type", Array)
|
|
59
|
+
], SurveyPatch.prototype, "trusteeUserIds", void 0);
|
|
60
|
+
tslib_1.__decorate([
|
|
61
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'A secret survey - how many key holders it takes to decrypt' }),
|
|
62
|
+
tslib_1.__metadata("design:type", Number)
|
|
63
|
+
], SurveyPatch.prototype, "trusteeThreshold", void 0);
|
|
64
|
+
tslib_1.__decorate([
|
|
65
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'Publish only the top this many choices' }),
|
|
66
|
+
tslib_1.__metadata("design:type", Number)
|
|
67
|
+
], SurveyPatch.prototype, "publishTop", void 0);
|
|
68
|
+
tslib_1.__decorate([
|
|
69
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'With publishTop - publish the top places with their figures' }),
|
|
70
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
71
|
+
], SurveyPatch.prototype, "publishTopFigures", void 0);
|
|
72
|
+
tslib_1.__decorate([
|
|
73
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The round before' }),
|
|
74
|
+
tslib_1.__metadata("design:type", String)
|
|
75
|
+
], SurveyPatch.prototype, "followsSurveyId", void 0);
|
|
76
|
+
tslib_1.__decorate([
|
|
77
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'How many choices to take from the round before' }),
|
|
78
|
+
tslib_1.__metadata("design:type", Number)
|
|
79
|
+
], SurveyPatch.prototype, "carryTop", void 0);
|
|
80
|
+
tslib_1.__decorate([
|
|
81
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'How far down the round before a withdrawn choice may be followed' }),
|
|
82
|
+
tslib_1.__metadata("design:type", Number)
|
|
83
|
+
], SurveyPatch.prototype, "successionDepth", void 0);
|
|
84
|
+
tslib_1.__decorate([
|
|
85
|
+
(0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'The choices of the round before that withdrew' }),
|
|
86
|
+
tslib_1.__metadata("design:type", Array)
|
|
87
|
+
], SurveyPatch.prototype, "withdrawnKeys", void 0);
|
|
88
|
+
exports.SurveyPatch = SurveyPatch = tslib_1.__decorate([
|
|
89
|
+
(0, type_graphql_1.InputType)({ description: 'What to set on a draft survey - only the given fields change' })
|
|
90
|
+
], SurveyPatch);
|
|
91
|
+
let SurveyQuestionInput = class SurveyQuestionInput {
|
|
92
|
+
};
|
|
93
|
+
exports.SurveyQuestionInput = SurveyQuestionInput;
|
|
94
|
+
tslib_1.__decorate([
|
|
95
|
+
(0, type_graphql_1.Field)({ description: 'SINGLE, MULTI, SCALE or ALLOCATE' }),
|
|
96
|
+
tslib_1.__metadata("design:type", String)
|
|
97
|
+
], SurveyQuestionInput.prototype, "kind", void 0);
|
|
98
|
+
tslib_1.__decorate([
|
|
99
|
+
(0, type_graphql_1.Field)({ description: 'What is asked' }),
|
|
100
|
+
tslib_1.__metadata("design:type", String)
|
|
101
|
+
], SurveyQuestionInput.prototype, "prompt", void 0);
|
|
102
|
+
tslib_1.__decorate([
|
|
103
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'The choices - [{ key, label }]' }),
|
|
104
|
+
tslib_1.__metadata("design:type", Array)
|
|
105
|
+
], SurveyQuestionInput.prototype, "options", void 0);
|
|
106
|
+
tslib_1.__decorate([
|
|
107
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'MULTI - how many may be chosen at most' }),
|
|
108
|
+
tslib_1.__metadata("design:type", Number)
|
|
109
|
+
], SurveyQuestionInput.prototype, "maxPicks", void 0);
|
|
110
|
+
tslib_1.__decorate([
|
|
111
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'SCALE - the lowest value' }),
|
|
112
|
+
tslib_1.__metadata("design:type", Number)
|
|
113
|
+
], SurveyQuestionInput.prototype, "scaleMin", void 0);
|
|
114
|
+
tslib_1.__decorate([
|
|
115
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'SCALE - the highest value' }),
|
|
116
|
+
tslib_1.__metadata("design:type", Number)
|
|
117
|
+
], SurveyQuestionInput.prototype, "scaleMax", void 0);
|
|
118
|
+
tslib_1.__decorate([
|
|
119
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'ALLOCATE - what the shares add up to' }),
|
|
120
|
+
tslib_1.__metadata("design:type", Number)
|
|
121
|
+
], SurveyQuestionInput.prototype, "allocateTotal", void 0);
|
|
122
|
+
exports.SurveyQuestionInput = SurveyQuestionInput = tslib_1.__decorate([
|
|
123
|
+
(0, type_graphql_1.InputType)({ description: 'A question of a draft survey' })
|
|
124
|
+
], SurveyQuestionInput);
|
|
125
|
+
let SurveyAnswerInput = class SurveyAnswerInput {
|
|
126
|
+
};
|
|
127
|
+
exports.SurveyAnswerInput = SurveyAnswerInput;
|
|
128
|
+
tslib_1.__decorate([
|
|
129
|
+
(0, type_graphql_1.Field)({ description: 'The question' }),
|
|
130
|
+
tslib_1.__metadata("design:type", String)
|
|
131
|
+
], SurveyAnswerInput.prototype, "questionId", void 0);
|
|
132
|
+
tslib_1.__decorate([
|
|
133
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { description: '{ pick }, { picks }, { value } or { shares }' }),
|
|
134
|
+
tslib_1.__metadata("design:type", Object)
|
|
135
|
+
], SurveyAnswerInput.prototype, "value", void 0);
|
|
136
|
+
exports.SurveyAnswerInput = SurveyAnswerInput = tslib_1.__decorate([
|
|
137
|
+
(0, type_graphql_1.InputType)({ description: 'An answer to one question' })
|
|
138
|
+
], SurveyAnswerInput);
|
|
139
|
+
let SurveyDetail = class SurveyDetail {
|
|
140
|
+
};
|
|
141
|
+
exports.SurveyDetail = SurveyDetail;
|
|
142
|
+
tslib_1.__decorate([
|
|
143
|
+
(0, type_graphql_1.Field)(type => survey_1.Survey, { description: 'The survey' }),
|
|
144
|
+
tslib_1.__metadata("design:type", survey_1.Survey)
|
|
145
|
+
], SurveyDetail.prototype, "survey", void 0);
|
|
146
|
+
tslib_1.__decorate([
|
|
147
|
+
(0, type_graphql_1.Field)(type => [survey_question_1.SurveyQuestion], { description: 'Its questions in order' }),
|
|
148
|
+
tslib_1.__metadata("design:type", Array)
|
|
149
|
+
], SurveyDetail.prototype, "questions", void 0);
|
|
150
|
+
tslib_1.__decorate([
|
|
151
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'How many it asks' }),
|
|
152
|
+
tslib_1.__metadata("design:type", Number)
|
|
153
|
+
], SurveyDetail.prototype, "askedCount", void 0);
|
|
154
|
+
tslib_1.__decorate([
|
|
155
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'How many used their turn' }),
|
|
156
|
+
tslib_1.__metadata("design:type", Number)
|
|
157
|
+
], SurveyDetail.prototype, "takenCount", void 0);
|
|
158
|
+
tslib_1.__decorate([
|
|
159
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'The count, once counted' }),
|
|
160
|
+
tslib_1.__metadata("design:type", Object)
|
|
161
|
+
], SurveyDetail.prototype, "result", void 0);
|
|
162
|
+
tslib_1.__decorate([
|
|
163
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'What was published' }),
|
|
164
|
+
tslib_1.__metadata("design:type", Object)
|
|
165
|
+
], SurveyDetail.prototype, "published", void 0);
|
|
166
|
+
exports.SurveyDetail = SurveyDetail = tslib_1.__decorate([
|
|
167
|
+
(0, type_graphql_1.ObjectType)({ description: 'A survey as its operators see it - its questions, how many were asked and answered, its count' })
|
|
168
|
+
], SurveyDetail);
|
|
169
|
+
let SurveyAnswerSheet = class SurveyAnswerSheet {
|
|
170
|
+
};
|
|
171
|
+
exports.SurveyAnswerSheet = SurveyAnswerSheet;
|
|
172
|
+
tslib_1.__decorate([
|
|
173
|
+
(0, type_graphql_1.Field)({ description: 'The person' }),
|
|
174
|
+
tslib_1.__metadata("design:type", String)
|
|
175
|
+
], SurveyAnswerSheet.prototype, "userId", void 0);
|
|
176
|
+
tslib_1.__decorate([
|
|
177
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Their name' }),
|
|
178
|
+
tslib_1.__metadata("design:type", String)
|
|
179
|
+
], SurveyAnswerSheet.prototype, "name", void 0);
|
|
180
|
+
tslib_1.__decorate([
|
|
181
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { description: 'Their answers by question id' }),
|
|
182
|
+
tslib_1.__metadata("design:type", Object)
|
|
183
|
+
], SurveyAnswerSheet.prototype, "answers", void 0);
|
|
184
|
+
exports.SurveyAnswerSheet = SurveyAnswerSheet = tslib_1.__decorate([
|
|
185
|
+
(0, type_graphql_1.ObjectType)({ description: 'One person’s answers to a named survey' })
|
|
186
|
+
], SurveyAnswerSheet);
|
|
187
|
+
let MySurvey = class MySurvey {
|
|
188
|
+
};
|
|
189
|
+
exports.MySurvey = MySurvey;
|
|
190
|
+
tslib_1.__decorate([
|
|
191
|
+
(0, type_graphql_1.Field)(type => survey_1.Survey, { description: 'The survey' }),
|
|
192
|
+
tslib_1.__metadata("design:type", survey_1.Survey)
|
|
193
|
+
], MySurvey.prototype, "survey", void 0);
|
|
194
|
+
tslib_1.__decorate([
|
|
195
|
+
(0, type_graphql_1.Field)({ description: 'Whether I used my turn' }),
|
|
196
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
197
|
+
], MySurvey.prototype, "taken", void 0);
|
|
198
|
+
tslib_1.__decorate([
|
|
199
|
+
(0, type_graphql_1.Field)(type => [survey_question_1.SurveyQuestion], { description: 'Its questions - while I may answer, and with a result I may read' }),
|
|
200
|
+
tslib_1.__metadata("design:type", Array)
|
|
201
|
+
], MySurvey.prototype, "questions", void 0);
|
|
202
|
+
tslib_1.__decorate([
|
|
203
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'Its published result, when I am one of its readers' }),
|
|
204
|
+
tslib_1.__metadata("design:type", Object)
|
|
205
|
+
], MySurvey.prototype, "published", void 0);
|
|
206
|
+
exports.MySurvey = MySurvey = tslib_1.__decorate([
|
|
207
|
+
(0, type_graphql_1.ObjectType)({ description: 'A survey that asks me' })
|
|
208
|
+
], MySurvey);
|
|
209
|
+
let SurveyChoice = class SurveyChoice {
|
|
210
|
+
};
|
|
211
|
+
exports.SurveyChoice = SurveyChoice;
|
|
212
|
+
tslib_1.__decorate([
|
|
213
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Its id' }),
|
|
214
|
+
tslib_1.__metadata("design:type", String)
|
|
215
|
+
], SurveyChoice.prototype, "id", void 0);
|
|
216
|
+
tslib_1.__decorate([
|
|
217
|
+
(0, type_graphql_1.Field)({ description: 'Its name' }),
|
|
218
|
+
tslib_1.__metadata("design:type", String)
|
|
219
|
+
], SurveyChoice.prototype, "name", void 0);
|
|
220
|
+
exports.SurveyChoice = SurveyChoice = tslib_1.__decorate([
|
|
221
|
+
(0, type_graphql_1.ObjectType)({ description: 'A choice of whom a survey asks' })
|
|
222
|
+
], SurveyChoice);
|
|
223
|
+
let SurveyAudienceChoices = class SurveyAudienceChoices {
|
|
224
|
+
};
|
|
225
|
+
exports.SurveyAudienceChoices = SurveyAudienceChoices;
|
|
226
|
+
tslib_1.__decorate([
|
|
227
|
+
(0, type_graphql_1.Field)({ description: 'The domain - asking it asks everyone working here' }),
|
|
228
|
+
tslib_1.__metadata("design:type", String)
|
|
229
|
+
], SurveyAudienceChoices.prototype, "domainId", void 0);
|
|
230
|
+
tslib_1.__decorate([
|
|
231
|
+
(0, type_graphql_1.Field)(type => [SurveyChoice], { description: 'Departments' }),
|
|
232
|
+
tslib_1.__metadata("design:type", Array)
|
|
233
|
+
], SurveyAudienceChoices.prototype, "departments", void 0);
|
|
234
|
+
tslib_1.__decorate([
|
|
235
|
+
(0, type_graphql_1.Field)(type => [SurveyChoice], { description: 'Roles' }),
|
|
236
|
+
tslib_1.__metadata("design:type", Array)
|
|
237
|
+
], SurveyAudienceChoices.prototype, "roles", void 0);
|
|
238
|
+
tslib_1.__decorate([
|
|
239
|
+
(0, type_graphql_1.Field)(type => [SurveyChoice], { description: 'People working here' }),
|
|
240
|
+
tslib_1.__metadata("design:type", Array)
|
|
241
|
+
], SurveyAudienceChoices.prototype, "people", void 0);
|
|
242
|
+
exports.SurveyAudienceChoices = SurveyAudienceChoices = tslib_1.__decorate([
|
|
243
|
+
(0, type_graphql_1.ObjectType)({ description: 'The departments, roles and people a survey can ask' })
|
|
244
|
+
], SurveyAudienceChoices);
|
|
245
|
+
let SurveyAttributeInfo = class SurveyAttributeInfo {
|
|
246
|
+
};
|
|
247
|
+
exports.SurveyAttributeInfo = SurveyAttributeInfo;
|
|
248
|
+
tslib_1.__decorate([
|
|
249
|
+
(0, type_graphql_1.Field)({ description: 'The name a condition uses' }),
|
|
250
|
+
tslib_1.__metadata("design:type", String)
|
|
251
|
+
], SurveyAttributeInfo.prototype, "name", void 0);
|
|
252
|
+
tslib_1.__decorate([
|
|
253
|
+
(0, type_graphql_1.Field)({ description: 'A translation key for its label' }),
|
|
254
|
+
tslib_1.__metadata("design:type", String)
|
|
255
|
+
], SurveyAttributeInfo.prototype, "label", void 0);
|
|
256
|
+
tslib_1.__decorate([
|
|
257
|
+
(0, type_graphql_1.Field)({ description: 'boolean or number' }),
|
|
258
|
+
tslib_1.__metadata("design:type", String)
|
|
259
|
+
], SurveyAttributeInfo.prototype, "type", void 0);
|
|
260
|
+
exports.SurveyAttributeInfo = SurveyAttributeInfo = tslib_1.__decorate([
|
|
261
|
+
(0, type_graphql_1.ObjectType)({ description: 'An attribute a survey can weight by - registered by the host application' })
|
|
262
|
+
], SurveyAttributeInfo);
|
|
263
|
+
let SurveyBallotKit = class SurveyBallotKit {
|
|
264
|
+
};
|
|
265
|
+
exports.SurveyBallotKit = SurveyBallotKit;
|
|
266
|
+
tslib_1.__decorate([
|
|
267
|
+
(0, type_graphql_1.Field)({ description: 'The survey' }),
|
|
268
|
+
tslib_1.__metadata("design:type", String)
|
|
269
|
+
], SurveyBallotKit.prototype, "surveyId", void 0);
|
|
270
|
+
tslib_1.__decorate([
|
|
271
|
+
(0, type_graphql_1.Field)({ description: 'The key answers are sealed to - hex' }),
|
|
272
|
+
tslib_1.__metadata("design:type", String)
|
|
273
|
+
], SurveyBallotKit.prototype, "publicKey", void 0);
|
|
274
|
+
tslib_1.__decorate([
|
|
275
|
+
(0, type_graphql_1.Field)({ description: 'The person’s weight class' }),
|
|
276
|
+
tslib_1.__metadata("design:type", String)
|
|
277
|
+
], SurveyBallotKit.prototype, "weightClass", void 0);
|
|
278
|
+
tslib_1.__decorate([
|
|
279
|
+
(0, type_graphql_1.Field)({ description: 'The class token key’s modulus - hex' }),
|
|
280
|
+
tslib_1.__metadata("design:type", String)
|
|
281
|
+
], SurveyBallotKit.prototype, "modulus", void 0);
|
|
282
|
+
tslib_1.__decorate([
|
|
283
|
+
(0, type_graphql_1.Field)({ description: 'The class token key’s exponent - hex' }),
|
|
284
|
+
tslib_1.__metadata("design:type", String)
|
|
285
|
+
], SurveyBallotKit.prototype, "exponent", void 0);
|
|
286
|
+
tslib_1.__decorate([
|
|
287
|
+
(0, type_graphql_1.Field)({ description: 'Whether the person already took their token' }),
|
|
288
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
289
|
+
], SurveyBallotKit.prototype, "taken", void 0);
|
|
290
|
+
exports.SurveyBallotKit = SurveyBallotKit = tslib_1.__decorate([
|
|
291
|
+
(0, type_graphql_1.ObjectType)({ description: 'What a person’s browser needs to seal a secret ballot' })
|
|
292
|
+
], SurveyBallotKit);
|
|
293
|
+
let MyTrusteeSurvey = class MyTrusteeSurvey {
|
|
294
|
+
};
|
|
295
|
+
exports.MyTrusteeSurvey = MyTrusteeSurvey;
|
|
296
|
+
tslib_1.__decorate([
|
|
297
|
+
(0, type_graphql_1.Field)({ description: 'The survey' }),
|
|
298
|
+
tslib_1.__metadata("design:type", String)
|
|
299
|
+
], MyTrusteeSurvey.prototype, "surveyId", void 0);
|
|
300
|
+
tslib_1.__decorate([
|
|
301
|
+
(0, type_graphql_1.Field)({ description: 'Its title' }),
|
|
302
|
+
tslib_1.__metadata("design:type", String)
|
|
303
|
+
], MyTrusteeSurvey.prototype, "name", void 0);
|
|
304
|
+
tslib_1.__decorate([
|
|
305
|
+
(0, type_graphql_1.Field)({ description: 'Its step' }),
|
|
306
|
+
tslib_1.__metadata("design:type", String)
|
|
307
|
+
], MyTrusteeSurvey.prototype, "status", void 0);
|
|
308
|
+
tslib_1.__decorate([
|
|
309
|
+
(0, type_graphql_1.Field)({ description: 'My step - INVITED, KEYED, DEALT, CONFIRMED or DECRYPTED' }),
|
|
310
|
+
tslib_1.__metadata("design:type", String)
|
|
311
|
+
], MyTrusteeSurvey.prototype, "myStatus", void 0);
|
|
312
|
+
tslib_1.__decorate([
|
|
313
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'My number among the key holders' }),
|
|
314
|
+
tslib_1.__metadata("design:type", Number)
|
|
315
|
+
], MyTrusteeSurvey.prototype, "seq", void 0);
|
|
316
|
+
exports.MyTrusteeSurvey = MyTrusteeSurvey = tslib_1.__decorate([
|
|
317
|
+
(0, type_graphql_1.ObjectType)({ description: 'A secret survey I hold a key of' })
|
|
318
|
+
], MyTrusteeSurvey);
|
|
319
|
+
//# sourceMappingURL=survey-types.js.map
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { User } from '@things-factory/auth-base';
|
|
2
|
+
import { Domain } from '@things-factory/shell';
|
|
3
|
+
export declare class Survey {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
domain?: Domain;
|
|
6
|
+
domainId?: string;
|
|
7
|
+
name: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
level: string;
|
|
10
|
+
status: string;
|
|
11
|
+
audience?: {
|
|
12
|
+
scope: string;
|
|
13
|
+
targetId: string;
|
|
14
|
+
}[];
|
|
15
|
+
excludedUserIds?: string[];
|
|
16
|
+
basisDate?: string;
|
|
17
|
+
weighting?: any;
|
|
18
|
+
minGroup?: number;
|
|
19
|
+
resultReaders?: string;
|
|
20
|
+
publishedFigure?: string;
|
|
21
|
+
openedAt?: Date;
|
|
22
|
+
closesAt?: Date;
|
|
23
|
+
closedAt?: Date;
|
|
24
|
+
askedCount?: number;
|
|
25
|
+
result?: any;
|
|
26
|
+
published?: any;
|
|
27
|
+
publishedAt?: Date;
|
|
28
|
+
publishTop?: number;
|
|
29
|
+
publishTopFigures?: boolean;
|
|
30
|
+
followsSurveyId?: string;
|
|
31
|
+
carryTop?: number;
|
|
32
|
+
successionDepth?: number;
|
|
33
|
+
withdrawnKeys?: string[];
|
|
34
|
+
trusteeUserIds?: string[];
|
|
35
|
+
trusteeThreshold?: number;
|
|
36
|
+
publicKey?: string;
|
|
37
|
+
sums?: any;
|
|
38
|
+
bulletinFacts?: any;
|
|
39
|
+
bulletinHash?: string;
|
|
40
|
+
cancelReason?: string;
|
|
41
|
+
createdAt?: Date;
|
|
42
|
+
updatedAt?: Date;
|
|
43
|
+
creator?: User;
|
|
44
|
+
creatorId?: string;
|
|
45
|
+
updater?: User;
|
|
46
|
+
updaterId?: string;
|
|
47
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Survey = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const type_graphql_1 = require("type-graphql");
|
|
7
|
+
const auth_base_1 = require("@things-factory/auth-base");
|
|
8
|
+
const shell_1 = require("@things-factory/shell");
|
|
9
|
+
/*
|
|
10
|
+
* One survey - one round of asking (operato-survey design §2-1). Its level - named or secret (charter decision 10) - is
|
|
11
|
+
* chosen while it is a draft and never changes after it opens: the respondents answered trusting it.
|
|
12
|
+
*/
|
|
13
|
+
let Survey = class Survey {
|
|
14
|
+
};
|
|
15
|
+
exports.Survey = Survey;
|
|
16
|
+
tslib_1.__decorate([
|
|
17
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
18
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier' }),
|
|
19
|
+
tslib_1.__metadata("design:type", String)
|
|
20
|
+
], Survey.prototype, "id", void 0);
|
|
21
|
+
tslib_1.__decorate([
|
|
22
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
23
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain' }),
|
|
24
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
25
|
+
], Survey.prototype, "domain", void 0);
|
|
26
|
+
tslib_1.__decorate([
|
|
27
|
+
(0, typeorm_1.RelationId)((row) => row.domain),
|
|
28
|
+
tslib_1.__metadata("design:type", String)
|
|
29
|
+
], Survey.prototype, "domainId", void 0);
|
|
30
|
+
tslib_1.__decorate([
|
|
31
|
+
(0, typeorm_1.Column)(),
|
|
32
|
+
(0, type_graphql_1.Field)({ description: 'The title respondents see' }),
|
|
33
|
+
tslib_1.__metadata("design:type", String)
|
|
34
|
+
], Survey.prototype, "name", void 0);
|
|
35
|
+
tslib_1.__decorate([
|
|
36
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
37
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'What the survey is for and how its result is used' }),
|
|
38
|
+
tslib_1.__metadata("design:type", String)
|
|
39
|
+
], Survey.prototype, "description", void 0);
|
|
40
|
+
tslib_1.__decorate([
|
|
41
|
+
(0, typeorm_1.Column)({ default: 'NAMED' }),
|
|
42
|
+
(0, type_graphql_1.Field)({ description: 'NAMED - who answered what is kept; SECRET - nobody can tie an answer to a person' }),
|
|
43
|
+
tslib_1.__metadata("design:type", String)
|
|
44
|
+
], Survey.prototype, "level", void 0);
|
|
45
|
+
tslib_1.__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ default: 'DRAFT' }),
|
|
47
|
+
(0, type_graphql_1.Field)({ description: 'DRAFT, KEYING, OPEN, CLOSED, DECRYPTING, COUNTED, PUBLISHED or CANCELLED' }),
|
|
48
|
+
tslib_1.__metadata("design:type", String)
|
|
49
|
+
], Survey.prototype, "status", void 0);
|
|
50
|
+
tslib_1.__decorate([
|
|
51
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
|
52
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'Whom it asks - the organization audience targets: the domain, departments, roles, people' }),
|
|
53
|
+
tslib_1.__metadata("design:type", Array)
|
|
54
|
+
], Survey.prototype, "audience", void 0);
|
|
55
|
+
tslib_1.__decorate([
|
|
56
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
|
57
|
+
(0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'People the audience names who are not asked' }),
|
|
58
|
+
tslib_1.__metadata("design:type", Array)
|
|
59
|
+
], Survey.prototype, "excludedUserIds", void 0);
|
|
60
|
+
tslib_1.__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
62
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The day respondent attributes are read on - YYYY-MM-DD' }),
|
|
63
|
+
tslib_1.__metadata("design:type", String)
|
|
64
|
+
], Survey.prototype, "basisDate", void 0);
|
|
65
|
+
tslib_1.__decorate([
|
|
66
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
|
67
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'The weight classes and their rates, when answers are weighted' }),
|
|
68
|
+
tslib_1.__metadata("design:type", Object)
|
|
69
|
+
], Survey.prototype, "weighting", void 0);
|
|
70
|
+
tslib_1.__decorate([
|
|
71
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
72
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'The smallest group a published figure may come from' }),
|
|
73
|
+
tslib_1.__metadata("design:type", Number)
|
|
74
|
+
], Survey.prototype, "minGroup", void 0);
|
|
75
|
+
tslib_1.__decorate([
|
|
76
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
77
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Who reads the published result - RESPONDENTS or OPERATORS' }),
|
|
78
|
+
tslib_1.__metadata("design:type", String)
|
|
79
|
+
], Survey.prototype, "resultReaders", void 0);
|
|
80
|
+
tslib_1.__decorate([
|
|
81
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
82
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The one set of figures published per question when weighted - WEIGHTED or UNWEIGHTED' }),
|
|
83
|
+
tslib_1.__metadata("design:type", String)
|
|
84
|
+
], Survey.prototype, "publishedFigure", void 0);
|
|
85
|
+
tslib_1.__decorate([
|
|
86
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
87
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it opened' }),
|
|
88
|
+
tslib_1.__metadata("design:type", Date)
|
|
89
|
+
], Survey.prototype, "openedAt", void 0);
|
|
90
|
+
tslib_1.__decorate([
|
|
91
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
92
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it closes' }),
|
|
93
|
+
tslib_1.__metadata("design:type", Date)
|
|
94
|
+
], Survey.prototype, "closesAt", void 0);
|
|
95
|
+
tslib_1.__decorate([
|
|
96
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
97
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it closed' }),
|
|
98
|
+
tslib_1.__metadata("design:type", Date)
|
|
99
|
+
], Survey.prototype, "closedAt", void 0);
|
|
100
|
+
tslib_1.__decorate([
|
|
101
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
102
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'How many were asked when it opened' }),
|
|
103
|
+
tslib_1.__metadata("design:type", Number)
|
|
104
|
+
], Survey.prototype, "askedCount", void 0);
|
|
105
|
+
tslib_1.__decorate([
|
|
106
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
|
107
|
+
tslib_1.__metadata("design:type", Object)
|
|
108
|
+
], Survey.prototype, "result", void 0);
|
|
109
|
+
tslib_1.__decorate([
|
|
110
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
|
111
|
+
tslib_1.__metadata("design:type", Object)
|
|
112
|
+
], Survey.prototype, "published", void 0);
|
|
113
|
+
tslib_1.__decorate([
|
|
114
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
115
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When its result was published' }),
|
|
116
|
+
tslib_1.__metadata("design:type", Date)
|
|
117
|
+
], Survey.prototype, "publishedAt", void 0);
|
|
118
|
+
tslib_1.__decorate([
|
|
119
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
120
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'Publish only the top this many choices of each question with choices - the rest stay in the operators’ count' }),
|
|
121
|
+
tslib_1.__metadata("design:type", Number)
|
|
122
|
+
], Survey.prototype, "publishTop", void 0);
|
|
123
|
+
tslib_1.__decorate([
|
|
124
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
125
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'With publishTop - whether the top places are published with their figures, or by rank alone' }),
|
|
126
|
+
tslib_1.__metadata("design:type", Boolean)
|
|
127
|
+
], Survey.prototype, "publishTopFigures", void 0);
|
|
128
|
+
tslib_1.__decorate([
|
|
129
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
130
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The round before - its first question’s top choices become this round’s choices' }),
|
|
131
|
+
tslib_1.__metadata("design:type", String)
|
|
132
|
+
], Survey.prototype, "followsSurveyId", void 0);
|
|
133
|
+
tslib_1.__decorate([
|
|
134
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
135
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'How many choices this round takes from the round before' }),
|
|
136
|
+
tslib_1.__metadata("design:type", Number)
|
|
137
|
+
], Survey.prototype, "carryTop", void 0);
|
|
138
|
+
tslib_1.__decorate([
|
|
139
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
140
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'How far down the round before a withdrawn choice may be followed - the 3rd, the 4th …' }),
|
|
141
|
+
tslib_1.__metadata("design:type", Number)
|
|
142
|
+
], Survey.prototype, "successionDepth", void 0);
|
|
143
|
+
tslib_1.__decorate([
|
|
144
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
|
145
|
+
(0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'The choices of the round before that withdrew' }),
|
|
146
|
+
tslib_1.__metadata("design:type", Array)
|
|
147
|
+
], Survey.prototype, "withdrawnKeys", void 0);
|
|
148
|
+
tslib_1.__decorate([
|
|
149
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
|
150
|
+
(0, type_graphql_1.Field)(type => [String], { nullable: true, description: 'A secret survey - its key holders, in order' }),
|
|
151
|
+
tslib_1.__metadata("design:type", Array)
|
|
152
|
+
], Survey.prototype, "trusteeUserIds", void 0);
|
|
153
|
+
tslib_1.__decorate([
|
|
154
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
155
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'A secret survey - how many key holders it takes to decrypt' }),
|
|
156
|
+
tslib_1.__metadata("design:type", Number)
|
|
157
|
+
], Survey.prototype, "trusteeThreshold", void 0);
|
|
158
|
+
tslib_1.__decorate([
|
|
159
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
160
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A secret survey - the key its answers are sealed to, hex' }),
|
|
161
|
+
tslib_1.__metadata("design:type", String)
|
|
162
|
+
], Survey.prototype, "publicKey", void 0);
|
|
163
|
+
tslib_1.__decorate([
|
|
164
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
|
165
|
+
tslib_1.__metadata("design:type", Object)
|
|
166
|
+
], Survey.prototype, "sums", void 0);
|
|
167
|
+
tslib_1.__decorate([
|
|
168
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
|
169
|
+
tslib_1.__metadata("design:type", Object)
|
|
170
|
+
], Survey.prototype, "bulletinFacts", void 0);
|
|
171
|
+
tslib_1.__decorate([
|
|
172
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
173
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'A secret survey - the fingerprint of the bulletin fixed when counting began' }),
|
|
174
|
+
tslib_1.__metadata("design:type", String)
|
|
175
|
+
], Survey.prototype, "bulletinHash", void 0);
|
|
176
|
+
tslib_1.__decorate([
|
|
177
|
+
(0, typeorm_1.Column)({ type: 'text', nullable: true }),
|
|
178
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Why it was cancelled' }),
|
|
179
|
+
tslib_1.__metadata("design:type", String)
|
|
180
|
+
], Survey.prototype, "cancelReason", void 0);
|
|
181
|
+
tslib_1.__decorate([
|
|
182
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
183
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was made' }),
|
|
184
|
+
tslib_1.__metadata("design:type", Date)
|
|
185
|
+
], Survey.prototype, "createdAt", void 0);
|
|
186
|
+
tslib_1.__decorate([
|
|
187
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
188
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was last changed' }),
|
|
189
|
+
tslib_1.__metadata("design:type", Date)
|
|
190
|
+
], Survey.prototype, "updatedAt", void 0);
|
|
191
|
+
tslib_1.__decorate([
|
|
192
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
193
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who made it' }),
|
|
194
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
195
|
+
], Survey.prototype, "creator", void 0);
|
|
196
|
+
tslib_1.__decorate([
|
|
197
|
+
(0, typeorm_1.RelationId)((row) => row.creator),
|
|
198
|
+
tslib_1.__metadata("design:type", String)
|
|
199
|
+
], Survey.prototype, "creatorId", void 0);
|
|
200
|
+
tslib_1.__decorate([
|
|
201
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
202
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who changed it last' }),
|
|
203
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
204
|
+
], Survey.prototype, "updater", void 0);
|
|
205
|
+
tslib_1.__decorate([
|
|
206
|
+
(0, typeorm_1.RelationId)((row) => row.updater),
|
|
207
|
+
tslib_1.__metadata("design:type", String)
|
|
208
|
+
], Survey.prototype, "updaterId", void 0);
|
|
209
|
+
exports.Survey = Survey = tslib_1.__decorate([
|
|
210
|
+
(0, typeorm_1.Entity)({ name: 'survey_surveys' }),
|
|
211
|
+
(0, typeorm_1.Index)('ix_survey_survey_0', (row) => [row.domain, row.status]),
|
|
212
|
+
(0, type_graphql_1.ObjectType)({ description: 'A survey - one round of asking, named or secret (operato-survey)' })
|
|
213
|
+
], Survey);
|
|
214
|
+
//# sourceMappingURL=survey.js.map
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type Cipher, type CipherJson } from './elgamal';
|
|
2
|
+
import { type OneOfProof } from './proofs';
|
|
3
|
+
export interface BallotQuestion {
|
|
4
|
+
id: string;
|
|
5
|
+
kind: string;
|
|
6
|
+
options?: {
|
|
7
|
+
key: string;
|
|
8
|
+
}[] | null;
|
|
9
|
+
maxPicks?: number | null;
|
|
10
|
+
scaleMin?: number | null;
|
|
11
|
+
scaleMax?: number | null;
|
|
12
|
+
allocateTotal?: number | null;
|
|
13
|
+
}
|
|
14
|
+
export type BallotAnswer = {
|
|
15
|
+
pick?: string;
|
|
16
|
+
picks?: string[];
|
|
17
|
+
value?: number;
|
|
18
|
+
shares?: Record<string, number>;
|
|
19
|
+
};
|
|
20
|
+
type Cell = CipherJson & {
|
|
21
|
+
p?: OneOfProof;
|
|
22
|
+
bits?: (CipherJson & {
|
|
23
|
+
p: OneOfProof;
|
|
24
|
+
})[];
|
|
25
|
+
};
|
|
26
|
+
export type BallotPart = {
|
|
27
|
+
question: string;
|
|
28
|
+
cells: Cell[];
|
|
29
|
+
sum: OneOfProof;
|
|
30
|
+
};
|
|
31
|
+
export type SealedBallot = BallotPart[];
|
|
32
|
+
/** The cells of a question - its choices' keys, or a scale's values. */
|
|
33
|
+
export declare function cellsOf(question: BallotQuestion): string[];
|
|
34
|
+
/** The value of each cell for an answer - the answer was checked against the question before (survey-rules). */
|
|
35
|
+
export declare function valuesOf(question: BallotQuestion, answer: BallotAnswer): number[];
|
|
36
|
+
export declare function sealBallot(h: bigint, questions: readonly BallotQuestion[], answers: Record<string, BallotAnswer>, context: string): SealedBallot;
|
|
37
|
+
/**
|
|
38
|
+
* The cells of a sealed ballot, every proof checked - or why it is refused. A share's cell is computed from its bits,
|
|
39
|
+
* never taken as sent.
|
|
40
|
+
*/
|
|
41
|
+
export declare function openedCells(h: bigint, questions: readonly BallotQuestion[], ballot: SealedBallot, context: string): {
|
|
42
|
+
cells?: Cipher[][];
|
|
43
|
+
problem?: string;
|
|
44
|
+
};
|
|
45
|
+
/** The weighted sum of every ballot's cells - a ballot's cells raised to its class's rate (design §6-1). */
|
|
46
|
+
export declare function weightedSums(ballots: readonly {
|
|
47
|
+
rate: number;
|
|
48
|
+
cells: Cipher[][];
|
|
49
|
+
}[], questions: readonly BallotQuestion[]): Cipher[][];
|
|
50
|
+
/** The most a cell's sum can be - what the discrete log is searched up to. */
|
|
51
|
+
export declare function boundOf(question: BallotQuestion, ballots: number, maxRate: number): number;
|
|
52
|
+
/** The cells of a ballot whose proofs were checked when it came in - for the count, which does not check them again. */
|
|
53
|
+
export declare function cellsOfChecked(questions: readonly BallotQuestion[], ballot: SealedBallot): Cipher[][];
|
|
54
|
+
export {};
|