lex-microsoft_teams 0.6.1 → 0.6.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 439919e984b3f173a68fbf3aff14bcd05929e8d98a72bc9b0788f3ca52df6299
4
- data.tar.gz: e083fb48fa2085d2a62e3403e1e79fc4f1d50c594f098c2aefdedfb7fd1adca0
3
+ metadata.gz: b65419cdb8bc26549dada247389f085250775a2173f9a52b93319ddd3fc07638
4
+ data.tar.gz: 7d0d384606cecc4e8681d4c95c55f062ec7a77a7339cf38552cf2e9081691b5b
5
5
  SHA512:
6
- metadata.gz: c51c461988ebf5448d971c05f0e7adea2fe6b347b427d4ff39441461f440192dd1038292135a3acd570cbc6e539ac789e72d6b2d71fed140ce67e995bb644574
7
- data.tar.gz: 04750f07309b23c63e1ff20722e5d3507f06acccfa111c034eec8811c2776a95f5071a5e8781a2ff29a23542a9adbf249fa7404a69f8e4b3af49528ec4cbf889
6
+ metadata.gz: 28212c1cf97466c6f34769ce8c50ca2a002434e13c4d7d9430a59d1315b517653e575468658a750889116068c7458ebd1fedb6ac97d5c6b3a0a3f6f4acca769e
7
+ data.tar.gz: 28c56ecc7a0b4ffdd92dedd9e5bdf749680b8cb5133d11997c4c703845e440b3b057a8dcb1dbef8ce12787a5b85a7678370207a3b7a6c6ecb47cda8f6d5e18fb
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.3] - 2026-03-22
4
+
5
+ ### Fixed
6
+ - Add `extend self` to `Runners::ProfileIngest` so methods are callable at module level by framework actor dispatch
7
+ - Add token guard to `IncrementalSync` and `ProfileIngest` actors to skip execution when no valid delegated token exists
8
+
3
9
  ## [0.6.1] - 2026-03-21
4
10
 
5
11
  ### Fixed
data/CLAUDE.md CHANGED
@@ -10,7 +10,7 @@ Legion Extension that connects LegionIO to Microsoft Teams via Graph API and Bot
10
10
 
11
11
  **GitHub**: https://github.com/LegionIO/lex-microsoft_teams
12
12
  **License**: MIT
13
- **Version**: 0.6.0
13
+ **Version**: 0.6.3
14
14
 
15
15
  ## Architecture
16
16
 
@@ -251,7 +251,7 @@ Optional framework dependencies (guarded with `defined?`, not in gemspec):
251
251
 
252
252
  ```bash
253
253
  bundle install
254
- bundle exec rspec # 268 specs across 38 spec files (as of v0.6.0)
254
+ bundle exec rspec # 290 specs across 39 spec files (as of v0.6.0)
255
255
  bundle exec rubocop # Clean
256
256
  ```
257
257
 
@@ -28,19 +28,23 @@ module Legion
28
28
  false
29
29
  end
30
30
 
31
- def args
31
+ def manual
32
32
  token = resolve_token
33
+ return unless token
34
+
33
35
  settings = begin
34
36
  Legion::Settings[:microsoft_teams] || {}
35
37
  rescue StandardError
36
38
  {}
37
39
  end
38
40
  ingest = settings[:ingest] || {}
39
- {
41
+ runner_class.incremental_sync(
40
42
  token: token,
41
43
  top_people: ingest.fetch(:top_people, 10),
42
44
  message_depth: ingest.fetch(:message_depth, 50)
43
- }
45
+ )
46
+ rescue StandardError => e
47
+ Legion::Logging.error("IncrementalSync: #{e.message}") if defined?(Legion::Logging)
44
48
  end
45
49
 
46
50
  private
@@ -22,19 +22,23 @@ module Legion
22
22
  false
23
23
  end
24
24
 
25
- def args
25
+ def manual
26
26
  token = resolve_token
27
+ return unless token
28
+
27
29
  settings = begin
28
- Legion::Settings[:microsoft_teams]
30
+ Legion::Settings[:microsoft_teams] || {}
29
31
  rescue StandardError
30
32
  {}
31
33
  end
32
34
  ingest = settings[:ingest] || {}
33
- {
35
+ runner_class.full_ingest(
34
36
  token: token,
35
37
  top_people: ingest.fetch(:top_people, 10),
36
38
  message_depth: ingest.fetch(:message_depth, 50)
37
- }
39
+ )
40
+ rescue StandardError => e
41
+ Legion::Logging.error("ProfileIngest: #{e.message}") if defined?(Legion::Logging)
38
42
  end
39
43
 
40
44
  private
@@ -14,6 +14,7 @@ require 'legion/extensions/microsoft_teams/runners/presence'
14
14
  require 'legion/extensions/microsoft_teams/runners/meetings'
15
15
  require 'legion/extensions/microsoft_teams/runners/transcripts'
16
16
  require 'legion/extensions/microsoft_teams/runners/people'
17
+ require 'legion/extensions/microsoft_teams/runners/ownership'
17
18
 
18
19
  module Legion
19
20
  module Extensions
