ts_schema 0.1.6 → 0.1.9
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/lib/tasks/ts_schema_tasks.rake +10 -10
 - data/lib/ts_schema/schema_generator.rb +3 -3
 - data/lib/ts_schema/version.rb +1 -1
 - metadata +5 -11
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 98fda5d599b1c67632f071da87640ec19167fbc90c0ef50f3090ef1deb19a394
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 43145f323d86ce2acca7cf45687e0ac7b35e38e2fa0b5216f180fd920e7bd08f
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 20d2257583b6fd2c219ba6740822d7e7b05df7a49e165b9d8dd7d370a326e33cdf21f4c5920afea1fd76ffd428b5f6796ed2d7dfd0e484a7ea6f37e9248298f5
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: e7640bf87f7bd2243a1bab5d3b5bc15188f5151f95236357571141ceef72f4ac95ed8e5fc2a79ac3aa90da4256b7d401ceedd48ebb89188650929031177da301
         
     | 
| 
         @@ -1,30 +1,30 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require "rake"
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            namespace :ts_schema do
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
              desc "Generates a schema file in the default javascripts location, or the location specified in the ts_config initializer options"
         
     | 
| 
      
 5 
     | 
    
         
            +
              task :generate do
         
     | 
| 
      
 6 
     | 
    
         
            +
                TsSchema.output_file
         
     | 
| 
      
 7 
     | 
    
         
            +
              end
         
     | 
| 
       8 
8 
     | 
    
         
             
            end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
            namespace :db do
         
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 11 
     | 
    
         
            +
              def auto_generate_and_save_file
         
     | 
| 
      
 12 
     | 
    
         
            +
                TsSchema.output_file if TsSchema.configuration.auto_generate
         
     | 
| 
      
 13 
     | 
    
         
            +
              end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
              task migrate: :environment do
         
     | 
| 
       16 
16 
     | 
    
         
             
                auto_generate_and_save_file
         
     | 
| 
       17 
17 
     | 
    
         
             
              end
         
     | 
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
              task rollback: :environment do
         
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
                auto_generate_and_save_file
         
     | 
| 
       21 
21 
     | 
    
         
             
              end
         
     | 
| 
       22 
22 
     | 
    
         | 
| 
       23 
23 
     | 
    
         
             
              task reset: :environment do
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 24 
     | 
    
         
            +
                auto_generate_and_save_file
         
     | 
| 
       25 
25 
     | 
    
         
             
              end
         
     | 
| 
       26 
26 
     | 
    
         | 
| 
       27 
27 
     | 
    
         
             
              task setup: :environment do
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
      
 28 
     | 
    
         
            +
                auto_generate_and_save_file
         
     | 
| 
       29 
29 
     | 
    
         
             
              end
         
     | 
| 
       30 
30 
     | 
    
         
             
            end
         
     | 
| 
         @@ -5,7 +5,7 @@ module TsSchema 
     | 
|
| 
       5 
5 
     | 
    
         
             
                def initialize
         
     | 
| 
       6 
6 
     | 
    
         
             
                  Rails.application.eager_load!
         
     | 
| 
       7 
7 
     | 
    
         
             
                  @models = ApplicationRecord.send(:subclasses)
         
     | 
| 
       8 
     | 
    
         
            -
            			@models. 
     | 
| 
      
 8 
     | 
    
         
            +
            			@models.concat(TsSchema.configuration.additional_models) unless TsSchema.configuration.additional_models.empty?
         
     | 
| 
       9 
9 
     | 
    
         
             
                  @types = TsSchema.configuration.types.merge(TsSchema.configuration.custom_types || {})
         
     | 
| 
       10 
10 
     | 
    
         
             
                end
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
         @@ -67,12 +67,12 @@ module TsSchema 
     | 
|
| 
       67 
67 
     | 
    
         
             
                    when association.has_one? || association.belongs_to?
         
     | 
| 
       68 
68 
     | 
    
         
             
                      {
         
     | 
| 
       69 
69 
     | 
    
         
             
                        name: "#{association.name}?",
         
     | 
| 
       70 
     | 
    
         
            -
                        ts_type: association.class_name
         
     | 
| 
      
 70 
     | 
    
         
            +
                        ts_type: association.class_name.constantize.model_name.param_key.camelize
         
     | 
| 
       71 
71 
     | 
    
         
             
                      }
         
     | 
| 
       72 
72 
     | 
    
         
             
                    when association.collection?
         
     | 
| 
       73 
73 
     | 
    
         
             
                      {
         
     | 
| 
       74 
74 
     | 
    
         
             
                        name: "#{association.name}?",
         
     | 
| 
       75 
     | 
    
         
            -
                        ts_type: "#{association.class_name}[]"
         
     | 
| 
      
 75 
     | 
    
         
            +
                        ts_type: "#{association.class_name.constantize.model_name.param_key.camelize}[]"
         
     | 
| 
       76 
76 
     | 
    
         
             
                      }
         
     | 
| 
       77 
77 
     | 
    
         
             
                    end
         
     | 
| 
       78 
78 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/ts_schema/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,35 +1,29 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ts_schema
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.9
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Avram Walden
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022-04- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-04-04 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
     | 
    
         
            -
              name:  
     | 
| 
      
 14 
     | 
    
         
            +
              name: railties
         
     | 
| 
       15 
15 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       16 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       17 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       18 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       19 
     | 
    
         
            -
                    version: '7.0'
         
     | 
| 
       20 
17 
     | 
    
         
             
                - - ">="
         
     | 
| 
       21 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       22 
     | 
    
         
            -
                    version:  
     | 
| 
      
 19 
     | 
    
         
            +
                    version: 6.0.0
         
     | 
| 
       23 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       24 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       25 
22 
     | 
    
         
             
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
       26 
23 
     | 
    
         
             
                requirements:
         
     | 
| 
       27 
     | 
    
         
            -
                - - "~>"
         
     | 
| 
       28 
     | 
    
         
            -
                  - !ruby/object:Gem::Version
         
     | 
| 
       29 
     | 
    
         
            -
                    version: '7.0'
         
     | 
| 
       30 
24 
     | 
    
         
             
                - - ">="
         
     | 
| 
       31 
25 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       32 
     | 
    
         
            -
                    version:  
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 6.0.0
         
     | 
| 
       33 
27 
     | 
    
         
             
            description: ''
         
     | 
| 
       34 
28 
     | 
    
         
             
            email:
         
     | 
| 
       35 
29 
     | 
    
         
             
            - aviemet@gmail.com
         
     |