Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"x-generation-date": "2026-01-28T15:08:12.363Z"
"x-generation-date": "2026-01-28T18:13:51.743Z"
},
"x-strapi-config": {
"plugins": [
Expand Down
3 changes: 2 additions & 1 deletion backend/vaa-strapi/src/functions/generateMockData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* debugging & developing mock data generation functionality.
*/

import { type Faker, faker, fakerFI, fakerSV } from '@faker-js/faker';
import { faker, fakerFI, fakerSV } from '@faker-js/faker';
import crypto from 'crypto';
import { loadDefaultAppSettings } from './loadDefaultAppSettings';
import mockAdmins from './mockData/mockAdmins.json';
Expand All @@ -20,6 +20,7 @@ import { generateMockDataOnInitialise, generateMockDataOnRestart } from '../cons
import { API } from '../util/api';
import { getDynamicTranslations } from '../util/appCustomization';
import { dropAllCollections } from '../util/drop';
import type { Faker } from '@faker-js/faker';
import type { AnswerValue, LocalizedAnswer, LocalizedString, QuestionTypeSettings } from '@openvaa/app-shared';
import type { Data } from '@strapi/strapi';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import { Card } from '@strapi/design-system';
import { Flex } from '@strapi/design-system';
import { Main, Typography } from '@strapi/design-system';
import { Accordion } from '@strapi/design-system';
import { Box } from '@strapi/design-system';
import { Accordion, Box, Card, Flex, Main, Typography } from '@strapi/design-system';
import { CandidateNominatorFileImport } from '../components/CandidateNominatorFileImport';
import { DeleteData } from '../components/DeleteData';
import { FindData } from '../components/FindData';
Expand Down
4 changes: 2 additions & 2 deletions backend/vaa-strapi/src/util/appSettings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type DynamicSettings, dynamicSettings } from '@openvaa/app-shared';
import type { QuestionInCardContent } from '@openvaa/app-shared';
import { dynamicSettings } from '@openvaa/app-shared';
import type { DynamicSettings, QuestionInCardContent } from '@openvaa/app-shared';
import type { Data } from '@strapi/strapi';

/**
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/api/adapters/apiRoute/apiRouteAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { API_ROUTES, type ApiGetRoute, type ApiPostRoute, type ApiRouteReturnType } from './apiRoutes';
import { API_ROUTES } from './apiRoutes';
import type { UniversalAdapter } from '$lib/api/base/universalAdapter';
import type { ApiRouteAdapter, ApiRouteGetOptions, ApiRoutePostOptions } from './apiRouteAdapter.type';
import type { ApiGetRoute, ApiPostRoute, ApiRouteReturnType } from './apiRoutes';

/**
* A mixin for all ApiRoute Data API services, implementing `apiGet` and `apiPost` methods.
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/api/adapters/apiRoute/apiRoutes.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { DP_METHOD, type DPDataType } from '$lib/api/base/dataTypes';
import { DP_METHOD } from '$lib/api/base/dataTypes';
import { API_ROOT } from '$lib/api/base/universalApiRoutes';
import type { DataApiActionResult } from '$lib/api/base/actionResult.type';
import type { DPDataType } from '$lib/api/base/dataTypes';

export const API_GET_ROUTES = Object.fromEntries(
Object.keys(DP_METHOD).map((collection) => [collection, `${API_ROOT}/data/${collection}`])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import {
type AnyQuestionVariantData,
type ConstituencyData,
type ConstituencyGroupData,
ENTITY_TYPE,
type QuestionCategoryData
} from '@openvaa/data';
import { ENTITY_TYPE } from '@openvaa/data';
import { UniversalDataProvider } from '$lib/api/base/universalDataProvider';
import { translate, translateObject } from '$lib/i18n';
import { strapiAdapterMixin } from '../strapiAdapter';
Expand All @@ -23,6 +17,12 @@ import {
import { parseEntityType } from '../utils/parseEntityType';
import { parseQuestionCategoryCustomData } from '../utils/parseQuestionCategoryCustomData';
import { parseQuestionCustomData } from '../utils/parseQuestionCustomData';
import type {
AnyQuestionVariantData,
ConstituencyData,
ConstituencyGroupData,
QuestionCategoryData
} from '@openvaa/data';
import type { DPDataType } from '$lib/api/base/dataTypes';
import type {
GetAppCustomizationOptions,
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/api/adapters/strapi/strapiAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { ENTITY_TYPE } from '@openvaa/data';
import { browser } from '$app/environment';
import { constants } from '$lib/utils/constants';
import { STRAPI_API, STRAPI_AUTH_APIS, type StrapiApi, type StrapiApiReturnType } from './strapiApi';
import { STRAPI_API, STRAPI_AUTH_APIS } from './strapiApi';
import type { WithAuth, WithTargetEntity } from '$lib/api/base/dataWriter.type';
import type { UniversalAdapter } from '$lib/api/base/universalAdapter';
import type { StrapiAdapter, StrapiApiGetOptions, StrapiApiPostOptions } from './strapiAdapter.type';
import type { StrapiApi, StrapiApiReturnType } from './strapiApi';
import type { StrapiResult } from './strapiData.type';

/**
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/api/adapters/strapi/utils/parseCandidate.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { type CandidateData, ENTITY_TYPE } from '@openvaa/data';
import { ENTITY_TYPE } from '@openvaa/data';
import { formatId } from '$lib/api/utils/formatId';
import { parseAnswers } from '$lib/api/utils/parseAnswers';
import { parseImage } from './parseImage';
import type { CandidateData } from '@openvaa/data';
import type { LocalizedAnswers, LocalizedCandidateData } from '$lib/api/base/dataWriter.type';
import type { StrapiCandidateData, StrapiUpdateCandidateReturnData } from '../strapiData.type';

Expand Down
20 changes: 10 additions & 10 deletions frontend/src/lib/api/adapters/strapi/utils/parseNominations.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import {
type AnyEntityVariantData,
type AnyNominationVariantPublicData,
type CandidateData,
ENTITY_TYPE,
type OrganizationData,
type PublicAllianceNominationData,
type PublicCandidateNominationData,
type PublicOrganizationNominationData
} from '@openvaa/data';
import { ENTITY_TYPE } from '@openvaa/data';
import { logDebugError } from '$lib/utils/logger';
import { parseBasics, parseCandidate, parseOrganization, parseRelationIds, parseSingleRelationId } from '../utils';
import type { CustomData } from '@openvaa/app-shared';
import type { Id } from '@openvaa/core';
import type {
AnyEntityVariantData,
AnyNominationVariantPublicData,
CandidateData,
OrganizationData,
PublicAllianceNominationData,
PublicCandidateNominationData,
PublicOrganizationNominationData
} from '@openvaa/data';
import type { StrapiAllianceData, StrapiNominationData } from '../strapiData.type';

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ENTITY_TYPE, type OrganizationData } from '@openvaa/data';
import { ENTITY_TYPE } from '@openvaa/data';
import { parseAnswers } from '$lib/api/utils/parseAnswers';
import { parseBasics } from './parseBasics';
import { parseImage } from './parseImage';
import type { OrganizationData } from '@openvaa/data';
import type { StrapiPartyData } from '../strapiData.type';

export function parseOrganization(data: StrapiPartyData, locale: string | null): OrganizationData {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { type AnyQuestionVariantData, type Choice, QUESTION_TYPE } from '@openvaa/data';
import { QUESTION_TYPE } from '@openvaa/data';
import { formatId } from '$lib/api/utils/formatId';
import { translate } from '$lib/i18n';
import type { LocalizedChoice, QuestionSettingsDateType } from '@openvaa/app-shared';
import type { AnyQuestionVariantData, Choice } from '@openvaa/data';
import type { StrapiQuestionTypeData } from '../strapiData.type';

export function parseQuestionType(
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/lib/api/base/dataTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import type {
AnyQuestionVariantData,
ConstituencyData,
ConstituencyGroupData,
ElectionData
ElectionData,
QuestionCategoryData
} from '@openvaa/data';
import type { QuestionCategoryData } from '@openvaa/data';
import type { AppCustomization } from '$lib/contexts/app';
import type { DataProvider } from './dataProvider.type';

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/api/base/universalAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { constants } from '$lib/utils/constants';
import { addHeader } from '../utils/addHeader';
import { hasAuthHeaders } from '../utils/authHeaders';
import { cachifyUrl } from '../utils/cachifyUrl';
import { type ParsedResponse, parseResponse, type ResponseParser } from '../utils/parseResponse';
import { parseResponse } from '../utils/parseResponse';
import type { ParsedResponse, ResponseParser } from '../utils/parseResponse';
import type { AdapterConfig, FetchOptions, GetOptions, PostOptions, SearchParams } from './universalAdapter.type';

const DEFAULT_PARSER = 'json' as const;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { type AnyEntityVariantData, type AnyNominationVariantPublicData, ENTITY_TYPE } from '@openvaa/data';
import { ENTITY_TYPE } from '@openvaa/data';
import { describe, expect, test } from 'vitest';
import { filterEntitiesByNomination, parseEntitiesFromNominations } from './filterEntitiesByNomination';
import type { AnyEntityVariantData, AnyNominationVariantPublicData } from '@openvaa/data';

const nominations: Array<AnyNominationVariantPublicData> = [
{
Expand Down
8 changes: 2 additions & 6 deletions frontend/src/lib/api/utils/filterEntitiesByNomination.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import {
type AnyEntityVariantData,
type AnyNominationVariantPublicData,
ENTITY_TYPE,
type EntityType
} from '@openvaa/data';
import { ENTITY_TYPE } from '@openvaa/data';
import type { Id } from '@openvaa/core';
import type { AnyEntityVariantData, AnyNominationVariantPublicData, EntityType } from '@openvaa/data';

/**
* Filter the entities to those that are included in the possibly nested nominations.
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/api/utils/parseResponse.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { describe, expect, test, vi } from 'vitest';
import { parseResponse, type ResponseParser } from './parseResponse';
import { parseResponse } from './parseResponse';
import type { ResponseParser } from './parseResponse';

describe('parseResponse', () => {
test('should parse json response', async () => {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/api/utils/translateHeroContent.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type HeroContent, isEmoji, isImage, isLocalizedObject, type LocalizedHeroContent } from '@openvaa/app-shared';
import { isEmoji, isImage, isLocalizedObject } from '@openvaa/app-shared';
import { translateObject } from '$lib/i18n';
import type { HeroContent, LocalizedHeroContent } from '@openvaa/app-shared';

/**
* Translate possibly localized hero content object into a `HeroContent` object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,13 @@ When using this component, the `validPassword` property should be bound to a boo
-->

<script lang="ts">
import { minPasswordLength, validatePasswordDetails, type ValidationDetail } from '@openvaa/app-shared';
import { minPasswordLength, validatePasswordDetails } from '@openvaa/app-shared';
import { onMount } from 'svelte';
import { cubicOut } from 'svelte/easing';
import { tweened } from 'svelte/motion';
import { getComponentContext } from '$lib/contexts/component';
import { assertTranslationKey } from '$lib/i18n/utils/assertTranslationKey';
import type { ValidationDetail } from '@openvaa/app-shared';
import type { PasswordValidatorProps } from './PasswordValidator.type';

type $$Props = PasswordValidatorProps;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { QuestionCategory } from '@openvaa/data';
import type { SvelteHTMLElements } from 'svelte/elements';

export type CategoryTagProps = SvelteHTMLElements['span'] & {
/**
* The `QuestionCategory` object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ If any of the `ConstituencyGroup`s for the `Election`s are shared, only a single
-->

<script lang="ts">
import { type Constituency, isObjectType, OBJECT_TYPE } from '@openvaa/data';
import { isObjectType, OBJECT_TYPE } from '@openvaa/data';
import { error } from '@sveltejs/kit';
import { getComponentContext } from '$lib/contexts/component';
import { concatClass } from '$lib/utils/components';
import { SingleGroupConstituencySelector } from '.';
import type { Id } from '@openvaa/core';
import type { ConstituencyGroup, Election } from '@openvaa/data';
import type { Constituency, ConstituencyGroup, Election } from '@openvaa/data';
import type { ConstituencySelectorProps } from './ConstituencySelector.type';

type $$Props = ConstituencySelectorProps;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ Display constituency selection input for just one `ConstituencyGroup` which is n
-->

<script lang="ts">
import { type Constituency } from '@openvaa/data';
import { Select } from '$lib/components/select';
import { getComponentContext } from '$lib/contexts/component';
import type { Constituency } from '@openvaa/data';
import type { SingleGroupConstituencySelectorProps } from './SingleGroupConstituencySelector.type';

type $$Props = SingleGroupConstituencySelectorProps;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Election } from '@openvaa/data';
import type { SvelteHTMLElements } from 'svelte/elements';

export type ElectionTagProps = SvelteHTMLElements['span'] & {
/**
* The `Election` object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ Render an enumerated filter for entities that displays a list of values to inclu
-->

<script lang="ts">
import { isMissing, type MaybeMissing, MISSING_VALUE } from '@openvaa/filters';
import { isMissing, MISSING_VALUE } from '@openvaa/filters';
import { onDestroy } from 'svelte';
import { Icon } from '$lib/components/icon';
import { getComponentContext } from '$lib/contexts/component';
import { concatProps, getUUID } from '$lib/utils/components';
import { logDebugError } from '$lib/utils/logger';
import type { AnyChoice, AnyEntityVariant } from '@openvaa/data';
import type { MaybeMissing } from '@openvaa/filters';
import type { EnumeratedEntityFilterProps } from './EnumeratedEntityFilter.type';

type $$Props = EnumeratedEntityFilterProps;
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/components/entityTag/EntityTag.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ Used to display an `Entity` as small tag including an icon.
-->

<script lang="ts">
import { Icon, type IconName } from '$lib/components/icon';
import { Icon } from '$lib/components/icon';
import { concatClass } from '$lib/utils/components';
import { unwrapEntity } from '$lib/utils/entities';
import type { AnyEntityVariant, EntityType } from '@openvaa/data';
import type { IconName } from '$lib/components/icon';
import type { EntityTagProps } from './EntityTag.type';

type $$Props = EntityTagProps;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/components/entityTag/EntityTag.type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { SvelteHTMLElements } from 'svelte/elements';

export type EntityTagProps = SvelteHTMLElements['div'] & {
/**
* A possibly wrapped entity, e.g. candidate or a party.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { SvelteHTMLElements } from 'svelte/elements';

export type ErrorMessageProps = SvelteHTMLElements['div'] & {
/**
*Whether to show an inline version of the message. By default the message tries to center itself in the available area and displays a large emoji. @default false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and the main title.

<script lang="ts">
import { getComponentContext } from '$lib/contexts/component';

const { t } = getComponentContext();
</script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { AriaRole, SvelteHTMLElements } from 'svelte/elements';

export type HeadingGroupProps = SvelteHTMLElements['hgroup'] & {
/**
* The Aria role description of the `<hgroup>` element.
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/components/headingGroup/PreHeading.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Used for a pre-title, or kicker, above the main title of a page within a `Headin

<script lang="ts">
import { getComponentContext } from '$lib/contexts/component';

const { t } = getComponentContext();
</script>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { SvelteHTMLElements } from 'svelte/elements';

export type PreHeadingProps = SvelteHTMLElements['p'] & {
/**
* The Aria role description of the `<p>` element representing
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/components/heroEmoji/HeroEmoji.type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { SvelteHTMLElements } from 'svelte/elements';

export type HeroEmojiProps = SvelteHTMLElements['div'] & {
/**
* The emoji to use. Note that all non-emoji characters will be removed. If `undefined` the component will not be rendered at all. @default `undefined`
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/lib/components/input/Input.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ The input itself is wrapped in multiple container elements, the outermost of whi

<script lang="ts">
import { isLocalizedString } from '@openvaa/app-shared';
import { type Id, isEmptyValue } from '@openvaa/core';
import { isEmptyValue } from '@openvaa/core';
import { Button } from '$lib/components/button';
import { ErrorMessage } from '$lib/components/errorMessage';
import { Icon } from '$lib/components/icon';
Expand All @@ -64,6 +64,7 @@ The input itself is wrapped in multiple container elements, the outermost of whi
import { checkUrl } from '$lib/utils/links';
import { logDebugError } from '$lib/utils/logger';
import { iconBadgeClass, infoClass, joinGap, outsideLabelClass } from './shared';
import type { Id } from '@openvaa/core';
import type { AnyChoice, Image } from '@openvaa/data';
import type { TranslationsPayload } from '$lib/i18n/translations';
import type { TranslationKey } from '$types';
Expand Down
12 changes: 4 additions & 8 deletions frontend/src/lib/components/input/QuestionInput.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,11 @@ NB. To show opinion `Question`s, use the `OpinionQuestionInput` component in `$l

<script lang="ts">
import { getCustomData, isLocalizedString } from '@openvaa/app-shared';
import {
DateQuestion,
isChoiceQuestion,
isMultipleChoiceQuestion,
QUESTION_TYPE,
type QuestionType
} from '@openvaa/data';
import { DateQuestion, isChoiceQuestion, isMultipleChoiceQuestion, QUESTION_TYPE } from '@openvaa/data';
import { logDebugError } from '$lib/utils/logger';
import { Input, type InputProps } from '.';
import { Input } from '.';
import type { QuestionType } from '@openvaa/data';
import type { InputProps } from '.';
import type { QuestionInputProps } from './QuestionInput.type';

type $$Props = QuestionInputProps;
Expand Down
1 change: 1 addition & 0 deletions frontend/src/lib/components/loading/Loading.type.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { SvelteHTMLElements } from 'svelte/elements';

export type LoadingProps = SvelteHTMLElements['div'] & {
/**
* Whether to show an inline version of the spinner. By default the spinner tries to center itself in the available area. @default false
Expand Down
Loading
Loading