@@ -35,6 +36,7 @@ module Legion
35
36
  include Runners::LocalCache
36
37
  include Runners::CacheIngest
37
38
  include Runners::People
39
+ include Runners::Ownership
38
40
 
39
41
  attr_reader :opts
40
42
 
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'legion/extensions/microsoft_teams/helpers/client'
4
+
5
+ module Legion
6
+ module Extensions
7
+ module MicrosoftTeams
8
+ module Runners
9
+ module Ownership
10
+ include Legion::Extensions::MicrosoftTeams::Helpers::Client
11
+
12
+ TEAMS_FILTER = "resourceProvisioningOptions/Any(x:x eq 'Team')"
13
+ TEAMS_SELECT = 'id,displayName,mail'
14
+ OWNERS_SELECT = 'id,displayName,mail'
15
+
16
+ def sync_owners(team_id: nil, **)
17
+ conn = graph_connection(**)
18
+ if team_id
19
+ owners = fetch_owners(conn: conn, team_id: team_id)
20
+ { owners: owners, team_count: 1, synced_at: Time.now.utc.iso8601 }
21
+ else
22
+ teams = fetch_all_teams(conn: conn)
23
+ all_owners = teams.flat_map do |team|
24
+ fetch_owners(conn: conn, team_id: team['id']).map { |o| o.merge('team_id' => team['id']) }
25
+ end
26
+ { owners: all_owners, team_count: teams.length, synced_at: Time.now.utc.iso8601 }
27
+ end
28
+ rescue StandardError => e
29
+ { error: e.message }
30
+ end
31
+
32
+ def detect_orphans(**)
33
+ conn = graph_connection(**)
34
+ teams = fetch_all_teams(conn: conn)
35
+ orphaned = []
36
+
37
+ teams.each do |team|
38
+ owners = fetch_owners(conn: conn, team_id: team['id'])
39
+ orphaned << { id: team['id'], display_name: team['displayName'], mail: team['mail'] } if owners.empty?
40
+ end
41
+
42
+ { orphaned_teams: orphaned, total_scanned: teams.length, orphan_count: orphaned.length }
43
+ rescue StandardError => e
44
+ { error: e.message }
45
+ end
46
+
47
+ def get_team_owners(team_id:, **)
48
+ conn = graph_connection(**)
49
+ owners = fetch_owners(conn: conn, team_id: team_id)
50
+ { team_id: team_id, owners: owners }
51
+ rescue StandardError => e
52
+ { error: e.message }
53
+ end
54
+
55
+ private
56
+
57
+ def fetch_all_teams(conn:)
58
+ params = { '$filter' => TEAMS_FILTER, '$select' => TEAMS_SELECT }
59
+ resp = conn.get('groups', params)
60
+ (resp.body || {}).fetch('value', [])
61
+ end
62
+
63
+ def fetch_owners(conn:, team_id:)
64
+ params = { '$select' => OWNERS_SELECT }
65
+ resp = conn.get("groups/#{team_id}/owners", params)
66
+ (resp.body || {}).fetch('value', [])
67
+ end
68
+
69
+ include Legion::Extensions::Helpers::Lex if Legion::Extensions.const_defined?(:Helpers) &&
70
+ Legion::Extensions::Helpers.const_defined?(:Lex)
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -14,6 +14,7 @@ module Legion
14
14
  include Helpers::Client
15
15
  include Helpers::PermissionGuard
16
16
  include Helpers::HighWaterMark
17
+ extend self
17
18
 
18
19
  def full_ingest(token:, top_people: 10, message_depth: 50, **)
19
20
  self_result = ingest_self(token: token)
@@ -3,7 +3,7 @@
3
3
  module Legion
4
4
  module Extensions
5
5
  module MicrosoftTeams
6
- VERSION = '0.6.1'
6
+ VERSION = '0.6.3'
7
7
  end
8
8
  end
9
9
  end
@@ -18,6 +18,7 @@ require 'legion/extensions/microsoft_teams/runners/local_cache'
18
18
  require 'legion/extensions/microsoft_teams/runners/cache_ingest'
19
19
  require 'legion/extensions/microsoft_teams/runners/people'
20
20
  require 'legion/extensions/microsoft_teams/runners/profile_ingest'
21
+ require 'legion/extensions/microsoft_teams/runners/ownership'
21
22
 
22
23
  # Helpers (bot)
23
24
  require 'legion/extensions/microsoft_teams/helpers/high_water_mark'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lex-microsoft_teams
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esity
@@ -110,6 +110,7 @@ files:
110
110
  - lib/legion/extensions/microsoft_teams/runners/local_cache.rb
111
111
  - lib/legion/extensions/microsoft_teams/runners/meetings.rb
112
112
  - lib/legion/extensions/microsoft_teams/runners/messages.rb
113
+ - lib/legion/extensions/microsoft_teams/runners/ownership.rb
113
114
  - lib/legion/extensions/microsoft_teams/runners/people.rb
114
115
  - lib/legion/extensions/microsoft_teams/runners/presence.rb
115
116
  - lib/legion/extensions/microsoft_teams/runners/profile_ingest.rb