@usherlabs/cex-broker 0.2.52 → 0.3.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.
Files changed (144) hide show
  1. package/dist/commands/cli.js +364 -71
  2. package/dist/index.js +365 -72
  3. package/dist/index.js.map +14 -13
  4. package/package.json +5 -28
  5. package/dist/commands/cex-canonical-orderbook-export.d.ts +0 -23
  6. package/dist/commands/cex-canonical-orderbook-export.js +0 -34275
  7. package/dist/commands/cex-canonical-orderbook-export.js.map +0 -266
  8. package/dist/commands/market-data-vendor-backfill.d.ts +0 -24
  9. package/dist/commands/market-data-vendor-backfill.js +0 -34930
  10. package/dist/commands/market-data-vendor-backfill.js.map +0 -268
  11. package/dist/handlers/execute-action/context.d.ts +0 -50
  12. package/dist/handlers/execute-action/deposit.d.ts +0 -2
  13. package/dist/handlers/execute-action/handler.d.ts +0 -19
  14. package/dist/handlers/execute-action/index.d.ts +0 -10
  15. package/dist/handlers/execute-action/internal-transfer.d.ts +0 -2
  16. package/dist/handlers/execute-action/order-book-call.d.ts +0 -3
  17. package/dist/handlers/execute-action/orders.d.ts +0 -2
  18. package/dist/handlers/execute-action/pass-through.d.ts +0 -2
  19. package/dist/handlers/execute-action/perp-config.d.ts +0 -2
  20. package/dist/handlers/execute-action/registry.d.ts +0 -5
  21. package/dist/handlers/execute-action/treasury-call.d.ts +0 -2
  22. package/dist/handlers/execute-action/withdraw.d.ts +0 -2
  23. package/dist/handlers/subscribe/broker-lifecycle.d.ts +0 -13
  24. package/dist/handlers/subscribe/handler.d.ts +0 -20
  25. package/dist/handlers/subscribe/index.d.ts +0 -2
  26. package/dist/handlers/types.d.ts +0 -23
  27. package/dist/helpers/account-balance-archive-poller.d.ts +0 -19
  28. package/dist/helpers/auth.d.ts +0 -5
  29. package/dist/helpers/balance-update-archive-consumer.d.ts +0 -16
  30. package/dist/helpers/binance-user-data-normalization.d.ts +0 -3
  31. package/dist/helpers/binance-user-data-stream.d.ts +0 -58
  32. package/dist/helpers/broker-execution-archive/capture.d.ts +0 -41
  33. package/dist/helpers/broker-execution-archive/index.d.ts +0 -7
  34. package/dist/helpers/broker-execution-archive/journal-export.d.ts +0 -20
  35. package/dist/helpers/broker-execution-archive/loss-journal.d.ts +0 -36
  36. package/dist/helpers/broker-execution-archive/redact.d.ts +0 -7
  37. package/dist/helpers/broker-execution-archive/rows.d.ts +0 -134
  38. package/dist/helpers/broker-execution-archive/types.d.ts +0 -26
  39. package/dist/helpers/broker-execution-archive/withdrawal-observation-tracker.d.ts +0 -23
  40. package/dist/helpers/broker-execution-archive/writer.d.ts +0 -105
  41. package/dist/helpers/broker.d.ts +0 -38
  42. package/dist/helpers/canonical-orderbook-export/exact-selection.d.ts +0 -21
  43. package/dist/helpers/canonical-orderbook-export/exporter.d.ts +0 -26
  44. package/dist/helpers/canonical-orderbook-export/parquet-projection.d.ts +0 -19
  45. package/dist/helpers/constants.d.ts +0 -36
  46. package/dist/helpers/deposit-archive-poller.d.ts +0 -66
  47. package/dist/helpers/deposit.d.ts +0 -5
  48. package/dist/helpers/exchange-credentials.d.ts +0 -10
  49. package/dist/helpers/fill-archive-poller.d.ts +0 -42
  50. package/dist/helpers/grpc/broker.d.ts +0 -5
  51. package/dist/helpers/grpc/callbacks.d.ts +0 -9
  52. package/dist/helpers/grpc/payload.d.ts +0 -9
  53. package/dist/helpers/grpc/status.d.ts +0 -8
  54. package/dist/helpers/index.d.ts +0 -44
  55. package/dist/helpers/logger.d.ts +0 -13
  56. package/dist/helpers/market-data-archive/canonical-orderbook.d.ts +0 -20
  57. package/dist/helpers/market-data-archive/capture-context.d.ts +0 -53
  58. package/dist/helpers/market-data-archive/capture-contract.d.ts +0 -30
  59. package/dist/helpers/market-data-archive/capture.d.ts +0 -22
  60. package/dist/helpers/market-data-archive/index.d.ts +0 -13
  61. package/dist/helpers/market-data-archive/legacy-migration.d.ts +0 -37
  62. package/dist/helpers/market-data-archive/ohlcv-bar-tracker.d.ts +0 -11
  63. package/dist/helpers/market-data-archive/ohlcv-bootstrap.d.ts +0 -1
  64. package/dist/helpers/market-data-archive/ohlcv-history.d.ts +0 -8
  65. package/dist/helpers/market-data-archive/orderbook-depth.d.ts +0 -5
  66. package/dist/helpers/market-data-archive/orderbook-sampler.d.ts +0 -12
  67. package/dist/helpers/market-data-archive/parse-stream.d.ts +0 -26
  68. package/dist/helpers/market-data-archive/rows.d.ts +0 -14
  69. package/dist/helpers/market-data-archive/types.d.ts +0 -83
  70. package/dist/helpers/market-data-preparation/conformance-fixtures.d.ts +0 -128
  71. package/dist/helpers/market-data-preparation/contracts.d.ts +0 -2970
  72. package/dist/helpers/market-data-preparation/file-job.d.ts +0 -38
  73. package/dist/helpers/market-data-preparation/required-clock-qualification.d.ts +0 -43
  74. package/dist/helpers/market-data-preparation/source-tape-dependencies.d.ts +0 -19
  75. package/dist/helpers/market-data-preparation/source-tape-operation.d.ts +0 -109
  76. package/dist/helpers/market-data-source-forensics.d.ts +0 -400
  77. package/dist/helpers/market-data-vendor-backfill/archive-reader.d.ts +0 -26
  78. package/dist/helpers/market-data-vendor-backfill/batching.d.ts +0 -10
  79. package/dist/helpers/market-data-vendor-backfill/conformance-fixtures.d.ts +0 -78
  80. package/dist/helpers/market-data-vendor-backfill/contracts.d.ts +0 -358
  81. package/dist/helpers/market-data-vendor-backfill/core.d.ts +0 -101
  82. package/dist/helpers/market-data-vendor-backfill/cryptohftdata.d.ts +0 -118
  83. package/dist/helpers/market-data-vendor-backfill/forwarder-client.d.ts +0 -25
  84. package/dist/helpers/market-data-vendor-backfill/identity.d.ts +0 -10
  85. package/dist/helpers/market-data-vendor-backfill/manifests.d.ts +0 -61
  86. package/dist/helpers/market-data-vendor-backfill/promotion.d.ts +0 -10
  87. package/dist/helpers/market-data-vendor-backfill/qualification.d.ts +0 -20
  88. package/dist/helpers/market-data-vendor-backfill/selection.d.ts +0 -30
  89. package/dist/helpers/market-data-vendor-backfill/semantic-verification.d.ts +0 -25
  90. package/dist/helpers/market-type.d.ts +0 -16
  91. package/dist/helpers/order-activity-tracker.d.ts +0 -22
  92. package/dist/helpers/order-book.d.ts +0 -79
  93. package/dist/helpers/order-telemetry.d.ts +0 -50
  94. package/dist/helpers/otel.d.ts +0 -83
  95. package/dist/helpers/passive-order.d.ts +0 -8
  96. package/dist/helpers/public-market-data-feed/identity.d.ts +0 -12
  97. package/dist/helpers/public-market-data-feed/index.d.ts +0 -5
  98. package/dist/helpers/public-market-data-feed/orderbook-coalescing-evidence.d.ts +0 -79
  99. package/dist/helpers/public-market-data-feed/orderbook-profile.d.ts +0 -54
  100. package/dist/helpers/public-market-data-feed/subscriber-buffer.d.ts +0 -31
  101. package/dist/helpers/public-market-data-feed/supervisor.d.ts +0 -82
  102. package/dist/helpers/shared/errors.d.ts +0 -14
  103. package/dist/helpers/shared/guards.d.ts +0 -2
  104. package/dist/helpers/source-tape-sandbox.d.ts +0 -82
  105. package/dist/helpers/source-tape.d.ts +0 -165
  106. package/dist/helpers/stream-health-publisher.d.ts +0 -41
  107. package/dist/helpers/trace-context.d.ts +0 -8
  108. package/dist/helpers/transfer-network.d.ts +0 -12
  109. package/dist/helpers/travel-rule-deposit-reconciler.d.ts +0 -159
  110. package/dist/helpers/travel-rule.d.ts +0 -75
  111. package/dist/helpers/treasury-discovery.d.ts +0 -17
  112. package/dist/helpers/user-asset-archive-poller.d.ts +0 -19
  113. package/dist/helpers/user-data-stream-supervisor.d.ts +0 -27
  114. package/dist/helpers/verity.d.ts +0 -5
  115. package/dist/index.d.ts +0 -56
  116. package/dist/market-data-preparation/fixtures/conformance-v3.json +0 -621
  117. package/dist/market-data-preparation/policies/capability-policy.json +0 -39
  118. package/dist/market-data-preparation/policies/resource-policy.json +0 -16
  119. package/dist/market-data-preparation/policies/source-tape-capability-v1.json +0 -35
  120. package/dist/market-data-preparation/schema-manifest.json +0 -66
  121. package/dist/market-data-preparation/schemas/archive-selection-v1.schema.json +0 -224
  122. package/dist/market-data-preparation/schemas/backfill-request-v1.schema.json +0 -166
  123. package/dist/market-data-preparation/schemas/backfill-result-v2.schema.json +0 -212
  124. package/dist/market-data-preparation/schemas/canonical-orderbook-export-request-v1.schema.json +0 -61
  125. package/dist/market-data-preparation/schemas/canonical-orderbook-export-result-v2.schema.json +0 -252
  126. package/dist/market-data-preparation/schemas/order-book-depth-summary-parquet-projection-v1.schema.json +0 -256
  127. package/dist/market-data-preparation/schemas/order-book-levels-parquet-projection-v1.schema.json +0 -220
  128. package/dist/market-data-preparation/schemas/preparation-product-pin-v2.schema.json +0 -176
  129. package/dist/market-data-preparation/schemas/promotion-receipt-v1.schema.json +0 -175
  130. package/dist/market-data-preparation/schemas/required-clock-v1.schema.json +0 -47
  131. package/dist/market-data-preparation/schemas/source-forensics-ledger-v1.schema.json +0 -463
  132. package/dist/market-data-preparation/schemas/source-qualification-record-v1.schema.json +0 -394
  133. package/dist/market-data-preparation.d.ts +0 -11
  134. package/dist/market-data-preparation.js +0 -37488
  135. package/dist/market-data-preparation.js.map +0 -277
  136. package/dist/market-data-vendor-backfill.d.ts +0 -21
  137. package/dist/market-data-vendor-backfill.js +0 -22463
  138. package/dist/market-data-vendor-backfill.js.map +0 -199
  139. package/dist/proto/node.descriptor.d.ts +0 -127
  140. package/dist/proto-loader-options.d.ts +0 -7
  141. package/dist/proto-package-definition.d.ts +0 -2
  142. package/dist/schemas/action-payloads.d.ts +0 -88
  143. package/dist/server.d.ts +0 -10
  144. package/dist/types.d.ts +0 -100
