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
2 changes: 2 additions & 0 deletions .github/workflows/_validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ jobs:
- name: Initialize Terraform CDK configuration
shell: bash
working-directory: infra/cdktf
env:
NODE_OPTIONS: --max-old-space-size=4096
run: |
pnpm cdktf get
pnpm build:tsc
Expand Down
1 change: 1 addition & 0 deletions e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"private": true,
"scripts": {
"auth": "pnpm --filter=@flexion/forms-cli cli e2e create-test-session -p ../../packages/server/src/main.db -o ../../e2e/.env",
"clean": "rimraf coverage test-results playwright-report",
"dev": "tsc -w",
"test:e2e:ci": "pnpm auth && pnpm playwright test --headed",
"test:e2e:dev": "pnpm auth && pnpm playwright test --ui-port=8080 --ui-host=0.0.0.0"
Expand Down
1 change: 1 addition & 0 deletions infra/aws-cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"build:typescript": "tsc",
"build:synth": "cdk synth",
"cdk": "cdk",
"clean": "rimraf dist cdk.out tsconfig.tsbuildinfo coverage",
"test": "echo 'no tests'",
"watch": "tsc -w"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/design/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"build:storybook": "storybook build",
"build:styles": "gulp update",
"clean": "pnpm clean:lib && pnpm clean:styles",
"clean:lib": "rimraf dist",
"clean:lib": "rimraf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo coverage storybook-static",
"clean:styles": "rimraf static",
"dev": "run-p dev:*",
"dev:lib": "vite",
Expand Down
6 changes: 3 additions & 3 deletions packages/forms/src/blueprint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import {
generatePatternId,
getPatternMap,
removeChildPattern,
} from './pattern';
} from './pattern.js';
import {
type FieldsetPattern,
type FormSummaryPattern,
type PagePattern,
type PageSetPattern,
type RepeaterPattern,
type SequencePattern,
} from './patterns';
import { type Blueprint, type FormOutput, type FormSummary } from './types';
} from './patterns/index.js';
import { type Blueprint, type FormOutput, type FormSummary } from './types.js';

