webhookdb 1.0.2 → 1.1.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 +4 -4
- data/data/messages/web/install-customer-login.liquid +1 -1
- data/data/messages/web/install-success.liquid +2 -2
- data/db/migrations/038_webhookdb_api_key.rb +13 -0
- data/lib/webhookdb/api/install.rb +23 -1
- data/lib/webhookdb/api/service_integrations.rb +17 -12
- data/lib/webhookdb/api/system.rb +13 -2
- data/lib/webhookdb/fixtures/service_integrations.rb +4 -0
- data/lib/webhookdb/front.rb +23 -11
- data/lib/webhookdb/idempotency.rb +94 -33
- data/lib/webhookdb/jobs/backfill.rb +24 -5
- data/lib/webhookdb/jobs/scheduled_backfills.rb +5 -0
- data/lib/webhookdb/oauth/{front.rb → front_provider.rb} +21 -4
- data/lib/webhookdb/oauth/{intercom.rb → intercom_provider.rb} +1 -1
- data/lib/webhookdb/oauth.rb +8 -7
- data/lib/webhookdb/organization/alerting.rb +11 -0
- data/lib/webhookdb/postgres/model_utilities.rb +19 -0
- data/lib/webhookdb/replicator/column.rb +9 -1
- data/lib/webhookdb/replicator/front_conversation_v1.rb +5 -1
- data/lib/webhookdb/replicator/front_marketplace_root_v1.rb +2 -5
- data/lib/webhookdb/replicator/front_message_v1.rb +5 -1
- data/lib/webhookdb/replicator/front_signalwire_message_channel_app_v1.rb +325 -0
- data/lib/webhookdb/replicator/front_v1_mixin.rb +9 -1
- data/lib/webhookdb/replicator/signalwire_message_v1.rb +25 -13
- data/lib/webhookdb/service_integration.rb +36 -3
- data/lib/webhookdb/signalwire.rb +40 -0
- data/lib/webhookdb/spec_helpers/citest.rb +18 -9
- data/lib/webhookdb/spec_helpers/postgres.rb +9 -0
- data/lib/webhookdb/spec_helpers/service.rb +5 -0
- data/lib/webhookdb/spec_helpers/shared_examples_for_columns.rb +25 -13
- data/lib/webhookdb/spec_helpers/whdb.rb +7 -0
- data/lib/webhookdb/sync_target.rb +1 -1
- data/lib/webhookdb/tasks/specs.rb +4 -2
- data/lib/webhookdb/version.rb +1 -1
- data/lib/webhookdb.rb +14 -0
- metadata +34 -4
@@ -423,6 +423,11 @@ module Webhookdb::SpecHelpers::Service
|
|
423
423
|
super
|
424
424
|
end
|
425
425
|
|
426
|
+
def delete(uri, params={}, env={}, &)
|
427
|
+
env, params = make_json_request(env, params)
|
428
|
+
super
|
429
|
+
end
|
430
|
+
|
426
431
|
def make_json_request(env, params)
|
427
432
|
env["CONTENT_TYPE"] ||= "application/json"
|
428
433
|
params = Webhookdb::Json.encode(params) if env["CONTENT_TYPE"] == "application/json" && !params.is_a?(String)
|
@@ -27,7 +27,7 @@ RSpec.shared_examples "a service column converter" do |isomorphic_proc|
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
RSpec.shared_examples "a service column defaulter" do |isomorphic_proc|
|
30
|
+
RSpec.shared_examples "a service column defaulter" do |isomorphic_proc, ruby: true, sql: true|
|
31
31
|
let(:resource) { nil }
|
32
32
|
let(:event) { nil }
|
33
33
|
let(:enrichment) { nil }
|
@@ -37,20 +37,32 @@ RSpec.shared_examples "a service column defaulter" do |isomorphic_proc|
|
|
37
37
|
let(:expected_query) { nil }
|
38
38
|
let(:db) { Webhookdb::Postgres::Model.db }
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
40
|
+
if ruby
|
41
|
+
it "returns expected value using ruby proc" do
|
42
|
+
v = isomorphic_proc.ruby.call(resource:, event:, enrichment:, service_integration:)
|
43
|
+
expect(v).to expected
|
44
|
+
end
|
45
|
+
else
|
46
|
+
it "is not implemented for ruby" do
|
47
|
+
expect { isomorphic_proc.ruby.call }.to raise_error(NotImplementedError)
|
48
|
+
end
|
43
49
|
end
|
44
50
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
if sql
|
52
|
+
it "returns expected value using sql proc" do
|
53
|
+
e = isomorphic_proc.sql.call(service_integration:)
|
54
|
+
if expected_query.respond_to?(:match)
|
55
|
+
expect(db.select(e).sql).to match(expected_query)
|
56
|
+
elsif expected_query
|
57
|
+
expect(db.select(e).sql).to eq(expected_query)
|
58
|
+
else
|
59
|
+
v = db.select(e).first.to_a[0][1]
|
60
|
+
expect(v).to expected
|
61
|
+
end
|
62
|
+
end
|
63
|
+
else
|
64
|
+
it "is not implemented for sql" do
|
65
|
+
expect { isomorphic_proc.sql.call }.to raise_error(NotImplementedError)
|
54
66
|
end
|
55
67
|
end
|
56
68
|
end
|
@@ -136,4 +136,11 @@ module Webhookdb::SpecHelpers::Whdb
|
|
136
136
|
raise "Must provide :replicator or have :svc available" if replicator.nil?
|
137
137
|
return replicator.admin_dataset { |ds| ds.where(pk: row.fetch(:pk)).update(fields) }
|
138
138
|
end
|
139
|
+
|
140
|
+
RSpec::Matchers.define(:be_a_uuid) do
|
141
|
+
match do |v|
|
142
|
+
uuid = /\A[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\z/i
|
143
|
+
v =~ uuid
|
144
|
+
end
|
145
|
+
end
|
139
146
|
end
|
@@ -55,7 +55,7 @@ class Webhookdb::SyncTarget < Webhookdb::Postgres::Model(:sync_targets)
|
|
55
55
|
|
56
56
|
after_configured do
|
57
57
|
if Webhookdb::RACK_ENV == "test"
|
58
|
-
safename = ENV
|
58
|
+
safename = ENV.fetch("USER", "root").gsub(/[^A-Za-z]/, "")
|
59
59
|
self.default_schema = "synctest_#{safename}"
|
60
60
|
end
|
61
61
|
end
|
@@ -10,13 +10,15 @@ module Webhookdb::Tasks
|
|
10
10
|
def initialize
|
11
11
|
super()
|
12
12
|
namespace :specs do
|
13
|
-
desc "Run API integration tests"
|
13
|
+
desc "Run API integration tests in the 'integration' folder of this gem. " \
|
14
|
+
"To run your own tests, create a task similar to this one, " \
|
15
|
+
"that calls Webhookdb::SpecHelpers::Citest.run_tests."
|
14
16
|
task :integration do
|
15
17
|
require "rspec/core"
|
16
18
|
require "slack-notifier"
|
17
19
|
require "webhookdb/spec_helpers/integration"
|
18
20
|
require "webhookdb/spec_helpers/citest"
|
19
|
-
Webhookdb::SpecHelpers::Citest.run_tests(
|
21
|
+
Webhookdb::SpecHelpers::Citest.run_tests(Webhookdb::SpecHelpers::Citest::INTEGRATION_TESTS_DIR)
|
20
22
|
end
|
21
23
|
|
22
24
|
desc "The release process needs to finish quickly, so start the integration tests in another dyno."
|
data/lib/webhookdb/version.rb
CHANGED
data/lib/webhookdb.rb
CHANGED
@@ -10,7 +10,21 @@ require "phony"
|
|
10
10
|
|
11
11
|
require "webhookdb/json"
|
12
12
|
|
13
|
+
if ENV["DOCKER_DEV"]
|
14
|
+
# If DOCKER_DEV is set, replace 'localhost' urls with 'host.docker.internal'.
|
15
|
+
ENV.each do |k, v|
|
16
|
+
begin
|
17
|
+
localhost = URI(v).host == "localhost"
|
18
|
+
rescue StandardError
|
19
|
+
next
|
20
|
+
end
|
21
|
+
next unless localhost
|
22
|
+
ENV[k] = v.gsub("localhost", "host.docker.internal")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
13
26
|
if (heroku_app = ENV.fetch("MERGE_HEROKU_ENV", nil))
|
27
|
+
# If MERGE_HEROKU_ENV, merge all of its environment vars into the current env
|
14
28
|
text = `heroku config -j --app=#{heroku_app}`
|
15
29
|
json = Oj.load(text)
|
16
30
|
json.each do |k, v|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webhookdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- WebhookDB
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -248,6 +248,20 @@ dependencies:
|
|
248
248
|
- - ">="
|
249
249
|
- !ruby/object:Gem::Version
|
250
250
|
version: '0'
|
251
|
+
- !ruby/object:Gem::Dependency
|
252
|
+
name: jwt
|
253
|
+
requirement: !ruby/object:Gem::Requirement
|
254
|
+
requirements:
|
255
|
+
- - "~>"
|
256
|
+
- !ruby/object:Gem::Version
|
257
|
+
version: '2.7'
|
258
|
+
type: :runtime
|
259
|
+
prerelease: false
|
260
|
+
version_requirements: !ruby/object:Gem::Requirement
|
261
|
+
requirements:
|
262
|
+
- - "~>"
|
263
|
+
- !ruby/object:Gem::Version
|
264
|
+
version: '2.7'
|
251
265
|
- !ruby/object:Gem::Dependency
|
252
266
|
name: liquid
|
253
267
|
requirement: !ruby/object:Gem::Requirement
|
@@ -724,6 +738,20 @@ dependencies:
|
|
724
738
|
- - "~>"
|
725
739
|
- !ruby/object:Gem::Version
|
726
740
|
version: '10.4'
|
741
|
+
- !ruby/object:Gem::Dependency
|
742
|
+
name: uuidx
|
743
|
+
requirement: !ruby/object:Gem::Requirement
|
744
|
+
requirements:
|
745
|
+
- - "~>"
|
746
|
+
- !ruby/object:Gem::Version
|
747
|
+
version: '0.10'
|
748
|
+
type: :runtime
|
749
|
+
prerelease: false
|
750
|
+
version_requirements: !ruby/object:Gem::Requirement
|
751
|
+
requirements:
|
752
|
+
- - "~>"
|
753
|
+
- !ruby/object:Gem::Version
|
754
|
+
version: '0.10'
|
727
755
|
- !ruby/object:Gem::Dependency
|
728
756
|
name: warden
|
729
757
|
requirement: !ruby/object:Gem::Requirement
|
@@ -824,6 +852,7 @@ files:
|
|
824
852
|
- db/migrations/035_synchronous_backfill.rb
|
825
853
|
- db/migrations/036_oauth.rb
|
826
854
|
- db/migrations/037_oauth_used.rb
|
855
|
+
- db/migrations/038_webhookdb_api_key.rb
|
827
856
|
- integration/async_spec.rb
|
828
857
|
- integration/auth_spec.rb
|
829
858
|
- integration/database_spec.rb
|
@@ -975,8 +1004,8 @@ files:
|
|
975
1004
|
- lib/webhookdb/microsoft_calendar.rb
|
976
1005
|
- lib/webhookdb/nextpax.rb
|
977
1006
|
- lib/webhookdb/oauth.rb
|
978
|
-
- lib/webhookdb/oauth/
|
979
|
-
- lib/webhookdb/oauth/
|
1007
|
+
- lib/webhookdb/oauth/front_provider.rb
|
1008
|
+
- lib/webhookdb/oauth/intercom_provider.rb
|
980
1009
|
- lib/webhookdb/oauth/session.rb
|
981
1010
|
- lib/webhookdb/organization.rb
|
982
1011
|
- lib/webhookdb/organization/alerting.rb
|
@@ -1014,6 +1043,7 @@ files:
|
|
1014
1043
|
- lib/webhookdb/replicator/front_conversation_v1.rb
|
1015
1044
|
- lib/webhookdb/replicator/front_marketplace_root_v1.rb
|
1016
1045
|
- lib/webhookdb/replicator/front_message_v1.rb
|
1046
|
+
- lib/webhookdb/replicator/front_signalwire_message_channel_app_v1.rb
|
1017
1047
|
- lib/webhookdb/replicator/front_v1_mixin.rb
|
1018
1048
|
- lib/webhookdb/replicator/github_issue_comment_v1.rb
|
1019
1049
|
- lib/webhookdb/replicator/github_issue_v1.rb
|