turbopuffer 1.5.0 → 1.7.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2f5759ef6a54d8d20fd914a7afb761b2f63e9383fe76094336a59d2dd77c887
4
- data.tar.gz: 6186eaa83038a13743abdc63737933c49666249bf4435067551ac1271c47202e
3
+ metadata.gz: e86efb79e86d8d7b74b0139e810bef55805bae162b9fab4eed29be9425e104e9
4
+ data.tar.gz: d4f37a4e3fb10f033a476546319f5dc2238f741d1485eb5917758e50dba8d3cd
5
5
  SHA512:
6
- metadata.gz: 6c1dc39006702ca0bdba4684355c7c4436522fd796c33031b553523808b2ae6486bbc5865a1e55d5986ccafa837c6ac914319f9171914e1391ff9c9e527f116d
7
- data.tar.gz: 5b77e8508f24ffbac98423426cc270e812f6ef434d50ceab6397cb8b905e4e4e4a8a2f52f62b84c4051afc2955899f74c39cec35ef6039386eae837567ed5908
6
+ metadata.gz: c86bfa585e8c3ca4fe60de6df7b69bf39152ca8f23b6cde8a6bfa8e4fa25c5c6581e504d4dc9de8a9091ed0e045bfb00478006e4016266976f241af985d33421
7
+ data.tar.gz: a8bd49b7edd37e4eb795bd0fb1cd75dfdfa090f4e63fe8b06eede5d3ea2e69bf3060b2a89ba17093f474c9ae6d9cde5684285af4fbc0cc5397a3957bbc5a2fb6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.7.0 (2025-11-17)
4
+
5
+ Full Changelog: [v1.6.0...v1.7.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v1.6.0...v1.7.0)
6
+
7
+ ### Features
8
+
9
+ * Allow for a CMEK key to be specified in copy_from_namespace ([5c29fe0](https://github.com/turbopuffer/turbopuffer-ruby/commit/5c29fe01f4fb0e9795d92e7c0d27fbc3fc9c2c52))
10
+ * spec: add support for cross-org CFN to SDKs ([eb1028c](https://github.com/turbopuffer/turbopuffer-ruby/commit/eb1028cf9c62e50a1d62866eb399a51fd12424e8))
11
+
12
+ ## 1.6.0 (2025-11-06)
13
+
14
+ Full Changelog: [v1.5.0...v1.6.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v1.5.0...v1.6.0)
15
+
16
+ ### Features
17
+
18
+ * Add vector attribute schema to metadata endpoint ([a509e47](https://github.com/turbopuffer/turbopuffer-ruby/commit/a509e479bc8fdeb6a72b39703636d1ccc331274e))
19
+ * handle thread interrupts in the core HTTP client ([ad531ac](https://github.com/turbopuffer/turbopuffer-ruby/commit/ad531ac4776d6445a23033601d7e46900f8824bc))
20
+ * Make `type` required on `AttributeSchemaConfig` ([c9300f6](https://github.com/turbopuffer/turbopuffer-ruby/commit/c9300f621999c6937d16c363ba7bdb423605a825))
21
+ * openapi: Fix stainless warnings ([1b7685f](https://github.com/turbopuffer/turbopuffer-ruby/commit/1b7685f30fd448eff4d17b809714ee01aa864ffd))
22
+ * openapi: name variants of `NamespaceMetadata.index` ([3b7cd24](https://github.com/turbopuffer/turbopuffer-ruby/commit/3b7cd24aa4f0fbb0c7f805d28f3c0e20726697de))
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * better thread safety via early initializing SSL store during HTTP client creation ([588faf7](https://github.com/turbopuffer/turbopuffer-ruby/commit/588faf74de4e21652afadd3eb557062818639cd6))
28
+
29
+
30
+ ### Chores
31
+
32
+ * bump dependency version and update sorbet types ([b8c6c9a](https://github.com/turbopuffer/turbopuffer-ruby/commit/b8c6c9a56cf98142d6736e21b25fa3a541fafd47))
33
+ * **client:** send user-agent header ([dda4633](https://github.com/turbopuffer/turbopuffer-ruby/commit/dda4633d4fe3cfb16b90d5d4b32aa887ee810d52))
34
+
3
35
  ## 1.5.0 (2025-10-21)
4
36
 
5
37
  Full Changelog: [v1.4.0...v1.5.0](https://github.com/turbopuffer/turbopuffer-ruby/compare/v1.4.0...v1.5.0)
data/README.md CHANGED
@@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
17
17
  <!-- x-release-please-start-version -->
18
18
 
19
19
  ```ruby
20
- gem "turbopuffer", "~> 1.5.0"
20
+ gem "turbopuffer", "~> 1.7.0"
21
21
  ```
22
22
 
23
23
  <!-- x-release-please-end -->
@@ -201,7 +201,8 @@ module Turbopuffer
201
201
  self.class::PLATFORM_HEADERS,
202
202
  {
203
203
  "accept" => "application/json",
204
- "content-type" => "application/json"
204
+ "content-type" => "application/json",
205
+ "user-agent" => user_agent
205
206
  },
206
207
  headers
207
208
  )
@@ -219,6 +220,11 @@ module Turbopuffer
219
220
  # @return [Hash{String=>String}]
220
221
  private def auth_headers = {}
221
222
 
223
+ # @api private
224
+ #
225
+ # @return [String]
226
+ private def user_agent = "#{self.class.name}/Ruby #{Turbopuffer::VERSION}"
227
+
222
228
  # @api private
223
229
  #
224
230
  # @return [String]
@@ -16,10 +16,11 @@ module Turbopuffer
16
16
  class << self
17
17
  # @api private
18
18
  #
19
+ # @param cert_store [OpenSSL::X509::Store]
19
20
  # @param url [URI::Generic]
20
21
  #
21
22
  # @return [Net::HTTP]
22
- def connect(url)
23
+ def connect(cert_store:, url:)
23
24
  port =
24
25
  case [url.port, url.scheme]
25
26
  in [Integer, _]
@@ -33,6 +34,8 @@ module Turbopuffer
33
34
  Net::HTTP.new(url.host, port).tap do
34
35
  _1.use_ssl = %w[https wss].include?(url.scheme)
35
36
  _1.max_retries = 0
37
+
38
+ (_1.cert_store = cert_store) if _1.use_ssl?
36
39
  end
37
40
  end
38
41
 
@@ -102,7 +105,7 @@ module Turbopuffer
102
105
  pool =
103
106
  @mutex.synchronize do
104
107
  @pools[origin] ||= ConnectionPool.new(size: @size) do
105
- self.class.connect(url)
108
+ self.class.connect(cert_store: @cert_store, url: url)
106
109
  end
107
110
  end
108
111
 
@@ -128,40 +131,48 @@ module Turbopuffer
128
131
  url, deadline = request.fetch_values(:url, :deadline)
129
132
 
130
133
  req = nil
131
- eof = false
132
134
  finished = false
133
- closing = nil
134
135
 
135
136
  # rubocop:disable Metrics/BlockLength
136
137
  enum = Enumerator.new do |y|
137
138
  next if finished
138
139
 
139
140
  with_pool(url, deadline: deadline) do |conn|
140
- req, closing = self.class.build_request(request) do
141
- self.class.calibrate_socket_timeout(conn, deadline)
142
- end
143
-
144
- self.class.calibrate_socket_timeout(conn, deadline)
145
- unless conn.started?
146
- conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
147
- conn.start
148
- end
141
+ eof = false
142
+ closing = nil
143
+ ::Thread.handle_interrupt(Object => :never) do
144
+ ::Thread.handle_interrupt(Object => :immediate) do
145
+ req, closing = self.class.build_request(request) do
146
+ self.class.calibrate_socket_timeout(conn, deadline)
147
+ end
149
148
 
150
- self.class.calibrate_socket_timeout(conn, deadline)
151
- conn.request(req) do |rsp|
152
- y << [req, rsp]
153
- break if finished
154
-
155
- rsp.read_body do |bytes|
156
- y << bytes.force_encoding(Encoding::BINARY)
157
- break if finished
149
+ self.class.calibrate_socket_timeout(conn, deadline)
150
+ unless conn.started?
151
+ conn.keep_alive_timeout = self.class::KEEP_ALIVE_TIMEOUT
152
+ conn.start
153
+ end
158
154
 
159
155
  self.class.calibrate_socket_timeout(conn, deadline)
156
+ conn.request(req) do |rsp|
157
+ y << [req, rsp]
158
+ break if finished
159
+
160
+ rsp.read_body do |bytes|
161
+ y << bytes.force_encoding(Encoding::BINARY)
162
+ break if finished
163
+
164
+ self.class.calibrate_socket_timeout(conn, deadline)
165
+ end
166
+ eof = true
167
+ end
168
+ end
169
+ ensure
170
+ begin
171
+ conn.finish if !eof && conn&.started?
172
+ ensure
173
+ closing&.call
160
174
  end
161
- eof = true
162
175
  end
163
- ensure
164
- conn.finish if !eof && conn&.started?
165
176
  end
166
177
  rescue Timeout::Error
167
178
  raise Turbopuffer::Errors::APITimeoutError.new(url: url, request: req)
@@ -174,8 +185,6 @@ module Turbopuffer
174
185
  body = Turbopuffer::Internal::Util.fused_enum(enum, external: true) do
175
186
  finished = true
176
187
  loop { enum.next }
177
- ensure
178
- closing&.call
179
188
  end
180
189
  [Integer(response.code), response, body]
181
190
  end
@@ -186,6 +195,7 @@ module Turbopuffer
186
195
  def initialize(size: self.class::DEFAULT_MAX_CONNECTIONS)
187
196
  @mutex = Mutex.new
188
197
  @size = size
198
+ @cert_store = OpenSSL::X509::Store.new.tap(&:set_default_paths)
189
199
  @pools = {}
190
200
  end
191
201
 
@@ -11,7 +11,7 @@ module Turbopuffer
11
11
  # when Turbopuffer::AttributeType
12
12
  # # ...
13
13
  # when Turbopuffer::AttributeSchemaConfig
14
- # puts(attribute_schema.ann)
14
+ # puts(attribute_schema.type)
15
15
  # else
16
16
  # puts(attribute_schema)
17
17
  # end
@@ -3,11 +3,20 @@
3
3
  module Turbopuffer
4
4
  module Models
5
5
  class AttributeSchemaConfig < Turbopuffer::Internal::Type::BaseModel
6
+ # @!attribute type
7
+ # The data type of the attribute. Valid values: string, int, uint, float, uuid,
8
+ # datetime, bool, []string, []int, []uint, []float, []uuid, []datetime, []bool,
9
+ # [DIMS]f16, [DIMS]f32.
10
+ #
11
+ # @return [String]
12
+ required :type, String
13
+
6
14
  # @!attribute ann
7
- # Whether to create an approximate nearest neighbor index for the attribute.
15
+ # Whether to create an approximate nearest neighbor index for the attribute. Can
16
+ # be a boolean or a detailed configuration object.
8
17
  #
9
- # @return [Boolean, nil]
10
- optional :ann, Turbopuffer::Internal::Type::Boolean
18
+ # @return [Boolean, Turbopuffer::Models::AttributeSchemaConfig::Ann::AnnConfig, nil]
19
+ optional :ann, union: -> { Turbopuffer::AttributeSchemaConfig::Ann }
11
20
 
12
21
  # @!attribute filterable
13
22
  # Whether or not the attributes can be used in filters.
@@ -29,29 +38,50 @@ module Turbopuffer
29
38
  # @return [Boolean, nil]
30
39
  optional :regex, Turbopuffer::Internal::Type::Boolean
31
40
 
32
- # @!attribute type
33
- # The data type of the attribute. Valid values: string, int, uint, float, uuid,
34
- # datetime, bool, []string, []int, []uint, []float, []uuid, []datetime, []bool,
35
- # [DIMS]f16, [DIMS]f32.
36
- #
37
- # @return [String, nil]
38
- optional :type, String
39
-
40
- # @!method initialize(ann: nil, filterable: nil, full_text_search: nil, regex: nil, type: nil)
41
+ # @!method initialize(type:, ann: nil, filterable: nil, full_text_search: nil, regex: nil)
41
42
  # Some parameter documentations has been truncated, see
42
43
  # {Turbopuffer::Models::AttributeSchemaConfig} for more details.
43
44
  #
44
45
  # Detailed configuration for an attribute attached to a document.
45
46
  #
46
- # @param ann [Boolean] Whether to create an approximate nearest neighbor index for the attribute.
47
+ # @param type [String] The data type of the attribute. Valid values: string, int, uint, float, uuid, da
48
+ #
49
+ # @param ann [Boolean, Turbopuffer::Models::AttributeSchemaConfig::Ann::AnnConfig] Whether to create an approximate nearest neighbor index for the attribute. Can b
47
50
  #
48
51
  # @param filterable [Boolean] Whether or not the attributes can be used in filters.
49
52
  #
50
53
  # @param full_text_search [Boolean, Turbopuffer::Models::FullTextSearchConfig] Whether this attribute can be used as part of a BM25 full-text search. Requires
51
54
  #
52
55
  # @param regex [Boolean] Whether to enable Regex filters on this attribute.
56
+
57
+ # Whether to create an approximate nearest neighbor index for the attribute. Can
58
+ # be a boolean or a detailed configuration object.
53
59
  #
54
- # @param type [String] The data type of the attribute. Valid values: string, int, uint, float, uuid, da
60
+ # @see Turbopuffer::Models::AttributeSchemaConfig#ann
61
+ module Ann
62
+ extend Turbopuffer::Internal::Type::Union
63
+
64
+ variant Turbopuffer::Internal::Type::Boolean
65
+
66
+ # Configuration options for ANN (Approximate Nearest Neighbor) indexing.
67
+ variant -> { Turbopuffer::AttributeSchemaConfig::Ann::AnnConfig }
68
+
69
+ class AnnConfig < Turbopuffer::Internal::Type::BaseModel
70
+ # @!attribute distance_metric
71
+ # A function used to calculate vector similarity.
72
+ #
73
+ # @return [Symbol, Turbopuffer::Models::DistanceMetric, nil]
74
+ optional :distance_metric, enum: -> { Turbopuffer::DistanceMetric }
75
+
76
+ # @!method initialize(distance_metric: nil)
77
+ # Configuration options for ANN (Approximate Nearest Neighbor) indexing.
78
+ #
79
+ # @param distance_metric [Symbol, Turbopuffer::Models::DistanceMetric] A function used to calculate vector similarity.
80
+ end
81
+
82
+ # @!method self.variants
83
+ # @return [Array(Boolean, Turbopuffer::Models::AttributeSchemaConfig::Ann::AnnConfig)]
84
+ end
55
85
  end
56
86
  end
57
87
  end
@@ -22,6 +22,18 @@ module Turbopuffer
22
22
  # @return [Time]
23
23
  required :created_at, Time
24
24
 
25
+ # @!attribute encryption
26
+ # Indicates that the namespace is encrypted with a customer-managed encryption key
27
+ # (CMEK).
28
+ #
29
+ # @return [Turbopuffer::Models::NamespaceMetadata::Encryption::Sse, Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek]
30
+ required :encryption, union: -> { Turbopuffer::NamespaceMetadata::Encryption }
31
+
32
+ # @!attribute index
33
+ #
34
+ # @return [Turbopuffer::Models::NamespaceMetadata::Index::IndexUpToDate, Turbopuffer::Models::NamespaceMetadata::Index::IndexUpdating]
35
+ required :index, union: -> { Turbopuffer::NamespaceMetadata::Index }
36
+
25
37
  # @!attribute schema
26
38
  # The schema of the namespace.
27
39
  #
@@ -34,19 +46,7 @@ module Turbopuffer
34
46
  # @return [Time]
35
47
  required :updated_at, Time
36
48
 
37
- # @!attribute encryption
38
- # Indicates that the namespace is encrypted with a customer-managed encryption key
39
- # (CMEK).
40
- #
41
- # @return [Boolean, Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek, nil]
42
- optional :encryption, union: -> { Turbopuffer::NamespaceMetadata::Encryption }
43
-
44
- # @!attribute index
45
- #
46
- # @return [Turbopuffer::Models::NamespaceMetadata::Index::Status, Turbopuffer::Models::NamespaceMetadata::Index::UnionMember1, nil]
47
- optional :index, union: -> { Turbopuffer::NamespaceMetadata::Index }
48
-
49
- # @!method initialize(approx_logical_bytes:, approx_row_count:, created_at:, schema:, updated_at:, encryption: nil, index: nil)
49
+ # @!method initialize(approx_logical_bytes:, approx_row_count:, created_at:, encryption:, index:, schema:, updated_at:)
50
50
  # Some parameter documentations has been truncated, see
51
51
  # {Turbopuffer::Models::NamespaceMetadata} for more details.
52
52
  #
@@ -58,13 +58,13 @@ module Turbopuffer
58
58
  #
59
59
  # @param created_at [Time] The timestamp when the namespace was created.
60
60
  #
61
- # @param schema [Hash{Symbol=>Turbopuffer::Models::AttributeSchemaConfig}] The schema of the namespace.
61
+ # @param encryption [Turbopuffer::Models::NamespaceMetadata::Encryption::Sse, Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek] Indicates that the namespace is encrypted with a customer-managed encryption key
62
62
  #
63
- # @param updated_at [Time] The timestamp when the namespace was last modified by a write operation.
63
+ # @param index [Turbopuffer::Models::NamespaceMetadata::Index::IndexUpToDate, Turbopuffer::Models::NamespaceMetadata::Index::IndexUpdating]
64
64
  #
65
- # @param encryption [Boolean, Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek] Indicates that the namespace is encrypted with a customer-managed encryption key
65
+ # @param schema [Hash{Symbol=>Turbopuffer::Models::AttributeSchemaConfig}] The schema of the namespace.
66
66
  #
67
- # @param index [Turbopuffer::Models::NamespaceMetadata::Index::Status, Turbopuffer::Models::NamespaceMetadata::Index::UnionMember1]
67
+ # @param updated_at [Time] The timestamp when the namespace was last modified by a write operation.
68
68
 
69
69
  # Indicates that the namespace is encrypted with a customer-managed encryption key
70
70
  # (CMEK).
@@ -73,18 +73,29 @@ module Turbopuffer
73
73
  module Encryption
74
74
  extend Turbopuffer::Internal::Type::Union
75
75
 
76
- variant Turbopuffer::Internal::Type::Boolean
76
+ variant -> { Turbopuffer::NamespaceMetadata::Encryption::Sse }
77
77
 
78
78
  # Indicates that the namespace is encrypted with a customer-managed encryption key (CMEK).
79
79
  variant -> { Turbopuffer::NamespaceMetadata::Encryption::Cmek }
80
80
 
81
+ class Sse < Turbopuffer::Internal::Type::BaseModel
82
+ # @!attribute sse
83
+ # Always true. Indicates that the namespace is encrypted with SSE.
84
+ #
85
+ # @return [Boolean]
86
+ required :sse, Turbopuffer::Internal::Type::Boolean
87
+
88
+ # @!method initialize(sse:)
89
+ # @param sse [Boolean] Always true. Indicates that the namespace is encrypted with SSE.
90
+ end
91
+
81
92
  class Cmek < Turbopuffer::Internal::Type::BaseModel
82
93
  # @!attribute cmek
83
94
  #
84
- # @return [Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek::Cmek, nil]
85
- optional :cmek, -> { Turbopuffer::NamespaceMetadata::Encryption::Cmek::Cmek }
95
+ # @return [Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek::Cmek]
96
+ required :cmek, -> { Turbopuffer::NamespaceMetadata::Encryption::Cmek::Cmek }
86
97
 
87
- # @!method initialize(cmek: nil)
98
+ # @!method initialize(cmek:)
88
99
  # Indicates that the namespace is encrypted with a customer-managed encryption key
89
100
  # (CMEK).
90
101
  #
@@ -104,18 +115,18 @@ module Turbopuffer
104
115
  end
105
116
 
106
117
  # @!method self.variants
107
- # @return [Array(Boolean, Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek)]
118
+ # @return [Array(Turbopuffer::Models::NamespaceMetadata::Encryption::Sse, Turbopuffer::Models::NamespaceMetadata::Encryption::Cmek)]
108
119
  end
109
120
 
110
121
  # @see Turbopuffer::Models::NamespaceMetadata#index
111
122
  module Index
112
123
  extend Turbopuffer::Internal::Type::Union
113
124
 
114
- variant -> { Turbopuffer::NamespaceMetadata::Index::Status }
125
+ variant -> { Turbopuffer::NamespaceMetadata::Index::IndexUpToDate }
115
126
 
116
- variant -> { Turbopuffer::NamespaceMetadata::Index::UnionMember1 }
127
+ variant -> { Turbopuffer::NamespaceMetadata::Index::IndexUpdating }
117
128
 
118
- class Status < Turbopuffer::Internal::Type::BaseModel
129
+ class IndexUpToDate < Turbopuffer::Internal::Type::BaseModel
119
130
  # @!attribute status
120
131
  #
121
132
  # @return [Symbol, :"up-to-date"]
@@ -125,7 +136,7 @@ module Turbopuffer
125
136
  # @param status [Symbol, :"up-to-date"]
126
137
  end
127
138
 
128
- class UnionMember1 < Turbopuffer::Internal::Type::BaseModel
139
+ class IndexUpdating < Turbopuffer::Internal::Type::BaseModel
129
140
  # @!attribute status
130
141
  #
131
142
  # @return [Symbol, :updating]
@@ -140,7 +151,7 @@ module Turbopuffer
140
151
 
141
152
  # @!method initialize(unindexed_bytes:, status: :updating)
142
153
  # Some parameter documentations has been truncated, see
143
- # {Turbopuffer::Models::NamespaceMetadata::Index::UnionMember1} for more details.
154
+ # {Turbopuffer::Models::NamespaceMetadata::Index::IndexUpdating} for more details.
144
155
  #
145
156
  # @param unindexed_bytes [Integer] The number of bytes in the namespace that are in the write-ahead log but have no
146
157
  #
@@ -148,7 +159,7 @@ module Turbopuffer
148
159
  end
149
160
 
150
161
  # @!method self.variants
151
- # @return [Array(Turbopuffer::Models::NamespaceMetadata::Index::Status, Turbopuffer::Models::NamespaceMetadata::Index::UnionMember1)]
162
+ # @return [Array(Turbopuffer::Models::NamespaceMetadata::Index::IndexUpToDate, Turbopuffer::Models::NamespaceMetadata::Index::IndexUpdating)]
152
163
  end
153
164
  end
154
165
  end
@@ -15,8 +15,8 @@ module Turbopuffer
15
15
  # @!attribute copy_from_namespace
16
16
  # The namespace to copy documents from.
17
17
  #
18
- # @return [String, nil]
19
- optional :copy_from_namespace, String
18
+ # @return [String, Turbopuffer::Models::NamespaceWriteParams::CopyFromNamespace::CopyFromNamespaceConfig, nil]
19
+ optional :copy_from_namespace, union: -> { Turbopuffer::NamespaceWriteParams::CopyFromNamespace }
20
20
 
21
21
  # @!attribute delete_by_filter
22
22
  # The filter specifying which documents to delete.
@@ -110,7 +110,7 @@ module Turbopuffer
110
110
  #
111
111
  # @param namespace [String]
112
112
  #
113
- # @param copy_from_namespace [String] The namespace to copy documents from.
113
+ # @param copy_from_namespace [String, Turbopuffer::Models::NamespaceWriteParams::CopyFromNamespace::CopyFromNamespaceConfig] The namespace to copy documents from.
114
114
  #
115
115
  # @param delete_by_filter [Object] The filter specifying which documents to delete.
116
116
  #
@@ -142,6 +142,38 @@ module Turbopuffer
142
142
  #
143
143
  # @param request_options [Turbopuffer::RequestOptions, Hash{Symbol=>Object}]
144
144
 
145
+ # The namespace to copy documents from.
146
+ module CopyFromNamespace
147
+ extend Turbopuffer::Internal::Type::Union
148
+
149
+ # The namespace to copy documents from.
150
+ variant String
151
+
152
+ variant -> { Turbopuffer::NamespaceWriteParams::CopyFromNamespace::CopyFromNamespaceConfig }
153
+
154
+ class CopyFromNamespaceConfig < Turbopuffer::Internal::Type::BaseModel
155
+ # @!attribute source_api_key
156
+ # An API key for the organization containing the source namespace
157
+ #
158
+ # @return [String]
159
+ required :source_api_key, String
160
+
161
+ # @!attribute source_namespace
162
+ # The namespace to copy documents from.
163
+ #
164
+ # @return [String]
165
+ required :source_namespace, String
166
+
167
+ # @!method initialize(source_api_key:, source_namespace:)
168
+ # @param source_api_key [String] An API key for the organization containing the source namespace
169
+ #
170
+ # @param source_namespace [String] The namespace to copy documents from.
171
+ end
172
+
173
+ # @!method self.variants
174
+ # @return [Array(String, Turbopuffer::Models::NamespaceWriteParams::CopyFromNamespace::CopyFromNamespaceConfig)]
175
+ end
176
+
145
177
  class Encryption < Turbopuffer::Internal::Type::BaseModel
146
178
  # @!attribute cmek
147
179
  #
@@ -309,7 +309,7 @@ module Turbopuffer
309
309
  #
310
310
  # @param namespace [String] Path param: The name of the namespace.
311
311
  #
312
- # @param copy_from_namespace [String] Body param: The namespace to copy documents from.
312
+ # @param copy_from_namespace [String, Turbopuffer::Models::NamespaceWriteParams::CopyFromNamespace::CopyFromNamespaceConfig] Body param: The namespace to copy documents from.
313
313
  #
314
314
  # @param delete_by_filter [Object] Body param: The filter specifying which documents to delete.
315
315
  #
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Turbopuffer
4
- VERSION = "1.5.0"
4
+ VERSION = "1.7.0"
5
5
  end
data/lib/turbopuffer.rb CHANGED
@@ -9,6 +9,7 @@ require "erb"
9
9
  require "etc"
10
10
  require "json"
11
11
  require "net/http"
12
+ require "openssl"
12
13
  require "pathname"
13
14
  require "rbconfig"
14
15
  require "securerandom"
data/manifest.yaml CHANGED
@@ -6,6 +6,7 @@ dependencies:
6
6
  - etc
7
7
  - json
8
8
  - net/http
9
+ - openssl
9
10
  - pathname
10
11
  - rbconfig
11
12
  - securerandom
@@ -180,6 +180,11 @@ module Turbopuffer
180
180
  private def auth_headers
181
181
  end
182
182
 
183
+ # @api private
184
+ sig { returns(String) }
185
+ private def user_agent
186
+ end
187
+
183
188
  # @api private
184
189
  sig { returns(String) }
185
190
  private def generate_idempotency_key
@@ -26,8 +26,12 @@ module Turbopuffer
26
26
 
27
27
  class << self
28
28
  # @api private
29
- sig { params(url: URI::Generic).returns(Net::HTTP) }
30
- def connect(url)
29
+ sig do
30
+ params(cert_store: OpenSSL::X509::Store, url: URI::Generic).returns(
31
+ Net::HTTP
32
+ )
33
+ end
34
+ def connect(cert_store:, url:)
31
35
  end
32
36
 
33
37
  # @api private
@@ -31,7 +31,7 @@ module Turbopuffer
31
31
  #
32
32
  # Assumes superclass fields are totally defined before fields are accessed /
33
33
  # defined on subclasses.
34
- sig { params(child: T.self_type).void }
34
+ sig { params(child: Turbopuffer::Internal::Type::BaseModel).void }
35
35
  def inherited(child)
36
36
  end
37
37
 
@@ -276,9 +276,13 @@ module Turbopuffer
276
276
 
277
277
  # Create a new instance of a model.
278
278
  sig do
279
- params(data: T.any(T::Hash[Symbol, T.anything], T.self_type)).returns(
280
- T.attached_class
281
- )
279
+ params(
280
+ data:
281
+ T.any(
282
+ T::Hash[Symbol, T.anything],
283
+ Turbopuffer::Internal::Type::BaseModel
284
+ )
285
+ ).returns(T.attached_class)
282
286
  end
283
287
  def self.new(data = {})
284
288
  end