@kontur.candy/tools 2.236.2 → 2.237.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ICandyApiClient.js","names":[],"sources":["../../../../Common/CandyApiClient/ICandyApiClient.ts"],"sourcesContent":["import { HttpStatusCode } from \"../HttpClient/IHttpClient\";\nimport { ICombineByTransfers } from \"../../Engine/src/Engine/Core/ModalManager/Modals/UploadSection/Types\";\nimport { AbsoluteModelPath } from \"../ModelPath/ModelPath\";\nimport { AbsoluteModelFieldPath } from \"../ModelPath/AbsoluteModelFieldPath\";\nimport { FormSettings } from \"../../Engine/src/Forms/Types/FormSettings\";\nimport { AUOOptions } from \"../../Engine/src/Forms/Types/AUOOptions\";\n\nimport { ServerErrorLog } from \"./Types/ErrorLog/ServerErrorLog\";\nimport { ServerInnerResponse, ServerJsonResponse } from \"./Types/GetInner/ServerInnerResponse\";\nimport {\n ExcelsToPartialFufsResponse,\n FileProperties,\n ServerErrorResponse,\n UploadFilePropertiesResponse,\n} from \"./Types/DraftActions/FileProperties\";\nimport { CreateDraftResponse } from \"./Types/CreateDraft/CreateDraftResponse\";\nimport { CreateExplanatoryNoteResponse } from \"./Types/ExplanatoryNote/CreateExplanatoryNoteResponse\";\nimport { DraftFullId } from \"./Types/DraftFullId\";\nimport { ServerChangeSet } from \"./Types/ChangeSet/ServerChangeSet\";\nimport { ServerTask, VerifyAndFixFnsRequirementsTaskInfo } from \"./Types/Tasks/Tasks\";\nimport { GetByInnResponse } from \"./Types/Focus/FocusTypes\";\nimport { AttachInfo } from \"./Types/Attachments/Attacments\";\nimport { DraftPresentationType } from \"./Types/Presentations/DraftPresentationType\";\nimport { PresentationContent } from \"./Types/Presentations/PresentationContent\";\nimport { ConvertDraftRequest } from \"./Types/DraftActions/ConvertDraftRequest\";\nimport { ServerRequisitesResponse } from \"./Types/GetInner/ServerRequisitesResponse\";\nimport { CombinatorType, CombineFufResult, FufCombineMethod } from \"./Types/DraftActions/CombineFufResult\";\nimport { FeatureFlagsResponse } from \"./Types/FeatureFlags/FeatureFlagsResponse\";\nimport { ImportEmployeesRequest } from \"./Types/Staff/ImportEmployeesRequest\";\nimport { MassActionParameters } from \"./Types/MassActions/MassActionParameters\";\nimport { PrintType } from \"./Types/Print/PrintType\";\nimport { PrintResponse } from \"./Types/Print/PrintResponse\";\nimport { ServerRawResponse } from \"./Types/GetInner/ServerRawResponse\";\nimport { CandyPopdProtocol } from \"./Types/ErrorLog/CandyPopdProtocol\";\nimport { InstancesDeletingRule } from \"./Types/InstancesDeleting/InstancesDeletingRule\";\nimport { ValueForInstancesSettingRule } from \"./Types/MassActions/ValueForInstancesSettingRule\";\nimport { GetAttachmentsResponse } from \"./Types/Attachments/GetAttachmentsResponse\";\nimport { InnerQueryRequest } from \"./Types/QueryCollecton/InnerQueryRequest\";\nimport { InnerQueryResponse } from \"./Types/QueryCollecton/InnerQueryResponse\";\nimport { ResolveInnerPathRequest } from \"./Types/ErrorLog/ResolveInnerPathRequest\";\nimport { ResolvePathResponse } from \"./Types/ErrorLog/ResolvePathResponse\";\nimport { InnerHistoryResponse } from \"./Types/HistoryEditing/InnerHistoryResponse\";\nimport { PollingTaskWithResult } from \"./Types/PollingTasks/PollingTasks\";\n\nexport interface ICandyApiClient {\n forDraft(draftFullId: DraftFullId): ICandyApiDraftClient;\n\n // region Create draft\n createDraft(ns: string, gfv: string): Promise<CreateDraftResponse>;\n createDraft(ns: string, gfv: undefined, body: Buffer): Promise<CreateDraftResponse>;\n createDraftFromDrive(ns: string, fufDriveUri: string, abortSignal?: AbortSignal): Promise<CreateDraftResponse>;\n createEmptyDraft(ns: string, gfv: string, abortSignal?: AbortSignal): Promise<CreateDraftResponse>;\n // endregion\n\n //region Focus\n getInfoByInns(draftFullId: DraftFullId, inns: readonly string[]): Promise<GetByInnResponse>;\n //endregion\n\n // region Diagnostics\n getAllGfvs(abortSignal?: AbortSignal): Promise<string[]>;\n forceGetAllGfvs(): Promise<string[]>;\n // endregion\n\n checkAlive(): Promise<void>;\n\n getFeatureFlags(abonId?: string, orgId?: string, userId?: string): Promise<FeatureFlagsResponse>;\n}\n\nexport interface ICandyApiDraftTasksClient {\n getAllTasks(): Promise<ServerTask[]>;\n getTaskById(taskId: string): Promise<ServerTask | undefined>;\n enqueueTask(taskId: string, taskInfo: VerifyAndFixFnsRequirementsTaskInfo): Promise<void>;\n cancelTask(taskId: string): Promise<void>;\n}\n\nexport interface ICandyApiDraftAttachmentsClient {\n getAttachmentById(attachmentId: string): Promise<AttachInfo>;\n getAllAttachments(): Promise<AttachInfo[]>;\n createOrUpdateAttachments(attachments: readonly AttachInfo[]): Promise<void>;\n createDraftAttachment(gfv: string, path: string): Promise<AttachInfo>;\n openLoadedAttachmentAsDraft(id: string): Promise<AttachInfo>;\n removeAttachments(attachmentIds: readonly string[]): Promise<void>;\n}\n\nexport interface PathLoadSpecification {\n pathOrPathPrefix: AbsoluteModelPath | AbsoluteModelFieldPath | \"*\";\n skip: boolean;\n}\n\nexport type CheckScenarioType = \"readonly\";\nexport interface IInnerChangeSuccessResult {\n dataVersion: number;\n changedPaths?: string[];\n}\nexport type IInnerChangeResult = IInnerChangeSuccessResult | HttpStatusCode;\n\nexport interface DraftSettings {\n isReadOnly?: FormSettings[\"isReadOnly\"];\n isIndividual?: FormSettings[\"isIndividual\"];\n isForeign?: FormSettings[\"isForeign\"];\n employerId?: FormSettings[\"employerId\"];\n}\n\nexport type NormalizerNames = \"formulas\" | \"formulasWithInitializers\";\n\nexport interface NormalizationProgressTask {\n id: string;\n status: \"InProgress\" | \"Success\" | \"Error\";\n progress: number;\n}\n\nexport interface RequestNdsFileOptions {\n driveUri: string;\n ignoreSizeCheck?: boolean;\n declarationGfv: string;\n requestedGfv?: string;\n}\n\nexport interface ICandyApiDraftClient extends ICandyApiDraftTasksClient, ICandyApiDraftAttachmentsClient {\n // region Explanatory note\n getExplanatoryNote(): Promise<CreateExplanatoryNoteResponse>;\n // endregion\n\n // region Error log\n getErrorLog(): Promise<ServerErrorLog>;\n checkByPopd(): Promise<CandyPopdProtocol>;\n getErrorLogWithCheckScenarios(checkScenarios: CheckScenarioType[]): Promise<ServerErrorLog>;\n getExpertErrorLog(auo: Partial<AUOOptions>): Promise<ServerErrorLog>;\n getHrefToErrorLogPdf(errorLogName: string, propsName: string): string;\n // endregion\n\n // region Get draft requisites\n getRequisites(requisiteList: readonly string[]): Promise<ServerRequisitesResponse>;\n // endregion\n\n //region Get draft inner\n getInner(paths: undefined | readonly string[]): Promise<ServerInnerResponse>;\n getPartialInner(rules: readonly PathLoadSpecification[], maxInstanceCount?: number): Promise<ServerInnerResponse>;\n getPartialInnerAsJsonTree(\n rules: readonly PathLoadSpecification[],\n maxInstanceCount?: number,\n skipNormalization?: boolean\n ): Promise<ServerJsonResponse>;\n getRawPartialInnerAsJsonTree(\n rules: readonly PathLoadSpecification[],\n maxInstanceCount?: number,\n skipNormalization?: boolean\n ): Promise<ServerRawResponse>;\n getDataVersion(): Promise<number>;\n startNormalizationTask(): Promise<NormalizationProgressTask>;\n getNormalizationTask(): Promise<NormalizationProgressTask>;\n //endregion\n\n // region Update draft inner\n sendChangeSet(\n data: ServerChangeSet,\n currentDataVersion: number,\n operationName?: string\n ): Promise<IInnerChangeResult>;\n sendChangeSetSync(data: ServerChangeSet, currentDataVersion: number): IInnerChangeResult;\n sendChangeWithNormalizationSet(\n data: ServerChangeSet,\n currentDataVersion: number,\n normalizerId?: NormalizerNames,\n operationName?: string\n ): Promise<IInnerChangeResult>;\n startPatchWithNormalizationTask(\n data: ServerChangeSet,\n currentDataVersion: number,\n normalizerId?: string,\n operationName?: string,\n instantResultDelay?: number\n ): Promise<PollingTaskWithResult<IInnerChangeSuccessResult> | number>;\n getPatchWithNormalizationTask(): Promise<PollingTaskWithResult<IInnerChangeSuccessResult>>;\n // endregion\n\n // region Draft presentations\n setPresentation(type: DraftPresentationType, content: string | unknown): Promise<void>;\n patchPresentation(type: DraftPresentationType, content: PresentationContent): Promise<void>;\n // endregion\n\n // region Draft inner print\n print(type: PrintType, body?: string[]): Promise<PrintResponse>;\n // endregion\n\n // region Draft actions\n clearDraft(): Promise<void>;\n convertDraftFromPrevGfv(request: ConvertDraftRequest): Promise<void>;\n getFileProperties(driveUri: string, ignoreSizeCheck?: boolean): Promise<FileProperties | undefined>;\n getFileNdsProperties(params: RequestNdsFileOptions): Promise<FileProperties[] | undefined>;\n prepareAndGetFileProperties(\n driveUri: string,\n gfv: string,\n ignoreSizeCheck?: boolean\n ): Promise<FileProperties | undefined>;\n uploadAndGetFileProperties(\n driveUri: string[],\n gfv: string,\n abortSignal?: AbortSignal\n ): Promise<UploadFilePropertiesResponse>;\n setFufByDriveUri(driveUri: string): Promise<void>;\n acceptMultipleTransferType(\n files: ICombineByTransfers[],\n abortSignal?: AbortSignal\n ): Promise<ServerErrorResponse | undefined>;\n excelsToPartialFufs(\n gfv: string,\n pathToTable: string,\n driveUris: string[]\n ): Promise<ExcelsToPartialFufsResponse | undefined>;\n importXmls(\n driveUris: string[],\n combineMethod: FufCombineMethod,\n combinatorType: CombinatorType,\n isImportByFuf: boolean,\n args?: string[]\n ): Promise<CombineFufResult | undefined>;\n setDraftSettings(settings: DraftSettings): Promise<void>;\n getDraftSettings(): Promise<DraftSettings>;\n // endregion\n\n normalizeByRules(rules: string): Promise<void>;\n\n getHrefToConvertationLog(): string;\n getHrefToDownloadInnerFuf(): string;\n getHrefToDownloadClientInfo(): string;\n getHrefToDownloadFormsClientInfo(): string;\n getHrefToInnerEditor(): string;\n\n getFufWithAttachments(): Promise<FufWithAttachmentsResponse | undefined>;\n getPartialFuf(rules: string[]): Promise<BaseGetFufResponse | undefined>;\n getInnerFuf(): Promise<string | undefined>;\n\n downloadFuf(): Promise<void>;\n downloadInner(): Promise<void>;\n makeDownloadDriveLink(uri: string, fileName?: string): void;\n\n setMultipleWithNormalization(rules: ValueForInstancesSettingRule[]): Promise<IInnerChangeResult>;\n\n normalizeDirtyMasks(): Promise<IInnerChangeResult>;\n\n searchInstancesByText(\n text: string,\n pathPrefix: string,\n pathsToSearch: string[],\n maxInstanceCount?: number\n ): Promise<string[]>;\n\n queryCollection(request: InnerQueryRequest, abortSignal?: AbortSignal): Promise<InnerQueryResponse>;\n\n customNormalize(\n normalizerId: string | null,\n pathPrefixes: AbsoluteModelPath[],\n abortSignal?: AbortSignal\n ): Promise<IInnerChangeResult>;\n startCustomNormalizationTask(\n pathPrefixes: AbsoluteModelPath[],\n normalizerId?: string,\n operationName?: string\n ): Promise<PollingTaskWithResult<IInnerChangeResult>>;\n getCustomNormalizationTask(): Promise<PollingTaskWithResult<IInnerChangeResult>>;\n importEmployees(request: ImportEmployeesRequest): Promise<void>;\n runMassAction(actionId: string, parameters?: MassActionParameters): Promise<void>;\n deleteInstances(deletingRules: InstancesDeletingRule[]): Promise<void>;\n printExcel(pathToTable: string): Promise<PrintResponse | undefined>;\n\n resolveInnerPath(request: ResolveInnerPathRequest, abortSignal?: AbortSignal): Promise<ResolvePathResponse>;\n getHistory(): Promise<InnerHistoryResponse | number>;\n undoToChange(changeGUID: string): Promise<number>;\n getGFV(): Promise<string>;\n getUser(): Promise<GetUserResponse>;\n}\n\nexport interface GetUserResponse {\n Id: string | null;\n Ip: string | null;\n FirstName: string | null;\n MiddleName: string | null;\n LastName: string | null;\n}\n\nexport interface BaseGetFufResponse {\n ContentUri: string;\n Name: string;\n}\n\nexport interface FufWithAttachmentsResponse {\n Fuf: BaseGetFufResponse;\n attachments: GetAttachmentsResponse[];\n}\n\nexport interface CandyApiErrorResponse {\n message: string;\n errorCode: \"InvalidEditSession\" | string;\n}\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ICandyApiClient.js","names":[],"sources":["../../../../Common/CandyApiClient/ICandyApiClient.ts"],"sourcesContent":["import { HttpStatusCode } from \"../HttpClient/IHttpClient\";\nimport { ICombineByTransfers } from \"../../Engine/src/Engine/Core/ModalManager/Modals/UploadSection/Types\";\nimport { AbsoluteModelPath } from \"../ModelPath/ModelPath\";\nimport { AbsoluteModelFieldPath } from \"../ModelPath/AbsoluteModelFieldPath\";\nimport { FormSettings } from \"../../Engine/src/Forms/Types/FormSettings\";\nimport { AUOOptions } from \"../../Engine/src/Forms/Types/AUOOptions\";\n\nimport { ServerErrorLog } from \"./Types/ErrorLog/ServerErrorLog\";\nimport { ServerInnerResponse, ServerJsonResponse } from \"./Types/GetInner/ServerInnerResponse\";\nimport {\n ExcelsToPartialFufsResponse,\n FileProperties,\n ServerErrorResponse,\n UploadFilePropertiesResponse,\n} from \"./Types/DraftActions/FileProperties\";\nimport { CreateDraftResponse } from \"./Types/CreateDraft/CreateDraftResponse\";\nimport { CreateExplanatoryNoteResponse } from \"./Types/ExplanatoryNote/CreateExplanatoryNoteResponse\";\nimport { DraftFullId } from \"./Types/DraftFullId\";\nimport { ServerChangeSet } from \"./Types/ChangeSet/ServerChangeSet\";\nimport { ServerTask, VerifyAndFixFnsRequirementsTaskInfo } from \"./Types/Tasks/Tasks\";\nimport { GetByInnResponse } from \"./Types/Focus/FocusTypes\";\nimport { AttachInfo } from \"./Types/Attachments/Attacments\";\nimport { DraftPresentationType } from \"./Types/Presentations/DraftPresentationType\";\nimport { PresentationContent } from \"./Types/Presentations/PresentationContent\";\nimport { ConvertDraftRequest } from \"./Types/DraftActions/ConvertDraftRequest\";\nimport { ServerRequisitesResponse } from \"./Types/GetInner/ServerRequisitesResponse\";\nimport { CombinatorType, CombineFufResult, FufCombineMethod } from \"./Types/DraftActions/CombineFufResult\";\nimport { FeatureFlagsResponse } from \"./Types/FeatureFlags/FeatureFlagsResponse\";\nimport { ImportEmployeesRequest } from \"./Types/Staff/ImportEmployeesRequest\";\nimport { MassActionParameters } from \"./Types/MassActions/MassActionParameters\";\nimport { PrintType } from \"./Types/Print/PrintType\";\nimport { PrintResponse } from \"./Types/Print/PrintResponse\";\nimport { ServerRawResponse } from \"./Types/GetInner/ServerRawResponse\";\nimport { CandyPopdProtocol } from \"./Types/ErrorLog/CandyPopdProtocol\";\nimport { InstancesDeletingRule } from \"./Types/InstancesDeleting/InstancesDeletingRule\";\nimport { ValueForInstancesSettingRule } from \"./Types/MassActions/ValueForInstancesSettingRule\";\nimport { GetAttachmentsResponse } from \"./Types/Attachments/GetAttachmentsResponse\";\nimport { InnerQueryRequest } from \"./Types/QueryCollecton/InnerQueryRequest\";\nimport { InnerQueryResponse } from \"./Types/QueryCollecton/InnerQueryResponse\";\nimport { ResolveInnerPathRequest } from \"./Types/ErrorLog/ResolveInnerPathRequest\";\nimport { ResolvePathResponse } from \"./Types/ErrorLog/ResolvePathResponse\";\nimport { InnerHistoryResponse } from \"./Types/HistoryEditing/InnerHistoryResponse\";\nimport { PollingTaskWithResult } from \"./Types/PollingTasks/PollingTasks\";\n\nexport interface ICandyApiClient {\n forDraft(draftFullId: DraftFullId): ICandyApiDraftClient;\n\n // region Create draft\n createDraft(ns: string, gfv: string): Promise<CreateDraftResponse>;\n createDraft(ns: string, gfv: undefined, body: Buffer): Promise<CreateDraftResponse>;\n createDraftFromDrive(ns: string, fufDriveUri: string, abortSignal?: AbortSignal): Promise<CreateDraftResponse>;\n createEmptyDraft(ns: string, gfv: string, abortSignal?: AbortSignal): Promise<CreateDraftResponse>;\n // endregion\n\n //region Focus\n getInfoByInns(draftFullId: DraftFullId, inns: readonly string[]): Promise<GetByInnResponse>;\n //endregion\n\n // region Diagnostics\n getAllGfvs(abortSignal?: AbortSignal): Promise<string[]>;\n forceGetAllGfvs(): Promise<string[]>;\n // endregion\n\n checkAlive(): Promise<void>;\n\n getFeatureFlags(abonId?: string, orgId?: string, userId?: string): Promise<FeatureFlagsResponse>;\n}\n\nexport interface ICandyApiDraftTasksClient {\n getAllTasks(): Promise<ServerTask[]>;\n getTaskById(taskId: string): Promise<ServerTask | undefined>;\n enqueueTask(taskId: string, taskInfo: VerifyAndFixFnsRequirementsTaskInfo): Promise<void>;\n cancelTask(taskId: string): Promise<void>;\n}\n\nexport interface ICandyApiDraftAttachmentsClient {\n getAttachmentById(attachmentId: string): Promise<AttachInfo>;\n getAllAttachments(): Promise<AttachInfo[]>;\n createOrUpdateAttachments(attachments: readonly AttachInfo[]): Promise<void>;\n createDraftAttachment(gfv: string, path: string): Promise<AttachInfo>;\n openLoadedAttachmentAsDraft(id: string): Promise<AttachInfo>;\n removeAttachments(attachmentIds: readonly string[]): Promise<void>;\n}\n\nexport interface PathLoadSpecification {\n pathOrPathPrefix: AbsoluteModelPath | AbsoluteModelFieldPath | \"*\";\n skip: boolean;\n}\n\nexport type CheckScenarioType = \"readonly\";\nexport interface IInnerChangeSuccessResult {\n dataVersion: number;\n changedPaths?: string[];\n}\nexport type IInnerChangeResult = IInnerChangeSuccessResult | HttpStatusCode;\n\nexport interface DraftSettings {\n isReadOnly?: FormSettings[\"isReadOnly\"];\n isIndividual?: FormSettings[\"isIndividual\"];\n isForeign?: FormSettings[\"isForeign\"];\n employerId?: FormSettings[\"employerId\"];\n}\n\nexport type NormalizerNames = \"formulas\" | \"formulasWithInitializers\";\n\nexport interface NormalizationProgressTask {\n id: string;\n status: \"InProgress\" | \"Success\" | \"Error\";\n progress: number;\n}\n\nexport interface RequestNdsFileOptions {\n driveUri: string;\n ignoreSizeCheck?: boolean;\n declarationGfv: string;\n requestedGfv?: string;\n}\n\nexport interface ICandyApiDraftClient extends ICandyApiDraftTasksClient, ICandyApiDraftAttachmentsClient {\n // region Explanatory note\n getExplanatoryNote(): Promise<CreateExplanatoryNoteResponse>;\n // endregion\n\n // region Error log\n getErrorLog(): Promise<ServerErrorLog>;\n checkByPopd(): Promise<CandyPopdProtocol>;\n getErrorLogWithCheckScenarios(checkScenarios: CheckScenarioType[]): Promise<ServerErrorLog>;\n getExpertErrorLog(auo: Partial<AUOOptions>): Promise<ServerErrorLog>;\n getHrefToErrorLogPdf(errorLogName: string, propsName: string): string;\n // endregion\n\n // region Get draft requisites\n getRequisites(requisiteList: readonly string[]): Promise<ServerRequisitesResponse>;\n // endregion\n\n //region Get draft inner\n getInner(paths: undefined | readonly string[]): Promise<ServerInnerResponse>;\n getPartialInner(rules: readonly PathLoadSpecification[], maxInstanceCount?: number): Promise<ServerInnerResponse>;\n getPartialInnerAsJsonTree(\n rules: readonly PathLoadSpecification[],\n maxInstanceCount?: number,\n skipNormalization?: boolean\n ): Promise<ServerJsonResponse>;\n getRawPartialInnerAsJsonTree(\n rules: readonly PathLoadSpecification[],\n maxInstanceCount?: number,\n skipNormalization?: boolean\n ): Promise<ServerRawResponse>;\n getDataVersion(): Promise<number>;\n startNormalizationTask(): Promise<NormalizationProgressTask>;\n getNormalizationTask(): Promise<NormalizationProgressTask>;\n //endregion\n\n // region Update draft inner\n sendChangeSet(\n data: ServerChangeSet,\n currentDataVersion: number,\n operationName?: string\n ): Promise<IInnerChangeResult>;\n sendChangeSetSync(data: ServerChangeSet, currentDataVersion: number): IInnerChangeResult;\n sendChangeWithNormalizationSet(\n data: ServerChangeSet,\n currentDataVersion: number,\n normalizerId?: NormalizerNames,\n operationName?: string\n ): Promise<IInnerChangeResult>;\n startPatchWithNormalizationTask(\n data: ServerChangeSet,\n currentDataVersion: number,\n normalizerId?: string,\n operationName?: string,\n instantResultDelay?: number\n ): Promise<PollingTaskWithResult<IInnerChangeSuccessResult> | number>;\n getPatchWithNormalizationTask(): Promise<PollingTaskWithResult<IInnerChangeSuccessResult>>;\n // endregion\n\n // region Draft presentations\n setPresentation(type: DraftPresentationType, content: string | unknown): Promise<void>;\n patchPresentation(type: DraftPresentationType, content: PresentationContent): Promise<void>;\n // endregion\n\n // region Draft inner print\n print(type: PrintType, body?: string[]): Promise<PrintResponse>;\n // endregion\n\n // region Draft actions\n clearDraft(): Promise<void>;\n convertDraftFromPrevGfv(request: ConvertDraftRequest): Promise<void>;\n getFileProperties(driveUri: string, ignoreSizeCheck?: boolean): Promise<FileProperties | undefined>;\n getFileNdsProperties(params: RequestNdsFileOptions): Promise<FileProperties[] | undefined>;\n prepareAndGetFileProperties(\n driveUri: string,\n gfv: string,\n ignoreSizeCheck?: boolean\n ): Promise<FileProperties | undefined>;\n uploadAndGetFileProperties(\n driveUri: string[],\n gfv: string,\n abortSignal?: AbortSignal\n ): Promise<UploadFilePropertiesResponse>;\n setFufByDriveUri(driveUri: string): Promise<void>;\n acceptMultipleTransferType(\n files: ICombineByTransfers[],\n abortSignal?: AbortSignal\n ): Promise<ServerErrorResponse | undefined>;\n excelsToPartialFufs(\n gfv: string,\n pathToTable: string,\n driveUris: string[]\n ): Promise<ExcelsToPartialFufsResponse | undefined>;\n importXmls(\n driveUris: string[],\n combineMethod: FufCombineMethod,\n combinatorType: CombinatorType,\n isImportByFuf: boolean,\n args?: string[]\n ): Promise<CombineFufResult | undefined>;\n setDraftSettings(settings: DraftSettings): Promise<void>;\n getDraftSettings(): Promise<DraftSettings>;\n // endregion\n\n normalizeByRules(rules: string): Promise<void>;\n\n getHrefToConvertationLog(): string;\n getHrefToDownloadInnerFuf(): string;\n getHrefToDownloadClientInfo(): string;\n getHrefToDownloadFormsClientInfo(): string;\n getHrefToInnerEditor(): string;\n\n getFufWithAttachments(): Promise<FufWithAttachmentsResponse | undefined>;\n startGetFufWithAttachmentsTask(): Promise<PollingTaskWithResult<FufWithAttachmentsTaskResult>>;\n getFufWithAttachmentsTask(\n format: \"Json\" | \"DriveUri\"\n ): Promise<PollingTaskWithResult<FufWithAttachmentsTaskResult>>;\n getPartialFuf(rules: string[]): Promise<BaseGetFufResponse | undefined>;\n getInnerFuf(): Promise<string | undefined>;\n\n downloadFuf(): Promise<void>;\n downloadInner(): Promise<void>;\n makeDownloadDriveLink(uri: string, fileName?: string): void;\n\n setMultipleWithNormalization(rules: ValueForInstancesSettingRule[]): Promise<IInnerChangeResult>;\n\n normalizeDirtyMasks(): Promise<IInnerChangeResult>;\n\n searchInstancesByText(\n text: string,\n pathPrefix: string,\n pathsToSearch: string[],\n maxInstanceCount?: number\n ): Promise<string[]>;\n\n queryCollection(request: InnerQueryRequest, abortSignal?: AbortSignal): Promise<InnerQueryResponse>;\n\n customNormalize(\n normalizerId: string | null,\n pathPrefixes: AbsoluteModelPath[],\n abortSignal?: AbortSignal\n ): Promise<IInnerChangeResult>;\n startCustomNormalizationTask(\n pathPrefixes: AbsoluteModelPath[],\n normalizerId?: string,\n operationName?: string\n ): Promise<PollingTaskWithResult<IInnerChangeResult>>;\n getCustomNormalizationTask(): Promise<PollingTaskWithResult<IInnerChangeResult>>;\n importEmployees(request: ImportEmployeesRequest): Promise<void>;\n runMassAction(actionId: string, parameters?: MassActionParameters): Promise<void>;\n deleteInstances(deletingRules: InstancesDeletingRule[]): Promise<void>;\n printExcel(pathToTable: string): Promise<PrintResponse | undefined>;\n\n resolveInnerPath(request: ResolveInnerPathRequest, abortSignal?: AbortSignal): Promise<ResolvePathResponse>;\n getHistory(): Promise<InnerHistoryResponse | number>;\n undoToChange(changeGUID: string): Promise<number>;\n getGFV(): Promise<string>;\n getUser(): Promise<GetUserResponse>;\n}\n\nexport interface GetUserResponse {\n Id: string | null;\n Ip: string | null;\n FirstName: string | null;\n MiddleName: string | null;\n LastName: string | null;\n}\n\nexport interface BaseGetFufResponse {\n ContentUri: string;\n Name: string;\n}\n\nexport interface FufWithAttachmentsResponse {\n Fuf: BaseGetFufResponse;\n attachments: GetAttachmentsResponse[];\n}\n\nexport type FufWithAttachmentsTaskResult = FufWithAttachmentsResponse | { resultUri: string };\n\nexport interface CandyApiErrorResponse {\n message: string;\n errorCode: \"InvalidEditSession\" | string;\n}\n"],"mappings":"","ignoreList":[]}
@@ -9,6 +9,7 @@ var _AuthenticationMode = require("../HttpClient/AuthenticationMode");
9
9
  var _utils = require("../../Engine/src/Engine/utils");
