encoded_id 1.0.0.rc5 → 1.0.0.rc7
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/CHANGELOG.md +99 -3
- data/README.md +86 -329
- data/context/encoded_id.md +437 -0
- data/lib/encoded_id/alphabet.rb +34 -3
- data/lib/encoded_id/blocklist.rb +100 -0
- data/lib/encoded_id/encoders/base_configuration.rb +154 -0
- data/lib/encoded_id/encoders/hashid.rb +527 -0
- data/lib/encoded_id/encoders/hashid_configuration.rb +40 -0
- data/lib/encoded_id/encoders/hashid_consistent_shuffle.rb +110 -0
- data/lib/encoded_id/encoders/hashid_ordinal_alphabet_separator_guards.rb +244 -0
- data/lib/encoded_id/encoders/hashid_salt.rb +51 -0
- data/lib/encoded_id/encoders/my_sqids.rb +454 -0
- data/lib/encoded_id/encoders/sqids.rb +59 -0
- data/lib/encoded_id/encoders/sqids_configuration.rb +22 -0
- data/lib/encoded_id/encoders/sqids_with_blocklist_mode.rb +54 -0
- data/lib/encoded_id/hex_representation.rb +29 -14
- data/lib/encoded_id/reversible_id.rb +115 -82
- data/lib/encoded_id/version.rb +3 -1
- data/lib/encoded_id.rb +34 -4
- metadata +34 -26
- data/.devcontainer/Dockerfile +0 -9
- data/.devcontainer/compose.yml +0 -8
- data/.devcontainer/devcontainer.json +0 -8
- data/.standard.yml +0 -2
- data/Gemfile +0 -36
- data/Rakefile +0 -20
- data/Steepfile +0 -5
- data/ext/encoded_id/extconf.rb +0 -3
- data/ext/encoded_id/extension.c +0 -123
- data/ext/encoded_id/hashids.c +0 -939
- data/ext/encoded_id/hashids.h +0 -139
- data/lib/encoded_id/hash_id.rb +0 -227
- data/lib/encoded_id/hash_id_consistent_shuffle.rb +0 -27
- data/lib/encoded_id/hash_id_salt.rb +0 -15
- data/lib/encoded_id/ordinal_alphabet_separator_guards.rb +0 -90
- data/rbs_collection.yaml +0 -24
- data/sig/encoded_id.rbs +0 -189
data/sig/encoded_id.rbs
DELETED
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
module EncodedId
|
|
2
|
-
VERSION: ::String
|
|
3
|
-
|
|
4
|
-
InvalidConfigurationError: ::StandardError
|
|
5
|
-
EncodedIdFormatError: ::ArgumentError
|
|
6
|
-
EncodedIdLengthError: ::ArgumentError
|
|
7
|
-
InvalidAlphabetError: ::ArgumentError
|
|
8
|
-
InvalidInputError: ::ArgumentError
|
|
9
|
-
|
|
10
|
-
class HashId
|
|
11
|
-
MIN_ALPHABET_LENGTH: ::Integer
|
|
12
|
-
|
|
13
|
-
SEP_DIV: ::Float
|
|
14
|
-
|
|
15
|
-
GUARD_DIV: ::Float
|
|
16
|
-
|
|
17
|
-
DEFAULT_SEPS: ::String
|
|
18
|
-
|
|
19
|
-
DEFAULT_ALPHABET: ::String
|
|
20
|
-
|
|
21
|
-
attr_reader salt: ::String
|
|
22
|
-
|
|
23
|
-
attr_reader min_hash_length: ::Integer
|
|
24
|
-
|
|
25
|
-
@alphabet: ::String
|
|
26
|
-
|
|
27
|
-
attr_reader alphabet: ::String
|
|
28
|
-
|
|
29
|
-
attr_reader seps: ::String | ::Array[::String]
|
|
30
|
-
|
|
31
|
-
attr_reader guards: untyped
|
|
32
|
-
|
|
33
|
-
def initialize: (?::String salt, ?::Integer min_hash_length, ?untyped alphabet) -> void
|
|
34
|
-
|
|
35
|
-
def encode: (*(Array[::Integer] | ::Integer) numbers) -> ::String
|
|
36
|
-
|
|
37
|
-
def encode_hex: (::String str) -> ::String
|
|
38
|
-
|
|
39
|
-
def decode: (::String hash) -> ::Array[::Integer]
|
|
40
|
-
|
|
41
|
-
def decode_hex: (::String hash) -> ::Array[::Integer]
|
|
42
|
-
|
|
43
|
-
# protected
|
|
44
|
-
|
|
45
|
-
def internal_encode: (untyped numbers) -> untyped
|
|
46
|
-
|
|
47
|
-
def internal_decode: (untyped hash, untyped alphabet) -> untyped
|
|
48
|
-
|
|
49
|
-
def consistent_shuffle: (::Array[::String] chars, ::String salt1, ::String ?salt2, ::Integer salt1_length) -> untyped
|
|
50
|
-
|
|
51
|
-
def hash: (untyped input, untyped alphabet) -> untyped
|
|
52
|
-
|
|
53
|
-
def unhash: (untyped input, untyped alphabet) -> untyped
|
|
54
|
-
|
|
55
|
-
private
|
|
56
|
-
|
|
57
|
-
def setup_alphabet: () -> untyped
|
|
58
|
-
|
|
59
|
-
def setup_seps: () -> untyped
|
|
60
|
-
|
|
61
|
-
def setup_guards: () -> untyped
|
|
62
|
-
|
|
63
|
-
SaltError: ArgumentError
|
|
64
|
-
|
|
65
|
-
MinLengthError: ArgumentError
|
|
66
|
-
|
|
67
|
-
AlphabetError: ArgumentError
|
|
68
|
-
|
|
69
|
-
InputError: ArgumentError
|
|
70
|
-
|
|
71
|
-
def validate_attributes: () -> untyped
|
|
72
|
-
|
|
73
|
-
def validate_alphabet: () -> (untyped | nil)
|
|
74
|
-
|
|
75
|
-
def hex_string?: (untyped string) -> untyped
|
|
76
|
-
|
|
77
|
-
def pick_characters: (untyped array, untyped index) -> untyped
|
|
78
|
-
|
|
79
|
-
def uniq_characters: (untyped string) -> untyped
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
class Alphabet
|
|
83
|
-
MIN_UNIQUE_CHARACTERS: ::Integer
|
|
84
|
-
|
|
85
|
-
def initialize: (String | ::Array[::String] characters, ::Hash[::String, ::String] ?equivalences) -> void
|
|
86
|
-
|
|
87
|
-
attr_reader unique_characters: ::Array[::String]
|
|
88
|
-
attr_reader characters: String
|
|
89
|
-
attr_reader equivalences: ::Hash[::String, ::String] | nil
|
|
90
|
-
|
|
91
|
-
def include?: (::String character) -> bool
|
|
92
|
-
|
|
93
|
-
def self.modified_crockford: () -> Alphabet
|
|
94
|
-
|
|
95
|
-
private
|
|
96
|
-
|
|
97
|
-
def valid_input_characters?: ((::Array[::String] | ::String) characters) -> bool
|
|
98
|
-
|
|
99
|
-
def valid_characters?: -> bool
|
|
100
|
-
|
|
101
|
-
def sufficient_characters?: -> bool
|
|
102
|
-
|
|
103
|
-
def unique_character_alphabet: ((::Array[::String] | ::String) characters) -> ::Array[::String]
|
|
104
|
-
|
|
105
|
-
def valid_equivalences?: (::Hash[::String, ::String] ?equivalences) -> bool
|
|
106
|
-
|
|
107
|
-
def raise_character_set_too_small!: -> untyped
|
|
108
|
-
|
|
109
|
-
def raise_invalid_alphabet!: -> void
|
|
110
|
-
|
|
111
|
-
def raise_invalid_equivalences!: -> void
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
type encodeableValue = ::Array[::String | ::Integer] | ::String | ::Integer
|
|
115
|
-
type encodeableHexValue = ::Array[::String] | ::String
|
|
116
|
-
|
|
117
|
-
class HexRepresentation
|
|
118
|
-
def initialize: (::Integer) -> void
|
|
119
|
-
def hex_as_integers: (encodeableHexValue) -> ::Array[::Integer]
|
|
120
|
-
def integers_as_hex: (::Array[::Integer]) -> ::Array[::String]
|
|
121
|
-
|
|
122
|
-
private
|
|
123
|
-
|
|
124
|
-
def validate_hex_digit_encoding_group_size: (::Integer) -> ::Integer
|
|
125
|
-
def integer_representation: (encodeableHexValue) -> ::Array[::Integer]
|
|
126
|
-
def integers_to_hex_strings: (::Array[::Integer]) -> ::Array[::String]
|
|
127
|
-
def hex_string_as_integer_representation: (::String) -> ::Array[::Integer]
|
|
128
|
-
def hex_string_separator: -> ::Integer
|
|
129
|
-
def remove_non_hex_characters: (::String) -> ::String
|
|
130
|
-
def convert_to_integer_groups: (::String) -> ::Array[::Integer]
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
class ReversibleId
|
|
134
|
-
def initialize: (salt: ::String, ?length: ::Integer, ?split_at: ::Integer, ?split_with: ::String, ?alphabet: Alphabet, ?hex_digit_encoding_group_size: ::Integer, ?max_length: ::Integer, ?max_inputs_per_id: ::Integer) -> void
|
|
135
|
-
|
|
136
|
-
# Encode the input values into a hash
|
|
137
|
-
def encode: (encodeableValue values) -> ::String
|
|
138
|
-
|
|
139
|
-
# Encode hex strings into a hash
|
|
140
|
-
def encode_hex: (encodeableHexValue hexs) -> ::String
|
|
141
|
-
|
|
142
|
-
# Decode the hash to original array
|
|
143
|
-
def decode: (::String str) -> ::Array[::Integer]
|
|
144
|
-
|
|
145
|
-
# Decode hex strings from a hash
|
|
146
|
-
def decode_hex: (::String str) -> ::Array[::String]
|
|
147
|
-
|
|
148
|
-
private
|
|
149
|
-
|
|
150
|
-
@encoded_id_generator: HashId
|
|
151
|
-
@split_regex: ::Regexp
|
|
152
|
-
@hex_string_separator: ::Integer
|
|
153
|
-
|
|
154
|
-
attr_reader salt: ::String
|
|
155
|
-
|
|
156
|
-
attr_reader length: ::Integer
|
|
157
|
-
attr_reader max_length: ::Integer | nil
|
|
158
|
-
|
|
159
|
-
attr_reader alphabet: Alphabet
|
|
160
|
-
|
|
161
|
-
attr_reader split_at: ::Integer | nil
|
|
162
|
-
attr_reader split_with: ::String
|
|
163
|
-
|
|
164
|
-
attr_reader hex_represention_encoder: HexRepresentation
|
|
165
|
-
|
|
166
|
-
def validate_alphabet: (Alphabet) -> Alphabet
|
|
167
|
-
def validate_salt: (::String) -> ::String
|
|
168
|
-
def validate_length: (::Integer) -> ::Integer
|
|
169
|
-
def validate_max_length: (::Integer | nil) -> (::Integer | nil)
|
|
170
|
-
def validate_max_input: (::Integer) -> ::Integer
|
|
171
|
-
def validate_split_at: (::Integer | nil) -> (::Integer | nil)
|
|
172
|
-
def validate_split_with: (::String, Alphabet) -> (::String | nil)
|
|
173
|
-
def validate_hex_digit_encoding_group_size: (::Integer) -> ::Integer
|
|
174
|
-
def valid_integer_option?: (::Integer | nil) -> bool
|
|
175
|
-
|
|
176
|
-
def prepare_input: (untyped value) -> ::Array[::Integer]
|
|
177
|
-
|
|
178
|
-
def encoded_id_generator: () -> HashId
|
|
179
|
-
|
|
180
|
-
def split_regex: () -> ::Regexp
|
|
181
|
-
|
|
182
|
-
def humanize_length: (::String hash) -> ::String
|
|
183
|
-
|
|
184
|
-
def convert_to_hash: (::String str, bool) -> ::String
|
|
185
|
-
|
|
186
|
-
def map_equivalent_characters: (::String str) -> ::String
|
|
187
|
-
def max_length_exceeded?: (::String str) -> bool
|
|
188
|
-
end
|
|
189
|
-
end
|