@adobe/pdfservices-node-sdk
Version:
The Adobe PDF Services Node.js SDK provides APIs for creating, combining, exporting and manipulating PDFs.
39 lines • 1.83 kB
JavaScript
;
/*
* Copyright 2024 Adobe
* All Rights Reserved.
*
* NOTICE: Adobe permits you to use, modify, and distribute this file in
* accordance with the terms of the Adobe license agreement accompanying
* it. If you have received this file from a source other than Adobe,
* then your use, modification, or distribution of it requires the prior
* written permission of Adobe.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecutionContext = void 0;
const ClientConfig_1 = require("../config/ClientConfig");
const PDFServiceRequestContext_1 = require("./PDFServiceRequestContext");
const AuthenticatorFactory_1 = require("./auth/AuthenticatorFactory");
const HttpRequestConfig_1 = require("./http/HttpRequestConfig");
const ObjectUtil_1 = require("./util/ObjectUtil");
class ExecutionContext {
constructor(credentials, clientConfig) {
this._clientConfig = clientConfig ?? new ClientConfig_1.ClientConfig({});
this._authenticator = AuthenticatorFactory_1.AuthenticatorFactory.getAuthenticator(credentials, this._clientConfig);
this._pdfServiceRequestContext = new PDFServiceRequestContext_1.PDFServiceRequestContext(this.clientConfig.pdfServicesUri);
}
get clientConfig() {
return this._clientConfig;
}
getBaseRequestFromRequestContext(requestKey) {
const baseRequest = this._pdfServiceRequestContext.getBaseRequest(requestKey);
baseRequest.authenticator = this._authenticator;
baseRequest.httpRequestConfig = new HttpRequestConfig_1.HttpRequestConfig(this.clientConfig);
return baseRequest;
}
validate() {
ObjectUtil_1.ObjectUtil.requireNonNullOrUndefined(this._authenticator, "Authenticator");
}
}
exports.ExecutionContext = ExecutionContext;
//# sourceMappingURL=ExecutionContext.js.map