parse-stack-next 4.5.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 +7 -0
- data/.bundle/config +2 -0
- data/.env.sample +112 -0
- data/.env.test +10 -0
- data/.github/workflows/ruby.yml +36 -0
- data/.gitignore +49 -0
- data/.ruby-version +1 -0
- data/.solargraph.yml +22 -0
- data/CHANGELOG.md +5816 -0
- data/Gemfile +30 -0
- data/Gemfile.lock +175 -0
- data/LICENSE.txt +23 -0
- data/Makefile +63 -0
- data/README.md +5655 -0
- data/Rakefile +573 -0
- data/bin/console +38 -0
- data/bin/parse-console +136 -0
- data/bin/server +17 -0
- data/bin/setup +7 -0
- data/config/parse-config.json +12 -0
- data/docs/TEST_SERVER.md +271 -0
- data/docs/_config.yml +1 -0
- data/docs/mcp_guide.md +3484 -0
- data/docs/mongodb_direct_guide.md +1348 -0
- data/docs/mongodb_index_optimization_guide.md +631 -0
- data/examples/transaction_example.rb +219 -0
- data/lib/parse/acl_scope.rb +728 -0
- data/lib/parse/agent/cancellation_token.rb +80 -0
- data/lib/parse/agent/constraint_translator.rb +480 -0
- data/lib/parse/agent/describe.rb +420 -0
- data/lib/parse/agent/errors.rb +133 -0
- data/lib/parse/agent/mcp_client.rb +557 -0
- data/lib/parse/agent/mcp_dispatcher.rb +1023 -0
- data/lib/parse/agent/mcp_rack_app.rb +1143 -0
- data/lib/parse/agent/mcp_server.rb +376 -0
- data/lib/parse/agent/metadata_audit.rb +259 -0
- data/lib/parse/agent/metadata_dsl.rb +733 -0
- data/lib/parse/agent/metadata_registry.rb +794 -0
- data/lib/parse/agent/pipeline_validator.rb +82 -0
- data/lib/parse/agent/prompts.rb +351 -0
- data/lib/parse/agent/rate_limiter.rb +158 -0
- data/lib/parse/agent/relation_graph.rb +162 -0
- data/lib/parse/agent/result_formatter.rb +453 -0
- data/lib/parse/agent/tools.rb +5489 -0
- data/lib/parse/agent.rb +3249 -0
- data/lib/parse/api/aggregate.rb +79 -0
- data/lib/parse/api/all.rb +26 -0
- data/lib/parse/api/analytics.rb +18 -0
- data/lib/parse/api/batch.rb +33 -0
- data/lib/parse/api/cloud_functions.rb +58 -0
- data/lib/parse/api/config.rb +125 -0
- data/lib/parse/api/files.rb +29 -0
- data/lib/parse/api/hooks.rb +117 -0
- data/lib/parse/api/objects.rb +146 -0
- data/lib/parse/api/path_segment.rb +75 -0
- data/lib/parse/api/push.rb +20 -0
- data/lib/parse/api/schema.rb +49 -0
- data/lib/parse/api/server.rb +50 -0
- data/lib/parse/api/sessions.rb +24 -0
- data/lib/parse/api/users.rb +250 -0
- data/lib/parse/atlas_search/index_manager.rb +353 -0
- data/lib/parse/atlas_search/result.rb +204 -0
- data/lib/parse/atlas_search/search_builder.rb +604 -0
- data/lib/parse/atlas_search/session.rb +253 -0
- data/lib/parse/atlas_search.rb +995 -0
- data/lib/parse/client/authentication.rb +97 -0
- data/lib/parse/client/batch.rb +234 -0
- data/lib/parse/client/body_builder.rb +240 -0
- data/lib/parse/client/caching.rb +203 -0
- data/lib/parse/client/logging.rb +293 -0
- data/lib/parse/client/profiling.rb +181 -0
- data/lib/parse/client/protocol.rb +91 -0
- data/lib/parse/client/request.rb +233 -0
- data/lib/parse/client/response.rb +208 -0
- data/lib/parse/client.rb +1104 -0
- data/lib/parse/clp_scope.rb +361 -0
- data/lib/parse/live_query/circuit_breaker.rb +256 -0
- data/lib/parse/live_query/client.rb +1001 -0
- data/lib/parse/live_query/configuration.rb +224 -0
- data/lib/parse/live_query/event.rb +115 -0
- data/lib/parse/live_query/event_queue.rb +272 -0
- data/lib/parse/live_query/health_monitor.rb +214 -0
- data/lib/parse/live_query/logging.rb +149 -0
- data/lib/parse/live_query/subscription.rb +294 -0
- data/lib/parse/live_query.rb +163 -0
- data/lib/parse/lookup_rewriter.rb +445 -0
- data/lib/parse/model/acl.rb +968 -0
- data/lib/parse/model/associations/belongs_to.rb +275 -0
- data/lib/parse/model/associations/collection_proxy.rb +435 -0
- data/lib/parse/model/associations/has_many.rb +597 -0
- data/lib/parse/model/associations/has_one.rb +158 -0
- data/lib/parse/model/associations/pointer_collection_proxy.rb +134 -0
- data/lib/parse/model/associations/relation_collection_proxy.rb +177 -0
- data/lib/parse/model/bytes.rb +62 -0
- data/lib/parse/model/classes/audience.rb +262 -0
- data/lib/parse/model/classes/installation.rb +363 -0
- data/lib/parse/model/classes/job_schedule.rb +153 -0
- data/lib/parse/model/classes/job_status.rb +264 -0
- data/lib/parse/model/classes/product.rb +75 -0
- data/lib/parse/model/classes/push_status.rb +263 -0
- data/lib/parse/model/classes/role.rb +751 -0
- data/lib/parse/model/classes/session.rb +201 -0
- data/lib/parse/model/classes/user.rb +943 -0
- data/lib/parse/model/clp.rb +544 -0
- data/lib/parse/model/core/actions.rb +1268 -0
- data/lib/parse/model/core/builder.rb +139 -0
- data/lib/parse/model/core/create_lock.rb +386 -0
- data/lib/parse/model/core/describe.rb +382 -0
- data/lib/parse/model/core/enhanced_change_tracking.rb +159 -0
- data/lib/parse/model/core/errors.rb +38 -0
- data/lib/parse/model/core/fetching.rb +566 -0
- data/lib/parse/model/core/field_guards.rb +220 -0
- data/lib/parse/model/core/indexing.rb +382 -0
- data/lib/parse/model/core/parse_reference.rb +407 -0
- data/lib/parse/model/core/properties.rb +809 -0
- data/lib/parse/model/core/querying.rb +491 -0
- data/lib/parse/model/core/schema.rb +202 -0
- data/lib/parse/model/core/search_indexing.rb +174 -0
- data/lib/parse/model/date.rb +88 -0
- data/lib/parse/model/email.rb +213 -0
- data/lib/parse/model/file.rb +527 -0
- data/lib/parse/model/geojson.rb +271 -0
- data/lib/parse/model/geopoint.rb +261 -0
- data/lib/parse/model/model.rb +260 -0
- data/lib/parse/model/object.rb +2068 -0
- data/lib/parse/model/phone.rb +520 -0
- data/lib/parse/model/pointer.rb +443 -0
- data/lib/parse/model/polygon.rb +406 -0
- data/lib/parse/model/push.rb +975 -0
- data/lib/parse/model/shortnames.rb +8 -0
- data/lib/parse/model/time_zone.rb +141 -0
- data/lib/parse/model/validations/uniqueness_validator.rb +97 -0
- data/lib/parse/model/validations.rb +96 -0
- data/lib/parse/mongodb.rb +2300 -0
- data/lib/parse/pipeline_security.rb +554 -0
- data/lib/parse/query/constraint.rb +198 -0
- data/lib/parse/query/constraints.rb +3279 -0
- data/lib/parse/query/cursor.rb +434 -0
- data/lib/parse/query/n_plus_one_detector.rb +445 -0
- data/lib/parse/query/operation.rb +104 -0
- data/lib/parse/query/ordering.rb +66 -0
- data/lib/parse/query.rb +7028 -0
- data/lib/parse/schema/index_migrator.rb +291 -0
- data/lib/parse/schema/search_index_migrator.rb +289 -0
- data/lib/parse/schema.rb +494 -0
- data/lib/parse/stack/generators/rails.rb +40 -0
- data/lib/parse/stack/generators/templates/model.erb +51 -0
- data/lib/parse/stack/generators/templates/model_installation.rb +4 -0
- data/lib/parse/stack/generators/templates/model_role.rb +4 -0
- data/lib/parse/stack/generators/templates/model_session.rb +4 -0
- data/lib/parse/stack/generators/templates/model_user.rb +11 -0
- data/lib/parse/stack/generators/templates/parse.rb +12 -0
- data/lib/parse/stack/generators/templates/webhooks.rb +10 -0
- data/lib/parse/stack/railtie.rb +18 -0
- data/lib/parse/stack/tasks.rb +563 -0
- data/lib/parse/stack/version.rb +11 -0
- data/lib/parse/stack.rb +455 -0
- data/lib/parse/two_factor_auth/user_extension.rb +449 -0
- data/lib/parse/two_factor_auth.rb +310 -0
- data/lib/parse/webhooks/payload.rb +360 -0
- data/lib/parse/webhooks/registration.rb +199 -0
- data/lib/parse/webhooks/replay_protection.rb +189 -0
- data/lib/parse/webhooks.rb +510 -0
- data/lib/parse-stack-next.rb +5 -0
- data/lib/parse-stack.rb +5 -0
- data/parse-stack-next.gemspec +82 -0
- data/parse-stack.png +0 -0
- data/scripts/debug-ips.js +35 -0
- data/scripts/docker/Dockerfile.parse +13 -0
- data/scripts/docker/atlas-init.js +284 -0
- data/scripts/docker/docker-compose.atlas.yml +76 -0
- data/scripts/docker/docker-compose.test.yml +106 -0
- data/scripts/docker/mongo-init.js +21 -0
- data/scripts/eval_mcp_with_lm_studio.rb +274 -0
- data/scripts/start-parse.sh +90 -0
- data/scripts/start_mcp_server.rb +78 -0
- data/scripts/test_server_connection.rb +82 -0
- metadata +377 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
# Note: Do not require "../object" here - this file is loaded from object.rb
|
|
5
|
+
# and adding that require would create a circular dependency.
|
|
6
|
+
|
|
7
|
+
module Parse
|
|
8
|
+
# This class represents the data and columns contained in the standard Parse
|
|
9
|
+
# `_PushStatus` collection. Push status records track the delivery status
|
|
10
|
+
# and metrics of push notifications sent through Parse Server.
|
|
11
|
+
#
|
|
12
|
+
# Push status records are created automatically when a push is sent and
|
|
13
|
+
# are updated as the push progresses through the delivery pipeline.
|
|
14
|
+
#
|
|
15
|
+
# Status lifecycle: pending → scheduled → running → succeeded/failed
|
|
16
|
+
#
|
|
17
|
+
# The default schema for the {PushStatus} class is as follows:
|
|
18
|
+
# class Parse::PushStatus < Parse::Object
|
|
19
|
+
# # See Parse::Object for inherited properties...
|
|
20
|
+
#
|
|
21
|
+
# property :push_hash # Unique hash identifying the push
|
|
22
|
+
# property :query, :object # The query used to target installations
|
|
23
|
+
# property :payload, :object # The push payload that was sent
|
|
24
|
+
# property :source # "rest" or "webUI"
|
|
25
|
+
# property :status # "pending", "scheduled", "running", "succeeded", "failed"
|
|
26
|
+
# property :num_sent, :integer
|
|
27
|
+
# property :num_failed, :integer
|
|
28
|
+
# property :sent_per_type, :object
|
|
29
|
+
# property :failed_per_type, :object
|
|
30
|
+
# property :sent_per_utc_offset, :object
|
|
31
|
+
# property :failed_per_utc_offset, :object
|
|
32
|
+
# property :count, :integer # Total installations targeted
|
|
33
|
+
# property :push_time, :date # When the push was/will be sent
|
|
34
|
+
# property :expiry, :date # When the push expires
|
|
35
|
+
# end
|
|
36
|
+
#
|
|
37
|
+
# @example Checking push status
|
|
38
|
+
# status = Parse::PushStatus.find(push_id)
|
|
39
|
+
# puts "Sent: #{status.num_sent}, Failed: #{status.num_failed}"
|
|
40
|
+
# puts "Status: #{status.status}"
|
|
41
|
+
#
|
|
42
|
+
# @example Querying recent pushes
|
|
43
|
+
# recent = Parse::PushStatus.recent.limit(10).all
|
|
44
|
+
# recent.each { |s| puts "#{s.status}: #{s.num_sent} sent" }
|
|
45
|
+
#
|
|
46
|
+
# @note This collection requires master key access
|
|
47
|
+
# @see Parse::Push
|
|
48
|
+
# @see Parse::Object
|
|
49
|
+
class PushStatus < Parse::Object
|
|
50
|
+
parse_class Parse::Model::CLASS_PUSH_STATUS
|
|
51
|
+
|
|
52
|
+
# @!attribute push_hash
|
|
53
|
+
# A unique hash identifying this push notification.
|
|
54
|
+
# @return [String] The push hash.
|
|
55
|
+
property :push_hash
|
|
56
|
+
|
|
57
|
+
# @!attribute query
|
|
58
|
+
# The query constraints used to target installations.
|
|
59
|
+
# @return [Hash] The query constraint hash.
|
|
60
|
+
property :query, :object
|
|
61
|
+
|
|
62
|
+
# @!attribute payload
|
|
63
|
+
# The push payload that was sent.
|
|
64
|
+
# @return [Hash] The payload data.
|
|
65
|
+
property :payload, :object
|
|
66
|
+
|
|
67
|
+
# @!attribute source
|
|
68
|
+
# The source of the push ("rest" for API, "webUI" for dashboard).
|
|
69
|
+
# @return [String] The push source.
|
|
70
|
+
property :source
|
|
71
|
+
|
|
72
|
+
# @!attribute status
|
|
73
|
+
# The current status of the push.
|
|
74
|
+
# One of: "pending", "scheduled", "running", "succeeded", "failed"
|
|
75
|
+
# @return [String] The push status.
|
|
76
|
+
property :status
|
|
77
|
+
|
|
78
|
+
# @!attribute num_sent
|
|
79
|
+
# The number of notifications successfully sent.
|
|
80
|
+
# @return [Integer] The success count.
|
|
81
|
+
property :num_sent, :integer
|
|
82
|
+
|
|
83
|
+
# @!attribute num_failed
|
|
84
|
+
# The number of notifications that failed to send.
|
|
85
|
+
# @return [Integer] The failure count.
|
|
86
|
+
property :num_failed, :integer
|
|
87
|
+
|
|
88
|
+
# @!attribute sent_per_type
|
|
89
|
+
# Breakdown of successful sends by device type (ios, android, etc.).
|
|
90
|
+
# @return [Hash] Device type to count mapping.
|
|
91
|
+
# @example
|
|
92
|
+
# status.sent_per_type # => {"ios" => 800, "android" => 450}
|
|
93
|
+
property :sent_per_type, :object
|
|
94
|
+
|
|
95
|
+
# @!attribute failed_per_type
|
|
96
|
+
# Breakdown of failed sends by device type.
|
|
97
|
+
# @return [Hash] Device type to count mapping.
|
|
98
|
+
property :failed_per_type, :object
|
|
99
|
+
|
|
100
|
+
# @!attribute sent_per_utc_offset
|
|
101
|
+
# Breakdown of successful sends by UTC timezone offset.
|
|
102
|
+
# @return [Hash] UTC offset to count mapping.
|
|
103
|
+
# @example
|
|
104
|
+
# status.sent_per_utc_offset # => {"-8" => 500, "0" => 300, "5" => 200}
|
|
105
|
+
property :sent_per_utc_offset, :object
|
|
106
|
+
|
|
107
|
+
# @!attribute failed_per_utc_offset
|
|
108
|
+
# Breakdown of failed sends by UTC timezone offset.
|
|
109
|
+
# @return [Hash] UTC offset to count mapping.
|
|
110
|
+
property :failed_per_utc_offset, :object
|
|
111
|
+
|
|
112
|
+
# @!attribute count
|
|
113
|
+
# Total number of installations targeted by this push.
|
|
114
|
+
# @return [Integer] The target count.
|
|
115
|
+
property :count, :integer
|
|
116
|
+
|
|
117
|
+
# @!attribute push_time
|
|
118
|
+
# When the push was/will be sent. For scheduled pushes, this is the future time.
|
|
119
|
+
# @return [Parse::Date] The push time.
|
|
120
|
+
property :push_time, :date
|
|
121
|
+
|
|
122
|
+
# @!attribute expiry
|
|
123
|
+
# When the push expires and will no longer be delivered.
|
|
124
|
+
# @return [Parse::Date] The expiration time.
|
|
125
|
+
property :expiry, :date
|
|
126
|
+
|
|
127
|
+
# @!attribute error_message
|
|
128
|
+
# Error message if the push failed.
|
|
129
|
+
# @return [String, nil] The error message or nil.
|
|
130
|
+
property :error_message
|
|
131
|
+
|
|
132
|
+
# =========================================================================
|
|
133
|
+
# Status Query Scopes
|
|
134
|
+
# =========================================================================
|
|
135
|
+
|
|
136
|
+
class << self
|
|
137
|
+
# Query for pending pushes (not yet started).
|
|
138
|
+
# @return [Parse::Query] a query for pending pushes
|
|
139
|
+
def pending
|
|
140
|
+
query(status: "pending")
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Query for scheduled pushes (waiting for push_time).
|
|
144
|
+
# @return [Parse::Query] a query for scheduled pushes
|
|
145
|
+
def scheduled
|
|
146
|
+
query(status: "scheduled")
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Query for running pushes (currently being sent).
|
|
150
|
+
# @return [Parse::Query] a query for running pushes
|
|
151
|
+
def running
|
|
152
|
+
query(status: "running")
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Query for succeeded pushes.
|
|
156
|
+
# @return [Parse::Query] a query for succeeded pushes
|
|
157
|
+
def succeeded
|
|
158
|
+
query(status: "succeeded")
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
# Query for failed pushes.
|
|
162
|
+
# @return [Parse::Query] a query for failed pushes
|
|
163
|
+
def failed
|
|
164
|
+
query(status: "failed")
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
# Query for recent pushes, ordered by creation time descending.
|
|
168
|
+
# @return [Parse::Query] a query for recent pushes
|
|
169
|
+
def recent
|
|
170
|
+
query.order(:created_at.desc)
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# =========================================================================
|
|
175
|
+
# Status Predicates
|
|
176
|
+
# =========================================================================
|
|
177
|
+
|
|
178
|
+
# Check if the push is pending (not yet started).
|
|
179
|
+
# @return [Boolean] true if status is "pending"
|
|
180
|
+
def pending?
|
|
181
|
+
status == "pending"
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# Check if the push is scheduled (waiting for push_time).
|
|
185
|
+
# @return [Boolean] true if status is "scheduled"
|
|
186
|
+
def scheduled?
|
|
187
|
+
status == "scheduled"
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
# Check if the push is currently running.
|
|
191
|
+
# @return [Boolean] true if status is "running"
|
|
192
|
+
def running?
|
|
193
|
+
status == "running"
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
# Check if the push succeeded.
|
|
197
|
+
# @return [Boolean] true if status is "succeeded"
|
|
198
|
+
def succeeded?
|
|
199
|
+
status == "succeeded"
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Check if the push failed.
|
|
203
|
+
# @return [Boolean] true if status is "failed"
|
|
204
|
+
def failed?
|
|
205
|
+
status == "failed"
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Check if the push is complete (either succeeded or failed).
|
|
209
|
+
# @return [Boolean] true if the push has finished
|
|
210
|
+
def complete?
|
|
211
|
+
succeeded? || failed?
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Check if the push is still in progress.
|
|
215
|
+
# @return [Boolean] true if pending, scheduled, or running
|
|
216
|
+
def in_progress?
|
|
217
|
+
!complete?
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
# =========================================================================
|
|
221
|
+
# Metrics Methods
|
|
222
|
+
# =========================================================================
|
|
223
|
+
|
|
224
|
+
# Get the total number of notifications attempted (sent + failed).
|
|
225
|
+
# @return [Integer] the total count
|
|
226
|
+
def total_attempted
|
|
227
|
+
(num_sent || 0) + (num_failed || 0)
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Get the success rate as a percentage.
|
|
231
|
+
# @return [Float] the success rate (0.0 to 100.0)
|
|
232
|
+
# @example
|
|
233
|
+
# status.success_rate # => 98.5
|
|
234
|
+
def success_rate
|
|
235
|
+
total = total_attempted
|
|
236
|
+
return 0.0 if total == 0
|
|
237
|
+
((num_sent || 0).to_f / total * 100).round(2)
|
|
238
|
+
end
|
|
239
|
+
|
|
240
|
+
# Get the failure rate as a percentage.
|
|
241
|
+
# @return [Float] the failure rate (0.0 to 100.0)
|
|
242
|
+
def failure_rate
|
|
243
|
+
100.0 - success_rate
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
# Get a summary of the push metrics.
|
|
247
|
+
# @return [Hash] summary hash with key metrics
|
|
248
|
+
# @example
|
|
249
|
+
# status.summary
|
|
250
|
+
# # => { status: "succeeded", sent: 1250, failed: 12, success_rate: 99.05 }
|
|
251
|
+
def summary
|
|
252
|
+
{
|
|
253
|
+
status: status,
|
|
254
|
+
sent: num_sent || 0,
|
|
255
|
+
failed: num_failed || 0,
|
|
256
|
+
total_targeted: count || 0,
|
|
257
|
+
success_rate: success_rate,
|
|
258
|
+
sent_per_type: sent_per_type || {},
|
|
259
|
+
failed_per_type: failed_per_type || {},
|
|
260
|
+
}
|
|
261
|
+
end
|
|
262
|
+
end
|
|
263
|
+
end
|