chronicle-imessage 0.2.2 → 0.2.5

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: 76cac6e564a07e8e411e2378c43b15b812c4b4631dedcdee3863eedb0e3932e6
4
- data.tar.gz: 7f7551136fae37aa832a98f9bd5ba386fceb7d4d1c0e3396eee4d64c0cbc03d0
3
+ metadata.gz: 7cb26617d37224afe34143ff667c42b021736feb1a4c50b40a69c123ffea215a
4
+ data.tar.gz: 0b09ac95860c9fb5c871d0f79703d5aa305e8563ff42fbd2849a36217d28934e
5
5
  SHA512:
6
- metadata.gz: fec05237d35c28b1ff9be65c5a60a622abdabec4c3726d7a91583c579891903e5ecd0860422c88bd35ef5b63d9f1c1fea807233dc6997ae6cd8ee3a0557dc4de
7
- data.tar.gz: f1d909c69c41258d43d0175ad707dd1069f540527abc122460a587815ff0617fb7b452e2c53ac93de5bc366a6f0fae6ff89905d11edc7eca9b008096ab2f6c80
6
+ metadata.gz: 58438e98dafbf84d7a959d48428ad0ea63066f8f83b5112e70f63bdbc0c115642ab6876e10b0420e3ec6e1cba34d40e4bdc7573a0cc9bddb61046175f9b3be61
7
+ data.tar.gz: '0480e7dfce115a6471b2a7732175ff679560b083ea941157d4b765b115ae36e423e5bfbaf70ce49b1d4234d9ac3948446c45e64cb97388534784a3c10eb50b18'
data/README.md CHANGED
@@ -1,18 +1,42 @@
1
1
  # Chronicle::Imessage