10
10
  var _TypingUtils = require("../TypingUtils");
11
11
  var _DraftPresentationType = require("../CandyApiClient/Types/Presentations/DraftPresentationType");
12
+ var _PollingTaskWaiter = require("../CandyApiClient/Types/PollingTasks/PollingTaskWaiter");
12
13
  var _IFSPrinterClient = require("./IFSPrinterClient");
13
14
  class FSPrinterClient {
14
15
  constructor(fetchImpl, baseUrl, resourceZone, authentication, candyApiDraftClient, exceptionLogger) {
@@ -80,8 +81,9 @@ class FSPrinterClient {
80
81
  throw new Error("downloadFufHref is not defined");
81
82
  }
82
83
  async getFufDriveUrl() {
83
- const downloadFufHref = await this.candyApiDraftClient.getFufWithAttachments();
84
- if (downloadFufHref && downloadFufHref !== null && downloadFufHref !== void 0 && downloadFufHref.Fuf.ContentUri) {
84
+ await this.candyApiDraftClient.startGetFufWithAttachmentsTask();
85
+ const downloadFufHref = await (0, _PollingTaskWaiter.waitPollingTask)(() => this.candyApiDraftClient.getFufWithAttachmentsTask("Json"));
86
+ if (downloadFufHref && "Fuf" in downloadFufHref && downloadFufHref !== null && downloadFufHref !== void 0 && downloadFufHref.Fuf.ContentUri) {
85
87
  return downloadFufHref === null || downloadFufHref === void 0 ? void 0 : downloadFufHref.Fuf.ContentUri;
86
88
  }
87
89
  throw new Error("downloadFufHref is not defined");
@@ -1 +1 @@
1
- {"version":3,"file":"FSPrinterClient.js","names":["_HttpClient","require","_AuthenticationMode","_utils","_TypingUtils","_DraftPresentationType","_IFSPrinterClient","FSPrinterClient","constructor","fetchImpl","baseUrl","resourceZone","authentication","candyApiDraftClient","exceptionLogger","httpClient","pullingDelay","factor","timeout","defaultPullingDelay","defaultFactor","defaultTimeout","taskResult","HttpClient","createAuthenticationProvider","printRSV","type","resultType","PrinterResultTypes","Excel","presentation","DraftPresentationType","fuf","innerFuf","requestOptions","options","rsvInfo","driveUri","print","printByRules","partialFufUri","getPartialFufDriveUrl","rules","Pdf","_this$taskResult","applyRequestOptions","task","createTask","runMonitoringTask","taskId","resultUrl","resultUri","resetPrintResult","downloadDocument","downloadFufHref","getPartialFuf","ContentUri","Error","getInnerFufDriveUrl","downloadHref","getInnerFuf","getFufDriveUrl","getFufWithAttachments","Fuf","_this$taskResult2","_this$taskResult3","checkTask","delay","taskStatus","get","json","errorInfo","userMessage","presentationUri","getPresentationUri","optionsWithFuf","appendFufUrlToOptions","optionsWithSender","appendSenderAppToOptions","taskInfo","post","withJsonBody","_options$fuf$driveUri","_options$fuf2","_options$fuf","driveUrl","isNullOrEmpty","_this$taskResult4","reject","window","location","href","fufUrl","senderApp","_requestOptions$pulli","_requestOptions$facto","_requestOptions$timeo","undefined","exports"],"sources":["../../../../Common/FSPrinterClient/FSPrinterClient.ts"],"sourcesContent":["import { Fetch } from \"../HttpClient/FetchImplementation/Fetch\";\nimport { ExceptionLogger, HttpClient } from \"../HttpClient/HttpClient\";\nimport { IHttpClient } from \"../HttpClient/IHttpClient\";\nimport { AuthenticationMode, createAuthenticationProvider } from \"../HttpClient/AuthenticationMode\";\nimport { ICandyApiDraftClient } from \"../CandyApiClient/ICandyApiClient\";\nimport { delay } from \"../../Engine/src/Engine/utils\";\nimport { isNullOrEmpty, reject } from \"../TypingUtils\";\nimport { DraftPresentationType } from \"../CandyApiClient/Types/Presentations/DraftPresentationType\";\n\nimport {\n FSPrinterTaskResult,\n FSPrinterTaskStatus,\n IFSPrinterClient,\n PrintByRulesOptions,\n PrinterOptions,\n PrinterRequestOptions,\n PrinterResultTypes,\n RSVPrinterOptions,\n} from \"./IFSPrinterClient\";\n\nexport class FSPrinterClient implements IFSPrinterClient {\n private readonly httpClient: IHttpClient;\n private readonly candyApiDraftClient: ICandyApiDraftClient;\n\n private pullingDelay: number = 0;\n private factor: number = 0;\n private timeout: number = 0;\n\n private readonly defaultPullingDelay: number = 1200;\n private readonly defaultFactor: number = 2;\n private readonly defaultTimeout: number = 1000 * 60 * 10;\n\n private taskResult: FSPrinterTaskResult | undefined;\n\n public constructor(\n fetchImpl: Fetch,\n baseUrl: string,\n resourceZone: undefined | string,\n authentication: undefined | AuthenticationMode,\n candyApiDraftClient: ICandyApiDraftClient,\n exceptionLogger?: ExceptionLogger\n ) {\n this.httpClient = new HttpClient(\n fetchImpl,\n baseUrl,\n createAuthenticationProvider(authentication),\n {\n resourceZone: resourceZone,\n },\n exceptionLogger\n );\n this.candyApiDraftClient = candyApiDraftClient;\n }\n\n public async printRSV(\n {\n type,\n resultType = PrinterResultTypes.Excel,\n presentation = DraftPresentationType.fuf,\n innerFuf,\n }: RSVPrinterOptions,\n requestOptions?: PrinterRequestOptions\n ): Promise<void> {\n const options: PrinterOptions = {\n resultType: resultType,\n rsvInfo: { type: type },\n presentation: presentation,\n };\n if (innerFuf?.driveUri) {\n options.fuf = { driveUri: innerFuf?.driveUri };\n }\n await this.print(options, requestOptions);\n }\n\n public async printByRules(options: PrintByRulesOptions): Promise<void> {\n const partialFufUri = await this.getPartialFufDriveUrl(options.rules);\n await this.print({\n fuf: {\n driveUri: partialFufUri,\n },\n resultType: PrinterResultTypes.Pdf,\n ...options.options,\n });\n }\n\n public async print(options: PrinterOptions, requestOptions?: PrinterRequestOptions): Promise<void> {\n this.applyRequestOptions(requestOptions);\n const task = await this.createTask(options);\n await this.runMonitoringTask(task.taskId);\n const resultUrl = this.taskResult?.resultUri;\n this.resetPrintResult();\n this.downloadDocument(resultUrl);\n }\n\n private async getPartialFufDriveUrl(rules: string[]): Promise<string> {\n const downloadFufHref = await this.candyApiDraftClient.getPartialFuf(rules);\n if (downloadFufHref && downloadFufHref?.ContentUri) {\n return downloadFufHref?.ContentUri;\n }\n throw new Error(\"downloadFufHref is not defined\");\n }\n\n private async getInnerFufDriveUrl(): Promise<string> {\n const downloadHref = await this.candyApiDraftClient.getInnerFuf();\n if (downloadHref) {\n return downloadHref;\n }\n throw new Error(\"downloadFufHref is not defined\");\n }\n\n private async getFufDriveUrl(): Promise<string> {\n const downloadFufHref = await this.candyApiDraftClient.getFufWithAttachments();\n if (downloadFufHref && downloadFufHref?.Fuf.ContentUri) {\n return downloadFufHref?.Fuf.ContentUri;\n }\n throw new Error(\"downloadFufHref is not defined\");\n }\n\n private async runMonitoringTask(taskId: string): Promise<void> {\n while (!this.taskResult?.resultUri) {\n await this.checkTask(taskId);\n if (!this.taskResult?.resultUri) {\n await delay(this.pullingDelay);\n this.pullingDelay *= this.factor;\n }\n }\n }\n\n private async checkTask(taskId: string): Promise<void> {\n const taskStatus = await this.httpClient.get(`v3/tasks/${taskId}`).json<FSPrinterTaskResult>();\n if (taskStatus.errorInfo) {\n throw new Error(taskStatus.errorInfo.userMessage);\n }\n if (taskStatus.resultUri) {\n this.taskResult = taskStatus;\n return;\n }\n if (this.timeout <= this.pullingDelay) {\n throw new Error(`Timeout ${this.timeout / 60 / 1000} min for print file has expired`);\n }\n }\n\n private async createTask(options: PrinterOptions): Promise<FSPrinterTaskStatus> {\n const presentationUri = await this.getPresentationUri(options);\n\n const optionsWithFuf = this.appendFufUrlToOptions(options, presentationUri);\n const optionsWithSender = this.appendSenderAppToOptions(optionsWithFuf);\n const taskInfo = await this.httpClient\n .post(\"v3/tasks\")\n .withJsonBody(optionsWithSender)\n .json<FSPrinterTaskStatus>();\n return taskInfo;\n }\n\n private async getPresentationUri(options: PrinterOptions) {\n if (options.presentation === DraftPresentationType.innerFuf) {\n if (options.fuf?.driveUri) {\n return options.fuf.driveUri;\n }\n return await this.getInnerFufDriveUrl();\n }\n return options.fuf?.driveUri ?? (await this.getFufDriveUrl());\n }\n\n private downloadDocument(driveUrl: string | undefined) {\n if (isNullOrEmpty(driveUrl)) {\n reject(`Ссылка на печать документа пустая или undefined. Трейс печати: ${this.taskResult?.taskId}`);\n }\n window.location.href = driveUrl;\n }\n\n private appendFufUrlToOptions(options: PrinterOptions, fufUrl: string): PrinterOptions {\n return { ...options, fuf: { driveUri: fufUrl } };\n }\n\n private appendSenderAppToOptions(options: PrinterOptions): PrinterOptions {\n return { ...options, senderApp: \"candy-front\" };\n }\n\n private applyRequestOptions(requestOptions?: PrinterRequestOptions) {\n this.pullingDelay = requestOptions?.pullingDelay ?? this.defaultPullingDelay;\n this.factor = requestOptions?.factor ?? this.defaultFactor;\n this.timeout = requestOptions?.timeout ?? this.defaultTimeout;\n }\n\n private resetPrintResult() {\n this.taskResult = undefined;\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,mB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AAA,eAAA","ignoreList":[]}
1
+ {"version":3,"file":"FSPrinterClient.js","names":["_HttpClient","require","_AuthenticationMode","_utils","_TypingUtils","_DraftPresentationType","_PollingTaskWaiter","_IFSPrinterClient","FSPrinterClient","constructor","fetchImpl","baseUrl","resourceZone","authentication","candyApiDraftClient","exceptionLogger","httpClient","pullingDelay","factor","timeout","defaultPullingDelay","defaultFactor","defaultTimeout","taskResult","HttpClient","createAuthenticationProvider","printRSV","type","resultType","PrinterResultTypes","Excel","presentation","DraftPresentationType","fuf","innerFuf","requestOptions","options","rsvInfo","driveUri","print","printByRules","partialFufUri","getPartialFufDriveUrl","rules","Pdf","_this$taskResult","applyRequestOptions","task","createTask","runMonitoringTask","taskId","resultUrl","resultUri","resetPrintResult","downloadDocument","downloadFufHref","getPartialFuf","ContentUri","Error","getInnerFufDriveUrl","downloadHref","getInnerFuf","getFufDriveUrl","startGetFufWithAttachmentsTask","waitPollingTask","getFufWithAttachmentsTask","Fuf","_this$taskResult2","_this$taskResult3","checkTask","delay","taskStatus","get","json","errorInfo","userMessage","presentationUri","getPresentationUri","optionsWithFuf","appendFufUrlToOptions","optionsWithSender","appendSenderAppToOptions","taskInfo","post","withJsonBody","_options$fuf$driveUri","_options$fuf2","_options$fuf","driveUrl","isNullOrEmpty","_this$taskResult4","reject","window","location","href","fufUrl","senderApp","_requestOptions$pulli","_requestOptions$facto","_requestOptions$timeo","undefined","exports"],"sources":["../../../../Common/FSPrinterClient/FSPrinterClient.ts"],"sourcesContent":["import { Fetch } from \"../HttpClient/FetchImplementation/Fetch\";\nimport { ExceptionLogger, HttpClient } from \"../HttpClient/HttpClient\";\nimport { IHttpClient } from \"../HttpClient/IHttpClient\";\nimport { AuthenticationMode, createAuthenticationProvider } from \"../HttpClient/AuthenticationMode\";\nimport { ICandyApiDraftClient } from \"../CandyApiClient/ICandyApiClient\";\nimport { delay } from \"../../Engine/src/Engine/utils\";\nimport { isNullOrEmpty, reject } from \"../TypingUtils\";\nimport { DraftPresentationType } from \"../CandyApiClient/Types/Presentations/DraftPresentationType\";\nimport { waitPollingTask } from \"../CandyApiClient/Types/PollingTasks/PollingTaskWaiter\";\n\nimport {\n FSPrinterTaskResult,\n FSPrinterTaskStatus,\n IFSPrinterClient,\n PrintByRulesOptions,\n PrinterOptions,\n PrinterRequestOptions,\n PrinterResultTypes,\n RSVPrinterOptions,\n} from \"./IFSPrinterClient\";\n\nexport class FSPrinterClient implements IFSPrinterClient {\n private readonly httpClient: IHttpClient;\n private readonly candyApiDraftClient: ICandyApiDraftClient;\n\n private pullingDelay: number = 0;\n private factor: number = 0;\n private timeout: number = 0;\n\n private readonly defaultPullingDelay: number = 1200;\n private readonly defaultFactor: number = 2;\n private readonly defaultTimeout: number = 1000 * 60 * 10;\n\n private taskResult: FSPrinterTaskResult | undefined;\n\n public constructor(\n fetchImpl: Fetch,\n baseUrl: string,\n resourceZone: undefined | string,\n authentication: undefined | AuthenticationMode,\n candyApiDraftClient: ICandyApiDraftClient,\n exceptionLogger?: ExceptionLogger\n ) {\n this.httpClient = new HttpClient(\n fetchImpl,\n baseUrl,\n createAuthenticationProvider(authentication),\n {\n resourceZone: resourceZone,\n },\n exceptionLogger\n );\n this.candyApiDraftClient = candyApiDraftClient;\n }\n\n public async printRSV(\n {\n type,\n resultType = PrinterResultTypes.Excel,\n presentation = DraftPresentationType.fuf,\n innerFuf,\n }: RSVPrinterOptions,\n requestOptions?: PrinterRequestOptions\n ): Promise<void> {\n const options: PrinterOptions = {\n resultType: resultType,\n rsvInfo: { type: type },\n presentation: presentation,\n };\n if (innerFuf?.driveUri) {\n options.fuf = { driveUri: innerFuf?.driveUri };\n }\n await this.print(options, requestOptions);\n }\n\n public async printByRules(options: PrintByRulesOptions): Promise<void> {\n const partialFufUri = await this.getPartialFufDriveUrl(options.rules);\n await this.print({\n fuf: {\n driveUri: partialFufUri,\n },\n resultType: PrinterResultTypes.Pdf,\n ...options.options,\n });\n }\n\n public async print(options: PrinterOptions, requestOptions?: PrinterRequestOptions): Promise<void> {\n this.applyRequestOptions(requestOptions);\n const task = await this.createTask(options);\n await this.runMonitoringTask(task.taskId);\n const resultUrl = this.taskResult?.resultUri;\n this.resetPrintResult();\n this.downloadDocument(resultUrl);\n }\n\n private async getPartialFufDriveUrl(rules: string[]): Promise<string> {\n const downloadFufHref = await this.candyApiDraftClient.getPartialFuf(rules);\n if (downloadFufHref && downloadFufHref?.ContentUri) {\n return downloadFufHref?.ContentUri;\n }\n throw new Error(\"downloadFufHref is not defined\");\n }\n\n private async getInnerFufDriveUrl(): Promise<string> {\n const downloadHref = await this.candyApiDraftClient.getInnerFuf();\n if (downloadHref) {\n return downloadHref;\n }\n throw new Error(\"downloadFufHref is not defined\");\n }\n\n private async getFufDriveUrl(): Promise<string> {\n await this.candyApiDraftClient.startGetFufWithAttachmentsTask();\n const downloadFufHref = await waitPollingTask(() => this.candyApiDraftClient.getFufWithAttachmentsTask(\"Json\"));\n if (downloadFufHref && \"Fuf\" in downloadFufHref && downloadFufHref?.Fuf.ContentUri) {\n return downloadFufHref?.Fuf.ContentUri;\n }\n throw new Error(\"downloadFufHref is not defined\");\n }\n\n private async runMonitoringTask(taskId: string): Promise<void> {\n while (!this.taskResult?.resultUri) {\n await this.checkTask(taskId);\n if (!this.taskResult?.resultUri) {\n await delay(this.pullingDelay);\n this.pullingDelay *= this.factor;\n }\n }\n }\n\n private async checkTask(taskId: string): Promise<void> {\n const taskStatus = await this.httpClient.get(`v3/tasks/${taskId}`).json<FSPrinterTaskResult>();\n if (taskStatus.errorInfo) {\n throw new Error(taskStatus.errorInfo.userMessage);\n }\n if (taskStatus.resultUri) {\n this.taskResult = taskStatus;\n return;\n }\n if (this.timeout <= this.pullingDelay) {\n throw new Error(`Timeout ${this.timeout / 60 / 1000} min for print file has expired`);\n }\n }\n\n private async createTask(options: PrinterOptions): Promise<FSPrinterTaskStatus> {\n const presentationUri = await this.getPresentationUri(options);\n\n const optionsWithFuf = this.appendFufUrlToOptions(options, presentationUri);\n const optionsWithSender = this.appendSenderAppToOptions(optionsWithFuf);\n const taskInfo = await this.httpClient\n .post(\"v3/tasks\")\n .withJsonBody(optionsWithSender)\n .json<FSPrinterTaskStatus>();\n return taskInfo;\n }\n\n private async getPresentationUri(options: PrinterOptions) {\n if (options.presentation === DraftPresentationType.innerFuf) {\n if (options.fuf?.driveUri) {\n return options.fuf.driveUri;\n }\n return await this.getInnerFufDriveUrl();\n }\n return options.fuf?.driveUri ?? (await this.getFufDriveUrl());\n }\n\n private downloadDocument(driveUrl: string | undefined) {\n if (isNullOrEmpty(driveUrl)) {\n reject(`Ссылка на печать документа пустая или undefined. Трейс печати: ${this.taskResult?.taskId}`);\n }\n window.location.href = driveUrl;\n }\n\n private appendFufUrlToOptions(options: PrinterOptions, fufUrl: string): PrinterOptions {\n return { ...options, fuf: { driveUri: fufUrl } };\n }\n\n private appendSenderAppToOptions(options: PrinterOptions): PrinterOptions {\n return { ...options, senderApp: \"candy-front\" };\n }\n\n private applyRequestOptions(requestOptions?: PrinterRequestOptions) {\n this.pullingDelay = requestOptions?.pullingDelay ?? this.defaultPullingDelay;\n this.factor = requestOptions?.factor ?? this.defaultFactor;\n this.timeout = requestOptions?.timeout ?? this.defaultTimeout;\n }\n\n private resetPrintResult() {\n this.taskResult = undefined;\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,WAAA,GAAAC,OAAA;AAEA,IAAAC,mBAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,sBAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AAEA,IAAAM,iBAAA,GAAAN,OAAA;AAWO,MAAMO,eAAe,CAA6B;EAc9CC,WAAWA,CACdC,SAAgB,EAChBC,OAAe,EACfC,YAAgC,EAChCC,cAA8C,EAC9CC,mBAAyC,EACzCC,eAAiC,EACnC;IAAA,KApBeC,UAAU;IAAA,KACVF,mBAAmB;IAAA,KAE5BG,YAAY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AiBxC,MAAM,EAAE,CAAC;IACvG;IACA0C,MAAM,CAACC,QAAQ,CAACC,IAAI,GAAGN,QAAQ;EACnC;EAEQT,qBAAqBA,CAAC3C,OAAuB,EAAE2D,MAAc,EAAkB;IACnF,OAAO;MAAE,GAAG3D,OAAO;MAAEH,GAAG,EAAE;QAAEK,QAAQ,EAAEyD;MAAO;IAAE,CAAC;EACpD;EAEQd,wBAAwBA,CAAC7C,OAAuB,EAAkB;IACtE,OAAO;MAAE,GAAGA,OAAO;MAAE4D,SAAS,EAAE;IAAc,CAAC;EACnD;EAEQlD,mBAAmBA,CAACX,cAAsC,EAAE;IAAA,IAAA8D,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;IAChE,IAAI,CAAClF,YAAY,IAAAgF,qBAAA,GAAG9D,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAElB,YAAY,cAAAgF,qBAAA,cAAAA,qBAAA,GAAI,IAAI,CAAC7E,mBAAmB;IAC5E,IAAI,CAACF,MAAM,IAAAgF,qBAAA,GAAG/D,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEjB,MAAM,cAAAgF,qBAAA,cAAAA,qBAAA,GAAI,IAAI,CAAC7E,aAAa;IAC1D,IAAI,CAACF,OAAO,IAAAgF,qBAAA,GAAGhE,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEhB,OAAO,cAAAgF,qBAAA,cAAAA,qBAAA,GAAI,IAAI,CAAC7E,cAAc;EACjE;EAEQ+B,gBAAgBA,CAAA,EAAG;IACvB,IAAI,CAAC9B,UAAU,GAAG6E,SAAS;EAC/B;AACJ;AAACC,OAAA,CAAA7F,eAAA,GAAAA,eAAA","ignoreList":[]}
@@ -18,6 +18,20 @@ async function createConfigVariant(options) {
18
18
  const buildCache = options.buildCacheOptions != undefined ? new _CacheAssetsPlugin.BuildCache(options.buildCacheOptions.farmDirectory, options.buildCacheOptions.mode) : undefined;
19
19
  const buildCacheWebpackPlugin = buildCache != undefined && options.buildCacheOptions != undefined ? await buildCache.createWebpackPlugin(options.buildCacheOptions) : undefined;
20
20
  const devtoolOption = options.mode === "production" ? "hidden-source-map" : options.isLocalDev ? "inline-source-map" : "source-map";
21
+ const threadLoaderOptions = {
22
+ workers: 4,
23
+ workerParallelJobs: 10,
24
+ workerNodeArgs: ["--max-old-space-size=3072"]
25
+ };
26
+ const babelLoaderRules = [];
27
+ if (!options.isLocalDev) {
28
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
29
+ require("thread-loader").warmup(threadLoaderOptions, ["babel-loader", "@babel/preset-env", "@babel/preset-react"]);
30
+ babelLoaderRules.push({
31
+ loader: require.resolve("thread-loader"),
32
+ options: threadLoaderOptions
33
+ });
34
+ }
21
35
  return {
22
36
  mode: options.mode,
23
37
  target: ["web", "es5"],
@@ -75,28 +89,36 @@ async function createConfigVariant(options) {
75
89
  }]
76
90
  }, {
77
91
  test: /\.jsx?$/,
78
- use: [{
79
- loader: require.resolve("babel-loader"),
80
- options: {
81
- babelrc: false,
82
- configFile: false,
83
- presets: [require.resolve("@babel/preset-react"), [require.resolve("@babel/preset-env"), {
84
- targets: {
85
- browsers: "> 0%"
86
- },
87
- loose: true
88
- }]],
89
- plugins: [[require.resolve("@babel/plugin-proposal-decorators"), {
90
- legacy: true
91
- }], [require.resolve("@babel/plugin-transform-class-properties"), {
92
- loose: true
93
- }], require.resolve("@babel/plugin-proposal-export-default-from")]
94
- }
95
- }],
96
- resolve: {
97
- fullySpecified: false
98
- },
99
- exclude: [/node_modules/]
92
+ oneOf: [{
93
+ test: /(kcXmlValidationConfigurator|kcXmlAutoCalculationConfigurator|dataDeclaration)\.js$/,
94
+ type: "javascript/auto"
95
+ }, {
96
+ use: [...babelLoaderRules, {
97
+ loader: require.resolve("babel-loader"),
98
+ options: {
99
+ babelrc: false,
100
+ configFile: false,
101
+ presets: [require.resolve("@babel/preset-react"), [require.resolve("@babel/preset-env"), {
102
+ targets: {
103
+ browsers: [">0.5%", "last 2 versions", "not dead", "not IE 11"]
104
+ },
105
+ loose: true,
106
+ useBuiltIns: "usage",
107
+ corejs: 3
108
+ }]],
109
+ plugins: [[require.resolve("@babel/plugin-proposal-decorators"), {
110
+ legacy: true
111
+ }], [require.resolve("@babel/plugin-transform-class-properties"), {
112
+ loose: true
113
+ }], require.resolve("@babel/plugin-proposal-export-default-from")],
114
+ cacheDirectory: true
115
+ }
116
+ }],
117
+ resolve: {
118
+ fullySpecified: false
119
+ },
120
+ exclude: [/node_modules/]
121
+ }]
100
122
  }, {
101
123
  test: /\.(png|svg)$/,
102
124
  loader: require.resolve("file-loader"),
@@ -1 +1 @@
1
- {"version":3,"file":"createFormWebpackConfiguration.js","names":["_path","_interopRequireDefault","require","_miniCssExtractPlugin","_webpack","_CacheAssetsPlugin","createConfigVariant","options","gfv","fileNameSuffix","mode","formPath","buildCache","buildCacheOptions","undefined","BuildCache","farmDirectory","buildCacheWebpackPlugin","createWebpackPlugin","devtoolOption","isLocalDev","target","context","output","filename","path","resourcesDirectoryPath","publicPath","resolve","alias","join","__dirname","variables","Resources","extensions","entry","devtool","cache","type","maxGenerations","module","rules","test","use","loader","MiniCssExtractPlugin","modules","localIdentName","postcssOptions","ident","plugins","overrideBrowserslist","babelrc","configFile","presets","targets","browsers","loose","legacy","fullySpecified","exclude","name","webpack","DefinePlugin","GFV","JSON","stringify","NODE_ENV","RESOURCES_HASH","resourcesHash","filter","isNotNullOrUndefined","input","createConfig","result","modes","push","Promise","all"],"sources":["../../../../src/FormWebpackConfiguration/createFormWebpackConfiguration.ts"],"sourcesContent":["import path from \"path\";\n\nimport MiniCssExtractPlugin from \"mini-css-extract-plugin\";\nimport webpack, { Configuration } from \"webpack\";\n\nimport { BuildCache, FormBuildCacheOptions } from \"./CacheAssetsPlugin\";\n\ntype BuildMode = \"production\" | \"development\";\n\ninterface CreateWebpackConfigurationVariantOptions {\n gfv: string;\n resourcesHash: string;\n formPath: string;\n mode?: BuildMode;\n isLocalDev?: boolean;\n resourcesDirectoryPath: string;\n buildCacheOptions?: FormBuildCacheOptions;\n}\n\nasync function createConfigVariant(options: CreateWebpackConfigurationVariantOptions): Promise<Configuration> {\n const { gfv } = options;\n\n const fileNameSuffix = options.mode === \"production\" ? \".min\" : \"\";\n\n const formPath = options.formPath;\n const buildCache =\n options.buildCacheOptions != undefined\n ? new BuildCache(options.buildCacheOptions.farmDirectory, options.buildCacheOptions.mode)\n : undefined;\n\n const buildCacheWebpackPlugin =\n buildCache != undefined && options.buildCacheOptions != undefined\n ? await buildCache.createWebpackPlugin(options.buildCacheOptions)\n : undefined;\n\n const devtoolOption: Configuration[\"devtool\"] =\n options.mode === \"production\" ? \"hidden-source-map\" : options.isLocalDev ? \"inline-source-map\" : \"source-map\";\n\n return {\n mode: options.mode,\n target: [\"web\", \"es5\"],\n context: formPath,\n output: {\n filename: `public/scripts/${gfv}${fileNameSuffix}.js`,\n path: options.resourcesDirectoryPath,\n publicPath: \"/static/\",\n },\n resolve: {\n alias: {\n \"variables.less\": path.resolve(path.join(__dirname, \"variables.less\")),\n variables: path.resolve(path.join(__dirname, \"variables.less\")),\n Resources: path.join(formPath, \"form\", \"resources\"),\n },\n extensions: [\".js\", \".jsx\"],\n },\n entry: [path.join(formPath, \"form\", \"./web\")],\n devtool: devtoolOption,\n cache:\n options.mode === \"development\"\n ? {\n type: \"memory\",\n maxGenerations: 5,\n }\n : false,\n module: {\n rules: [\n {\n test: /\\.less$/,\n use: [\n {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n loader: MiniCssExtractPlugin.loader as any,\n options: { publicPath: \"../../\" },\n },\n {\n loader: require.resolve(\"css-loader\"),\n options: {\n modules: {\n localIdentName: \"[hash:base64:5]\",\n },\n },\n },\n {\n loader: require.resolve(\"postcss-loader\"),\n options: {\n postcssOptions: {\n ident: \"postcss\",\n plugins: [\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n require(\"autoprefixer\")({\n // Просто дефолтные значение из текущего (1.7.7) browserslist\n overrideBrowserslist: \"> 1%, last 2 versions, Firefox ESR\",\n }),\n ],\n },\n },\n },\n {\n loader: require.resolve(\"less-loader\"),\n },\n ],\n },\n {\n test: /\\.jsx?$/,\n use: [\n {\n loader: require.resolve(\"babel-loader\"),\n options: {\n babelrc: false,\n configFile: false,\n presets: [\n require.resolve(\"@babel/preset-react\"),\n [\n require.resolve(\"@babel/preset-env\"),\n {\n targets: { browsers: \"> 0%\" },\n loose: true,\n },\n ],\n ],\n plugins: [\n [require.resolve(\"@babel/plugin-proposal-decorators\"), { legacy: true }],\n [require.resolve(\"@babel/plugin-transform-class-properties\"), { loose: true }],\n require.resolve(\"@babel/plugin-proposal-export-default-from\"),\n ],\n },\n },\n ],\n resolve: {\n fullySpecified: false,\n },\n exclude: [/node_modules/],\n },\n {\n test: /\\.(png|svg)$/,\n loader: require.resolve(\"file-loader\"),\n options: { name: \"public/images/[hash].[ext]\" },\n },\n {\n test: /\\.(ttf|eot|woff2?)$/,\n loader: require.resolve(\"file-loader\"),\n options: { name: \"public/fonts/[hash].[ext]\" },\n },\n ],\n },\n // @ts-expect-error Починится, когда все либы обновятся\n plugins: [\n new MiniCssExtractPlugin({\n filename: `public/styles/${gfv}${fileNameSuffix}.css`,\n }),\n new webpack.DefinePlugin({\n \"process.env\": {\n GFV: JSON.stringify(gfv),\n NODE_ENV: JSON.stringify(options.mode),\n RESOURCES_HASH: JSON.stringify(options.resourcesHash),\n },\n }),\n buildCacheWebpackPlugin,\n ].filter(isNotNullOrUndefined),\n };\n}\n\nfunction isNotNullOrUndefined<T>(input: T | undefined | null): input is T {\n return input != undefined;\n}\n\nexport interface CreateWebpackConfigurationOptions {\n gfv: string;\n resourcesHash: string;\n formPath: string;\n resourcesDirectoryPath: string;\n modes: BuildMode[];\n isLocalDev?: boolean;\n buildCacheOptions?: FormBuildCacheOptions;\n}\n\nexport function createConfig(options: CreateWebpackConfigurationOptions): Promise<Configuration[]> {\n const result: Array<Promise<Configuration>> = [];\n\n for (const mode of options.modes) {\n result.push(\n createConfigVariant({\n gfv: options.gfv,\n resourcesHash: options.resourcesHash,\n formPath: options.formPath,\n resourcesDirectoryPath: options.resourcesDirectoryPath,\n mode: mode,\n isLocalDev: options.isLocalDev,\n buildCacheOptions: options.buildCacheOptions,\n })\n );\n }\n return Promise.all(result);\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA;AAcA,eAAeI,mBAAmBA,CAACC,OAAiD,EAA0B;EAC1G,MAAM;IAAEC;EAAI,CAAC,GAAGD,OAAO;EAEvB,MAAME,cAAc,GAAGF,OAAO,CAACG,IAAI,KAAK,YAAY,GAAG,MAAM,GAAG,EAAE;EAElE,MAAMC,QAAQ,GAAGJ,OAAO,CAACI,QAAQ;EACjC,MAAMC,UAAU,GACZL,OAAO,CAACM,iBAAiB,IAAIC,SAAS,GAChC,IAAIC,6BAAU,CAACR,OAAO,CAACM,iBAAiB,CAACG,aAAa,EAAET,OAAO,CAACM,iBAAiB,CAACH,IAAI,CAAC,GACvFI,SAAS;EAEnB,MAAMG,uBAAuB,GACzBL,UAAU,IAAIE,SAAS,IAAIP,OAAO,CAACM,iBAAiB,IAAIC,SAAS,GAC3D,MAAMF,UAAU,CAACM,mBAAmB,CAACX,OAAO,CAACM,iBAAiB,CAAC,GAC/DC,SAAS;EAEnB,MAAMK,aAAuC,GACzCZ,OAAO,CAACG,IAAI,KAAK,YAAY,GAAG,mBAAmB,GAAGH,OAAO,CAACa,UAAU,GAAG,mBAAmB,GAAG,YAAY;EAEjH,OAAO;IACHV,IAAI,EAAEH,OAAO,CAACG,IAAI;IAClBW,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;IACtBC,OAAO,EAAEX,QAAQ;IACjBY,MAAM,EAAE;MACJC,QAAQ,EAAE,kBAAkBhB,GAAG,GAA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,IAAI,EAAE;QAA4B;MACjD,CAAC;IAET,CAAC;IACD;IACAX,OAAO,EAAE,CACL,IAAIL,6BAAoB,CAAC;MACrBrB,QAAQ,EAAE,iBAAiBhB,GAAG,GAAGC,cAAc;IACnD,CAAC,CAAC,EACF,IAAIqD,gBAAO,CAACC,YAAY,CAAC;MACrB,aAAa,EAAE;QACXC,GAAG,EAAEC,IAAI,CAACC,SAAS,CAAC1D,GAAG,CAAC;QACxB2D,QAAQ,EAAEF,IAAI,CAACC,SAAS,CAAC3D,OAAO,CAACG,IAAI,CAAC;QACtC0D,cAAc,EAAEH,IAAI,CAACC,SAAS,CAAC3D,OAAO,CAAC8D,aAAa;MACxD;IACJ,CAAC,CAAC,EACFpD,uBAAuB,CAC1B,CAACqD,MAAM,CAACC,oBAAoB;EACjC,CAAC;AACL;AAEA,SAASA,oBAAoBA,CAAIC,KAA2B,EAAc;EACtE,OAAOA,KAAK,IAAI1D,SAAS;AAC7B;AAYO,SAAS2D,YAAYA,CAAClE,OAA0C,EAA4B;EAC/F,MAAMmE,MAAqC,GAAG,EAAE;EAEhD,KAAK,MAAMhE,IAAI,IAAIH,OAAO,CAACoE,KAAK,EAAE;IAC9BD,MAAM,CAACE,IAAI,CACPtE,mBAAmB,CAAC;MAChBE,GAAG,EAAED,OAAO,CAACC,GAAG;MAChB6D,aAAa,EAAE9D,OAAO,CAAC8D,aAAa;MACpC1D,QAAQ,EAAEJ,OAAO,CAACI,QAAQ;MAC1Be,sBAAsB,EAAEnB,OAAO,CAACmB,sBAAsB;MACtDhB,IAAI,EAAEA,IAAI;MACVU,UAAU,EAAEb,OAAO,CAACa,UAAU;MAC9BP,iBAAiB,EAAEN,OAAO,CAACM;IAC/B,CAAC,CACL,CAAC;EACL;EACA,OAAOgE,OAAO,CAACC,GAAG,CAACJ,MAAM,CAAC;AAC9B","ignoreList":[]}
1
+ {"version":3,"file":"createFormWebpackConfiguration.js","names":["_path","_interopRequireDefault","require","_miniCssExtractPlugin","_webpack","_CacheAssetsPlugin","createConfigVariant","options","gfv","fileNameSuffix","mode","formPath","buildCache","buildCacheOptions","undefined","BuildCache","farmDirectory","buildCacheWebpackPlugin","createWebpackPlugin","devtoolOption","isLocalDev","threadLoaderOptions","workers","workerParallelJobs","workerNodeArgs","babelLoaderRules","warmup","push","loader","resolve","target","context","output","filename","path","resourcesDirectoryPath","publicPath","alias","join","__dirname","variables","Resources","extensions","entry","devtool","cache","type","maxGenerations","module","rules","test","use","MiniCssExtractPlugin","modules","localIdentName","postcssOptions","ident","plugins","overrideBrowserslist","oneOf","babelrc","configFile","presets","targets","browsers","loose","useBuiltIns","corejs","legacy","cacheDirectory","fullySpecified","exclude","name","webpack","DefinePlugin","GFV","JSON","stringify","NODE_ENV","RESOURCES_HASH","resourcesHash","filter","isNotNullOrUndefined","input","createConfig","result","modes","Promise","all"],"sources":["../../../../src/FormWebpackConfiguration/createFormWebpackConfiguration.ts"],"sourcesContent":["import path from \"path\";\n\nimport MiniCssExtractPlugin from \"mini-css-extract-plugin\";\nimport webpack, { Configuration } from \"webpack\";\n\nimport { BuildCache, FormBuildCacheOptions } from \"./CacheAssetsPlugin\";\n\ntype BuildMode = \"production\" | \"development\";\n\ninterface CreateWebpackConfigurationVariantOptions {\n gfv: string;\n resourcesHash: string;\n formPath: string;\n mode?: BuildMode;\n isLocalDev?: boolean;\n resourcesDirectoryPath: string;\n buildCacheOptions?: FormBuildCacheOptions;\n}\n\nasync function createConfigVariant(options: CreateWebpackConfigurationVariantOptions): Promise<Configuration> {\n const { gfv } = options;\n\n const fileNameSuffix = options.mode === \"production\" ? \".min\" : \"\";\n\n const formPath = options.formPath;\n const buildCache =\n options.buildCacheOptions != undefined\n ? new BuildCache(options.buildCacheOptions.farmDirectory, options.buildCacheOptions.mode)\n : undefined;\n\n const buildCacheWebpackPlugin =\n buildCache != undefined && options.buildCacheOptions != undefined\n ? await buildCache.createWebpackPlugin(options.buildCacheOptions)\n : undefined;\n\n const devtoolOption: Configuration[\"devtool\"] =\n options.mode === \"production\" ? \"hidden-source-map\" : options.isLocalDev ? \"inline-source-map\" : \"source-map\";\n\n const threadLoaderOptions = {\n workers: 4,\n workerParallelJobs: 10,\n workerNodeArgs: [\"--max-old-space-size=3072\"],\n };\n\n const babelLoaderRules = [];\n\n if (!options.isLocalDev) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n require(\"thread-loader\").warmup(threadLoaderOptions, [\n \"babel-loader\",\n \"@babel/preset-env\",\n \"@babel/preset-react\",\n ]);\n\n babelLoaderRules.push({\n loader: require.resolve(\"thread-loader\"),\n options: threadLoaderOptions,\n });\n }\n\n return {\n mode: options.mode,\n target: [\"web\", \"es5\"],\n context: formPath,\n output: {\n filename: `public/scripts/${gfv}${fileNameSuffix}.js`,\n path: options.resourcesDirectoryPath,\n publicPath: \"/static/\",\n },\n resolve: {\n alias: {\n \"variables.less\": path.resolve(path.join(__dirname, \"variables.less\")),\n variables: path.resolve(path.join(__dirname, \"variables.less\")),\n Resources: path.join(formPath, \"form\", \"resources\"),\n },\n extensions: [\".js\", \".jsx\"],\n },\n entry: [path.join(formPath, \"form\", \"./web\")],\n devtool: devtoolOption,\n cache:\n options.mode === \"development\"\n ? {\n type: \"memory\",\n maxGenerations: 5,\n }\n : false,\n module: {\n rules: [\n {\n test: /\\.less$/,\n use: [\n {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n loader: MiniCssExtractPlugin.loader as any,\n options: { publicPath: \"../../\" },\n },\n {\n loader: require.resolve(\"css-loader\"),\n options: {\n modules: {\n localIdentName: \"[hash:base64:5]\",\n },\n },\n },\n {\n loader: require.resolve(\"postcss-loader\"),\n options: {\n postcssOptions: {\n ident: \"postcss\",\n plugins: [\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n require(\"autoprefixer\")({\n // Просто дефолтные значение из текущего (1.7.7) browserslist\n overrideBrowserslist: \"> 1%, last 2 versions, Firefox ESR\",\n }),\n ],\n },\n },\n },\n {\n loader: require.resolve(\"less-loader\"),\n },\n ],\n },\n {\n test: /\\.jsx?$/,\n oneOf: [\n {\n test: /(kcXmlValidationConfigurator|kcXmlAutoCalculationConfigurator|dataDeclaration)\\.js$/,\n type: \"javascript/auto\",\n },\n {\n use: [\n ...babelLoaderRules,\n {\n loader: require.resolve(\"babel-loader\"),\n options: {\n babelrc: false,\n configFile: false,\n presets: [\n require.resolve(\"@babel/preset-react\"),\n [\n require.resolve(\"@babel/preset-env\"),\n {\n targets: {\n browsers: [\">0.5%\", \"last 2 versions\", \"not dead\", \"not IE 11\"],\n },\n loose: true,\n useBuiltIns: \"usage\",\n corejs: 3,\n },\n ],\n ],\n plugins: [\n [require.resolve(\"@babel/plugin-proposal-decorators\"), { legacy: true }],\n [\n require.resolve(\"@babel/plugin-transform-class-properties\"),\n { loose: true },\n ],\n require.resolve(\"@babel/plugin-proposal-export-default-from\"),\n ],\n cacheDirectory: true,\n },\n },\n ],\n resolve: {\n fullySpecified: false,\n },\n exclude: [/node_modules/],\n },\n ],\n },\n {\n test: /\\.(png|svg)$/,\n loader: require.resolve(\"file-loader\"),\n options: { name: \"public/images/[hash].[ext]\" },\n },\n {\n test: /\\.(ttf|eot|woff2?)$/,\n loader: require.resolve(\"file-loader\"),\n options: { name: \"public/fonts/[hash].[ext]\" },\n },\n ],\n },\n // @ts-expect-error Починится, когда все либы обновятся\n plugins: [\n new MiniCssExtractPlugin({\n filename: `public/styles/${gfv}${fileNameSuffix}.css`,\n }),\n new webpack.DefinePlugin({\n \"process.env\": {\n GFV: JSON.stringify(gfv),\n NODE_ENV: JSON.stringify(options.mode),\n RESOURCES_HASH: JSON.stringify(options.resourcesHash),\n },\n }),\n buildCacheWebpackPlugin,\n ].filter(isNotNullOrUndefined),\n };\n}\n\nfunction isNotNullOrUndefined<T>(input: T | undefined | null): input is T {\n return input != undefined;\n}\n\nexport interface CreateWebpackConfigurationOptions {\n gfv: string;\n resourcesHash: string;\n formPath: string;\n resourcesDirectoryPath: string;\n modes: BuildMode[];\n isLocalDev?: boolean;\n buildCacheOptions?: FormBuildCacheOptions;\n}\n\nexport function createConfig(options: CreateWebpackConfigurationOptions): Promise<Configuration[]> {\n const result: Array<Promise<Configuration>> = [];\n\n for (const mode of options.modes) {\n result.push(\n createConfigVariant({\n gfv: options.gfv,\n resourcesHash: options.resourcesHash,\n formPath: options.formPath,\n resourcesDirectoryPath: options.resourcesDirectoryPath,\n mode: mode,\n isLocalDev: options.isLocalDev,\n buildCacheOptions: options.buildCacheOptions,\n })\n );\n }\n return Promise.all(result);\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,qBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAH,sBAAA,CAAAC,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA;AAcA,eAAeI,mBAAmBA,CAACC,OAAiD,EAA0B;EAC1G,MAAM;IAAEC;EAAI,CAAC,GAAGD,OAAO;EAEvB,MAAME,cAAc,GAAGF,OAAO,CAACG,IAAI,KAAK,YAAY,GAAG,MAAM,GAAG,EAAE;EAElE,MAAMC,QAAQ,GAAGJ,OAAO,CAACI,QAAQ;EACjC,MAAMC,UAAU,GACZL,OAAO,CAACM,iBAAiB,IAAIC,SAAS,GAChC,IAAIC,6BAAU,CAACR,OAAO,CAACM,iBAAiB,CAACG,aAAa,EAAET,OAAO,CAACM,iBAAiB,CAACH,IAAI,CAAC,GACvFI,SAAS;EAEnB,MAAMG,uBAAuB,GACzBL,UAAU,IAAIE,SAAS,IAAIP,OAAO,CAACM,iBAAiB,IAAIC,SAAS,GAC3D,MAAMF,UAAU,CAACM,mBAAmB,CAACX,OAAO,CAACM,iBAAiB,CAAC,GAC/DC,SAAS;EAEnB,MAAMK,aAAuC,GACzCZ,OAAO,CAACG,IAAI,KAAK,YAAY,GAAG,mBAAmB,GAAGH,OAAO,CAACa,UAAU,GAAG,mBAAmB,GAAG,YAAY;EAEjH,MAAMC,mBAAmB,GAAG;IACxB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