@things-factory/survey 0.0.0-stage → 10.1.316
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,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TENURE_YEARS = exports.surveyAttributeOf = exports.surveyAttributes = void 0;
|
|
4
|
+
exports.registerSurveyAttribute = registerSurveyAttribute;
|
|
5
|
+
/*
|
|
6
|
+
* What a respondent is weighted by (operato-survey design §5-2) - attributes the host registers, read on the survey's
|
|
7
|
+
* basis day. The survey never names its host: shareholding is office's to register; tenure comes with organization.
|
|
8
|
+
*/
|
|
9
|
+
const typeorm_1 = require("typeorm");
|
|
10
|
+
const organization_1 = require("@things-factory/organization");
|
|
11
|
+
const survey_rules_1 = require("./survey-rules");
|
|
12
|
+
const REGISTRY = new Map();
|
|
13
|
+
function registerSurveyAttribute(attribute) {
|
|
14
|
+
REGISTRY.set(attribute.name, attribute);
|
|
15
|
+
}
|
|
16
|
+
const surveyAttributes = () => [...REGISTRY.values()];
|
|
17
|
+
exports.surveyAttributes = surveyAttributes;
|
|
18
|
+
const surveyAttributeOf = (name) => REGISTRY.get(name);
|
|
19
|
+
exports.surveyAttributeOf = surveyAttributeOf;
|
|
20
|
+
/** Full years of service on the basis day, from the employee record's hire day (organization). */
|
|
21
|
+
exports.TENURE_YEARS = {
|
|
22
|
+
name: 'tenureYears',
|
|
23
|
+
label: 'label.survey-attr-tenure-years',
|
|
24
|
+
type: 'number',
|
|
25
|
+
async valuesOn(tx, domain, userIds, basisDate) {
|
|
26
|
+
const out = new Map();
|
|
27
|
+
if (!userIds.length)
|
|
28
|
+
return out;
|
|
29
|
+
const records = await tx.getRepository(organization_1.Employee).find({ where: { domain: { id: domain.id }, user: { id: (0, typeorm_1.In)(userIds) } }, relations: ['user'] });
|
|
30
|
+
for (const one of records) {
|
|
31
|
+
const years = (0, survey_rules_1.fullYearsBetween)(one.hiredOn, basisDate);
|
|
32
|
+
const userId = one.user?.id;
|
|
33
|
+
if (userId && years !== undefined && (!out.has(userId) || out.get(userId) < years))
|
|
34
|
+
out.set(userId, years);
|
|
35
|
+
}
|
|
36
|
+
return out;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=survey-attributes.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Domain } from '@things-factory/shell';
|
|
2
|
+
import { Survey } from './survey';
|
|
3
|
+
export declare class SurveyBallot {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
domain?: Domain;
|
|
6
|
+
domainId?: string;
|
|
7
|
+
survey?: Survey;
|
|
8
|
+
surveyId?: string;
|
|
9
|
+
weightClass: string;
|
|
10
|
+
serial: string;
|
|
11
|
+
signature: string;
|
|
12
|
+
sealed: any;
|
|
13
|
+
receipt: string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SurveyBallot = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const typeorm_1 = require("typeorm");
|
|
6
|
+
const shell_1 = require("@things-factory/shell");
|
|
7
|
+
const survey_1 = require("./survey");
|
|
8
|
+
/*
|
|
9
|
+
* A secret ballot (design §2-5): its weight class, its one-time token and the sealed answers with their proofs - and
|
|
10
|
+
* nothing that names a person or a moment. No creator, no updater, no created or updated time: the conventions test
|
|
11
|
+
* excuses the six by name (charter §4-9). Its id is random. It is never sent out on its own - only on the bulletin,
|
|
12
|
+
* ordered by receipt rather than by arrival.
|
|
13
|
+
*/
|
|
14
|
+
let SurveyBallot = class SurveyBallot {
|
|
15
|
+
};
|
|
16
|
+
exports.SurveyBallot = SurveyBallot;
|
|
17
|
+
tslib_1.__decorate([
|
|
18
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
19
|
+
tslib_1.__metadata("design:type", String)
|
|
20
|
+
], SurveyBallot.prototype, "id", void 0);
|
|
21
|
+
tslib_1.__decorate([
|
|
22
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
23
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
24
|
+
], SurveyBallot.prototype, "domain", void 0);
|
|
25
|
+
tslib_1.__decorate([
|
|
26
|
+
(0, typeorm_1.RelationId)((row) => row.domain),
|
|
27
|
+
tslib_1.__metadata("design:type", String)
|
|
28
|
+
], SurveyBallot.prototype, "domainId", void 0);
|
|
29
|
+
tslib_1.__decorate([
|
|
30
|
+
(0, typeorm_1.ManyToOne)(type => survey_1.Survey, { onDelete: 'CASCADE' }),
|
|
31
|
+
tslib_1.__metadata("design:type", survey_1.Survey)
|
|
32
|
+
], SurveyBallot.prototype, "survey", void 0);
|
|
33
|
+
tslib_1.__decorate([
|
|
34
|
+
(0, typeorm_1.RelationId)((row) => row.survey),
|
|
35
|
+
tslib_1.__metadata("design:type", String)
|
|
36
|
+
], SurveyBallot.prototype, "surveyId", void 0);
|
|
37
|
+
tslib_1.__decorate([
|
|
38
|
+
(0, typeorm_1.Column)(),
|
|
39
|
+
tslib_1.__metadata("design:type", String)
|
|
40
|
+
], SurveyBallot.prototype, "weightClass", void 0);
|
|
41
|
+
tslib_1.__decorate([
|
|
42
|
+
(0, typeorm_1.Column)(),
|
|
43
|
+
tslib_1.__metadata("design:type", String)
|
|
44
|
+
], SurveyBallot.prototype, "serial", void 0);
|
|
45
|
+
tslib_1.__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
47
|
+
tslib_1.__metadata("design:type", String)
|
|
48
|
+
], SurveyBallot.prototype, "signature", void 0);
|
|
49
|
+
tslib_1.__decorate([
|
|
50
|
+
(0, typeorm_1.Column)('simple-json'),
|
|
51
|
+
tslib_1.__metadata("design:type", Object)
|
|
52
|
+
], SurveyBallot.prototype, "sealed", void 0);
|
|
53
|
+
tslib_1.__decorate([
|
|
54
|
+
(0, typeorm_1.Column)(),
|
|
55
|
+
tslib_1.__metadata("design:type", String)
|
|
56
|
+
], SurveyBallot.prototype, "receipt", void 0);
|
|
57
|
+
exports.SurveyBallot = SurveyBallot = tslib_1.__decorate([
|
|
58
|
+
(0, typeorm_1.Entity)({ name: 'survey_ballots' }),
|
|
59
|
+
(0, typeorm_1.Index)('ix_survey_ballot_0', (row) => [row.survey, row.serial], { unique: true })
|
|
60
|
+
], SurveyBallot);
|
|
61
|
+
//# sourceMappingURL=survey-ballot.js.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { User } from '@things-factory/auth-base';
|
|
2
|
+
import { Domain } from '@things-factory/shell';
|
|
3
|
+
import { Survey } from './survey';
|
|
4
|
+
export declare class SurveyClassKey {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
domain?: Domain;
|
|
7
|
+
domainId?: string;
|
|
8
|
+
survey?: Survey;
|
|
9
|
+
surveyId?: string;
|
|
10
|
+
weightClass: string;
|
|
11
|
+
modulus: string;
|
|
12
|
+
exponent: string;
|
|
13
|
+
privateExponent: string;
|
|
14
|
+
createdAt?: Date;
|
|
15
|
+
updatedAt?: Date;
|
|
16
|
+
creator?: User;
|
|
17
|
+
creatorId?: string;
|
|
18
|
+
updater?: User;
|
|
19
|
+
updaterId?: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SurveyClassKey = 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
|
+
const survey_1 = require("./survey");
|
|
10
|
+
/*
|
|
11
|
+
* The key a weight class's ballot tokens are signed with (design §2-6). It guards who may vote, not what was voted: one
|
|
12
|
+
* who reads the private half could sign tokens - so the count checks that no class has more ballots than tokens issued,
|
|
13
|
+
* and a person shown as having taken a ballot they never took sees it on their own screen.
|
|
14
|
+
*/
|
|
15
|
+
let SurveyClassKey = class SurveyClassKey {
|
|
16
|
+
};
|
|
17
|
+
exports.SurveyClassKey = SurveyClassKey;
|
|
18
|
+
tslib_1.__decorate([
|
|
19
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
20
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier' }),
|
|
21
|
+
tslib_1.__metadata("design:type", String)
|
|
22
|
+
], SurveyClassKey.prototype, "id", void 0);
|
|
23
|
+
tslib_1.__decorate([
|
|
24
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
25
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain' }),
|
|
26
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
27
|
+
], SurveyClassKey.prototype, "domain", void 0);
|
|
28
|
+
tslib_1.__decorate([
|
|
29
|
+
(0, typeorm_1.RelationId)((row) => row.domain),
|
|
30
|
+
tslib_1.__metadata("design:type", String)
|
|
31
|
+
], SurveyClassKey.prototype, "domainId", void 0);
|
|
32
|
+
tslib_1.__decorate([
|
|
33
|
+
(0, typeorm_1.ManyToOne)(type => survey_1.Survey, { onDelete: 'CASCADE' }),
|
|
34
|
+
tslib_1.__metadata("design:type", survey_1.Survey)
|
|
35
|
+
], SurveyClassKey.prototype, "survey", void 0);
|
|
36
|
+
tslib_1.__decorate([
|
|
37
|
+
(0, typeorm_1.RelationId)((row) => row.survey),
|
|
38
|
+
tslib_1.__metadata("design:type", String)
|
|
39
|
+
], SurveyClassKey.prototype, "surveyId", void 0);
|
|
40
|
+
tslib_1.__decorate([
|
|
41
|
+
(0, typeorm_1.Column)(),
|
|
42
|
+
(0, type_graphql_1.Field)({ description: 'The weight class - ALL when the survey is not weighted' }),
|
|
43
|
+
tslib_1.__metadata("design:type", String)
|
|
44
|
+
], SurveyClassKey.prototype, "weightClass", void 0);
|
|
45
|
+
tslib_1.__decorate([
|
|
46
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
47
|
+
(0, type_graphql_1.Field)({ description: 'The modulus - hex' }),
|
|
48
|
+
tslib_1.__metadata("design:type", String)
|
|
49
|
+
], SurveyClassKey.prototype, "modulus", void 0);
|
|
50
|
+
tslib_1.__decorate([
|
|
51
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
52
|
+
(0, type_graphql_1.Field)({ description: 'The public exponent - hex' }),
|
|
53
|
+
tslib_1.__metadata("design:type", String)
|
|
54
|
+
], SurveyClassKey.prototype, "exponent", void 0);
|
|
55
|
+
tslib_1.__decorate([
|
|
56
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
57
|
+
tslib_1.__metadata("design:type", String)
|
|
58
|
+
], SurveyClassKey.prototype, "privateExponent", void 0);
|
|
59
|
+
tslib_1.__decorate([
|
|
60
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
61
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was made' }),
|
|
62
|
+
tslib_1.__metadata("design:type", Date)
|
|
63
|
+
], SurveyClassKey.prototype, "createdAt", void 0);
|
|
64
|
+
tslib_1.__decorate([
|
|
65
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
66
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was last changed' }),
|
|
67
|
+
tslib_1.__metadata("design:type", Date)
|
|
68
|
+
], SurveyClassKey.prototype, "updatedAt", void 0);
|
|
69
|
+
tslib_1.__decorate([
|
|
70
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
71
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who opened the survey' }),
|
|
72
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
73
|
+
], SurveyClassKey.prototype, "creator", void 0);
|
|
74
|
+
tslib_1.__decorate([
|
|
75
|
+
(0, typeorm_1.RelationId)((row) => row.creator),
|
|
76
|
+
tslib_1.__metadata("design:type", String)
|
|
77
|
+
], SurveyClassKey.prototype, "creatorId", void 0);
|
|
78
|
+
tslib_1.__decorate([
|
|
79
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
80
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who changed it last' }),
|
|
81
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
82
|
+
], SurveyClassKey.prototype, "updater", void 0);
|
|
83
|
+
tslib_1.__decorate([
|
|
84
|
+
(0, typeorm_1.RelationId)((row) => row.updater),
|
|
85
|
+
tslib_1.__metadata("design:type", String)
|
|
86
|
+
], SurveyClassKey.prototype, "updaterId", void 0);
|
|
87
|
+
exports.SurveyClassKey = SurveyClassKey = tslib_1.__decorate([
|
|
88
|
+
(0, typeorm_1.Entity)({ name: 'survey_class_keys' }),
|
|
89
|
+
(0, typeorm_1.Index)('ix_survey_class_key_0', (row) => [row.survey, row.weightClass], { unique: true }),
|
|
90
|
+
(0, type_graphql_1.ObjectType)({ description: 'The public half of a weight class’s token key' })
|
|
91
|
+
], SurveyClassKey);
|
|
92
|
+
//# sourceMappingURL=survey-class-key.js.map
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { User } from '@things-factory/auth-base';
|
|
2
|
+
import { Domain } from '@things-factory/shell';
|
|
3
|
+
import { Survey } from './survey';
|
|
4
|
+
export declare class SurveyQuestion {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
domain?: Domain;
|
|
7
|
+
domainId?: string;
|
|
8
|
+
survey?: Survey;
|
|
9
|
+
surveyId?: string;
|
|
10
|
+
seq: number;
|
|
11
|
+
kind: string;
|
|
12
|
+
prompt: string;
|
|
13
|
+
options?: {
|
|
14
|
+
key: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}[];
|
|
17
|
+
maxPicks?: number;
|
|
18
|
+
scaleMin?: number;
|
|
19
|
+
scaleMax?: number;
|
|
20
|
+
allocateTotal?: number;
|
|
21
|
+
createdAt?: Date;
|
|
22
|
+
updatedAt?: Date;
|
|
23
|
+
creator?: User;
|
|
24
|
+
creatorId?: string;
|
|
25
|
+
updater?: User;
|
|
26
|
+
updaterId?: string;
|
|
27
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SurveyQuestion = 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
|
+
const survey_1 = require("./survey");
|
|
10
|
+
/*
|
|
11
|
+
* One question of a survey (design §2-2) - only kinds whose answers can be counted without reading them one by one
|
|
12
|
+
* (charter §4-4): no free text.
|
|
13
|
+
*/
|
|
14
|
+
let SurveyQuestion = class SurveyQuestion {
|
|
15
|
+
};
|
|
16
|
+
exports.SurveyQuestion = SurveyQuestion;
|
|
17
|
+
tslib_1.__decorate([
|
|
18
|
+
(0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
|
|
19
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'Unique identifier' }),
|
|
20
|
+
tslib_1.__metadata("design:type", String)
|
|
21
|
+
], SurveyQuestion.prototype, "id", void 0);
|
|
22
|
+
tslib_1.__decorate([
|
|
23
|
+
(0, typeorm_1.ManyToOne)(type => shell_1.Domain),
|
|
24
|
+
(0, type_graphql_1.Field)(type => shell_1.Domain, { nullable: true, description: 'The domain' }),
|
|
25
|
+
tslib_1.__metadata("design:type", shell_1.Domain)
|
|
26
|
+
], SurveyQuestion.prototype, "domain", void 0);
|
|
27
|
+
tslib_1.__decorate([
|
|
28
|
+
(0, typeorm_1.RelationId)((row) => row.domain),
|
|
29
|
+
tslib_1.__metadata("design:type", String)
|
|
30
|
+
], SurveyQuestion.prototype, "domainId", void 0);
|
|
31
|
+
tslib_1.__decorate([
|
|
32
|
+
(0, typeorm_1.ManyToOne)(type => survey_1.Survey, { onDelete: 'CASCADE' }),
|
|
33
|
+
tslib_1.__metadata("design:type", survey_1.Survey)
|
|
34
|
+
], SurveyQuestion.prototype, "survey", void 0);
|
|
35
|
+
tslib_1.__decorate([
|
|
36
|
+
(0, typeorm_1.RelationId)((row) => row.survey),
|
|
37
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'The survey it belongs to' }),
|
|
38
|
+
tslib_1.__metadata("design:type", String)
|
|
39
|
+
], SurveyQuestion.prototype, "surveyId", void 0);
|
|
40
|
+
tslib_1.__decorate([
|
|
41
|
+
(0, typeorm_1.Column)(),
|
|
42
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { description: 'Its place in the survey, from 1' }),
|
|
43
|
+
tslib_1.__metadata("design:type", Number)
|
|
44
|
+
], SurveyQuestion.prototype, "seq", void 0);
|
|
45
|
+
tslib_1.__decorate([
|
|
46
|
+
(0, typeorm_1.Column)(),
|
|
47
|
+
(0, type_graphql_1.Field)({ description: 'SINGLE, MULTI, SCALE or ALLOCATE' }),
|
|
48
|
+
tslib_1.__metadata("design:type", String)
|
|
49
|
+
], SurveyQuestion.prototype, "kind", void 0);
|
|
50
|
+
tslib_1.__decorate([
|
|
51
|
+
(0, typeorm_1.Column)({ type: 'text' }),
|
|
52
|
+
(0, type_graphql_1.Field)({ description: 'What is asked' }),
|
|
53
|
+
tslib_1.__metadata("design:type", String)
|
|
54
|
+
], SurveyQuestion.prototype, "prompt", void 0);
|
|
55
|
+
tslib_1.__decorate([
|
|
56
|
+
(0, typeorm_1.Column)('simple-json', { nullable: true }),
|
|
57
|
+
(0, type_graphql_1.Field)(type => shell_1.ScalarObject, { nullable: true, description: 'The choices - [{ key, label }]' }),
|
|
58
|
+
tslib_1.__metadata("design:type", Array)
|
|
59
|
+
], SurveyQuestion.prototype, "options", void 0);
|
|
60
|
+
tslib_1.__decorate([
|
|
61
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
62
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'MULTI - how many may be chosen at most' }),
|
|
63
|
+
tslib_1.__metadata("design:type", Number)
|
|
64
|
+
], SurveyQuestion.prototype, "maxPicks", void 0);
|
|
65
|
+
tslib_1.__decorate([
|
|
66
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
67
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'SCALE - the lowest value' }),
|
|
68
|
+
tslib_1.__metadata("design:type", Number)
|
|
69
|
+
], SurveyQuestion.prototype, "scaleMin", 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: 'SCALE - the highest value' }),
|
|
73
|
+
tslib_1.__metadata("design:type", Number)
|
|
74
|
+
], SurveyQuestion.prototype, "scaleMax", void 0);
|
|
75
|
+
tslib_1.__decorate([
|
|
76
|
+
(0, typeorm_1.Column)({ nullable: true }),
|
|
77
|
+
(0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'ALLOCATE - what the shares add up to' }),
|
|
78
|
+
tslib_1.__metadata("design:type", Number)
|
|
79
|
+
], SurveyQuestion.prototype, "allocateTotal", void 0);
|
|
80
|
+
tslib_1.__decorate([
|
|
81
|
+
(0, typeorm_1.CreateDateColumn)(),
|
|
82
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was made' }),
|
|
83
|
+
tslib_1.__metadata("design:type", Date)
|
|
84
|
+
], SurveyQuestion.prototype, "createdAt", void 0);
|
|
85
|
+
tslib_1.__decorate([
|
|
86
|
+
(0, typeorm_1.UpdateDateColumn)(),
|
|
87
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'When it was last changed' }),
|
|
88
|
+
tslib_1.__metadata("design:type", Date)
|
|
89
|
+
], SurveyQuestion.prototype, "updatedAt", void 0);
|
|
90
|
+
tslib_1.__decorate([
|
|
91
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
92
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who made it' }),
|
|
93
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
94
|
+
], SurveyQuestion.prototype, "creator", void 0);
|
|
95
|
+
tslib_1.__decorate([
|
|
96
|
+
(0, typeorm_1.RelationId)((row) => row.creator),
|
|
97
|
+
tslib_1.__metadata("design:type", String)
|
|
98
|
+
], SurveyQuestion.prototype, "creatorId", void 0);
|
|
99
|
+
tslib_1.__decorate([
|
|
100
|
+
(0, typeorm_1.ManyToOne)(type => auth_base_1.User, { nullable: true }),
|
|
101
|
+
(0, type_graphql_1.Field)(type => auth_base_1.User, { nullable: true, description: 'Who changed it last' }),
|
|
102
|
+
tslib_1.__metadata("design:type", auth_base_1.User)
|
|
103
|
+
], SurveyQuestion.prototype, "updater", void 0);
|
|
104
|
+
tslib_1.__decorate([
|
|
105
|
+
(0, typeorm_1.RelationId)((row) => row.updater),
|
|
106
|
+
tslib_1.__metadata("design:type", String)
|
|
107
|
+
], SurveyQuestion.prototype, "updaterId", void 0);
|
|
108
|
+
exports.SurveyQuestion = SurveyQuestion = tslib_1.__decorate([
|
|
109
|
+
(0, typeorm_1.Entity)({ name: 'survey_questions' }),
|
|
110
|
+
(0, typeorm_1.Index)('ix_survey_question_0', (row) => [row.survey, row.seq], { unique: true }),
|
|
111
|
+
(0, type_graphql_1.ObjectType)({ description: 'A question of a survey' })
|
|
112
|
+
], SurveyQuestion);
|
|
113
|
+
//# sourceMappingURL=survey-question.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Survey } from './survey';
|
|
2
|
+
import { SurveyQuestion } from './survey-question';
|
|
3
|
+
import { MySurvey, MyTrusteeSurvey, SurveyAnswerInput, SurveyAttributeInfo, SurveyBallotKit, SurveyChoice, SurveyAnswerSheet, SurveyAudienceChoices, SurveyDetail, SurveyPatch, SurveyQuestionInput } from './survey-types';
|
|
4
|
+
export declare class SurveyResolver {
|
|
5
|
+
surveys(context: ResolverContext): Promise<Survey[]>;
|
|
6
|
+
surveyDetail(id: string, context: ResolverContext): Promise<SurveyDetail>;
|
|
7
|
+
surveyAnswerSheets(id: string, context: ResolverContext): Promise<SurveyAnswerSheet[]>;
|
|
8
|
+
surveyAudienceChoices(context: ResolverContext): Promise<SurveyAudienceChoices>;
|
|
9
|
+
surveyAttributes(): Promise<SurveyAttributeInfo[]>;
|
|
10
|
+
surveyClassPreview(id: string, context: ResolverContext): Promise<Record<string, number>>;
|
|
11
|
+
surveyPreviousChoices(id: string, context: ResolverContext): Promise<SurveyChoice[]>;
|
|
12
|
+
carrySurveyForward(id: string, context: ResolverContext): Promise<SurveyQuestion[]>;
|
|
13
|
+
createSurvey(patch: SurveyPatch, context: ResolverContext): Promise<Survey>;
|
|
14
|
+
updateSurvey(id: string, patch: SurveyPatch, context: ResolverContext): Promise<Survey>;
|
|
15
|
+
deleteSurvey(id: string, context: ResolverContext): Promise<boolean>;
|
|
16
|
+
setSurveyQuestions(id: string, questions: SurveyQuestionInput[], context: ResolverContext): Promise<SurveyQuestion[]>;
|
|
17
|
+
openSurvey(id: string, context: ResolverContext): Promise<Survey>;
|
|
18
|
+
closeSurvey(id: string, context: ResolverContext): Promise<Survey>;
|
|
19
|
+
countSurvey(id: string, context: ResolverContext): Promise<Survey>;
|
|
20
|
+
publishSurvey(id: string, context: ResolverContext): Promise<Survey>;
|
|
21
|
+
cancelSurvey(id: string, reason: string, context: ResolverContext): Promise<Survey>;
|
|
22
|
+
mySurveys(context: ResolverContext): Promise<MySurvey[]>;
|
|
23
|
+
answerSurvey(id: string, answers: SurveyAnswerInput[], context: ResolverContext): Promise<boolean>;
|
|
24
|
+
}
|
|
25
|
+
export declare class SurveySecretResolver {
|
|
26
|
+
startSurveyKeying(id: string, context: ResolverContext): Promise<Survey>;
|
|
27
|
+
surveyBulletin(id: string, context: ResolverContext): Promise<any>;
|
|
28
|
+
surveyBallotKit(id: string, context: ResolverContext): Promise<SurveyBallotKit>;
|
|
29
|
+
issueSurveyBallot(id: string, blinded: string, context: ResolverContext): Promise<string>;
|
|
30
|
+
surveyReceiptListed(id: string, receipt: string, context: ResolverContext): Promise<boolean>;
|
|
31
|
+
myTrusteeSurveys(context: ResolverContext): Promise<MyTrusteeSurvey[]>;
|
|
32
|
+
surveyTrusteeView(id: string, context: ResolverContext): Promise<any>;
|
|
33
|
+
postSurveyTransportKey(id: string, key: string, proof: any, context: ResolverContext): Promise<boolean>;
|
|
34
|
+
postSurveyDealing(id: string, dealing: any, sealed: any, context: ResolverContext): Promise<boolean>;
|
|
35
|
+
confirmSurveyShares(id: string, context: ResolverContext): Promise<boolean>;
|
|
36
|
+
postSurveyPartials(id: string, partials: any, context: ResolverContext): Promise<boolean>;
|
|
37
|
+
}
|