connectors_stubs 8.3.2.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 97b977f7c4b9156c031c6cde8a544b16d108c6ab15d98507f02cf427bb0018d6
4
+ data.tar.gz: e93ce3f7f1a46383d4e1b0e4d0046bfca7afad3968a96efafd8c6844c2dad05c
5
+ SHA512:
6
+ metadata.gz: b432ce24ed4653b8554dbcfae53f0ce127f2b63cc77b58f8ffe5d42e12f682bc73e207efbace28914a0f81d696189bd47c8b28e68e11ce06d34a0174be919391
7
+ data.tar.gz: 56ef579e96aa8f03a5933860a95a7ad480a19421e3c7f535d9c65707a73e26372a6e19fac1219a379727865bf3f11a016dfb26a92a26d283e3986393a64c810e
data/LICENSE ADDED
@@ -0,0 +1,93 @@
1
+ Elastic License 2.0
2
+
3
+ URL: https://www.elastic.co/licensing/elastic-license
4
+
5
+ ## Acceptance
6
+
7
+ By using the software, you agree to all of the terms and conditions below.
8
+
9
+ ## Copyright License
10
+
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
12
+ non-sublicensable, non-transferable license to use, copy, distribute, make
13
+ available, and prepare derivative works of the software, in each case subject to
14
+ the limitations and conditions below.
15
+
16
+ ## Limitations
17
+
18
+ You may not provide the software to third parties as a hosted or managed
19
+ service, where the service provides users with access to any substantial set of
20
+ the features or functionality of the software.
21
+
22
+ You may not move, change, disable, or circumvent the license key functionality
23
+ in the software, and you may not remove or obscure any functionality in the
24
+ software that is protected by the license key.
25
+
26
+ You may not alter, remove, or obscure any licensing, copyright, or other notices
27
+ of the licensor in the software. Any use of the licensor’s trademarks is subject
28
+ to applicable law.
29
+
30
+ ## Patents
31
+
32
+ The licensor grants you a license, under any patent claims the licensor can
33
+ license, or becomes able to license, to make, have made, use, sell, offer for
34
+ sale, import and have imported the software, in each case subject to the
35
+ limitations and conditions in this license. This license does not cover any
36
+ patent claims that you cause to be infringed by modifications or additions to
37
+ the software. If you or your company make any written claim that the software
38
+ infringes or contributes to infringement of any patent, your patent license for
39
+ the software granted under these terms ends immediately. If your company makes
40
+ such a claim, your patent license ends immediately for work on behalf of your
41
+ company.
42
+
43
+ ## Notices
44
+
45
+ You must ensure that anyone who gets a copy of any part of the software from you
46
+ also gets a copy of these terms.
47
+
48
+ If you modify the software, you must include in any modified copies of the
49
+ software prominent notices stating that you have modified the software.
50
+
51
+ ## No Other Rights
52
+
53
+ These terms do not imply any licenses other than those expressly granted in
54
+ these terms.
55
+
56
+ ## Termination
57
+
58
+ If you use the software in violation of these terms, such use is not licensed,
59
+ and your licenses will automatically terminate. If the licensor provides you
60
+ with a notice of your violation, and you cease all violation of this license no
61
+ later than 30 days after you receive that notice, your licenses will be
62
+ reinstated retroactively. However, if you violate these terms after such
63
+ reinstatement, any additional violation of these terms will cause your licenses
64
+ to terminate automatically and permanently.
65
+
66
+ ## No Liability
67
+
68
+ *As far as the law allows, the software comes as is, without any warranty or
69
+ condition, and the licensor will not be liable to you for any damages arising
70
+ out of these terms or the use or nature of the software, under any kind of
71
+ legal claim.*
72
+
73
+ ## Definitions
74
+
75
+ The **licensor** is the entity offering these terms, and the **software** is the
76
+ software the licensor makes available under these terms, including any portion
77
+ of it.
78
+
79
+ **you** refers to the individual or entity agreeing to these terms.
80
+
81
+ **your company** is any legal entity, sole proprietorship, or other kind of
82
+ organization that you work for, plus all organizations that have control over,
83
+ are under the control of, or are under common control with that
84
+ organization. **control** means ownership of substantially all the assets of an
85
+ entity, or the power to direct its management and policies by vote, contract, or
86
+ otherwise. Control can be direct or indirect.
87
+
88
+ **your licenses** are all the licenses granted to you for the software under
89
+ these terms.
90
+
91
+ **use** means anything you do with the software requiring one of your licenses.
92
+
93
+ **trademark** means trademarks, service marks, and similar rights.
data/NOTICE.txt ADDED
@@ -0,0 +1,2 @@
1
+ connectors
2
+ Copyright 2022 Elasticsearch B.V.
@@ -0,0 +1,41 @@
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
+ require 'logger'
8
+
9
+ class AppConfig
10
+ class << self
11
+ def connectors_logger
12
+ Logger.new(STDOUT)
13
+ end
14
+
15
+ def connectors
16
+ {
17
+ 'transient_server_error_retry_delay_minutes' => 5
18
+ }
19
+ end
20
+
21
+ def content_source_sync_max_errors
22
+ 1000
23
+ end
24
+
25
+ def content_source_sync_max_consecutive_errors
26
+ 10
27
+ end
28
+
29
+ def content_source_sync_max_error_ratio
30
+ 0.15
31
+ end
32
+
33
+ def content_source_sync_error_ratio_window_size
34
+ 100
35
+ end
36
+
37
+ def content_source_sync_thumbnails_enabled?
38
+ true
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,35 @@
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 'active_support/inflector'
10
+
11
+ module Connectors
12
+ module Stats
13
+ def self.measure(_key, _value = nil, &block)
14
+ block.call
15
+ end
16
+
17
+ def self.increment(key, value = 1)
18
+ # no op
19
+ end
20
+
21
+ def self.prefix_key(key)
22
+ "connectors.#{key}"
23
+ end
24
+
25
+ def self.class_key(klass, deconstantize = true)
26
+ name = klass.name
27
+ # Changes Connectors::GoogleDrive::Adapter to Connectors::GoogleDrive
28
+ name = ActiveSupport::Inflector.deconstantize(name) if deconstantize
29
+ # Changes Connectors::GoogleDrive to GoogleDrive
30
+ name = ActiveSupport::Inflector.demodulize(name)
31
+ # Changes GoogleDrive to google_drive
32
+ ActiveSupport::Inflector.underscore(name)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,15 @@
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
+ require 'stubs/app_config'
8
+
9
+ module Connectors
10
+ class << self
11
+ def config
12
+ AppConfig.connectors
13
+ end
14
+ end
15
+ end
@@ -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
@@ -0,0 +1,13 @@
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
+ class ServiceType
10
+ def classify
11
+ 'classify'
12
+ end
13
+ end
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: connectors_stubs
3
+ version: !ruby/object:Gem::Version
4
+ version: 8.3.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Elastic
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-07-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activesupport
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: ''
28
+ email: ent-search-dev@elastic.co
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - LICENSE
34
+ - NOTICE.txt
35
+ - lib/stubs/app_config.rb
36
+ - lib/stubs/connectors.rb
37
+ - lib/stubs/connectors/stats.rb
38
+ - lib/stubs/enterprise_search/exception_tracking.rb
39
+ - lib/stubs/service_type.rb
40
+ homepage: https://github.com/elastic/connectors
41
+ licenses:
42
+ - Elastic-2.0
43
+ metadata:
44
+ revision: ae98106feeebb94ba10c0f52dc49f3054eaa36c0
45
+ repository: git@github.com:elastic/ent-search-connectors.git
46
+ post_install_message:
47
+ rdoc_options: []
48
+ require_paths:
49
+ - lib
50
+ required_ruby_version: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: '0'
60
+ requirements: []
61
+ rubygems_version: 3.0.3.1
62
+ signing_key:
63
+ specification_version: 4
64
+ summary: Gem containing utilities used by implementations of Connectors when run external
65
+ to Enterprise Search
66
+ test_files: []