export const nullBlueprint: Blueprint = {
summary: {
Expand Down
4 changes: 2 additions & 2 deletions packages/forms/src/builder/parse-form.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import * as z from 'zod';

import { failure, success, type Result } from '@flexion/forms-common';
import type { FormConfig } from '../pattern';
import type { Blueprint } from '../types';
import type { FormConfig } from '../pattern.js';
import type { Blueprint } from '../types.js';

/**
* Parses and validates an object against a form schema defined by the given configuration.
Expand Down
4 changes: 3 additions & 1 deletion packages/forms/src/pattern.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import * as r from '@flexion/forms-common';
import set from 'set-value';

import { type CreatePrompt } from './components.js';
import { type FormError, type FormErrors } from './error.js';
Expand Down Expand Up @@ -249,6 +248,9 @@ export const getFirstPattern = (
): Pattern => {
if (!pattern) {
pattern = form.patterns[form.root];
if (!pattern) {
throw new Error(`Root pattern with id ${form.root} not found`);
}
}
const elemConfig = getPatternConfig(config, pattern.type);
const children = elemConfig.getChildren(pattern, form.patterns);
Expand Down
2 changes: 1 addition & 1 deletion packages/forms/src/patterns/attachment/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { z } from 'zod';
import { enLocale as message } from '@flexion/forms-common';
import { ParsePatternConfigData, type Pattern } from '../../pattern.js';
import { safeZodParseFormErrors } from '../../util/zod.js';
import { attachmentFileTypeMimes } from './file-type-options';
import { attachmentFileTypeMimes } from './file-type-options.js';

export type AttachmentPattern = Pattern<AttachmentConfigSchema>;

Expand Down
2 changes: 1 addition & 1 deletion packages/forms/src/patterns/attachment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { type PatternConfig } from '../../pattern.js';
import { parseConfigData, type AttachmentPattern } from './config.js';
import { createPrompt } from './prompt.js';
import { type AttachmentPatternOutput, parseUserInput } from './response.js';
import { attachmentFileTypeMimes } from './file-type-options';
import { attachmentFileTypeMimes } from './file-type-options.js';

export const attachmentConfig: PatternConfig<
AttachmentPattern,
Expand Down
2 changes: 1 addition & 1 deletion packages/forms/src/patterns/name/name.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { createNameSchema, nameConfig, type NamePattern } from './index';
import { createNameSchema, nameConfig, type NamePattern } from './index.js';

describe('NamePattern tests', () => {
describe('createNameSchema', () => {
Expand Down
10 changes: 5 additions & 5 deletions packages/forms/src/patterns/package-download/submit.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { failure, success, type Result } from '@flexion/forms-common';

import { type Blueprint, type FormOutput } from '../..';
import { createFormOutputFieldData, fillPDF } from '../../documents';
import { sessionIsComplete } from '../../session';
import { type SubmitHandler } from '../../submission';
import { type FormOutput } from '../../index.js';
import { createFormOutputFieldData, fillPDF } from '../../documents/index.js';
import { sessionIsComplete } from '../../session.js';
import { type SubmitHandler } from '../../submission.js';

import { type PackageDownloadPattern } from './index';
import { type PackageDownloadPattern } from './index.js';

export const downloadPackageHandler: SubmitHandler<
PackageDownloadPattern
Expand Down
8 changes: 4 additions & 4 deletions packages/forms/src/patterns/page-set/submit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import {
getPatternSafely,
aggregatePatternSessionValues,
} from '../../pattern.js';
import { type FormSession } from '../../session';
import { type SubmitHandler } from '../../submission';
import { type PagePattern } from '../page/config';
import { type PageSetPattern } from './config';
import { type FormSession } from '../../session.js';
import { type SubmitHandler } from '../../submission.js';
import { type PagePattern } from '../page/config.js';
import { type PageSetPattern } from './config.js';

const getPage = (formSession: FormSession) => {
const page = formSession.route?.params.page?.toString();
Expand Down
6 changes: 3 additions & 3 deletions packages/forms/src/patterns/repeater/submit.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { success } from '@flexion/forms-common';

import { type RepeaterPattern } from '../..';
import { type SubmitHandler } from '../../submission';
import { type RepeaterPattern } from '../../index.js';
import { type SubmitHandler } from '../../submission.js';

export const repeaterAddRowHandler: SubmitHandler<RepeaterPattern> = async (
context,
Expand All @@ -15,7 +15,7 @@ export const repeaterAddRowHandler: SubmitHandler<RepeaterPattern> = async (
: [];

const initialRepeaterRowData = opts.pattern.data.patterns.reduce(
(acc, patternId: string) => {
(acc, patternId) => {
// THIS requires all the patterns to have object not string input values
// acc[patternId] = {};

Expand Down
6 changes: 3 additions & 3 deletions packages/forms/src/repository/add-document.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type Result, failure, success } from '@flexion/forms-common';

import type { ParsedPdf } from '../documents/pdf/parsing-api';
import type { DocumentFieldMap } from '../documents/types';
import type { FormRepositoryContext } from '.';
import type { ParsedPdf } from '../documents/pdf/parsing-api.js';
import type { DocumentFieldMap } from '../documents/types.js';
import type { FormRepositoryContext } from './index.js';

export type AddDocument = (
ctx: FormRepositoryContext,
Expand Down
6 changes: 3 additions & 3 deletions packages/forms/src/repository/delete-form.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type VoidResult, failure, voidSuccess } from '@flexion/forms-common';

import type { FormOutput } from '../types';
import type { FormRepositoryContext } from '.';
import type { FormOutput } from '../types.js';
import type { FormRepositoryContext } from './index.js';

export type DeleteForm = (
ctx: FormRepositoryContext,
Expand Down Expand Up @@ -39,7 +39,7 @@ export const deleteForm: DeleteForm = async (ctx, formId) => {
.where('id', 'in', documentIds)
.execute()
.then(_ => voidSuccess)
.catch((error: Error) => {
.catch(error => {
return failure({ message: error.message, code: 'unknown' as const });
});
});
Expand Down
6 changes: 3 additions & 3 deletions packages/forms/src/repository/get-document.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { type Result, failure, success } from '@flexion/forms-common';

import type { ParsedPdf } from '../documents/pdf/parsing-api';
import type { DocumentFieldMap } from '../documents/types';
import type { FormRepositoryContext } from '.';
import type { ParsedPdf } from '../documents/pdf/parsing-api.js';
import type { DocumentFieldMap } from '../documents/types.js';
import type { FormRepositoryContext } from './index.js';

export type GetDocument = (
ctx: FormRepositoryContext,
Expand Down
2 changes: 1 addition & 1 deletion packages/forms/src/repository/get-form-list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FormRepositoryContext } from '.';
import type { FormRepositoryContext } from './index.js';
import type { JobStatus } from './jobs/types.js';

export type FormListItem = {
Expand Down
4 changes: 2 additions & 2 deletions packages/forms/src/repository/get-form-session.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Result, failure, success } from '@flexion/forms-common';
import { type FormSession, type FormSessionId } from '../session';
import type { FormRepositoryContext } from '.';
import { type FormSession, type FormSessionId } from '../session.js';
import type { FormRepositoryContext } from './index.js';

export type GetFormSession = (
ctx: FormRepositoryContext,
Expand Down
4 changes: 2 additions & 2 deletions packages/forms/src/repository/upsert-form-session.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Result, failure, success } from '@flexion/forms-common';
import { type FormSession } from '../session';
import type { FormRepositoryContext } from '.';
import { type FormSession } from '../session.js';
import type { FormRepositoryContext } from './index.js';

export type UpsertFormSession = (
ctx: FormRepositoryContext,
Expand Down
8 changes: 4 additions & 4 deletions packages/forms/src/services/submit-form.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { failure, success, type Result } from '@flexion/forms-common';

import { type FormServiceContext } from '../context/index.js';
import { submitPage } from '../patterns/page-set/submit';
import { downloadPackageHandler } from '../patterns/package-download/submit';
import { submitPage } from '../patterns/page-set/submit.js';
import { downloadPackageHandler } from '../patterns/package-download/submit.js';
import {
repeaterAddRowHandler,
repeaterDeleteRowHandler,
} from '../patterns/repeater/submit';
} from '../patterns/repeater/submit.js';
import { type FormRoute } from '../route-data.js';
import { SubmissionRegistry } from '../submission';
import { SubmissionRegistry } from '../submission.js';
import {
createFormSession,
type FormSession,
Expand Down
6 changes: 3 additions & 3 deletions packages/forms/src/submission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
type Pattern,
type PatternId,
getPattern,
} from './pattern';
import { type FormSession } from './session';
import { type Blueprint, type DocumentFieldMap } from '.';
} from './pattern.js';
import { type FormSession } from './session.js';
import { type Blueprint, type DocumentFieldMap } from './index.js';

export type SubmitHandlerContext = {
config: FormConfig;
Expand Down
4 changes: 2 additions & 2 deletions packages/forms/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type DocumentFieldMap } from './documents/types';
import { type PatternId, type PatternMap } from './pattern';
import { type DocumentFieldMap } from './documents/types.js';
import { type PatternId, type PatternMap } from './pattern.js';

export type Blueprint = {
summary: FormSummary;
Expand Down