diff --git a/.eslintrc.js b/.eslintrc.js index 5ec21e0..bb161a9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1,32 +1,19 @@ +/* eslint-env node */ + module.exports = { - env: { - browser: false, - commonjs: true, - es2021: true, - node: true - }, - extends: [ - 'eslint:recommended', - 'plugin:@typescript-eslint/recommended', - 'prettier' - ], - parserOptions: { - ecmaVersion: 'latest' - }, - plugins: ['@typescript-eslint'], - rules: { - '@typescript-eslint/no-non-null-assertion': 0, - '@typescript-eslint/ban-types': 0, - '@typescript-eslint/explicit-module-boundary-types': ['off'], - '@typescript-eslint/no-explicit-any': ['off'] - }, overrides: [ { - files: ['*.js'], + files: ['*.ts'], + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 'latest', + project: `${__dirname}/tsconfig.json` + }, rules: { - '@typescript-eslint/no-var-requires': 'off' + 'max-lines-per-function': ['error', { max: 80, skipBlankLines: true }], + 'max-depth': ['error', 6], + complexity: ['error', 20] } } - ], - ignorePatterns: ['**/build/*'] + ] }; diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..54c982d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,26 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'yarn' + + - name: Install dependencies + run: yarn install --frozen-lockfile + + - name: Build + run: yarn build diff --git a/package.json b/package.json index 47e302c..3b89a70 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hyperproof/hypersync-models", - "version": "5.2.0", + "version": "6.0.0-beta", "description": "Hypersync Models", "license": "MIT", "repository": { @@ -14,7 +14,7 @@ "lint": "./node_modules/eslint/bin/eslint.js 'src/**/*.{js,ts}' --max-warnings 0" }, "engines": { - "node": "^16.19.1 || ^18.17.1" + "node": "^22.0.0" }, "dependencies": {}, "devDependencies": { diff --git a/src/credentials.ts b/src/credentials.ts deleted file mode 100644 index f52565e..0000000 --- a/src/credentials.ts +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Enumeration of the types of fields that are available during the - * provide credentials step of connecting a Hypersync app. - */ -export enum CredentialFieldType { - Group = 'group', - Hidden = 'hidden', - Password = 'password', - Select = 'select', - Text = 'text', - TextArea = 'textArea' -} diff --git a/src/criteria.ts b/src/criteria.ts index bef06ba..31a691b 100644 --- a/src/criteria.ts +++ b/src/criteria.ts @@ -72,6 +72,7 @@ export interface ICriteriaFieldConfig { schemaCategory?: SchemaCategory; isMulti?: boolean; validation?: IValidation; + savedCriteriaSettings?: DataValueMap; } /** @@ -89,6 +90,11 @@ export interface IProofCriterionRef { name: string; page: number; } + +export interface ICriteriaSearchInput { + [criterion: string]: { value: string; offset: string }; +} + export enum ValidationTypes { alphaNumeric = 'alphaNumeric', email = 'email', diff --git a/src/dataSource.ts b/src/dataSource.ts index f591eb1..f8c5cff 100644 --- a/src/dataSource.ts +++ b/src/dataSource.ts @@ -38,6 +38,7 @@ export interface IDataSetLookup { dataSet: string; dataSetParams?: DataValueMap; delaySeconds?: number; + continueOnError?: boolean; } export enum PagingType { diff --git a/src/proofTypes.ts b/src/proofTypes.ts index 34d587e..13d4dc9 100644 --- a/src/proofTypes.ts +++ b/src/proofTypes.ts @@ -1,5 +1,6 @@ import { IProofCriterionRef } from './criteria'; import { DataValueMap } from './data'; +import { SortClause } from './dataSource'; export enum HypersyncDataFormat { Stacked = 'stacked', @@ -72,6 +73,33 @@ export interface IHypersyncField { format?: HypersyncFieldFormat; } +export enum IteratorSource { + DataSet = 'dataSet', + Criteria = 'criteria' +} + +export interface BaseIteratorDefinition { + layer: number; + iterandKey: string; + subArraySize?: number; +} + +export interface DataSetSourcedIterator extends BaseIteratorDefinition { + source: IteratorSource.DataSet; + dataSet: string; + dataSetParams?: DataValueMap; +} + +export interface CriteriaSourcedIterator extends BaseIteratorDefinition { + source: IteratorSource.Criteria; + criteriaProperty: string; + criteriaTransformer: string; +} + +export type DataSetIteratorDefinition = + | DataSetSourcedIterator + | CriteriaSourcedIterator; + export interface IProofSpec { period: HypersyncPeriod; useVersioning: boolean; @@ -82,11 +110,13 @@ export interface IProofSpec { subtitle: string; dataSet: string; dataSetParams?: DataValueMap; + dataSetIterator?: DataSetIteratorDefinition[]; noResultsMessage?: string; lookups?: IProofSpecLookup[]; fields: IHypersyncField[]; webPageUrl?: string; autoLayout?: boolean; + sort?: SortClause[]; } export interface IProofSpecOverride {