2
+ [![Gem Version](https://badge.fury.io/rb/chronicle-imessage.svg)](https://badge.fury.io/rb/chronicle-imessage)
2
3
 
3
- IMessage importer for [chronicle-etl](https://github.com/chronicle-app/chronicle-etl)
4
+ Access your iMessage messages and attachments using the command line with this plugin for [chronicle-etl](https://github.com/chronicle-app/chronicle-etl).
5
+
6
+ ## Usage
7
+
8
+ ```sh
9
+ # Install chronicle-etl and this plugin
10
+ $ gem install chronicle-etl
11
+ $ chronicle-etl plugins:install imessage
12
+
13
+ # Load messages since February 7
14
+ $ chronicle-etl --extractor imessage --transformer imessage --since "2022-02-07"
15
+
16
+ # Of the latest 1000 messages received, who were the top senders?
17
+ $ chronicle-etl -e imessage -t imessage --limit 1000 --no-header-row --fields actor.title | sort | uniq -c | sort -nr
18
+
19
+ # Get the raw query results for the latest 10 messages and save as a CSV
20
+ $ chronicle-etl -e imessage --loader csv --limit 10 -o imessages.csv
21
+ ```
4
22
 
5
23
  ## Available Connectors
6
24
  ### Extractors
7
- - `imessage` - Extractor for importing messages and attachments from local macOS iMessage install (`~/Library/Messages/chat.db`)
8
25
 
9
- ### Transformers
10
- - `imessage` - Transformer for processing messages into Chronicle Schema
26
+ #### `imessage`
27
+ Extractor for importing messages and attachments from local macOS iMessage install (`~/Library/Messages/chat.db`)
11
28
 
12
- ## Usage
29
+ ##### Settings
30
+ - `load_attachments`: (default: false) Whether to load message attachments
31
+ - `only_attachments`: (default: fasle) Whether to load only messages with attachments
13
32
 
14
- ```bash
15
- gem install chronicle-etl
16
- chronicle-etl plugins:install imessage
17
- chronicle-etl --extractor imessage --since "2022-02-07" --transformer imessage
18
- ```
33
+ We want messages to have sender/receiver information set properly so we try to infer your iCloud information and phone number automatically. If these fail, you can provide the necessary information with:
34
+ - `my_phone_number`: Your phone number (for setting messages's actor fields properly)
35
+ - `my_name`: Your name (for setting messages's actor fields properly)
36
+ - `icloud_account_id`: Specify an email address that represents your iCloud account ID
37
+ - `icloud_account_dsid`: Specify iCloud DSID
38
+ - Can find in Keychain or by running `$ defaults read MobileMeAccounts Accounts`
39
+ ### Transformers
40
+
41
+ #### `imessage`
42
+ Transform an iMessage message into Chronicle Schema
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
36
  spec.require_paths = ["lib"]
37
37
 
38
- spec.add_dependency "chronicle-etl", "~> 0.4.2"
38
+ spec.add_dependency "chronicle-etl", "~> 0.4.4"
39
39
  spec.add_dependency "sqlite3", "~> 1.4"
40
40
  spec.add_dependency "phonelib", "~> 0.6"
41
41
 
@@ -1,6 +1,5 @@
1
1
  require 'chronicle/etl'
2
2
  require 'sqlite3'
3
- require 'pry'
4
3
 
5
4
  module Chronicle
6
5
  module Imessage
@@ -28,8 +27,8 @@ module Chronicle
28
27
  meta = {}
29
28
  meta[:participants] = @chats[message['chat_id']]
30
29
  meta[:attachments] = @attachments[message['message_id']] if @attachments
31
- meta[:my_phone_contact] = @my_phone_contact
32
- meta[:my_icloud_account] = @my_icloud_account
30
+ meta[:my_phone_contact] = @my_phone_contact if @my_phone_contact.values.all?
31
+ meta[:my_icloud_account] = @my_icloud_account if @my_icloud_account.values.all?
33
32
 
34
33
  yield Chronicle::ETL::Extraction.new(data: message, meta: meta)
35
34
  end
@@ -59,16 +58,16 @@ module Chronicle
59
58
 
60
59
  def load_my_phone_contact(local_contacts)
61
60
  {
62
- phone_number: @config.my_phone_number || local_contacts.my_phone_contact.fetch(:phone_number),
63
- name: @config.my_name || local_contacts.my_phone_contact.fetch(:full_name)
61
+ phone_number: @config.my_phone_number || local_contacts.my_phone_contact&.fetch(:phone_number),
62
+ name: @config.my_name || local_contacts.my_phone_contact&.fetch(:full_name)
64
63
  }
65
64
  end
66
65
 
67
66
  def load_my_icloud_account(local_contacts)
68
67
  {
69
- id: @config.icloud_account_id || local_contacts.my_icloud_account.fetch(:AccountID),
70
- dsid: @config.icloud_account_dsid || local_contacts.my_icloud_account.fetch(:AccountDSID),
71
- display_name: @config.icloud_account_display_name || @config.my_name || local_contacts.my_icloud_account.fetch(:DisplayName)
68
+ id: @config.icloud_account_id || local_contacts.my_icloud_account&.fetch(:AccountID),
69
+ dsid: @config.icloud_account_dsid || local_contacts.my_icloud_account&.fetch(:AccountDSID),
70
+ display_name: @config.icloud_account_display_name || @config.my_name || local_contacts.my_icloud_account&.fetch(:DisplayName)
72
71
  }
73
72
  end
74
73
 
@@ -102,7 +102,7 @@ module Chronicle
102
102
  end
103
103
 
104
104
  def build_identity identity
105
- raise ::Chronicle::ETL::UntransformableRecordError.new("Could not build identity", transformation: self) unless identity
105
+ raise(Chronicle::ETL::UntransformableRecordError, "Could not build record due to missing identity data") unless identity
106
106
 
107
107
  record = ::Chronicle::ETL::Models::Entity.new({
108
108
  represents: 'identity',
@@ -125,7 +125,7 @@ module Chronicle
125
125
 
126
126
  def build_identity_mine_icloud
127
127
  icloud_account = @extraction.meta[:my_icloud_account]
128
- raise(UntransformableRecordError, "Missing iCloud account information") unless icloud_account
128
+ raise(Chronicle::ETL::UntransformableRecordError, "Could not build record due to missing iCloud details. Please provide them through the extractor settings.") unless icloud_account
129
129
 
130
130
  record = ::Chronicle::ETL::Models::Entity.new({
131
131
  represent: 'identity',
@@ -140,7 +140,7 @@ module Chronicle
140
140
 
141
141
  def build_identity_mine_phone
142
142
  phone_account = @extraction.meta[:my_phone_contact]
143
- raise(UntransformableRecordError, "Missing own phone contact information") unless phone_account
143
+ raise(Chronicle::ETL::UntransformableRecordError, "Could not build record due to missing phone details. Please provide them through the extractor settings.") unless phone_account
144
144
 
145
145
  record = ::Chronicle::ETL::Models::Entity.new({
146
146
  represent: 'identity',
@@ -31,6 +31,8 @@ module Chronicle
31
31
  @my_icloud_account ||= load_my_icloud_account
32
32
  end
33
33
 
34
+ private
35
+
34
36
  # The synced address book doesn't have a stable folder location so we
35
37
  # have to search for it
36
38
  def find_local_icloud_address_book
@@ -1,5 +1,5 @@
1
1
  module Chronicle
2
2
  module Imessage
3
- VERSION = "0.2.2"
3
+ VERSION = "0.2.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chronicle-imessage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Louis
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-12 00:00:00.000000000 Z
11
+ date: 2022-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronicle-etl
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.4.2
19
+ version: 0.4.4
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.4.2
26
+ version: 0.4.4
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -107,7 +107,7 @@ metadata:
107
107
  homepage_uri: https://github.com/chronicle-app/chronicle-imessage
108
108
  source_code_uri: https://github.com/chronicle-app/chronicle-imessage
109
109
  changelog_uri: https://github.com/chronicle-app/chronicle-imessage
110
- post_install_message:
110
+ post_install_message:
111
111
  rdoc_options: []
112
112
  require_paths:
113
113
  - lib
@@ -122,8 +122,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
124
  requirements: []
125
- rubygems_version: 3.3.9
126
- signing_key:
125
+ rubygems_version: 3.3.3
126
+ signing_key:
127
127
  specification_version: 4
128
128
  summary: iMessage importer for Chronicle
129
129
  test_files: []