nexo 0.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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +28 -0
- data/Rakefile +8 -0
- data/app/helpers/nexo/controller_helper.rb +10 -0
- data/app/jobs/nexo/api_clients.rb +25 -0
- data/app/jobs/nexo/base_job.rb +8 -0
- data/app/jobs/nexo/delete_remote_resource_job.rb +10 -0
- data/app/jobs/nexo/folder_sync_job.rb +25 -0
- data/app/jobs/nexo/sync_element_job.rb +91 -0
- data/app/jobs/nexo/synchronizable_changed_job.rb +25 -0
- data/app/jobs/nexo/update_remote_resource_job.rb +56 -0
- data/app/lib/nexo/active_record_google_token_store.rb +43 -0
- data/app/lib/nexo/api_client/api_response.rb +4 -0
- data/app/lib/nexo/api_client/calendar_service.rb +9 -0
- data/app/lib/nexo/api_client/google_auth_service.rb +89 -0
- data/app/lib/nexo/api_client/google_calendar_service.rb +113 -0
- data/app/lib/nexo/api_client/google_dummy_calendar_service.rb +31 -0
- data/app/lib/nexo/errors.rb +28 -0
- data/app/lib/nexo/event_receiver.rb +45 -0
- data/app/lib/nexo/folder_service.rb +67 -0
- data/app/lib/nexo/policy_service.rb +40 -0
- data/app/lib/nexo/service_builder.rb +30 -0
- data/app/models/concerns/nexo/calendar_event.rb +56 -0
- data/app/models/concerns/nexo/folder_policy.rb +24 -0
- data/app/models/concerns/nexo/synchronizable.rb +88 -0
- data/app/models/nexo/application_record.rb +5 -0
- data/app/models/nexo/client.rb +49 -0
- data/app/models/nexo/element.rb +74 -0
- data/app/models/nexo/element_version.rb +38 -0
- data/app/models/nexo/folder.rb +43 -0
- data/app/models/nexo/integration.rb +60 -0
- data/app/models/nexo/token.rb +29 -0
- data/config/routes.rb +2 -0
- data/db/migrate/20250505192315_create_nexo_clients.rb +13 -0
- data/db/migrate/20250505195429_create_nexo_integrations.rb +15 -0
- data/db/migrate/20250506125057_create_nexo_tokens.rb +12 -0
- data/db/migrate/20250512025423_create_nexo_folders.rb +13 -0
- data/db/migrate/20250512025950_create_nexo_elements.rb +16 -0
- data/db/migrate/20250512030530_create_nexo_element_versions.rb +13 -0
- data/db/migrate/20250519210346_create_good_jobs.rb +104 -0
- data/db/seeds.rb +3 -0
- data/lib/nexo/engine.rb +24 -0
- data/lib/nexo/version.rb +5 -0
- data/lib/nexo.rb +6 -0
- metadata +144 -0
@@ -0,0 +1,12 @@
|
|
1
|
+
class CreateNexoTokens < ActiveRecord::Migration[7.2]
|
2
|
+
def change
|
3
|
+
create_table :nexo_tokens do |t|
|
4
|
+
t.references :integration, null: false, foreign_key: { to_table: :nexo_integrations }
|
5
|
+
t.string :secret
|
6
|
+
t.integer :tpt_status, null: false
|
7
|
+
t.string :environment, null: false
|
8
|
+
|
9
|
+
t.timestamps
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateNexoFolders < ActiveRecord::Migration[7.2]
|
2
|
+
def change
|
3
|
+
create_table :nexo_folders do |t|
|
4
|
+
t.references :integration, null: false, foreign_key: { to_table: :nexo_integrations }
|
5
|
+
t.integer :protocol, null: false
|
6
|
+
t.string :external_identifier
|
7
|
+
t.string :name
|
8
|
+
t.string :description
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
class CreateNexoElements < ActiveRecord::Migration[7.2]
|
2
|
+
def change
|
3
|
+
create_table :nexo_elements do |t|
|
4
|
+
t.references :folder, null: false, foreign_key: { to_table: :nexo_folders }
|
5
|
+
t.integer :synchronizable_id, null: false, index: true
|
6
|
+
t.string :synchronizable_type, null: false, index: true
|
7
|
+
t.string :uuid
|
8
|
+
t.boolean :flag_deletion, null: false
|
9
|
+
t.integer :deletion_reason
|
10
|
+
t.boolean :conflicted, null: false, default: false
|
11
|
+
t.datetime :discarded_at, index: true
|
12
|
+
|
13
|
+
t.timestamps
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class CreateNexoElementVersions < ActiveRecord::Migration[7.2]
|
2
|
+
def change
|
3
|
+
create_table :nexo_element_versions do |t|
|
4
|
+
t.references :element, null: false, foreign_key: { to_table: :nexo_elements }
|
5
|
+
t.string :payload
|
6
|
+
t.string :etag
|
7
|
+
t.integer :sequence
|
8
|
+
t.integer :origin, null: false
|
9
|
+
|
10
|
+
t.timestamps
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class CreateGoodJobs < ActiveRecord::Migration[7.2]
|
4
|
+
def change
|
5
|
+
# Uncomment for Postgres v12 or earlier to enable gen_random_uuid() support
|
6
|
+
enable_extension 'pgcrypto'
|
7
|
+
|
8
|
+
create_table :good_jobs, id: :uuid do |t|
|
9
|
+
t.text :queue_name
|
10
|
+
t.integer :priority
|
11
|
+
t.jsonb :serialized_params
|
12
|
+
t.datetime :scheduled_at
|
13
|
+
t.datetime :performed_at
|
14
|
+
t.datetime :finished_at
|
15
|
+
t.text :error
|
16
|
+
|
17
|
+
t.timestamps
|
18
|
+
|
19
|
+
t.uuid :active_job_id
|
20
|
+
t.text :concurrency_key
|
21
|
+
t.text :cron_key
|
22
|
+
t.uuid :retried_good_job_id
|
23
|
+
t.datetime :cron_at
|
24
|
+
|
25
|
+
t.uuid :batch_id
|
26
|
+
t.uuid :batch_callback_id
|
27
|
+
|
28
|
+
t.boolean :is_discrete
|
29
|
+
t.integer :executions_count
|
30
|
+
t.text :job_class
|
31
|
+
t.integer :error_event, limit: 2
|
32
|
+
t.text :labels, array: true
|
33
|
+
t.uuid :locked_by_id
|
34
|
+
t.datetime :locked_at
|
35
|
+
end
|
36
|
+
|
37
|
+
create_table :good_job_batches, id: :uuid do |t|
|
38
|
+
t.timestamps
|
39
|
+
t.text :description
|
40
|
+
t.jsonb :serialized_properties
|
41
|
+
t.text :on_finish
|
42
|
+
t.text :on_success
|
43
|
+
t.text :on_discard
|
44
|
+
t.text :callback_queue_name
|
45
|
+
t.integer :callback_priority
|
46
|
+
t.datetime :enqueued_at
|
47
|
+
t.datetime :discarded_at
|
48
|
+
t.datetime :finished_at
|
49
|
+
t.datetime :jobs_finished_at
|
50
|
+
end
|
51
|
+
|
52
|
+
create_table :good_job_executions, id: :uuid do |t|
|
53
|
+
t.timestamps
|
54
|
+
|
55
|
+
t.uuid :active_job_id, null: false
|
56
|
+
t.text :job_class
|
57
|
+
t.text :queue_name
|
58
|
+
t.jsonb :serialized_params
|
59
|
+
t.datetime :scheduled_at
|
60
|
+
t.datetime :finished_at
|
61
|
+
t.text :error
|
62
|
+
t.integer :error_event, limit: 2
|
63
|
+
t.text :error_backtrace, array: true
|
64
|
+
t.uuid :process_id
|
65
|
+
t.interval :duration
|
66
|
+
end
|
67
|
+
|
68
|
+
create_table :good_job_processes, id: :uuid do |t|
|
69
|
+
t.timestamps
|
70
|
+
t.jsonb :state
|
71
|
+
t.integer :lock_type, limit: 2
|
72
|
+
end
|
73
|
+
|
74
|
+
create_table :good_job_settings, id: :uuid do |t|
|
75
|
+
t.timestamps
|
76
|
+
t.text :key
|
77
|
+
t.jsonb :value
|
78
|
+
t.index :key, unique: true
|
79
|
+
end
|
80
|
+
|
81
|
+
add_index :good_jobs, :scheduled_at, where: "(finished_at IS NULL)", name: :index_good_jobs_on_scheduled_at
|
82
|
+
add_index :good_jobs, [:queue_name, :scheduled_at], where: "(finished_at IS NULL)", name: :index_good_jobs_on_queue_name_and_scheduled_at
|
83
|
+
add_index :good_jobs, [:active_job_id, :created_at], name: :index_good_jobs_on_active_job_id_and_created_at
|
84
|
+
add_index :good_jobs, :concurrency_key, where: "(finished_at IS NULL)", name: :index_good_jobs_on_concurrency_key_when_unfinished
|
85
|
+
add_index :good_jobs, [:concurrency_key, :created_at], name: :index_good_jobs_on_concurrency_key_and_created_at
|
86
|
+
add_index :good_jobs, [:cron_key, :created_at], where: "(cron_key IS NOT NULL)", name: :index_good_jobs_on_cron_key_and_created_at_cond
|
87
|
+
add_index :good_jobs, [:cron_key, :cron_at], where: "(cron_key IS NOT NULL)", unique: true, name: :index_good_jobs_on_cron_key_and_cron_at_cond
|
88
|
+
add_index :good_jobs, [:finished_at], where: "retried_good_job_id IS NULL AND finished_at IS NOT NULL", name: :index_good_jobs_jobs_on_finished_at
|
89
|
+
add_index :good_jobs, [:priority, :created_at], order: { priority: "DESC NULLS LAST", created_at: :asc },
|
90
|
+
where: "finished_at IS NULL", name: :index_good_jobs_jobs_on_priority_created_at_when_unfinished
|
91
|
+
add_index :good_jobs, [:priority, :created_at], order: { priority: "ASC NULLS LAST", created_at: :asc },
|
92
|
+
where: "finished_at IS NULL", name: :index_good_job_jobs_for_candidate_lookup
|
93
|
+
add_index :good_jobs, [:batch_id], where: "batch_id IS NOT NULL"
|
94
|
+
add_index :good_jobs, [:batch_callback_id], where: "batch_callback_id IS NOT NULL"
|
95
|
+
add_index :good_jobs, :labels, using: :gin, where: "(labels IS NOT NULL)", name: :index_good_jobs_on_labels
|
96
|
+
|
97
|
+
add_index :good_job_executions, [:active_job_id, :created_at], name: :index_good_job_executions_on_active_job_id_and_created_at
|
98
|
+
add_index :good_jobs, [:priority, :scheduled_at], order: { priority: "ASC NULLS LAST", scheduled_at: :asc },
|
99
|
+
where: "finished_at IS NULL AND locked_by_id IS NULL", name: :index_good_jobs_on_priority_scheduled_at_unfinished_unlocked
|
100
|
+
add_index :good_jobs, :locked_by_id,
|
101
|
+
where: "locked_by_id IS NOT NULL", name: "index_good_jobs_on_locked_by_id"
|
102
|
+
add_index :good_job_executions, [:process_id, :created_at], name: :index_good_job_executions_on_process_id_and_created_at
|
103
|
+
end
|
104
|
+
end
|
data/db/seeds.rb
ADDED
data/lib/nexo/engine.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module Nexo
|
2
|
+
def self.folder_policies
|
3
|
+
::Nexo::PolicyService.instance
|
4
|
+
end
|
5
|
+
|
6
|
+
mattr_accessor :api_jobs_throttle
|
7
|
+
|
8
|
+
# @!visibility private
|
9
|
+
class Engine < ::Rails::Engine
|
10
|
+
isolate_namespace Nexo
|
11
|
+
|
12
|
+
initializer "nexo.collapse_dirs" do
|
13
|
+
dir = "#{root}/app/lib/nexo/api_client"
|
14
|
+
Rails.autoloaders.main.collapse(dir)
|
15
|
+
end
|
16
|
+
|
17
|
+
initializer "configurar_generators" do
|
18
|
+
config.generators do |g|
|
19
|
+
g.test_framework :rspec
|
20
|
+
g.orm :active_record
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/nexo/version.rb
ADDED
data/lib/nexo.rb
ADDED
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nexo
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Martín Rosso
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2025-05-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 7.2.2.1
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 7.2.2.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: google-apis-calendar_v3
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.46.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.46.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: google-apis-oauth2_v2
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.19.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.19.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: googleauth
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.14'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.14'
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- mrosso10@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- MIT-LICENSE
|
77
|
+
- README.md
|
78
|
+
- Rakefile
|
79
|
+
- app/helpers/nexo/controller_helper.rb
|
80
|
+
- app/jobs/nexo/api_clients.rb
|
81
|
+
- app/jobs/nexo/base_job.rb
|
82
|
+
- app/jobs/nexo/delete_remote_resource_job.rb
|
83
|
+
- app/jobs/nexo/folder_sync_job.rb
|
84
|
+
- app/jobs/nexo/sync_element_job.rb
|
85
|
+
- app/jobs/nexo/synchronizable_changed_job.rb
|
86
|
+
- app/jobs/nexo/update_remote_resource_job.rb
|
87
|
+
- app/lib/nexo/active_record_google_token_store.rb
|
88
|
+
- app/lib/nexo/api_client/api_response.rb
|
89
|
+
- app/lib/nexo/api_client/calendar_service.rb
|
90
|
+
- app/lib/nexo/api_client/google_auth_service.rb
|
91
|
+
- app/lib/nexo/api_client/google_calendar_service.rb
|
92
|
+
- app/lib/nexo/api_client/google_dummy_calendar_service.rb
|
93
|
+
- app/lib/nexo/errors.rb
|
94
|
+
- app/lib/nexo/event_receiver.rb
|
95
|
+
- app/lib/nexo/folder_service.rb
|
96
|
+
- app/lib/nexo/policy_service.rb
|
97
|
+
- app/lib/nexo/service_builder.rb
|
98
|
+
- app/models/concerns/nexo/calendar_event.rb
|
99
|
+
- app/models/concerns/nexo/folder_policy.rb
|
100
|
+
- app/models/concerns/nexo/synchronizable.rb
|
101
|
+
- app/models/nexo/application_record.rb
|
102
|
+
- app/models/nexo/client.rb
|
103
|
+
- app/models/nexo/element.rb
|
104
|
+
- app/models/nexo/element_version.rb
|
105
|
+
- app/models/nexo/folder.rb
|
106
|
+
- app/models/nexo/integration.rb
|
107
|
+
- app/models/nexo/token.rb
|
108
|
+
- config/routes.rb
|
109
|
+
- db/migrate/20250505192315_create_nexo_clients.rb
|
110
|
+
- db/migrate/20250505195429_create_nexo_integrations.rb
|
111
|
+
- db/migrate/20250506125057_create_nexo_tokens.rb
|
112
|
+
- db/migrate/20250512025423_create_nexo_folders.rb
|
113
|
+
- db/migrate/20250512025950_create_nexo_elements.rb
|
114
|
+
- db/migrate/20250512030530_create_nexo_element_versions.rb
|
115
|
+
- db/migrate/20250519210346_create_good_jobs.rb
|
116
|
+
- db/seeds.rb
|
117
|
+
- lib/nexo.rb
|
118
|
+
- lib/nexo/engine.rb
|
119
|
+
- lib/nexo/version.rb
|
120
|
+
homepage: https://github.com/martin-rosso/nexo
|
121
|
+
licenses:
|
122
|
+
- MIT
|
123
|
+
metadata:
|
124
|
+
homepage_uri: https://github.com/martin-rosso/nexo
|
125
|
+
post_install_message:
|
126
|
+
rdoc_options: []
|
127
|
+
require_paths:
|
128
|
+
- lib
|
129
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
131
|
+
- - ">="
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
requirements: []
|
140
|
+
rubygems_version: 3.5.11
|
141
|
+
signing_key:
|
142
|
+
specification_version: 4
|
143
|
+
summary: Integrate a Rails app with external services
|
144
|
+
test_files: []
|