@@ -1,212 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://schemas.usher.so/market-data-vendor-backfill-result/v2",
4
- "title": "CEX Broker market data vendor backfill file-job result v2",
5
- "type": "object",
6
- "additionalProperties": false,
7
- "required": [
8
- "schema_id",
9
- "result_sha256",
10
- "job_id",
11
- "request_file_sha256",
12
- "schema_manifest_sha256",
13
- "producer",
14
- "capability_policy",
15
- "resource_policy",
16
- "started_at",
17
- "completed_at",
18
- "outcome"
19
- ],
20
- "properties": {
21
- "schema_id": {
22
- "const": "https://schemas.usher.so/market-data-vendor-backfill-result/v2"
23
- },
24
- "result_sha256": { "$ref": "#/$defs/sha256" },
25
- "job_id": { "$ref": "#/$defs/uuid" },
26
- "request_file_sha256": {
27
- "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/sha256" }]
28
- },
29
- "schema_manifest_sha256": { "$ref": "#/$defs/sha256" },
30
- "producer": { "$ref": "#/$defs/producer" },
31
- "capability_policy": { "$ref": "#/$defs/policyPin" },
32
- "resource_policy": { "$ref": "#/$defs/policyPin" },
33
- "started_at": { "$ref": "#/$defs/timestamp" },
34
- "completed_at": { "$ref": "#/$defs/timestamp" },
35
- "outcome": {
36
- "type": "object",
37
- "additionalProperties": false,
38
- "required": [
39
- "status",
40
- "reason_code",
41
- "reason_subcode",
42
- "request_id",
43
- "idempotency_key",
44
- "target",
45
- "selection",
46
- "receipt",
47
- "diagnostics"
48
- ],
49
- "properties": {
50
- "status": {
51
- "enum": [
52
- "request_invalid",
53
- "archive_preflight_failed",
54
- "already_covered",
55
- "promoted",
56
- "capability_unsupported",
57
- "credentials_missing",
58
- "vendor_fetch_failed",
59
- "archive_ingest_failed",
60
- "promotion_verification_failed"
61
- ]
62
- },
63
- "reason_code": {
64
- "type": "string",
65
- "pattern": "^[a-z][a-z0-9_]{0,127}$"
66
- },
67
- "reason_subcode": {
68
- "oneOf": [
69
- { "type": "null" },
70
- { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,127}$" }
71
- ]
72
- },
73
- "request_id": {
74
- "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/uuid" }]
75
- },
76
- "idempotency_key": {
77
- "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/sha256" }]
78
- },
79
- "target": {
80
- "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/target" }]
81
- },
82
- "selection": {
83
- "oneOf": [
84
- { "type": "null" },
85
- {
86
- "$ref": "https://schemas.usher.so/market-data-vendor-backfill-archive-selection/v1"
87
- }
88
- ]
89
- },
90
- "receipt": {
91
- "oneOf": [
92
- { "type": "null" },
93
- {
94
- "$ref": "https://schemas.usher.so/market-data-vendor-backfill-promotion-receipt/v1"
95
- }
96
- ]
97
- },
98
- "diagnostics": {
99
- "type": "object",
100
- "maxProperties": 64,
101
- "additionalProperties": {
102
- "oneOf": [
103
- { "type": "string", "maxLength": 1024 },
104
- { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
105
- { "type": "boolean" }
106
- ]
107
- }
108
- }
109
- }
110
- }
111
- },
112
- "allOf": [
113
- {
114
- "if": {
115
- "type": "object",
116
- "properties": {
117
- "outcome": {
118
- "type": "object",
119
- "properties": {
120
- "status": { "const": "request_invalid" },
121
- "reason_subcode": { "const": "request_file_unreadable" }
122
- },
123
- "required": ["status", "reason_subcode"]
124
- }
125
- },
126
- "required": ["outcome"]
127
- },
128
- "then": {
129
- "type": "object",
130
- "properties": { "request_file_sha256": { "type": "null" } }
131
- },
132
- "else": {
133
- "type": "object",
134
- "properties": { "request_file_sha256": { "$ref": "#/$defs/sha256" } }
135
- }
136
- }
137
- ],
138
- "$defs": {
139
- "uuid": {
140
- "type": "string",
141
- "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
142
- },
143
- "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
144
- "timestamp": {
145
- "type": "string",
146
- "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-([0-2][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}Z$"
147
- },
148
- "semver": {
149
- "type": "string",
150
- "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?$"
151
- },
152
- "target": {
153
- "type": "object",
154
- "additionalProperties": false,
155
- "required": ["environment", "cluster"],
156
- "properties": {
157
- "environment": {
158
- "type": "string",
159
- "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
160
- },
161
- "cluster": {
162
- "type": "string",
163
- "pattern": "^[a-z0-9][a-z0-9_-]{0,127}$"
164
- }
165
- }
166
- },
167
- "policyPin": {
168
- "type": "object",
169
- "additionalProperties": false,
170
- "required": ["policy_id", "policy_sha256"],
171
- "properties": {
172
- "policy_id": { "type": "string", "minLength": 1, "maxLength": 256 },
173
- "policy_sha256": { "$ref": "#/$defs/sha256" }
174
- }
175
- },
176
- "producer": {
177
- "type": "object",
178
- "additionalProperties": false,
179
- "required": [
180
- "product_id",
181
- "product_version",
182
- "package",
183
- "executable_sha256",
184
- "runtime"
185
- ],
186
- "properties": {
187
- "product_id": { "const": "market-data-vendor-backfill" },
188
- "product_version": { "const": "market-data-vendor-backfill/v1" },
189
- "package": {
190
- "type": "object",
191
- "additionalProperties": false,
192
- "required": ["name", "version", "git_head"],
193
- "properties": {
194
- "name": { "const": "@usherlabs/cex-broker" },
195
- "version": { "$ref": "#/$defs/semver" },
196
- "git_head": { "type": "string", "pattern": "^[0-9a-f]{40}$" }
197
- }
198
- },
199
- "executable_sha256": { "$ref": "#/$defs/sha256" },
200
- "runtime": {
201
- "type": "object",
202
- "additionalProperties": false,
203
- "required": ["name", "version"],
204
- "properties": {
205
- "name": { "const": "node" },
206
- "version": { "$ref": "#/$defs/semver" }
207
- }
208
- }
209
- }
210
- }
211
- }
212
- }
@@ -1,61 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://schemas.usher.so/cex-canonical-orderbook-export-request/v1",
4
- "title": "CEX canonical order-book exact-selection export request v1",
5
- "type": "object",
6
- "additionalProperties": false,
7
- "required": [
8
- "schema_id",
9
- "request_id",
10
- "target",
11
- "selection",
12
- "depth",
13
- "construction_mode",
14
- "canonical_schema_version",
15
- "checksum_algorithm"
16
- ],
17
- "properties": {
18
- "schema_id": {
19
- "const": "https://schemas.usher.so/cex-canonical-orderbook-export-request/v1"
20
- },
21
- "request_id": { "$ref": "#/$defs/uuid" },
22
- "target": { "$ref": "#/$defs/target" },
23
- "selection": {
24
- "$ref": "https://schemas.usher.so/market-data-vendor-backfill-archive-selection/v1"
25
- },
26
- "depth": { "type": "integer", "minimum": 1, "maximum": 500 },
27
- "construction_mode": {
28
- "enum": [
29
- "sampled_top_n_snapshot",
30
- "exact_l2_reconstruction",
31
- "policy_neutral_top_n_state_change_tape/v1"
32
- ]
33
- },
34
- "canonical_schema_version": {
35
- "type": "string",
36
- "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+$"
37
- },
38
- "checksum_algorithm": { "const": "sha256-canonical-json-v1" }
39
- },
40
- "$defs": {
41
- "uuid": {
42
- "type": "string",
43
- "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
44
- },
45
- "target": {
46
- "type": "object",
47
- "additionalProperties": false,
48
- "required": ["environment", "cluster"],
49
- "properties": {
50
- "environment": {
51
- "type": "string",
52
- "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
53
- },
54
- "cluster": {
55
- "type": "string",
56
- "pattern": "^[a-z0-9][a-z0-9_-]{0,127}$"
57
- }
58
- }
59
- }
60
- }
61
- }
@@ -1,252 +0,0 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://schemas.usher.so/cex-canonical-orderbook-export-result/v2",
4
- "title": "CEX canonical order-book exact-selection export result v2",
5
- "type": "object",
6
- "additionalProperties": false,
7
- "required": [
8
- "schema_id",
9
- "result_sha256",
10
- "job_id",
11
- "request_file_sha256",
12
- "producer",
13
- "started_at",
14
- "completed_at",
15
- "outcome"
16
- ],
17
- "properties": {
18
- "schema_id": {
19
- "const": "https://schemas.usher.so/cex-canonical-orderbook-export-result/v2"
20
- },
21
- "result_sha256": { "$ref": "#/$defs/sha256" },
22
- "job_id": { "$ref": "#/$defs/uuid" },
23
- "request_file_sha256": {
24
- "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/sha256" }]
25
- },
26
- "producer": { "$ref": "#/$defs/producer" },
27
- "started_at": { "$ref": "#/$defs/timestamp" },
28
- "completed_at": { "$ref": "#/$defs/timestamp" },
29
- "outcome": {
30
- "type": "object",
31
- "additionalProperties": false,
32
- "required": [
33
- "status",
34
- "reason_code",
35
- "reason_subcode",
36
- "request_id",
37
- "target",
38
- "selection_sha256",
39
- "query_sha256",
40
- "query_segments",
41
- "promotion_receipt_ids",
42
- "artifacts",
43
- "diagnostics"
44
- ],
45
- "properties": {
46
- "status": {
47
- "enum": [
48
- "exported",
49
- "request_invalid",
50
- "archive_query_failed",
51
- "archive_data_invalid",
52
- "artifact_write_failed"
53
- ]
54
- },
55
- "reason_code": {
56
- "type": "string",
57
- "pattern": "^[a-z][a-z0-9_]{0,127}$"
58
- },
59
- "reason_subcode": {
60
- "oneOf": [
61
- { "type": "null" },
62
- { "type": "string", "pattern": "^[a-z][a-z0-9_]{0,127}$" }
63
- ]
64
- },
65
- "request_id": {
66
- "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/uuid" }]
67
- },
68
- "target": {
69
- "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/target" }]
70
- },
71
- "selection_sha256": {
72
- "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/sha256" }]
73
- },
74
- "query_sha256": {
75
- "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/sha256" }]
76
- },
77
- "query_segments": {
78
- "type": "array",
79
- "items": { "$ref": "#/$defs/segment" }
80
- },
81
- "promotion_receipt_ids": {
82
- "type": "array",
83
- "uniqueItems": true,
84
- "items": { "$ref": "#/$defs/sha256" }
85
- },
86
- "artifacts": {
87
- "oneOf": [
88
- { "type": "null" },
89
- {
90
- "type": "object",
91
- "additionalProperties": false,
92
- "required": ["levels", "summary"],
93
- "properties": {
94
- "levels": { "$ref": "#/$defs/artifact" },
95
- "summary": { "$ref": "#/$defs/artifact" }
96
- }
97
- }
98
- ]
99
- },
100
- "diagnostics": {
101
- "type": "object",
102
- "maxProperties": 64,
103
- "additionalProperties": {
104
- "oneOf": [
105
- { "type": "string", "maxLength": 1024 },
106
- { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
107
- { "type": "boolean" }
108
- ]
109
- }
110
- }
111
- },
112
- "allOf": [
113
- {
114
- "if": {
115
- "type": "object",
116
- "properties": { "status": { "const": "exported" } },
117
- "required": ["status"]
118
- },
119
- "then": {
120
- "type": "object",
121
- "properties": {
122
- "request_id": { "$ref": "#/$defs/uuid" },
123
- "target": { "$ref": "#/$defs/target" },
124
- "selection_sha256": { "$ref": "#/$defs/sha256" },
125
- "query_sha256": { "$ref": "#/$defs/sha256" },
126
- "query_segments": { "type": "array", "minItems": 1 },
127
- "artifacts": { "type": "object" }
128
- }
129
- },
130
- "else": {
131
- "type": "object",
132
- "properties": { "artifacts": { "type": "null" } }
133
- }
134
- }
135
- ]
136
- }
137
- },
138
- "$defs": {
139
- "uuid": {
140
- "type": "string",
141
- "pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
142
- },
143
- "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
144
- "timestamp": {
145
- "type": "string",
146
- "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])-([0-2][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]\\.[0-9]{3}Z$"
147
- },
148
- "semver": {
149
- "type": "string",
150
- "pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+(?:-[0-9A-Za-z.-]+)?$"
151
- },
152
- "target": {
153
- "type": "object",
154
- "additionalProperties": false,
155
- "required": ["environment", "cluster"],
156
- "properties": {
157
- "environment": {
158
- "type": "string",
159
- "pattern": "^[a-z0-9][a-z0-9_-]{0,63}$"
160
- },
161
- "cluster": {
162
- "type": "string",
163
- "pattern": "^[a-z0-9][a-z0-9_-]{0,127}$"
164
- }
165
- }
166
- },
167
- "producer": {
168
- "type": "object",
169
- "additionalProperties": false,
170
- "required": [
171
- "product_id",
172
- "product_version",
173
- "package",
174
- "executable_sha256",
175
- "runtime"
176
- ],
177
- "properties": {
178
- "product_id": { "const": "cex-canonical-orderbook-export" },
179
- "product_version": { "const": "cex-canonical-orderbook-export/v2" },
180
- "package": {
181
- "type": "object",
182
- "additionalProperties": false,
183
- "required": ["name", "version", "git_head"],
184
- "properties": {
185
- "name": { "const": "@usherlabs/cex-broker" },
186
- "version": { "$ref": "#/$defs/semver" },
187
- "git_head": { "type": "string", "pattern": "^[0-9a-f]{40}$" }
188
- }
189
- },
190
- "executable_sha256": { "$ref": "#/$defs/sha256" },
191
- "runtime": {
192
- "type": "object",
193
- "additionalProperties": false,
194
- "required": ["name", "version"],
195
- "properties": {
196
- "name": { "const": "node" },
197
- "version": { "$ref": "#/$defs/semver" }
198
- }
199
- }
200
- }
201
- },
202
- "segment": {
203
- "type": "object",
204
- "additionalProperties": false,
205
- "required": ["start_at", "end_at", "capture_bundle_id", "capture_origin"],
206
- "properties": {
207
- "start_at": { "$ref": "#/$defs/timestamp" },
208
- "end_at": { "$ref": "#/$defs/timestamp" },
209
- "capture_bundle_id": { "$ref": "#/$defs/sha256" },
210
- "capture_origin": {
211
- "enum": ["production_capture", "vendor_historical_backfill"]
212
- }
213
- }
214
- },
215
- "artifact": {
216
- "type": "object",
217
- "additionalProperties": false,
218
- "required": [
219
- "file_name",
220
- "rows",
221
- "bytes",
222
- "sha256",
223
- "projection_schema_id",
224
- "projection_schema_sha256"
225
- ],
226
- "properties": {
227
- "file_name": {
228
- "type": "string",
229
- "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$"
230
- },
231
- "rows": {
232
- "type": "integer",
233
- "minimum": 1,
234
- "maximum": 9007199254740991
235
- },
236
- "bytes": {
237
- "type": "integer",
238
- "minimum": 8,
239
- "maximum": 9007199254740991
240
- },
241
- "sha256": { "$ref": "#/$defs/sha256" },
242
- "projection_schema_id": {
243
- "enum": [
244
- "https://schemas.usher.so/cex-order-book-levels-parquet-projection/v1",
245
- "https://schemas.usher.so/cex-order-book-depth-summary-parquet-projection/v1"
246
- ]
247
- },
248
- "projection_schema_sha256": { "$ref": "#/$defs/sha256" }
249
- }
250
- }
251
- }
252
- }