@metrichor/epi2me-client-web
Advanced tools
Comparing version 0.2.10629429 to 0.2.10639339
@@ -21,2 +21,3 @@ import type { TypedDocumentNode } from '@graphql-typed-document-node/core'; | ||
formats: string[]; | ||
isConsentedHuman: number; | ||
} | null; | ||
@@ -23,0 +24,0 @@ } |
@@ -14,64 +14,3 @@ import type { GraphQLClient } from './GraphQLClient.type'; | ||
} | ||
export declare const is_widget_validator: import("ts-runtime-typecheck").TypeCheck<{ | ||
type: "syntactic"; | ||
pattern: import("ts-runtime-typecheck").Optional<string>; | ||
minLength: import("ts-runtime-typecheck").Optional<number>; | ||
maxLength: import("ts-runtime-typecheck").Optional<number>; | ||
message: import("ts-runtime-typecheck").Optional<string>; | ||
exclude: import("ts-runtime-typecheck").Optional<boolean>; | ||
}> & { | ||
TYPE_NAME: string; | ||
}; | ||
export declare const is_widget_form_type: import("ts-runtime-typecheck").TypeCheck<import("ts-runtime-typecheck").Optional<{ | ||
type: "number" | "text"; | ||
minLength: import("ts-runtime-typecheck").Optional<number>; | ||
maxLength: import("ts-runtime-typecheck").Optional<number>; | ||
min: import("ts-runtime-typecheck").Optional<number>; | ||
max: import("ts-runtime-typecheck").Optional<number>; | ||
step: import("ts-runtime-typecheck").Optional<number>; | ||
placeholder: import("ts-runtime-typecheck").Optional<string>; | ||
readonly: import("ts-runtime-typecheck").Optional<boolean>; | ||
}>> & { | ||
TYPE_NAME: string; | ||
}; | ||
export declare const is_workflow_param: import("ts-runtime-typecheck").TypeCheck<{ | ||
cgi_param: string; | ||
component_id: number; | ||
mandatory: boolean; | ||
widget: string; | ||
label: import("ts-runtime-typecheck").Optional<string>; | ||
default: import("ts-runtime-typecheck").Primitive; | ||
validation: import("ts-runtime-typecheck").Optional<{ | ||
type: "syntactic"; | ||
pattern: import("ts-runtime-typecheck").Optional<string>; | ||
minLength: import("ts-runtime-typecheck").Optional<number>; | ||
maxLength: import("ts-runtime-typecheck").Optional<number>; | ||
message: import("ts-runtime-typecheck").Optional<string>; | ||
exclude: import("ts-runtime-typecheck").Optional<boolean>; | ||
}[]>; | ||
filetype: import("ts-runtime-typecheck").Optional<string>; | ||
form_type: import("ts-runtime-typecheck").Optional<{ | ||
type: "number" | "text"; | ||
minLength: import("ts-runtime-typecheck").Optional<number>; | ||
maxLength: import("ts-runtime-typecheck").Optional<number>; | ||
min: import("ts-runtime-typecheck").Optional<number>; | ||
max: import("ts-runtime-typecheck").Optional<number>; | ||
step: import("ts-runtime-typecheck").Optional<number>; | ||
placeholder: import("ts-runtime-typecheck").Optional<string>; | ||
readonly: import("ts-runtime-typecheck").Optional<boolean>; | ||
}>; | ||
help: import("ts-runtime-typecheck").Optional<{ | ||
text: string; | ||
example: string; | ||
}>; | ||
values: import("ts-runtime-typecheck").Optional<{ | ||
source: string; | ||
} | { | ||
label: string; | ||
value: import("ts-runtime-typecheck").Primitive; | ||
}[]>; | ||
}> & { | ||
TYPE_NAME: string; | ||
}; | ||
export declare function get_workflow_configuration(gql: GraphQLClient, id_workflow: string): Promise<WorkflowConfiguration>; | ||
export declare function get_workflow_configuration(gql: GraphQLClient, id_workflow: string, id_dataset?: string): Promise<WorkflowConfiguration>; | ||
export declare function get_instance_configuration(gql: GraphQLClient, id_instance: string): Promise<WorkflowConfiguration>; | ||
@@ -84,4 +23,4 @@ export declare function transform_parameter(source: unknown): WorkflowParam; | ||
export declare function resolve_basename(location: string): string; | ||
export declare function resolve_workflow_configuration(gql: GraphQLClient, cfg: WorkflowConfiguration): Promise<ResolvedWorkflowConfiguration>; | ||
export declare function resolve_workflow_configuration(cfg: WorkflowConfiguration): ResolvedWorkflowConfiguration; | ||
export declare function validate_workflow_argument(parameter: WorkflowParam, value: string | undefined): string | undefined; | ||
//# sourceMappingURL=parameters.d.ts.map |
@@ -44,4 +44,4 @@ import type { Optional, Primitive } from 'ts-runtime-typecheck'; | ||
}; | ||
id_dataset?: string | undefined; | ||
human?: boolean; | ||
readonly id_dataset: string | undefined; | ||
human?: boolean | undefined; | ||
account?: string | undefined; | ||
@@ -48,0 +48,0 @@ } |
50
index.js
@@ -531,2 +531,3 @@ 'use strict'; | ||
formats | ||
isConsentedHuman | ||
} | ||
@@ -610,3 +611,3 @@ }`; | ||
}); | ||
async function get_workflow_configuration(gql, id_workflow) { | ||
async function get_workflow_configuration(gql, id_workflow, id_dataset) { | ||
var _a; | ||
@@ -637,2 +638,21 @@ const response = await gql.query({ | ||
} | ||
let human; | ||
if (id_dataset !== undefined) { | ||
const response = await gql.query({ | ||
query: DATASET_DOCUMENT, | ||
variables: { id_dataset }, | ||
}); | ||
const { dataset } = response.data; | ||
if (tsRuntimeTypecheck.isNullish(dataset)) { | ||
throw new Error(`Dataset ${id_dataset} does not exist.`); | ||
} | ||
if (dataset.size <= 0 || !dataset.isStored) { | ||
throw new Error('The source dataset contains no data.'); | ||
} | ||
const valid_types = dataset.formats.filter(type => input_formats.includes(type)); | ||
if (valid_types.length === 0) { | ||
throw new Error(`Workflow does not accept the filetypes ${dataset.formats.join(' ')}.`); | ||
} | ||
human = dataset.isConsentedHuman === 1; | ||
} | ||
return { | ||
@@ -643,2 +663,4 @@ id_workflow, | ||
accepted_files: input_formats, | ||
id_dataset, | ||
human, | ||
}; | ||
@@ -722,3 +744,3 @@ } | ||
} | ||
async function resolve_workflow_configuration(gql, cfg) { | ||
function resolve_workflow_configuration(cfg) { | ||
var _a; | ||
@@ -731,20 +753,2 @@ if (tsRuntimeTypecheck.isNullish(cfg.human)) { | ||
} | ||
const { id_dataset } = cfg; | ||
if (id_dataset !== undefined) { | ||
const response = await gql.query({ | ||
query: DATASET_DOCUMENT, | ||
variables: { id_dataset }, | ||
}); | ||
const { dataset } = response.data; | ||
if (tsRuntimeTypecheck.isNullish(dataset)) { | ||
throw new Error(`Dataset ${id_dataset} does not exist.`); | ||
} | ||
if (dataset.size <= 0 || !dataset.isStored) { | ||
throw new Error('The source dataset contains no data.'); | ||
} | ||
const invalid_types = dataset.formats.filter(type => !cfg.accepted_files.includes(type)); | ||
if (invalid_types.length > 0) { | ||
throw new Error(`Workflow does not accept the filetypes ${invalid_types.join(' ')}.`); | ||
} | ||
} | ||
const formatted_arguments = {}; | ||
@@ -756,3 +760,3 @@ const errors = []; | ||
} | ||
if (parameter.widget === exports.WIDGET.file && id_dataset !== undefined) { | ||
if (parameter.widget === exports.WIDGET.file && cfg.id_dataset !== undefined) { | ||
continue; | ||
@@ -786,3 +790,3 @@ } | ||
return { | ||
idDataset: id_dataset, | ||
idDataset: cfg.id_dataset, | ||
idWorkflow: cfg.id_workflow, | ||
@@ -796,3 +800,3 @@ isConsentedHuman: cfg.human, | ||
var _a, _b, _c, _d, _e, _f; | ||
if (value === undefined || value === '') { | ||
if (value === undefined || value.trim() === '') { | ||
if (parameter.mandatory) { | ||
@@ -799,0 +803,0 @@ return `${(_a = parameter.label) !== null && _a !== void 0 ? _a : parameter.cgi_param} is mandatory.`; |
{ | ||
"name": "@metrichor/epi2me-client-web", | ||
"version": "0.2.10629429", | ||
"version": "0.2.10639339", | ||
"license": "MPL-2.0", | ||
@@ -5,0 +5,0 @@ "author": "Metrichor <support@nanoporetech.com>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110820
2217