connectors_sdk 8.2.0.0 → 8.3.0.0.pre.20220517T144653Z
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.
- checksums.yaml +4 -4
- data/lib/connectors_sdk/atlassian/config.rb +27 -0
- data/lib/connectors_sdk/atlassian/custom_client.rb +87 -0
- data/lib/connectors_sdk/base/adapter.rb +7 -8
- data/lib/connectors_sdk/base/authorization.rb +89 -0
- data/lib/connectors_sdk/base/custom_client.rb +1 -2
- data/lib/connectors_sdk/base/extractor.rb +3 -2
- data/lib/connectors_sdk/base/http_call_wrapper.rb +135 -0
- data/lib/connectors_sdk/base/registry.rb +5 -3
- data/lib/connectors_sdk/confluence/adapter.rb +216 -0
- data/lib/connectors_sdk/confluence/custom_client.rb +143 -0
- data/lib/connectors_sdk/confluence/extractor.rb +265 -0
- data/lib/connectors_sdk/confluence_cloud/authorization.rb +64 -0
- data/lib/connectors_sdk/confluence_cloud/custom_client.rb +61 -0
- data/lib/connectors_sdk/confluence_cloud/extractor.rb +59 -0
- data/lib/connectors_sdk/confluence_cloud/http_call_wrapper.rb +59 -0
- data/lib/connectors_sdk/helpers/atlassian_time_formatter.rb +10 -0
- data/lib/connectors_sdk/office365/adapter.rb +7 -7
- data/lib/connectors_sdk/office365/config.rb +1 -0
- data/lib/connectors_sdk/office365/custom_client.rb +25 -64
- data/lib/connectors_sdk/office365/extractor.rb +18 -34
- data/lib/connectors_sdk/share_point/adapter.rb +24 -12
- data/lib/connectors_sdk/share_point/authorization.rb +14 -62
- data/lib/connectors_sdk/share_point/extractor.rb +2 -2
- data/lib/connectors_sdk/share_point/http_call_wrapper.rb +24 -83
- data/lib/connectors_shared/exception_tracking.rb +4 -4
- data/lib/connectors_shared/extraction_utils.rb +109 -0
- data/lib/connectors_shared/job_status.rb +18 -0
- data/lib/connectors_shared/middleware/basic_auth.rb +27 -0
- data/lib/connectors_shared/middleware/bearer_auth.rb +27 -0
- data/lib/connectors_shared/middleware/restrict_hostnames.rb +73 -0
- data/lib/connectors_shared/monitor.rb +3 -3
- data/lib/connectors_shared.rb +1 -0
- data/lib/stubs/enterprise_search/exception_tracking.rb +43 -0
- metadata +23 -5
@@ -9,108 +9,49 @@
|
|
9
9
|
require 'connectors_sdk/office365/config'
|
10
10
|
require 'connectors_sdk/share_point/extractor'
|
11
11
|
require 'connectors_sdk/share_point/authorization'
|
12
|
-
require '
|
12
|
+
require 'connectors_sdk/base/http_call_wrapper'
|
13
13
|
|
14
14
|
module ConnectorsSdk
|
15
15
|
module SharePoint
|
16
|
-
|
16
|
+
class HttpCallWrapper < ConnectorsSdk::Base::HttpCallWrapper
|
17
|
+
SERVICE_TYPE = 'share_point'
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
cursors = params.fetch(:cursors, {}) || {}
|
21
|
-
features = params.fetch(:features, {}) || {}
|
22
|
-
|
23
|
-
# XXX can we cache that class across calls?
|
24
|
-
ConnectorsSdk::SharePoint::Extractor.new(
|
25
|
-
content_source_id: BSON::ObjectId.new,
|
26
|
-
service_type: SERVICE_TYPE,
|
27
|
-
authorization_data_proc: proc { { access_token: params[:access_token] } },
|
28
|
-
client_proc: proc { ConnectorsSdk::Office365::CustomClient.new(:access_token => params[:access_token], :cursors => cursors) },
|
29
|
-
config: ConnectorsSdk::Office365::Config.new(:cursors => cursors, :drive_ids => 'all', :index_permissions => params[:index_permissions] || false),
|
30
|
-
features: features
|
31
|
-
)
|
32
|
-
end
|
33
|
-
|
34
|
-
def document_batch(params)
|
35
|
-
results = []
|
36
|
-
|
37
|
-
@extractor = extractor(params)
|
38
|
-
|
39
|
-
@extractor.yield_document_changes(:break_after_page => true, :modified_since => @extractor.config.cursors['modified_since']) do |action, doc, download_args_and_proc|
|
40
|
-
download_obj = nil
|
41
|
-
if download_args_and_proc
|
42
|
-
download_obj = {
|
43
|
-
id: download_args_and_proc[0],
|
44
|
-
name: download_args_and_proc[1],
|
45
|
-
size: download_args_and_proc[2],
|
46
|
-
download_args: download_args_and_proc[3]
|
47
|
-
}
|
48
|
-
end
|
49
|
-
|
50
|
-
results << {
|
51
|
-
:action => action,
|
52
|
-
:document => doc,
|
53
|
-
:download => download_obj
|
54
|
-
}
|
55
|
-
end
|
56
|
-
|
57
|
-
results
|
58
|
-
rescue ConnectorsSdk::Office365::CustomClient::ClientError => e
|
59
|
-
raise e.status_code == 401 ? ConnectorsShared::InvalidTokenError : e
|
60
|
-
end
|
61
|
-
|
62
|
-
def cursors
|
63
|
-
@extractor.config.cursors
|
19
|
+
def name
|
20
|
+
'SharePoint'
|
64
21
|
end
|
65
22
|
|
66
|
-
def
|
67
|
-
|
23
|
+
def service_type
|
24
|
+
SERVICE_TYPE
|
68
25
|
end
|
69
26
|
|
70
|
-
|
71
|
-
results = []
|
72
|
-
extractor(params).yield_deleted_ids(params[:ids]) do |id|
|
73
|
-
results << id
|
74
|
-
end
|
75
|
-
results
|
76
|
-
rescue ConnectorsSdk::Office365::CustomClient::ClientError => e
|
77
|
-
raise e.status_code == 401 ? ConnectorsShared::InvalidTokenError : e
|
78
|
-
end
|
27
|
+
private
|
79
28
|
|
80
|
-
def
|
81
|
-
|
82
|
-
return permissions
|
83
|
-
end
|
84
|
-
rescue ConnectorsSdk::Office365::CustomClient::ClientError => e
|
85
|
-
raise e.status_code == 401 ? ConnectorsShared::InvalidTokenError : e
|
29
|
+
def extractor_class
|
30
|
+
ConnectorsSdk::SharePoint::Extractor
|
86
31
|
end
|
87
32
|
|
88
|
-
def
|
89
|
-
ConnectorsSdk::SharePoint::Authorization
|
33
|
+
def authorization
|
34
|
+
ConnectorsSdk::SharePoint::Authorization
|
90
35
|
end
|
91
36
|
|
92
|
-
def
|
93
|
-
ConnectorsSdk::
|
37
|
+
def client(params)
|
38
|
+
ConnectorsSdk::Office365::CustomClient.new(:access_token => params[:access_token], :cursors => params.fetch(:cursors, {}) || {})
|
94
39
|
end
|
95
40
|
|
96
|
-
def
|
97
|
-
ConnectorsSdk::
|
41
|
+
def custom_client_error
|
42
|
+
ConnectorsSdk::Office365::CustomClient::ClientError
|
98
43
|
end
|
99
44
|
|
100
|
-
def
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
45
|
+
def config(params)
|
46
|
+
ConnectorsSdk::Office365::Config.new(
|
47
|
+
:cursors => params.fetch(:cursors, {}) || {},
|
48
|
+
:drive_ids => 'all',
|
49
|
+
:index_permissions => params[:index_permissions] || false
|
50
|
+
)
|
106
51
|
end
|
107
52
|
|
108
|
-
def
|
109
|
-
client
|
110
|
-
client.me
|
111
|
-
{ :status => 'OK', :statusCode => 200, :message => 'Connected to SharePoint' }
|
112
|
-
rescue StandardError => e
|
113
|
-
{ :status => 'FAILURE', :statusCode => e.is_a?(ConnectorsSdk::Office365::CustomClient::ClientError) ? e.status_code : 500, :message => e.message }
|
53
|
+
def health_check(params)
|
54
|
+
client(params).me
|
114
55
|
end
|
115
56
|
end
|
116
57
|
end
|
@@ -6,23 +6,23 @@
|
|
6
6
|
|
7
7
|
# frozen_string_literal: true
|
8
8
|
|
9
|
-
require 'stubs/swiftype/exception_tracking' unless defined?(Rails)
|
10
9
|
require 'bson'
|
11
10
|
require 'connectors_shared/logger'
|
11
|
+
require 'stubs/enterprise_search/exception_tracking'
|
12
12
|
|
13
13
|
module ConnectorsShared
|
14
14
|
class ExceptionTracking
|
15
15
|
class << self
|
16
16
|
def capture_message(message, context = {})
|
17
|
-
|
17
|
+
EnterpriseSearch::ExceptionTracking.capture_message(message, context)
|
18
18
|
end
|
19
19
|
|
20
20
|
def capture_exception(exception, context = {})
|
21
|
-
|
21
|
+
EnterpriseSearch::ExceptionTracking.log_exception(exception, :context => context)
|
22
22
|
end
|
23
23
|
|
24
24
|
def log_exception(exception, message = nil)
|
25
|
-
|
25
|
+
EnterpriseSearch::ExceptionTracking.log_exception(exception, message, :logger => ConnectorsShared::Logger.logger)
|
26
26
|
end
|
27
27
|
|
28
28
|
def augment_exception(exception)
|
@@ -0,0 +1,109 @@
|
|
1
|
+
#
|
2
|
+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
3
|
+
# or more contributor license agreements. Licensed under the Elastic License;
|
4
|
+
# you may not use this file except in compliance with the Elastic License.
|
5
|
+
#
|
6
|
+
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
require 'set'
|
10
|
+
|
11
|
+
module ConnectorsShared
|
12
|
+
module ExtractionUtils
|
13
|
+
# A list of tags tags we want to remove before extracting content
|
14
|
+
NON_CONTENT_TAGS = Set.new(%w[
|
15
|
+
comment
|
16
|
+
object
|
17
|
+
script
|
18
|
+
style
|
19
|
+
svg
|
20
|
+
video
|
21
|
+
]).freeze
|
22
|
+
|
23
|
+
# Tags, that generate a word/line break when rendered
|
24
|
+
BREAK_ELEMENTS = Set.new(%w[
|
25
|
+
br
|
26
|
+
hr
|
27
|
+
]).freeze
|
28
|
+
|
29
|
+
# The character used to signal that a string has been truncated
|
30
|
+
OMISSION = '…'
|
31
|
+
|
32
|
+
#-------------------------------------------------------------------------------------------------
|
33
|
+
# Expects a Nokogiri HTML node, returns textual content from the node and all of its children
|
34
|
+
def self.node_descendant_text(node)
|
35
|
+
return '' unless node&.present?
|
36
|
+
|
37
|
+
unless node.respond_to?(:children) && node.respond_to?(:name) && node.respond_to?(:text?)
|
38
|
+
raise ArgumentError, "Expecting something node-like but got a #{node.class}"
|
39
|
+
end
|
40
|
+
|
41
|
+
to_process_stack = [node]
|
42
|
+
text = []
|
43
|
+
|
44
|
+
loop do
|
45
|
+
# Get the next node to process
|
46
|
+
node = to_process_stack.pop
|
47
|
+
break unless node
|
48
|
+
|
49
|
+
# Base cases where we append content to the text buffer
|
50
|
+
if node.kind_of?(String)
|
51
|
+
text << node unless node == ' ' && text.last == ' '
|
52
|
+
next
|
53
|
+
end
|
54
|
+
|
55
|
+
# Remove tags that do not contain any text (and which sometimes are treated as CDATA, generating garbage text in jruby)
|
56
|
+
next if NON_CONTENT_TAGS.include?(node.name)
|
57
|
+
|
58
|
+
# Tags, that need to be replaced by spaces according to the standards
|
59
|
+
if replace_with_whitespace?(node)
|
60
|
+
text << ' ' unless text.last == ' '
|
61
|
+
next
|
62
|
+
end
|
63
|
+
|
64
|
+
# Extract the text from all text nodes
|
65
|
+
if node.text?
|
66
|
+
content = node.content
|
67
|
+
text << content.squish if content
|
68
|
+
next
|
69
|
+
end
|
70
|
+
|
71
|
+
# Add spaces before all tags
|
72
|
+
to_process_stack << ' '
|
73
|
+
|
74
|
+
# Recursion by adding the node's children to the stack and looping
|
75
|
+
node.children.reverse_each { |child| to_process_stack << child }
|
76
|
+
|
77
|
+
# Add spaces after all tags
|
78
|
+
to_process_stack << ' '
|
79
|
+
end
|
80
|
+
|
81
|
+
# Remove any duplicate spaces and return the content
|
82
|
+
text.join.squish!
|
83
|
+
end
|
84
|
+
|
85
|
+
#-------------------------------------------------------------------------------------------------
|
86
|
+
# Returns true, if the node should be replaced with a space when extracting text from a document
|
87
|
+
def self.replace_with_whitespace?(node)
|
88
|
+
BREAK_ELEMENTS.include?(node.name)
|
89
|
+
end
|
90
|
+
|
91
|
+
#-------------------------------------------------------------------------------------------------
|
92
|
+
# Limits the size of a given string value down to a given limit (in bytes)
|
93
|
+
# This is heavily inspired by https://github.com/rails/rails/pull/27319/files
|
94
|
+
def self.limit_bytesize(string, limit)
|
95
|
+
return string if string.nil? || string.bytesize <= limit
|
96
|
+
real_limit = limit - OMISSION.bytesize
|
97
|
+
(+'').tap do |cut|
|
98
|
+
string.scan(/\X/) do |grapheme|
|
99
|
+
if cut.bytesize + grapheme.bytesize <= real_limit
|
100
|
+
cut << grapheme
|
101
|
+
else
|
102
|
+
cut << OMISSION
|
103
|
+
break
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
#
|
2
|
+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
3
|
+
# or more contributor license agreements. Licensed under the Elastic License;
|
4
|
+
# you may not use this file except in compliance with the Elastic License.
|
5
|
+
#
|
6
|
+
|
7
|
+
module ConnectorsShared
|
8
|
+
class JobStatus
|
9
|
+
CREATED = 'created'
|
10
|
+
RUNNING = 'running'
|
11
|
+
FINISHED = 'finished'
|
12
|
+
FAILED = 'failed'
|
13
|
+
|
14
|
+
def self.is_valid?(status)
|
15
|
+
[CREATED, RUNNING, FINISHED, FAILED].include? status
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#
|
2
|
+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
3
|
+
# or more contributor license agreements. Licensed under the Elastic License;
|
4
|
+
# you may not use this file except in compliance with the Elastic License.
|
5
|
+
#
|
6
|
+
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
module ConnectorsShared
|
10
|
+
module Middleware
|
11
|
+
class BasicAuth
|
12
|
+
AUTHORIZATION = 'Authorization'
|
13
|
+
|
14
|
+
attr_reader :basic_auth_token
|
15
|
+
|
16
|
+
def initialize(app = nil, options = {})
|
17
|
+
@app = app
|
18
|
+
@basic_auth_token = options.fetch(:basic_auth_token)
|
19
|
+
end
|
20
|
+
|
21
|
+
def call(env)
|
22
|
+
env.request_headers[AUTHORIZATION] = "Basic #{basic_auth_token}"
|
23
|
+
@app.call(env)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
#
|
2
|
+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
3
|
+
# or more contributor license agreements. Licensed under the Elastic License;
|
4
|
+
# you may not use this file except in compliance with the Elastic License.
|
5
|
+
#
|
6
|
+
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
module ConnectorsShared
|
10
|
+
module Middleware
|
11
|
+
class BearerAuth
|
12
|
+
AUTHORIZATION = 'Authorization'
|
13
|
+
|
14
|
+
attr_reader :bearer_auth_token
|
15
|
+
|
16
|
+
def initialize(app = nil, options = {})
|
17
|
+
@app = app
|
18
|
+
@bearer_auth_token = options.fetch(:bearer_auth_token)
|
19
|
+
end
|
20
|
+
|
21
|
+
def call(env)
|
22
|
+
env.request_headers[AUTHORIZATION] = "Bearer #{bearer_auth_token}"
|
23
|
+
@app.call(env)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#
|
2
|
+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
3
|
+
# or more contributor license agreements. Licensed under the Elastic License;
|
4
|
+
# you may not use this file except in compliance with the Elastic License.
|
5
|
+
#
|
6
|
+
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
require 'faraday/middleware'
|
10
|
+
require 'resolv'
|
11
|
+
|
12
|
+
require 'connectors_shared/errors'
|
13
|
+
require 'connectors_shared/logger'
|
14
|
+
|
15
|
+
module ConnectorsShared
|
16
|
+
module Middleware
|
17
|
+
class RestrictHostnames < Faraday::Middleware
|
18
|
+
class AddressNotAllowed < ConnectorsShared::ClientError; end
|
19
|
+
URL_PATTERN = /\Ahttp/
|
20
|
+
|
21
|
+
attr_reader :allowed_hosts, :allowed_ips
|
22
|
+
|
23
|
+
def initialize(app = nil, options = {})
|
24
|
+
super(app)
|
25
|
+
@allowed_hosts = options[:allowed_hosts]
|
26
|
+
@allowed_ips = ips_from_hosts(@allowed_hosts)
|
27
|
+
end
|
28
|
+
|
29
|
+
def call(env)
|
30
|
+
raise AddressNotAllowed.new("Address not allowed for #{env[:url]}") if denied?(env)
|
31
|
+
@app.call(env)
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def ips_from_hosts(hosts)
|
37
|
+
hosts&.flat_map do |host|
|
38
|
+
if URL_PATTERN.match(host)
|
39
|
+
lookup_ips(URI.parse(host).host)
|
40
|
+
elsif Resolv::IPv4::Regex.match(host) || Resolv::IPv6::Regex.match(host)
|
41
|
+
IPAddr.new(host)
|
42
|
+
else
|
43
|
+
lookup_ips(host)
|
44
|
+
end
|
45
|
+
end || []
|
46
|
+
end
|
47
|
+
|
48
|
+
def denied?(env)
|
49
|
+
requested_ips = lookup_ips(env[:url].hostname)
|
50
|
+
no_match = requested_ips.all? { |ip| !@allowed_ips.include?(ip) }
|
51
|
+
return false unless no_match
|
52
|
+
ConnectorsShared::Logger.warn("Requested url #{env[:url]} with resolved ip addresses #{requested_ips} does not match " \
|
53
|
+
"allowed hosts #{@allowed_hosts} with resolved ip addresses #{@allowed_ips}. Retrying.")
|
54
|
+
@allowed_ips = ips_from_hosts(@allowed_hosts) # maybe the IP has changed for an allowed host. Re-do allowed_hosts DNS lookup
|
55
|
+
no_match = requested_ips.all? { |ip| !@allowed_ips.include?(ip) }
|
56
|
+
ConnectorsShared::Logger.error("Requested url #{env[:url]} with resolved ip addresses #{requested_ips} does not match " \
|
57
|
+
"allowed hosts #{@allowed_hosts} with resolved ip addresses #{@allowed_ips}") if no_match
|
58
|
+
no_match
|
59
|
+
end
|
60
|
+
|
61
|
+
def lookup_ips(hostname)
|
62
|
+
addr_infos(hostname).map { |a| IPAddr.new(a.ip_address) }
|
63
|
+
end
|
64
|
+
|
65
|
+
def addr_infos(hostname)
|
66
|
+
Addrinfo.getaddrinfo(hostname, nil, :UNSPEC, :STREAM)
|
67
|
+
rescue SocketError
|
68
|
+
# In case of invalid hostname, return an empty list of addresses
|
69
|
+
[]
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
require 'connectors_shared/errors'
|
10
10
|
require 'stubs/app_config' unless defined?(Rails)
|
11
|
-
require 'stubs/
|
11
|
+
require 'stubs/enterprise_search/exception_tracking' unless defined?(Rails)
|
12
12
|
|
13
13
|
module ConnectorsShared
|
14
14
|
class Monitor
|
@@ -44,8 +44,8 @@ module ConnectorsShared
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def note_error(error, id: Time.now.to_i)
|
47
|
-
stack_trace =
|
48
|
-
error_message =
|
47
|
+
stack_trace = EnterpriseSearch::ExceptionTracking.generate_stack_trace(error)
|
48
|
+
error_message = EnterpriseSearch::ExceptionTracking.generate_error_message(error, nil, nil)
|
49
49
|
@connector.log_debug("Message id: #{id} - #{error_message}\n#{stack_trace}")
|
50
50
|
@total_error_count += 1
|
51
51
|
@consecutive_error_count += 1
|
data/lib/connectors_shared.rb
CHANGED
@@ -8,5 +8,6 @@ require 'connectors_shared/constants'
|
|
8
8
|
require 'connectors_shared/errors'
|
9
9
|
require 'connectors_shared/exception_tracking'
|
10
10
|
require 'connectors_shared/extension_mapping_util'
|
11
|
+
require 'connectors_shared/job_status'
|
11
12
|
require 'connectors_shared/logger'
|
12
13
|
require 'connectors_shared/monitor'
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#
|
2
|
+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
3
|
+
# or more contributor license agreements. Licensed under the Elastic License;
|
4
|
+
# you may not use this file except in compliance with the Elastic License.
|
5
|
+
#
|
6
|
+
|
7
|
+
module EnterpriseSearch
|
8
|
+
class ExceptionTracking
|
9
|
+
def self.capture_message(message, context = {})
|
10
|
+
AppConfig.connectors_logger.error { "Error: #{message}. Context: #{context.inspect}" }
|
11
|
+
|
12
|
+
# When the method is called from a rescue block, our return value may leak outside of its
|
13
|
+
# intended scope, so let's explicitly return nil here to be safe.
|
14
|
+
nil
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.log_exception(exception, message = nil, context: nil, logger: AppConfig.connectors_logger)
|
18
|
+
logger.error { message } if message
|
19
|
+
logger.error { generate_stack_trace(exception) }
|
20
|
+
logger.error { "Context: #{context.inspect}" } if context
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.generate_error_message(exception, message, context)
|
24
|
+
context = { :message_id => exception.id }.merge(context || {}) if exception.respond_to?(:id)
|
25
|
+
context_message = context && "Context: #{context.inspect}"
|
26
|
+
['Exception', message, exception.class.to_s, exception.message, context_message]
|
27
|
+
.compact
|
28
|
+
.map { |part| part.to_s.dup.force_encoding('UTF-8') }
|
29
|
+
.join(': ')
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.generate_stack_trace(exception)
|
33
|
+
full_message = exception.full_message
|
34
|
+
|
35
|
+
cause = exception
|
36
|
+
while cause.cause != cause && (cause = cause.cause)
|
37
|
+
full_message << "Cause:\n#{cause.full_message}"
|
38
|
+
end
|
39
|
+
|
40
|
+
full_message.dup.force_encoding('UTF-8')
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: connectors_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 8.
|
4
|
+
version: 8.3.0.0.pre.20220517T144653Z
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -61,11 +61,23 @@ files:
|
|
61
61
|
- LICENSE
|
62
62
|
- NOTICE.txt
|
63
63
|
- lib/connectors_sdk.rb
|
64
|
+
- lib/connectors_sdk/atlassian/config.rb
|
65
|
+
- lib/connectors_sdk/atlassian/custom_client.rb
|
64
66
|
- lib/connectors_sdk/base/adapter.rb
|
67
|
+
- lib/connectors_sdk/base/authorization.rb
|
65
68
|
- lib/connectors_sdk/base/config.rb
|
66
69
|
- lib/connectors_sdk/base/custom_client.rb
|
67
70
|
- lib/connectors_sdk/base/extractor.rb
|
71
|
+
- lib/connectors_sdk/base/http_call_wrapper.rb
|
68
72
|
- lib/connectors_sdk/base/registry.rb
|
73
|
+
- lib/connectors_sdk/confluence/adapter.rb
|
74
|
+
- lib/connectors_sdk/confluence/custom_client.rb
|
75
|
+
- lib/connectors_sdk/confluence/extractor.rb
|
76
|
+
- lib/connectors_sdk/confluence_cloud/authorization.rb
|
77
|
+
- lib/connectors_sdk/confluence_cloud/custom_client.rb
|
78
|
+
- lib/connectors_sdk/confluence_cloud/extractor.rb
|
79
|
+
- lib/connectors_sdk/confluence_cloud/http_call_wrapper.rb
|
80
|
+
- lib/connectors_sdk/helpers/atlassian_time_formatter.rb
|
69
81
|
- lib/connectors_sdk/office365/adapter.rb
|
70
82
|
- lib/connectors_sdk/office365/config.rb
|
71
83
|
- lib/connectors_sdk/office365/custom_client.rb
|
@@ -79,13 +91,19 @@ files:
|
|
79
91
|
- lib/connectors_shared/errors.rb
|
80
92
|
- lib/connectors_shared/exception_tracking.rb
|
81
93
|
- lib/connectors_shared/extension_mapping_util.rb
|
94
|
+
- lib/connectors_shared/extraction_utils.rb
|
95
|
+
- lib/connectors_shared/job_status.rb
|
82
96
|
- lib/connectors_shared/logger.rb
|
97
|
+
- lib/connectors_shared/middleware/basic_auth.rb
|
98
|
+
- lib/connectors_shared/middleware/bearer_auth.rb
|
99
|
+
- lib/connectors_shared/middleware/restrict_hostnames.rb
|
83
100
|
- lib/connectors_shared/monitor.rb
|
101
|
+
- lib/stubs/enterprise_search/exception_tracking.rb
|
84
102
|
homepage: https://github.com/elastic/connectors
|
85
103
|
licenses:
|
86
104
|
- Elastic-2.0
|
87
105
|
metadata:
|
88
|
-
revision:
|
106
|
+
revision: 9f25f35e17ffb36dfda754d657794ed9b5d2d75a
|
89
107
|
repository: git@github.com:elastic/connectors.git
|
90
108
|
post_install_message:
|
91
109
|
rdoc_options: []
|
@@ -98,9 +116,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
98
116
|
version: '0'
|
99
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
118
|
requirements:
|
101
|
-
- - "
|
119
|
+
- - ">"
|
102
120
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
121
|
+
version: 1.3.1
|
104
122
|
requirements: []
|
105
123
|
rubygems_version: 3.0.3.1
|
106
124
|
signing_key:
|