@kontur.candy/tools 2.249.0 → 2.251.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.
- package/distr/Common/CandyApiClient/CandyApiClient.js +50 -16
- package/distr/Common/CandyApiClient/CandyApiClient.js.map +1 -1
- package/distr/Common/CandyApiClient/ICandyApiClient.js.map +1 -1
- package/distr/Common/CandyApiClient/Types/CreateDraft/CreateDraftParams.js +6 -0
- package/distr/Common/CandyApiClient/Types/CreateDraft/CreateDraftParams.js.map +1 -0
- package/distr/Common/CandyApiClient/Types/FeatureFlags/FeatureFlagsResponse.js.map +1 -1
- package/distr/Common/DriveIntegration/DriveApiClientExtension.js +53 -0
- package/distr/Common/DriveIntegration/DriveApiClientExtension.js.map +1 -0
- package/distr/Common/DriveIntegration/DriveHelpers.js +24 -0
- package/distr/Common/DriveIntegration/DriveHelpers.js.map +1 -0
- package/distr/Common/DriveIntegration/ensureCandyFrontSrvDriveUri.js +23 -0
- package/distr/Common/DriveIntegration/ensureCandyFrontSrvDriveUri.js.map +1 -0
- package/distr/Common/FSPrinterClient/FSPrinterClient.js +18 -4
- package/distr/Common/FSPrinterClient/FSPrinterClient.js.map +1 -1
- package/distr/Common/hashUtils.js +9 -0
- package/distr/Common/hashUtils.js.map +1 -1
- package/distr/Tools/src/BuildTasks/ClientJS/BuildClientJsTask.js +2 -12
- package/distr/Tools/src/BuildTasks/ClientJS/BuildClientJsTask.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Engine/BuildLocalEngineTask.js +2 -3
- package/distr/Tools/src/BuildTasks/Engine/BuildLocalEngineTask.js.map +1 -1
- package/distr/Tools/src/BuildTasks/EngineStructureUtils.js +2 -27
- package/distr/Tools/src/BuildTasks/EngineStructureUtils.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Form/GenerateForm.js +2 -2
- package/distr/Tools/src/BuildTasks/Form/GenerateForm.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Form/NullFormGenerator.js +0 -3
- package/distr/Tools/src/BuildTasks/Form/NullFormGenerator.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Form/WriteFLangNormalizationFiles.js +0 -6
- package/distr/Tools/src/BuildTasks/Form/WriteFLangNormalizationFiles.js.map +1 -1
- package/distr/Tools/src/BuildTasks/FormSource.js +6 -0
- package/distr/Tools/src/BuildTasks/FormSource.js.map +1 -0
- package/distr/Tools/src/BuildTasks/Generator/BuildGeneratorFromSourcesTask.js +3 -10
- package/distr/Tools/src/BuildTasks/Generator/BuildGeneratorFromSourcesTask.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/CreateAsyncGenerator.js +18 -70
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/CreateAsyncGenerator.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/GeneratorRequireUtils.js +17 -67
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/GeneratorRequireUtils.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ReadSourcesAndProcessSugarWorker.js +6 -6
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ReadSourcesAndProcessSugarWorker.js.map +1 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/RequireUncached.js +0 -9
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/RequireUncached.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildForms/RunBuildForms.js +3 -3
- package/distr/Tools/src/CLICommands/BuildForms/RunBuildForms.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/BuildServerBuildFormsController.js +6 -9
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/BuildServerBuildFormsController.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/BuildFormDevServer.js +38 -61
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/BuildFormDevServer.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/ClientJsDevServer.js +6 -7
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/ClientJsDevServer.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/EngineDevServer.js +6 -7
- package/distr/Tools/src/CLICommands/BuildServer/ResourcesControllers/DevServers/EngineDevServer.js.map +1 -1
- package/distr/Tools/src/CLICommands/BuildServer/RunBuildServer.js +13 -26
- package/distr/Tools/src/CLICommands/BuildServer/RunBuildServer.js.map +1 -1
- package/distr/Tools/src/CLICommands/DevBuild/RunDevBuild.js +4 -4
- package/distr/Tools/src/CLICommands/DevBuild/RunDevBuild.js.map +1 -1
- package/distr/Tools/src/CLICommands/Localization/RunLocalization.js +2 -2
- package/distr/Tools/src/CLICommands/Localization/RunLocalization.js.map +1 -1
- package/distr/Tools/src/CLICommands/SugarExtractor/ExtractTextsFromSugarController.js +1 -2
- package/distr/Tools/src/CLICommands/SugarExtractor/ExtractTextsFromSugarController.js.map +1 -1
- package/distr/Tools/src/CLICommands/SugarExtractor/Utils.js +1 -3
- package/distr/Tools/src/CLICommands/SugarExtractor/Utils.js.map +1 -1
- package/distr/Tools/src/CandyCLI.js +3 -3
- package/distr/Tools/src/CandyCLI.js.map +1 -1
- package/distr/Tools/src/LocalServerFrontEndDist/index.js +1 -1
- package/distr/Tools/src/LocalServerFrontEndDist/index.js.map +1 -1
- package/distr/Tools/src/ReadFarmConfig.js +1 -2
- package/distr/Tools/src/ReadFarmConfig.js.map +1 -1
- package/package.json +1 -1
- package/distr/Tools/src/BuildTasks/ClientJS/IsWebpack5.js +0 -14
- package/distr/Tools/src/BuildTasks/ClientJS/IsWebpack5.js.map +0 -1
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ProcessSugarWorker.js +0 -46
- package/distr/Tools/src/BuildTasks/Generator/GeneratorWorker/ProcessSugarWorker.js.map +0 -1
- package/distr/Tools/src/BuildTasks/ReadFormSource.js +0 -114
- package/distr/Tools/src/BuildTasks/ReadFormSource.js.map +0 -1
|
@@ -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\";\nimport { WorkspaceResourceType } from \"../../Engine/src/ContractorsServiceIntegration/Types/WorkspaceTypes\";\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, InnerHistoryUndoResponseWithStatus } 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 getWorkspaceDirectoryId(\n orgId: string,\n inn: string,\n resourceType: WorkspaceResourceType,\n kpp?: string\n ): Promise<string>;\n\n convertToPdfAndGetMeta(driveUri: string): Promise<ConvertedPDFMetaResponse>;\n convertToPdf(driveUri: string): Promise<ConvertedPdfResponse>;\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 ): 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 restoreToSourceFuf(): 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<GetPartialFufResponse | undefined>;\n getInnerFuf(): Promise<string | undefined>;\n startGetInnerFufTask(): Promise<PollingTaskWithResult<string>>;\n getInnerFufTask(): Promise<PollingTaskWithResult<string>>;\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<InnerHistoryUndoResponseWithStatus>;\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 GetPartialFufResponse {\n ContentUri: string;\n Name: string;\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\nexport interface ConvertedPDFMetaResponse {\n contentUri: string;\n isModified: boolean;\n pageCount: number;\n lastPageHeight: number;\n contentSizeBytes: number;\n}\n\nexport interface ConvertedPdfResponse {\n contentUri: string;\n isModified: boolean;\n contentSizeBytes: number;\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\";\nimport { WorkspaceResourceType } from \"../../Engine/src/ContractorsServiceIntegration/Types/WorkspaceTypes\";\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 { CreateDraftFromDriveParams, CreateEmptyDraftParams } from \"./Types/CreateDraft/CreateDraftParams\";\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, InnerHistoryUndoResponseWithStatus } 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(params: CreateDraftFromDriveParams): Promise<CreateDraftResponse>;\n createEmptyDraft(params: CreateEmptyDraftParams): 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 getWorkspaceDirectoryId(\n orgId: string,\n inn: string,\n resourceType: WorkspaceResourceType,\n kpp?: string\n ): Promise<string>;\n\n convertToPdfAndGetMeta(driveUri: string): Promise<ConvertedPDFMetaResponse>;\n convertToPdf(driveUri: string): Promise<ConvertedPdfResponse>;\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 ): 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 restoreToSourceFuf(): 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<GetPartialFufResponse | undefined>;\n getInnerFuf(): Promise<string | undefined>;\n startGetInnerFufTask(): Promise<PollingTaskWithResult<string>>;\n getInnerFufTask(): Promise<PollingTaskWithResult<string>>;\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<InnerHistoryUndoResponseWithStatus>;\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 GetPartialFufResponse {\n ContentUri: string;\n Name: string;\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\nexport interface ConvertedPDFMetaResponse {\n contentUri: string;\n isModified: boolean;\n pageCount: number;\n lastPageHeight: number;\n contentSizeBytes: number;\n}\n\nexport interface ConvertedPdfResponse {\n contentUri: string;\n isModified: boolean;\n contentSizeBytes: number;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CreateDraftParams.js","names":[],"sources":["../../../../../../Common/CandyApiClient/Types/CreateDraft/CreateDraftParams.ts"],"sourcesContent":["export interface CreateEmptyDraftParams {\n ns: string;\n gfv: string;\n abortSignal?: AbortSignal;\n scenario?: string;\n}\n\nexport interface CreateDraftFromDriveParams {\n ns: string;\n fufDriveUri: string;\n abortSignal?: AbortSignal;\n scenario?: string;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeatureFlagsResponse.js","names":[],"sources":["../../../../../../Common/CandyApiClient/Types/FeatureFlags/FeatureFlagsResponse.ts"],"sourcesContent":["export type FeatureFlagsResponse =\n | {\n candyTestFeature?: string;\n useExtendedErrorLog?: boolean;\n showDraftHistoryInEditor?: boolean;\n }\n | {\n [data: string]: unknown;\n };\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FeatureFlagsResponse.js","names":[],"sources":["../../../../../../Common/CandyApiClient/Types/FeatureFlags/FeatureFlagsResponse.ts"],"sourcesContent":["export type FeatureFlagsResponse =\n | {\n candyTestFeature?: string;\n useExtendedErrorLog?: boolean;\n showDraftHistoryInEditor?: boolean;\n newOrgAdPromoCode?: string;\n }\n | {\n [data: string]: unknown;\n };\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DriveApiClientExtension = void 0;
|
|
7
|
+
var _InitializeSentry = require("../../Engine/src/Forms/Sentry/InitializeSentry");
|
|
8
|
+
class DriveApiClientExtension {
|
|
9
|
+
constructor(fetchImpl, baseUrl) {
|
|
10
|
+
this.fetchImpl = void 0;
|
|
11
|
+
this.baseUrl = void 0;
|
|
12
|
+
this.fetchImpl = fetchImpl;
|
|
13
|
+
this.baseUrl = baseUrl;
|
|
14
|
+
}
|
|
15
|
+
async copyContents(name, copyName) {
|
|
16
|
+
const response = await this.fetchImpl(`${this.baseUrl}/v1/contents/copy`, {
|
|
17
|
+
method: "POST",
|
|
18
|
+
credentials: "include",
|
|
19
|
+
headers: {
|
|
20
|
+
"Content-Type": "application/json",
|
|
21
|
+
Accept: "application/json"
|
|
22
|
+
},
|
|
23
|
+
body: JSON.stringify({
|
|
24
|
+
name: decodeURI(name),
|
|
25
|
+
copyName: decodeURI(copyName),
|
|
26
|
+
expiryTimeChange: {
|
|
27
|
+
makePermanent: false,
|
|
28
|
+
newDaysToLive: 1
|
|
29
|
+
}
|
|
30
|
+
})
|
|
31
|
+
});
|
|
32
|
+
if (response.status === 403) {
|
|
33
|
+
(0, _InitializeSentry.getCandyHub)().captureException(new Error(`Drive contents copy forbidden: ${name}`));
|
|
34
|
+
return {
|
|
35
|
+
Name: name
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (response.status === 409) {
|
|
39
|
+
return {
|
|
40
|
+
Name: copyName
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (response.status >= 400 && response.status <= 500) {
|
|
44
|
+
return {
|
|
45
|
+
Name: name
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const result = await response.json();
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.DriveApiClientExtension = DriveApiClientExtension;
|
|
53
|
+
//# sourceMappingURL=DriveApiClientExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DriveApiClientExtension.js","names":["_InitializeSentry","require","DriveApiClientExtension","constructor","fetchImpl","baseUrl","copyContents","name","copyName","response","method","credentials","headers","Accept","body","JSON","stringify","decodeURI","expiryTimeChange","makePermanent","newDaysToLive","status","getCandyHub","captureException","Error","Name","result","json","exports"],"sources":["../../../../Common/DriveIntegration/DriveApiClientExtension.ts"],"sourcesContent":["import { Fetch } from \"../HttpClient/FetchImplementation/Fetch\";\nimport { getCandyHub } from \"../../Engine/src/Forms/Sentry/InitializeSentry\";\n\nexport interface IDriveContentsCopyResult {\n Name: string;\n}\n\nexport interface IDriveApiClientExtension {\n copyContents(name: string, copyName: string): Promise<IDriveContentsCopyResult>;\n}\n\nexport class DriveApiClientExtension implements IDriveApiClientExtension {\n private readonly fetchImpl: Fetch;\n private readonly baseUrl: string;\n\n public constructor(fetchImpl: Fetch, baseUrl: string) {\n this.fetchImpl = fetchImpl;\n this.baseUrl = baseUrl;\n }\n\n public async copyContents(name: string, copyName: string): Promise<IDriveContentsCopyResult> {\n const response = await this.fetchImpl(`${this.baseUrl}/v1/contents/copy`, {\n method: \"POST\",\n credentials: \"include\",\n headers: {\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n },\n body: JSON.stringify({\n name: decodeURI(name),\n copyName: decodeURI(copyName),\n expiryTimeChange: {\n makePermanent: false,\n newDaysToLive: 1,\n },\n }),\n });\n\n if (response.status === 403) {\n getCandyHub().captureException(new Error(`Drive contents copy forbidden: ${name}`));\n return {\n Name: name,\n };\n }\n\n if (response.status === 409) {\n return {\n Name: copyName,\n };\n }\n\n if (response.status >= 400 && response.status <= 500) {\n return {\n Name: name,\n };\n }\n\n const result = await response.json();\n\n return result as IDriveContentsCopyResult;\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAUO,MAAMC,uBAAuB,CAAqC;EAI9DC,WAAWA,CAACC,SAAgB,EAAEC,OAAe,EAAE;IAAA,KAHrCD,SAAS;IAAA,KACTC,OAAO;IAGpB,IAAI,CAACD,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACC,OAAO,GAAGA,OAAO;EAC1B;EAEA,MAAaC,YAAYA,CAACC,IAAY,EAAEC,QAAgB,EAAqC;IACzF,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACL,SAAS,CAAC,GAAG,IAAI,CAACC,OAAO,mBAAmB,EAAE;MACtEK,MAAM,EAAE,MAAM;MACdC,WAAW,EAAE,SAAS;MACtBC,OAAO,EAAE;QACL,cAAc,EAAE,kBAAkB;QAClCC,MAAM,EAAE;MACZ,CAAC;MACDC,IAAI,EAAEC,IAAI,CAACC,SAAS,CAAC;QACjBT,IAAI,EAAEU,SAAS,CAACV,IAAI,CAAC;QACrBC,QAAQ,EAAES,SAAS,CAACT,QAAQ,CAAC;QAC7BU,gBAAgB,EAAE;UACdC,aAAa,EAAE,KAAK;UACpBC,aAAa,EAAE;QACnB;MACJ,CAAC;IACL,CAAC,CAAC;IAEF,IAAIX,QAAQ,CAACY,MAAM,KAAK,GAAG,EAAE;MACzB,IAAAC,6BAAW,EAAC,CAAC,CAACC,gBAAgB,CAAC,IAAIC,KAAK,CAAC,kCAAkCjB,IAAI,EAAE,CAAC,CAAC;MACnF,OAAO;QACHkB,IAAI,EAAElB;MACV,CAAC;IACL;IAEA,IAAIE,QAAQ,CAACY,MAAM,KAAK,GAAG,EAAE;MACzB,OAAO;QACHI,IAAI,EAAEjB;MACV,CAAC;IACL;IAEA,IAAIC,QAAQ,CAACY,MAAM,IAAI,GAAG,IAAIZ,QAAQ,CAACY,MAAM,IAAI,GAAG,EAAE;MAClD,OAAO;QACHI,IAAI,EAAElB;MACV,CAAC;IACL;IAEA,MAAMmB,MAAM,GAAG,MAAMjB,QAAQ,CAACkB,IAAI,CAAC,CAAC;IAEpC,OAAOD,MAAM;EACjB;AACJ;AAACE,OAAA,CAAA1B,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.DriveHelpers = void 0;
|
|
7
|
+
class DriveHelpers {
|
|
8
|
+
constructor(driveApiClientExtension) {
|
|
9
|
+
this.driveApiClientExtension = void 0;
|
|
10
|
+
this.driveApiClientExtension = driveApiClientExtension;
|
|
11
|
+
}
|
|
12
|
+
async ensureCandyFrontSrv(driveUri) {
|
|
13
|
+
if (driveUri.toLowerCase().includes("srv/candyfront") || driveUri.toLowerCase().includes("srv/keforms")) {
|
|
14
|
+
return driveUri;
|
|
15
|
+
}
|
|
16
|
+
const index = driveUri.indexOf("srv/");
|
|
17
|
+
const prefix = driveUri.substring(0, index);
|
|
18
|
+
const uri = driveUri.substring(index);
|
|
19
|
+
const result = await this.driveApiClientExtension.copyContents(uri, uri.replace(/srv\/[A-Za-z]+/g, "srv/candyFront"));
|
|
20
|
+
return prefix + result.Name;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.DriveHelpers = DriveHelpers;
|
|
24
|
+
//# sourceMappingURL=DriveHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DriveHelpers.js","names":["DriveHelpers","constructor","driveApiClientExtension","ensureCandyFrontSrv","driveUri","toLowerCase","includes","index","indexOf","prefix","substring","uri","result","copyContents","replace","Name","exports"],"sources":["../../../../Common/DriveIntegration/DriveHelpers.ts"],"sourcesContent":["import { IDriveApiClientExtension } from \"./DriveApiClientExtension\";\n\nexport class DriveHelpers {\n private readonly driveApiClientExtension: IDriveApiClientExtension;\n\n public constructor(driveApiClientExtension: IDriveApiClientExtension) {\n this.driveApiClientExtension = driveApiClientExtension;\n }\n\n public async ensureCandyFrontSrv(driveUri: string): Promise<string> {\n if (driveUri.toLowerCase().includes(\"srv/candyfront\") || driveUri.toLowerCase().includes(\"srv/keforms\")) {\n return driveUri;\n }\n\n const index = driveUri.indexOf(\"srv/\");\n const prefix = driveUri.substring(0, index);\n const uri = driveUri.substring(index);\n\n const result = await this.driveApiClientExtension.copyContents(\n uri,\n uri.replace(/srv\\/[A-Za-z]+/g, \"srv/candyFront\")\n );\n\n return prefix + result.Name;\n }\n}\n"],"mappings":";;;;;;AAEO,MAAMA,YAAY,CAAC;EAGfC,WAAWA,CAACC,uBAAiD,EAAE;IAAA,KAFrDA,uBAAuB;IAGpC,IAAI,CAACA,uBAAuB,GAAGA,uBAAuB;EAC1D;EAEA,MAAaC,mBAAmBA,CAACC,QAAgB,EAAmB;IAChE,IAAIA,QAAQ,CAACC,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,gBAAgB,CAAC,IAAIF,QAAQ,CAACC,WAAW,CAAC,CAAC,CAACC,QAAQ,CAAC,aAAa,CAAC,EAAE;MACrG,OAAOF,QAAQ;IACnB;IAEA,MAAMG,KAAK,GAAGH,QAAQ,CAACI,OAAO,CAAC,MAAM,CAAC;IACtC,MAAMC,MAAM,GAAGL,QAAQ,CAACM,SAAS,CAAC,CAAC,EAAEH,KAAK,CAAC;IAC3C,MAAMI,GAAG,GAAGP,QAAQ,CAACM,SAAS,CAACH,KAAK,CAAC;IAErC,MAAMK,MAAM,GAAG,MAAM,IAAI,CAACV,uBAAuB,CAACW,YAAY,CAC1DF,GAAG,EACHA,GAAG,CAACG,OAAO,CAAC,iBAAiB,EAAE,gBAAgB,CACnD,CAAC;IAED,OAAOL,MAAM,GAAGG,MAAM,CAACG,IAAI;EAC/B;AACJ;AAACC,OAAA,CAAAhB,YAAA,GAAAA,YAAA","ignoreList":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ensureCandyFrontSrvDriveUris = exports.ensureCandyFrontSrvDriveUri = void 0;
|
|
7
|
+
const ensureCandyFrontSrvDriveUri = async (driveUri, driveHelpers) => {
|
|
8
|
+
let driveUriChecked = driveUri;
|
|
9
|
+
if (driveHelpers) {
|
|
10
|
+
driveUriChecked = await driveHelpers.ensureCandyFrontSrv(driveUri);
|
|
11
|
+
}
|
|
12
|
+
return driveUriChecked;
|
|
13
|
+
};
|
|
14
|
+
exports.ensureCandyFrontSrvDriveUri = ensureCandyFrontSrvDriveUri;
|
|
15
|
+
const ensureCandyFrontSrvDriveUris = async (driveUris, driveHelpers) => {
|
|
16
|
+
let driveUrisChecked = driveUris;
|
|
17
|
+
if (driveHelpers) {
|
|
18
|
+
driveUrisChecked = await Promise.all(driveUris.map(driveUri => driveHelpers === null || driveHelpers === void 0 ? void 0 : driveHelpers.ensureCandyFrontSrv(driveUri)));
|
|
19
|
+
}
|
|
20
|
+
return driveUrisChecked;
|
|
21
|
+
};
|
|
22
|
+
exports.ensureCandyFrontSrvDriveUris = ensureCandyFrontSrvDriveUris;
|
|
23
|
+
//# sourceMappingURL=ensureCandyFrontSrvDriveUri.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ensureCandyFrontSrvDriveUri.js","names":["ensureCandyFrontSrvDriveUri","driveUri","driveHelpers","driveUriChecked","ensureCandyFrontSrv","exports","ensureCandyFrontSrvDriveUris","driveUris","driveUrisChecked","Promise","all","map"],"sources":["../../../../Common/DriveIntegration/ensureCandyFrontSrvDriveUri.ts"],"sourcesContent":["import { DriveHelpers } from \"./DriveHelpers\";\n\nexport const ensureCandyFrontSrvDriveUri = async (driveUri: string, driveHelpers?: DriveHelpers): Promise<string> => {\n let driveUriChecked = driveUri;\n if (driveHelpers) {\n driveUriChecked = await driveHelpers.ensureCandyFrontSrv(driveUri);\n }\n return driveUriChecked;\n};\n\nexport const ensureCandyFrontSrvDriveUris = async (\n driveUris: string[],\n driveHelpers?: DriveHelpers\n): Promise<string[]> => {\n let driveUrisChecked = driveUris;\n if (driveHelpers) {\n driveUrisChecked = await Promise.all(driveUris.map(driveUri => driveHelpers?.ensureCandyFrontSrv(driveUri)));\n }\n return driveUrisChecked;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,2BAA2B,GAAG,MAAAA,CAAOC,QAAgB,EAAEC,YAA2B,KAAsB;EACjH,IAAIC,eAAe,GAAGF,QAAQ;EAC9B,IAAIC,YAAY,EAAE;IACdC,eAAe,GAAG,MAAMD,YAAY,CAACE,mBAAmB,CAACH,QAAQ,CAAC;EACtE;EACA,OAAOE,eAAe;AAC1B,CAAC;AAACE,OAAA,CAAAL,2BAAA,GAAAA,2BAAA;AAEK,MAAMM,4BAA4B,GAAG,MAAAA,CACxCC,SAAmB,EACnBL,YAA2B,KACP;EACpB,IAAIM,gBAAgB,GAAGD,SAAS;EAChC,IAAIL,YAAY,EAAE;IACdM,gBAAgB,GAAG,MAAMC,OAAO,CAACC,GAAG,CAACH,SAAS,CAACI,GAAG,CAACV,QAAQ,IAAIC,YAAY,aAAZA,YAAY,uBAAZA,YAAY,CAAEE,mBAAmB,CAACH,QAAQ,CAAC,CAAC,CAAC;EAChH;EACA,OAAOO,gBAAgB;AAC3B,CAAC;AAACH,OAAA,CAAAC,4BAAA,GAAAA,4BAAA","ignoreList":[]}
|
|
@@ -12,7 +12,7 @@ var _DraftPresentationType = require("../CandyApiClient/Types/Presentations/Draf
|
|
|
12
12
|
var _PollingTaskWaiter = require("../CandyApiClient/Types/PollingTasks/PollingTaskWaiter");
|
|
13
13
|
var _IFSPrinterClient = require("./IFSPrinterClient");
|
|
14
14
|
class FSPrinterClient {
|
|
15
|
-
constructor(fetchImpl, baseUrl, resourceZone, authentication, candyApiDraftClient, exceptionLogger) {
|
|
15
|
+
constructor(fetchImpl, baseUrl, resourceZone, authentication, candyApiDraftClient, exceptionLogger, driveHelpers) {
|
|
16
16
|
this.httpClient = void 0;
|
|
17
17
|
this.candyApiDraftClient = void 0;
|
|
18
18
|
this.pullingDelay = 0;
|
|
@@ -22,10 +22,12 @@ class FSPrinterClient {
|
|
|
22
22
|
this.defaultFactor = 2;
|
|
23
23
|
this.defaultTimeout = 1000 * 60 * 10;
|
|
24
24
|
this.taskResult = void 0;
|
|
25
|
+
this.driveHelpers = void 0;
|
|
25
26
|
this.httpClient = new _HttpClient.HttpClient(fetchImpl, baseUrl, (0, _AuthenticationMode.createAuthenticationProvider)(authentication), {
|
|
26
27
|
resourceZone: resourceZone
|
|
27
28
|
}, exceptionLogger);
|
|
28
29
|
this.candyApiDraftClient = candyApiDraftClient;
|
|
30
|
+
this.driveHelpers = driveHelpers;
|
|
29
31
|
}
|
|
30
32
|
async printRSV({
|
|
31
33
|
type,
|
|
@@ -41,17 +43,25 @@ class FSPrinterClient {
|
|
|
41
43
|
presentation: presentation
|
|
42
44
|
};
|
|
43
45
|
if (innerFuf !== null && innerFuf !== void 0 && innerFuf.driveUri) {
|
|
46
|
+
let driveUriChecked = innerFuf.driveUri;
|
|
47
|
+
if (this.driveHelpers) {
|
|
48
|
+
driveUriChecked = await this.driveHelpers.ensureCandyFrontSrv(innerFuf.driveUri);
|
|
49
|
+
}
|
|
44
50
|
options.fuf = {
|
|
45
|
-
driveUri:
|
|
51
|
+
driveUri: driveUriChecked
|
|
46
52
|
};
|
|
47
53
|
}
|
|
48
54
|
await this.print(options, requestOptions);
|
|
49
55
|
}
|
|
50
56
|
async printByRules(options) {
|
|
51
57
|
const partialFufUri = await this.getPartialFufDriveUrl(options.rules);
|
|
58
|
+
let driveUriChecked = partialFufUri;
|
|
59
|
+
if (this.driveHelpers) {
|
|
60
|
+
driveUriChecked = await this.driveHelpers.ensureCandyFrontSrv(partialFufUri);
|
|
61
|
+
}
|
|
52
62
|
await this.print({
|
|
53
63
|
fuf: {
|
|
54
|
-
driveUri:
|
|
64
|
+
driveUri: driveUriChecked
|
|
55
65
|
},
|
|
56
66
|
resultType: _IFSPrinterClient.PrinterResultTypes.Pdf,
|
|
57
67
|
...options.options
|
|
@@ -124,7 +134,11 @@ class FSPrinterClient {
|
|
|
124
134
|
if (options.presentation === _DraftPresentationType.DraftPresentationType.innerFuf) {
|
|
125
135
|
var _options$fuf;
|
|
126
136
|
if ((_options$fuf = options.fuf) !== null && _options$fuf !== void 0 && _options$fuf.driveUri) {
|
|
127
|
-
|
|
137
|
+
let driveUriChecked = options.fuf.driveUri;
|
|
138
|
+
if (this.driveHelpers) {
|
|
139
|
+
driveUriChecked = await this.driveHelpers.ensureCandyFrontSrv(options.fuf.driveUri);
|
|
140
|
+
}
|
|
141
|
+
return driveUriChecked;
|
|
128
142
|
}
|
|
129
143
|
return await this.getInnerFufDriveUrl();
|
|
130
144
|
}
|
|
@@ -1 +1 @@
|
|
|
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","startGetInnerFufTask","downloadHref","waitPollingTask","getInnerFufTask","getFufDriveUrl","startGetFufWithAttachmentsTask","getFufWithAttachmentsTask","contentUri","_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 await this.candyApiDraftClient.startGetInnerFufTask();\n const downloadHref = await waitPollingTask(() => this.candyApiDraftClient.getInnerFufTask());\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,GAAW,CAAC;IAAA,KACxBC,MAA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,mEAAAD,iBAAA,GAAkE,IAAI,CAACpE,UAAU,cAAAoE,iBAAA,uBAAfA,iBAAA,CAAiBzC,MAAM,EAAE,CAAC;IACvG;IACA2C,MAAM,CAACC,QAAQ,CAACC,IAAI,GAAGN,QAAQ;EACnC;EAEQT,qBAAqBA,CAAC5C,OAAuB,EAAE4D,MAAc,EAAkB;IACnF,OAAO;MAAE,GAAG5D,OAAO;MAAEH,GAAG,EAAE;QAAEK,QAAQ,EAAE0D;MAAO;IAAE,CAAC;EACpD;EAEQd,wBAAwBA,CAAC9C,OAAuB,EAAkB;IACtE,OAAO;MAAE,GAAGA,OAAO;MAAE6D,SAAS,EAAE;IAAc,CAAC;EACnD;EAEQnD,mBAAmBA,CAACX,cAAsC,EAAE;IAAA,IAAA+D,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;IAChE,IAAI,CAACnF,YAAY,IAAAiF,qBAAA,GAAG/D,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAElB,YAAY,cAAAiF,qBAAA,cAAAA,qBAAA,GAAI,IAAI,CAAC9E,mBAAmB;IAC5E,IAAI,CAACF,MAAM,IAAAiF,qBAAA,GAAGhE,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEjB,MAAM,cAAAiF,qBAAA,cAAAA,qBAAA,GAAI,IAAI,CAAC9E,aAAa;IAC1D,IAAI,CAACF,OAAO,IAAAiF,qBAAA,GAAGjE,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEhB,OAAO,cAAAiF,qBAAA,cAAAA,qBAAA,GAAI,IAAI,CAAC9E,cAAc;EACjE;EAEQ+B,gBAAgBA,CAAA,EAAG;IACvB,IAAI,CAAC9B,UAAU,GAAG8E,SAAS;EAC/B;AACJ;AAACC,OAAA,CAAA9F,eAAA,GAAAA,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","driveHelpers","httpClient","pullingDelay","factor","timeout","defaultPullingDelay","defaultFactor","defaultTimeout","taskResult","HttpClient","createAuthenticationProvider","printRSV","type","resultType","PrinterResultTypes","Excel","presentation","DraftPresentationType","fuf","innerFuf","requestOptions","options","rsvInfo","driveUri","driveUriChecked","ensureCandyFrontSrv","print","printByRules","partialFufUri","getPartialFufDriveUrl","rules","Pdf","_this$taskResult","applyRequestOptions","task","createTask","runMonitoringTask","taskId","resultUrl","resultUri","resetPrintResult","downloadDocument","downloadFufHref","getPartialFuf","ContentUri","Error","getInnerFufDriveUrl","startGetInnerFufTask","downloadHref","waitPollingTask","getInnerFufTask","getFufDriveUrl","startGetFufWithAttachmentsTask","getFufWithAttachmentsTask","contentUri","_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\";\nimport { DriveHelpers } from \"../DriveIntegration/DriveHelpers\";\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 private readonly driveHelpers?: DriveHelpers;\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 driveHelpers?: DriveHelpers\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 this.driveHelpers = driveHelpers;\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 let driveUriChecked = innerFuf.driveUri;\n if (this.driveHelpers) {\n driveUriChecked = await this.driveHelpers.ensureCandyFrontSrv(innerFuf.driveUri);\n }\n\n options.fuf = { driveUri: driveUriChecked };\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 let driveUriChecked = partialFufUri;\n if (this.driveHelpers) {\n driveUriChecked = await this.driveHelpers.ensureCandyFrontSrv(partialFufUri);\n }\n\n await this.print({\n fuf: {\n driveUri: driveUriChecked,\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 await this.candyApiDraftClient.startGetInnerFufTask();\n const downloadHref = await waitPollingTask(() => this.candyApiDraftClient.getInnerFufTask());\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 let driveUriChecked = options.fuf.driveUri;\n if (this.driveHelpers) {\n driveUriChecked = await this.driveHelpers.ensureCandyFrontSrv(options.fuf.driveUri);\n }\n\n return driveUriChecked;\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,GAA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Q,EAAE4D;MAAO;IAAE,CAAC;EACpD;EAEQd,wBAAwBA,CAAChD,OAAuB,EAAkB;IACtE,OAAO;MAAE,GAAGA,OAAO;MAAE+D,SAAS,EAAE;IAAc,CAAC;EACnD;EAEQnD,mBAAmBA,CAACb,cAAsC,EAAE;IAAA,IAAAiE,qBAAA,EAAAC,qBAAA,EAAAC,qBAAA;IAChE,IAAI,CAACrF,YAAY,IAAAmF,qBAAA,GAAGjE,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAElB,YAAY,cAAAmF,qBAAA,cAAAA,qBAAA,GAAI,IAAI,CAAChF,mBAAmB;IAC5E,IAAI,CAACF,MAAM,IAAAmF,qBAAA,GAAGlE,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEjB,MAAM,cAAAmF,qBAAA,cAAAA,qBAAA,GAAI,IAAI,CAAChF,aAAa;IAC1D,IAAI,CAACF,OAAO,IAAAmF,qBAAA,GAAGnE,cAAc,aAAdA,cAAc,uBAAdA,cAAc,CAAEhB,OAAO,cAAAmF,qBAAA,cAAAA,qBAAA,GAAI,IAAI,CAAChF,cAAc;EACjE;EAEQiC,gBAAgBA,CAAA,EAAG;IACvB,IAAI,CAAChC,UAAU,GAAGgF,SAAS;EAC/B;AACJ;AAACC,OAAA,CAAAjG,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.generateSimpleHash = void 0;
|
|
6
7
|
exports.getSimpleHashByString = getSimpleHashByString;
|
|
7
8
|
function getSimpleHashByString(source) {
|
|
8
9
|
let result = 0;
|
|
@@ -11,4 +12,12 @@ function getSimpleHashByString(source) {
|
|
|
11
12
|
}
|
|
12
13
|
return result;
|
|
13
14
|
}
|
|
15
|
+
const generateSimpleHash = (length = 8) => {
|
|
16
|
+
let result = "";
|
|
17
|
+
while (result.length < length) {
|
|
18
|
+
result += Math.random().toString(36).slice(2);
|
|
19
|
+
}
|
|
20
|
+
return result.slice(0, length);
|
|
21
|
+
};
|
|
22
|
+
exports.generateSimpleHash = generateSimpleHash;
|
|
14
23
|
//# sourceMappingURL=hashUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hashUtils.js","names":["getSimpleHashByString","source","result","index","length","charCodeAt"],"sources":["../../../Common/hashUtils.ts"],"sourcesContent":["export function getSimpleHashByString(source: string): number {\n let result = 0;\n for (let index = 0; index < source.length; index++) {\n result = ((result << 5) - result + source.charCodeAt(index)) | 0;\n }\n return result;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"hashUtils.js","names":["getSimpleHashByString","source","result","index","length","charCodeAt","generateSimpleHash","Math","random","toString","slice","exports"],"sources":["../../../Common/hashUtils.ts"],"sourcesContent":["export function getSimpleHashByString(source: string): number {\n let result = 0;\n for (let index = 0; index < source.length; index++) {\n result = ((result << 5) - result + source.charCodeAt(index)) | 0;\n }\n return result;\n}\n\nexport const generateSimpleHash = (length = 8): string => {\n let result = \"\";\n while (result.length < length) {\n result += Math.random().toString(36).slice(2);\n }\n return result.slice(0, length);\n};\n"],"mappings":";;;;;;;AAAO,SAASA,qBAAqBA,CAACC,MAAc,EAAU;EAC1D,IAAIC,MAAM,GAAG,CAAC;EACd,KAAK,IAAIC,KAAK,GAAG,CAAC,EAAEA,KAAK,GAAGF,MAAM,CAACG,MAAM,EAAED,KAAK,EAAE,EAAE;IAChDD,MAAM,GAAI,CAACA,MAAM,IAAI,CAAC,IAAIA,MAAM,GAAGD,MAAM,CAACI,UAAU,CAACF,KAAK,CAAC,GAAI,CAAC;EACpE;EACA,OAAOD,MAAM;AACjB;AAEO,MAAMI,kBAAkB,GAAGA,CAACF,MAAM,GAAG,CAAC,KAAa;EACtD,IAAIF,MAAM,GAAG,EAAE;EACf,OAAOA,MAAM,CAACE,MAAM,GAAGA,MAAM,EAAE;IAC3BF,MAAM,IAAIK,IAAI,CAACC,MAAM,CAAC,CAAC,CAACC,QAAQ,CAAC,EAAE,CAAC,CAACC,KAAK,CAAC,CAAC,CAAC;EACjD;EACA,OAAOR,MAAM,CAACQ,KAAK,CAAC,CAAC,EAAEN,MAAM,CAAC;AAClC,CAAC;AAACO,OAAA,CAAAL,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -10,7 +10,6 @@ var _ILogger = require("../../Commons/Logging/ILogger");
|
|
|
10
10
|
var _StaticLogger = require("../../Commons/Logging/StaticLogger");
|
|
11
11
|
var _ChainableValueProducer = require("../../Commons/TasksCore/ChainableValueProducer");
|
|
12
12
|
var _ProcessUtils = require("../ProcessUtils/ProcessUtils");
|
|
13
|
-
var _IsWebpack = require("./IsWebpack5");
|
|
14
13
|
class BuildClientJsTask extends _ChainableValueProducer.ObservableValueProducerBase {
|
|
15
14
|
constructor(pathToWebpackProvider, resourcesDirectory, logger = (0, _StaticLogger.getLogger)()) {
|
|
16
15
|
super();
|
|
@@ -52,21 +51,12 @@ class BuildClientJsTask extends _ChainableValueProducer.ObservableValueProducerB
|
|
|
52
51
|
async buildEngineFromSources(webpackConfigPath) {
|
|
53
52
|
const action = (0, _ILogger.buildActionBegin)(this.logger, "Build client.js");
|
|
54
53
|
const workingDirectory = _path.default.dirname(webpackConfigPath);
|
|
55
|
-
|
|
56
|
-
await _ProcessUtils.ProcessUtils.execShellCommand("yarn", ["client:build", `--env`, `resourcesPath=${this.resourcesDirectory}`], workingDirectory, this.logger);
|
|
57
|
-
} else {
|
|
58
|
-
await _ProcessUtils.ProcessUtils.execShellCommand("npm", ["run", "client:build", "--", `--env`, `resourcesPath=${this.resourcesDirectory}`], workingDirectory, this.logger);
|
|
59
|
-
}
|
|
54
|
+
await _ProcessUtils.ProcessUtils.execShellCommand("npm", ["run", "client:build", "--", `--env`, `resourcesPath=${this.resourcesDirectory}`], workingDirectory, this.logger);
|
|
60
55
|
action.complete();
|
|
61
56
|
}
|
|
62
57
|
async runWatchProcess(webpackConfigPath) {
|
|
63
58
|
const workingDirectory = _path.default.dirname(webpackConfigPath);
|
|
64
|
-
|
|
65
|
-
if (await (0, _IsWebpack.isYarn)(workingDirectory)) {
|
|
66
|
-
watchProcess = _ProcessUtils.ProcessUtils.createShellProcess("yarn", ["client:build", `--env`, `resourcesPath=${this.resourcesDirectory}`, "--watch"], workingDirectory);
|
|
67
|
-
} else {
|
|
68
|
-
watchProcess = _ProcessUtils.ProcessUtils.createShellProcess("npm", ["run", "client:build", "--", `--env`, `resourcesPath=${this.resourcesDirectory}`, "--watch"], workingDirectory);
|
|
69
|
-
}
|
|
59
|
+
const watchProcess = _ProcessUtils.ProcessUtils.createShellProcess("npm", ["run", "client:build", "--", `--env`, `resourcesPath=${this.resourcesDirectory}`, "--watch"], workingDirectory);
|
|
70
60
|
watchProcess.onStdOut.subscribe(output => this.logger.verbose(output));
|
|
71
61
|
this.logger.log("Begin watch");
|
|
72
62
|
watchProcess.start();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildClientJsTask.js","names":["_path","_interopRequireDefault","require","_ILogger","_StaticLogger","_ChainableValueProducer","_ProcessUtils","
|
|
1
|
+
{"version":3,"file":"BuildClientJsTask.js","names":["_path","_interopRequireDefault","require","_ILogger","_StaticLogger","_ChainableValueProducer","_ProcessUtils","BuildClientJsTask","ObservableValueProducerBase","constructor","pathToWebpackProvider","resourcesDirectory","logger","getLogger","useWatch","buildProcess","withPrefix","beginListening","beginObserve","stopListening","endObserve","undefined","kill","error","getCurrentValue","webpackConfigFile","currentValue","runWatchProcess","buildEngineFromSources","webpackConfigPath","action","buildActionBegin","workingDirectory","path","dirname","ProcessUtils","execShellCommand","complete","watchProcess","createShellProcess","onStdOut","subscribe","output","verbose","log","start","exports"],"sources":["../../../../../src/BuildTasks/ClientJS/BuildClientJsTask.ts"],"sourcesContent":["import path from \"path\";\n\nimport { buildActionBegin, ILogger } from \"../../Commons/Logging/ILogger\";\nimport { getLogger } from \"../../Commons/Logging/StaticLogger\";\nimport { IValueProducer } from \"../../Commons/TasksCore/BuildTask\";\nimport { ObservableValueProducerBase } from \"../../Commons/TasksCore/ChainableValueProducer\";\nimport { ProcessUtils } from \"../ProcessUtils/ProcessUtils\";\nimport { ShellProcessHandle } from \"../ProcessUtils/ShellProcessHandle\";\n\nexport class BuildClientJsTask extends ObservableValueProducerBase<string> {\n private readonly pathToWebpackProvider: IValueProducer<string>;\n private useWatch = false;\n private readonly resourcesDirectory: string;\n private buildProcess?: ShellProcessHandle;\n private readonly logger: ILogger;\n\n public constructor(\n pathToWebpackProvider: IValueProducer<string>,\n resourcesDirectory: string,\n logger: ILogger = getLogger()\n ) {\n super();\n this.pathToWebpackProvider = pathToWebpackProvider;\n this.resourcesDirectory = resourcesDirectory;\n this.logger = logger.withPrefix(\"CLIENT-JS\");\n }\n\n public async beginListening(): Promise<void> {\n await this.pathToWebpackProvider.beginObserve();\n this.useWatch = true;\n }\n\n public async stopListening(): Promise<void> {\n this.useWatch = false;\n await this.pathToWebpackProvider.endObserve();\n if (this.buildProcess != undefined) {\n try {\n const buildProcess = this.buildProcess;\n this.buildProcess = undefined;\n await buildProcess.kill();\n } catch (error) {\n this.logger.error(`Failed to stop process: ${error}`);\n }\n }\n }\n\n public async getCurrentValue(): Promise<string> {\n const webpackConfigFile = await this.pathToWebpackProvider.currentValue;\n if (this.useWatch) {\n this.buildProcess = await this.runWatchProcess(webpackConfigFile);\n } else {\n await this.buildEngineFromSources(webpackConfigFile);\n }\n return webpackConfigFile;\n }\n\n private async buildEngineFromSources(webpackConfigPath: string): Promise<void> {\n const action = buildActionBegin(this.logger, \"Build client.js\");\n const workingDirectory = path.dirname(webpackConfigPath);\n await ProcessUtils.execShellCommand(\n \"npm\",\n [\"run\", \"client:build\", \"--\", `--env`, `resourcesPath=${this.resourcesDirectory}`],\n workingDirectory,\n this.logger\n );\n action.complete();\n }\n\n private async runWatchProcess(webpackConfigPath: string): Promise<ShellProcessHandle> {\n const workingDirectory = path.dirname(webpackConfigPath);\n const watchProcess = ProcessUtils.createShellProcess(\n \"npm\",\n [\"run\", \"client:build\", \"--\", `--env`, `resourcesPath=${this.resourcesDirectory}`, \"--watch\"],\n workingDirectory\n );\n watchProcess.onStdOut.subscribe(output => this.logger.verbose(output));\n this.logger.log(\"Begin watch\");\n watchProcess.start();\n return watchProcess;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAEA,IAAAG,uBAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAGO,MAAMK,iBAAiB,SAASC,mDAA2B,CAAS;EAOhEC,WAAWA,CACdC,qBAA6C,EAC7CC,kBAA0B,EAC1BC,MAAe,GAAG,IAAAC,uBAAS,EAAC,CAAC,EAC/B;IACE,KAAK,CAAC,CAAC;IAAC,KAXKH,qBAAqB;IAAA,KAC9BI,QAAQ,GAAG,KAAK;IAAA,KACPH,kBAAkB;IAAA,KAC3BI,YAAY;IAAA,KACHH,MAAM;IAQnB,IAAI,CAACF,qBAAqB,GAAGA,qBAAqB;IAClD,IAAI,CAACC,kBAAkB,GAAGA,kBAAkB;IAC5C,IAAI,CAACC,MAAM,GAAGA,MAAM,CAACI,UAAU,CAAC,WAAW,CAAC;EAChD;EAEA,MAAaC,cAAcA,CAAA,EAAkB;IACzC,MAAM,IAAI,CAACP,qBAAqB,CAACQ,YAAY,CAAC,CAAC;IAC/C,IAAI,CAACJ,QAAQ,GAAG,IAAI;EACxB;EAEA,MAAaK,aAAaA,CAAA,EAAkB;IACxC,IAAI,CAACL,QAAQ,GAAG,KAAK;IACrB,MAAM,IAAI,CAACJ,qBAAqB,CAACU,UAAU,CAAC,CAAC;IAC7C,IAAI,IAAI,CAACL,YAAY,IAAIM,SAAS,EAAE;MAChC,IAAI;QACA,MAAMN,YAAY,GAAG,IAAI,CAACA,YAAY;QACtC,IAAI,C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,CAAC,EAC7FqB,gBACJ,CAAC;IACDM,YAAY,CAACE,QAAQ,CAACC,SAAS,CAACC,MAAM,IAAI,IAAI,CAAC9B,MAAM,CAAC+B,OAAO,CAACD,MAAM,CAAC,CAAC;IACtE,IAAI,CAAC9B,MAAM,CAACgC,GAAG,CAAC,aAAa,CAAC;IAC9BN,YAAY,CAACO,KAAK,CAAC,CAAC;IACpB,OAAOP,YAAY;EACvB;AACJ;AAACQ,OAAA,CAAAvC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -10,7 +10,6 @@ var _ILogger = require("../../Commons/Logging/ILogger");
|
|
|
10
10
|
var _StaticLogger = require("../../Commons/Logging/StaticLogger");
|
|
11
11
|
var _ChainableValueProducer = require("../../Commons/TasksCore/ChainableValueProducer");
|
|
12
12
|
var _ProcessUtils = require("../ProcessUtils/ProcessUtils");
|
|
13
|
-
var _IsWebpack = require("../ClientJS/IsWebpack5");
|
|
14
13
|
class BuildLocalEngineTask extends _ChainableValueProducer.ObservableValueProducerBase {
|
|
15
14
|
constructor(pathToWebpackProvider, resourcesDirectory, buildDebugOnly, logger) {
|
|
16
15
|
super();
|
|
@@ -54,7 +53,7 @@ class BuildLocalEngineTask extends _ChainableValueProducer.ObservableValueProduc
|
|
|
54
53
|
async buildEngineFromSources(webpackConfigPath) {
|
|
55
54
|
const action = (0, _ILogger.buildActionBegin)(this.logger, "Build engine");
|
|
56
55
|
const workingDirectory = _path.default.dirname(webpackConfigPath);
|
|
57
|
-
const buildProcess =
|
|
56
|
+
const buildProcess = _ProcessUtils.ProcessUtils.createShellProcess(`npm`, ["run", "runtime:build", "--", `--env`, `resourcesPath=${this.resourcesDirectory}`, ...this.getBuildOptions()], workingDirectory);
|
|
58
57
|
buildProcess.onStdOut.subscribe(data => this.logger.log(data.trimRight()));
|
|
59
58
|
buildProcess.start();
|
|
60
59
|
const code = await buildProcess.waitForExit();
|
|
@@ -71,7 +70,7 @@ class BuildLocalEngineTask extends _ChainableValueProducer.ObservableValueProduc
|
|
|
71
70
|
}
|
|
72
71
|
async runWatchProcess(webpackConfigPath) {
|
|
73
72
|
const workingDirectory = _path.default.dirname(webpackConfigPath);
|
|
74
|
-
const result =
|
|
73
|
+
const result = _ProcessUtils.ProcessUtils.createShellProcess("npm", ["run", "runtime:build", "--", "--watch", `--env`, `resourcesPath=${this.resourcesDirectory}`, ...this.getBuildOptions()], workingDirectory);
|
|
75
74
|
result.onStdOut.subscribe(data => this.logger.log(data.trimRight()));
|
|
76
75
|
this.logger.log("Begin watch");
|
|
77
76
|
result.start();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BuildLocalEngineTask.js","names":["_path","_interopRequireDefault","require","_ILogger","_StaticLogger","_ChainableValueProducer","_ProcessUtils","
|
|
1
|
+
{"version":3,"file":"BuildLocalEngineTask.js","names":["_path","_interopRequireDefault","require","_ILogger","_StaticLogger","_ChainableValueProducer","_ProcessUtils","BuildLocalEngineTask","ObservableValueProducerBase","constructor","pathToWebpackProvider","resourcesDirectory","buildDebugOnly","logger","useWatch","buildProcess","getLogger","withPrefix","beginListening","beginObserve","stopListening","endObserve","undefined","kill","error","getCurrentValue","webpackConfigFile","currentValue","runWatchProcess","buildEngineFromSources","webpackConfigPath","action","buildActionBegin","workingDirectory","path","dirname","ProcessUtils","createShellProcess","getBuildOptions","onStdOut","subscribe","data","log","trimRight","start","code","waitForExit","Error","complete","result","exports"],"sources":["../../../../../src/BuildTasks/Engine/BuildLocalEngineTask.ts"],"sourcesContent":["import path from \"path\";\n\nimport { buildActionBegin, ILogger } from \"../../Commons/Logging/ILogger\";\nimport { getLogger } from \"../../Commons/Logging/StaticLogger\";\nimport { IValueProducer } from \"../../Commons/TasksCore/BuildTask\";\nimport { ObservableValueProducerBase } from \"../../Commons/TasksCore/ChainableValueProducer\";\nimport { ProcessUtils } from \"../ProcessUtils/ProcessUtils\";\nimport { ShellProcessHandle } from \"../ProcessUtils/ShellProcessHandle\";\n\nexport class BuildLocalEngineTask extends ObservableValueProducerBase<string> {\n private readonly pathToWebpackProvider: IValueProducer<string>;\n private readonly logger: ILogger;\n private useWatch = false;\n private readonly resourcesDirectory: string;\n private buildProcess?: ShellProcessHandle;\n private readonly buildDebugOnly: boolean;\n\n public constructor(\n pathToWebpackProvider: IValueProducer<string>,\n resourcesDirectory: string,\n buildDebugOnly: boolean,\n logger?: ILogger\n ) {\n super();\n this.pathToWebpackProvider = pathToWebpackProvider;\n this.resourcesDirectory = resourcesDirectory;\n this.logger = (logger || getLogger()).withPrefix(\"ENGINE\");\n this.buildDebugOnly = buildDebugOnly;\n }\n\n public async beginListening(): Promise<void> {\n await this.pathToWebpackProvider.beginObserve();\n this.useWatch = true;\n }\n\n public async stopListening(): Promise<void> {\n this.useWatch = false;\n await this.pathToWebpackProvider.endObserve();\n if (this.buildProcess != undefined) {\n try {\n const buildProcess = this.buildProcess;\n this.buildProcess = undefined;\n await buildProcess.kill();\n } catch (error) {\n this.logger.error(`Failed to stop process: ${error}`);\n }\n }\n }\n\n public async getCurrentValue(): Promise<string> {\n const webpackConfigFile = await this.pathToWebpackProvider.currentValue;\n if (this.useWatch) {\n this.buildProcess = await this.runWatchProcess(webpackConfigFile);\n } else {\n await this.buildEngineFromSources(webpackConfigFile);\n }\n return webpackConfigFile;\n }\n\n private async buildEngineFromSources(webpackConfigPath: string): Promise<void> {\n const action = buildActionBegin(this.logger, \"Build engine\");\n const workingDirectory = path.dirname(webpackConfigPath);\n const buildProcess = ProcessUtils.createShellProcess(\n `npm`,\n [\n \"run\",\n \"runtime:build\",\n \"--\",\n `--env`,\n `resourcesPath=${this.resourcesDirectory}`,\n ...this.getBuildOptions(),\n ],\n workingDirectory\n );\n buildProcess.onStdOut.subscribe(data => this.logger.log(data.trimRight()));\n buildProcess.start();\n const code = await buildProcess.waitForExit();\n if (code !== 0) {\n throw new Error(`Executed with exit code ${code}`);\n }\n action.complete();\n }\n\n private getBuildOptions(): string[] {\n if (this.buildDebugOnly) {\n return [\"--env\", \"development=true\", \"--env\", \"testing=false\", \"--env\", \"production=false\"];\n }\n return [];\n }\n\n private async runWatchProcess(webpackConfigPath: string): Promise<ShellProcessHandle> {\n const workingDirectory = path.dirname(webpackConfigPath);\n\n const result = ProcessUtils.createShellProcess(\n \"npm\",\n [\n \"run\",\n \"runtime:build\",\n \"--\",\n \"--watch\",\n `--env`,\n `resourcesPath=${this.resourcesDirectory}`,\n ...this.getBuildOptions(),\n ],\n workingDirectory\n );\n result.onStdOut.subscribe(data => this.logger.log(data.trimRight()));\n this.logger.log(\"Begin watch\");\n result.start();\n return result;\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AAEA,IAAAG,uBAAA,GAAAH,OAAA;AACA,IAAAI,aAAA,GAAAJ,OAAA;AAGO,MAAMK,oBAAoB,SAASC,mDAA2B,CAAS;EAQnEC,WAAWA,CACdC,qBAA6C,EAC7CC,kBAA0B,EAC1BC,cAAuB,EACvBC,MAAgB,EAClB;IACE,KAAK,CAAC,CAAC;IAAC,KAbKH,qBAAqB;IAAA,KACrBG,MAAM;IAAA,KACfC,QAAQ,GAAG,KAAK;IAAA,KACPH,kBAAkB;IAAA,KAC3BI,YAAY;IAAA,KACHH,cAAc;IAS3B,IAAI,CAACF,qBAAqB,GAAGA,qBAAqB;IAClD,IAAI,CAACC,kBAAkB,GAAGA,kBAAkB;IAC5C,IAAI,CAACE,MAAM,GAAG,CAACA,MAAM,IAAI,IAAAG,uBAAS,EAAC,CAAC,EAAEC,UAAU,CAAC,QAAQ,CAAC;IAC1D,IAAI,CAACL,cAAc,GAAGA,cAAc;EACxC;EAEA,MAAaM,cAAcA,CAAA,EAAkB;IACzC,MAAM,IAAI,CAACR,qBAAqB,CAACS,YAAY,CAAC,CAAC;IAC/C,IAAI,CAACL,QAAQ,GAAG,IAAI;EACxB;EAEA,MAAaM,aAAaA,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{
|
|
|
7
7
|
exports.createClientViteConfigTask = createClientViteConfigTask;
|
|
8
8
|
exports.createClientWebpackConfigTask = createClientWebpackConfigTask;
|
|
9
9
|
exports.createEngineWebpackConfigTask = createEngineWebpackConfigTask;
|
|
10
|
-
exports.isNewEngineStructure = isNewEngineStructure;
|
|
11
|
-
exports.isOldGeneratorGetSugarTextsStructure = isOldGeneratorGetSugarTextsStructure;
|
|
12
|
-
exports.isOldGeneratorSourcesStructure = isOldGeneratorSourcesStructure;
|
|
13
10
|
var _path = _interopRequireDefault(require("path"));
|
|
14
|
-
var _fsExtra = require("fs-extra");
|
|
15
11
|
var _Observe = require("../Commons/TasksCore/Observe");
|
|
16
|
-
/// Новая стркутуа генератора -- когда при компиляции генератора, в каталог также компилируется движок и в
|
|
17
|
-
// каталоге dist оказываются папки Engine и Generator
|
|
18
|
-
async function isOldGeneratorSourcesStructure(pathToGenerator) {
|
|
19
|
-
return (0, _fsExtra.pathExists)(_path.default.join(pathToGenerator, "dist", "generators", "processSugar.js"));
|
|
20
|
-
}
|
|
21
|
-
async function isOldGeneratorGetSugarTextsStructure(pathToGenerator) {
|
|
22
|
-
return (0, _fsExtra.pathExists)(_path.default.join(pathToGenerator, "dist", "generators", "getSugarTexts.js"));
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/// Новая стркутуа -- когда каталоги движка и генератора находятся на двух разных уровнях
|
|
26
|
-
async function isNewEngineStructure(engineDirectory) {
|
|
27
|
-
return !(await (0, _fsExtra.pathExists)(_path.default.join(engineDirectory, "webpack.config.js")));
|
|
28
|
-
}
|
|
29
12
|
async function createEngineWebpackConfigTask(engineDirectory) {
|
|
30
|
-
|
|
31
|
-
return _Observe.Observe.file(_path.default.join(engineDirectory, "Engine", "webpack.config.js"));
|
|
32
|
-
} else {
|
|
33
|
-
return _Observe.Observe.file(_path.default.join(engineDirectory, "webpack.config.js"));
|
|
34
|
-
}
|
|
13
|
+
return _Observe.Observe.file(_path.default.join(engineDirectory, "webpack.config.js"));
|
|
35
14
|
}
|
|
36
15
|
async function createClientWebpackConfigTask(engineDirectory) {
|
|
37
|
-
|
|
38
|
-
return _Observe.Observe.file(_path.default.join(engineDirectory, "Engine", "clientjs.webpack.config.js"));
|
|
39
|
-
} else {
|
|
40
|
-
return _Observe.Observe.file(_path.default.join(engineDirectory, "clientjs.webpack.config.js"));
|
|
41
|
-
}
|
|
16
|
+
return _Observe.Observe.file(_path.default.join(engineDirectory, "clientjs.webpack.config.js"));
|
|
42
17
|
}
|
|
43
18
|
async function createClientViteConfigTask(engineDirectory) {
|
|
44
19
|
return _Observe.Observe.file(_path.default.join(engineDirectory, "Widgets", "CandyWidget", "vite", "common.ts"));
|