Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
keepAlivePolicy(pipelineOptions.keepAliveOptions),
telemetryPolicy,
generateClientRequestIdPolicy(),
new StorageBrowserPolicyFactory(),
deserializationPolicy(), // Default deserializationPolicy is provided by protocol layer
new StorageRetryPolicyFactory(pipelineOptions.retryOptions),
logPolicy({
logger: logger.info,
allowedHeaderNames: StorageFileLoggingAllowedHeaderNames,
allowedQueryParameters: StorageFileLoggingAllowedQueryParameters
})
];
if (isNode) {
// ProxyPolicy is only avaiable in Node.js runtime, not in browsers
factories.push(proxyPolicy(pipelineOptions.proxyOptions));
}
factories.push(credential);
return new Pipeline(factories, {
httpClient: pipelineOptions.httpClient
});
}
logPolicy({
logger: logger.info,
allowedHeaderNames: StorageFileLoggingAllowedHeaderNames,
allowedQueryParameters: StorageFileLoggingAllowedQueryParameters
})
];
if (isNode) {
// ProxyPolicy is only avaiable in Node.js runtime, not in browsers
let proxySettings: ProxySettings | undefined;
if (typeof pipelineOptions.proxy === "string" || !pipelineOptions.proxy) {
proxySettings = getDefaultProxySettings(pipelineOptions.proxy);
} else {
proxySettings = pipelineOptions.proxy;
}
factories.push(proxyPolicy(proxySettings));
}
factories.push(credential);
return new Pipeline(factories, {
HttpClient: pipelineOptions.httpClient,
logger: pipelineOptions.logger
});
}
keepAlivePolicy(pipelineOptions.keepAliveOptions),
telemetryPolicy,
generateClientRequestIdPolicy(),
new StorageBrowserPolicyFactory(),
deserializationPolicy(), // Default deserializationPolicy is provided by protocol layer
new StorageRetryPolicyFactory(pipelineOptions.retryOptions),
logPolicy({
logger: logger.info,
allowedHeaderNames: StorageBlobLoggingAllowedHeaderNames,
allowedQueryParameters: StorageBlobLoggingAllowedQueryParameters
})
];
if (isNode) {
// ProxyPolicy is only avaiable in Node.js runtime, not in browsers
factories.push(proxyPolicy(pipelineOptions.proxyOptions));
}
factories.push(
isTokenCredential(credential)
? bearerTokenAuthenticationPolicy(credential, StorageOAuthScopes)
: credential
);
return new Pipeline(factories, {
httpClient: pipelineOptions.httpClient
});
}
new UniqueRequestIDPolicyFactory(),
new BrowserPolicyFactory(),
deserializationPolicy(), // Default deserializationPolicy is provided by protocol layer
new RetryPolicyFactory(pipelineOptions.retryOptions),
new LoggingPolicyFactory()
];
if (isNode) {
// ProxyPolicy is only avaiable in Node.js runtime, not in browsers
let proxySettings: ProxySettings | undefined;
if (typeof pipelineOptions.proxy === "string") {
proxySettings = getDefaultProxySettings(pipelineOptions.proxy);
} else {
proxySettings = pipelineOptions.proxy;
}
factories.push(proxyPolicy(proxySettings));
}
factories.push(
isTokenCredential(credential)
? bearerTokenAuthenticationPolicy(credential, "https://storage.azure.com/.default")
: credential
);
return new Pipeline(factories, {
HTTPClient: pipelineOptions.httpClient,
logger: pipelineOptions.logger
});
}
keepAlivePolicy(pipelineOptions.keepAliveOptions),
telemetryPolicy,
generateClientRequestIdPolicy(),
new StorageBrowserPolicyFactory(),
deserializationPolicy(), // Default deserializationPolicy is provided by protocol layer
new StorageRetryPolicyFactory(pipelineOptions.retryOptions),
logPolicy({
logger: logger.info,
allowedHeaderNames: StorageDataLakeLoggingAllowedHeaderNames,
allowedQueryParameters: StorageDataLakeLoggingAllowedQueryParameters
})
];
if (isNode) {
// ProxyPolicy is only avaiable in Node.js runtime, not in browsers
factories.push(proxyPolicy(pipelineOptions.proxyOptions));
}
factories.push(
isTokenCredential(credential)
? bearerTokenAuthenticationPolicy(credential, StorageOAuthScopes)
: credential
);
return new Pipeline(factories, {
httpClient: pipelineOptions.httpClient
});
}
keepAlivePolicy(pipelineOptions.keepAliveOptions),
telemetryPolicy,
generateClientRequestIdPolicy(),
new StorageBrowserPolicyFactory(),
deserializationPolicy(), // Default deserializationPolicy is provided by protocol layer
new StorageRetryPolicyFactory(pipelineOptions.retryOptions),
logPolicy({
logger: logger.info,
allowedHeaderNames: StorageQueueLoggingAllowedHeaderNames,
allowedQueryParameters: StorageQueueLoggingAllowedQueryParameters
})
];
if (isNode) {
// ProxyPolicy is only avaiable in Node.js runtime, not in browsers
factories.push(proxyPolicy(pipelineOptions.proxyOptions));
}
factories.push(
isTokenCredential(credential)
? bearerTokenAuthenticationPolicy(credential, StorageOAuthScopes)
: credential
);
return new Pipeline(factories, {
httpClient: pipelineOptions.httpClient
});
}
new UniqueRequestIDPolicyFactory(),
new BrowserPolicyFactory(),
deserializationPolicy(), // Default deserializationPolicy is provided by protocol layer
new RetryPolicyFactory(pipelineOptions.retryOptions),
new LoggingPolicyFactory()
];
if (isNode) {
// ProxyPolicy is only avaiable in Node.js runtime, not in browsers
let proxySettings: ProxySettings | undefined;
if (typeof pipelineOptions.proxy === "string") {
proxySettings = getDefaultProxySettings(pipelineOptions.proxy);
} else {
proxySettings = pipelineOptions.proxy;
}
factories.push(proxyPolicy(proxySettings));
}
factories.push(credential);
return new Pipeline(factories, {
HTTPClient: pipelineOptions.httpClient,
logger: pipelineOptions.logger
});
}
const connectionStringObj: any = parseConnectionString(connectionString);
if (connectionStringObj.Endpoint == undefined) {
throw new Error("Missing Endpoint in connection string.");
}
const credentials = new SasServiceClientCredentials(
connectionStringObj.SharedAccessKeyName,
connectionStringObj.SharedAccessKey
);
const requestPolicyFactories: RequestPolicyFactory[] = [];
requestPolicyFactories.push(signingPolicy(credentials));
if (options && options.proxySettings) {
requestPolicyFactories.push(proxyPolicy(options.proxySettings));
}
const serviceClientOptions: ServiceClientOptions = {
requestPolicyFactories: requestPolicyFactories
};
super(credentials, serviceClientOptions);
this.queueResourceSerializer = new QueueResourceSerializer();
this.topicResourceSerializer = new TopicResourceSerializer();
this.subscriptionResourceSerializer = new SubscriptionResourceSerializer();
this.ruleResourceSerializer = new RuleResourceSerializer();
this.endpoint = (connectionString.match("Endpoint=sb://(.*)/;") || "")[1];
}