GraphQL — Центр
55 определений
← Вся документация · Источник: контракты, graphql/hub.graphql на коммите 8000474.
Справочники на английском — на языке контрактов, из которых они созданы.
extend type Query
# What the node adds to its GraphQL schema in the hub role (spec/SYNC.md):
# the hub serves graphql/store.graphql for the records it owns plus these
# queries, with the same permissions as openapi/hub-v1.yaml. Queries only:
# changes go through REST. Checked together with store.graphql.
extend type Query {
"store.read"
organization: Organization!
"store.read; each node only with node.manage (spec/SYNC.md, Who sees a node)"
stores: [HubStore!]!
"store.read; its node only with node.manage"
hubStore(id: UUID!): HubStore
"item.read"
storePrices(storeId: UUID!, first: Int! = 50, after: String): ItemPricePage!
"store.read: one store's tax codes (spec/TAX.md)"
storeTaxRates(storeId: UUID!): [TaxRate!]!
"store.read: one store's container deposits"
storeDeposits(storeId: UUID!): [Deposit!]!
"store.read: where one store's tax rates come from (spec/TAX.md)"
storeTaxProvider(storeId: UUID!): TaxProvider!
"report.read: spec/ANALYTICS.md, Currencies; newest first"
exchangeRates(from: Date, to: Date, currency: String): [ExchangeRate!]!
"node.manage"
nodes: [Node!]!
"node.manage"
node(id: UUID!): Node
"request.resolve"
hubChangeRequests(status: ChangeRequestStatus, storeId: UUID, first: Int! = 50, after: String): ChangeRequestPage!
"report.read: spec/ANALYTICS.md, the catalog of metrics/catalog.json"
analyticsMetrics: [Metric!]!
"report.read: spec/ANALYTICS.md, the query"
analytics(query: AnalyticsQuery!): AnalyticsResult!
"report.read: spec/DASHBOARDS.md, the organization's and the ready-made ones"
dashboards: [DashboardSummary!]!
"report.read: spec/DASHBOARDS.md"
dashboard(id: String!): StoredDashboard
"alert.read: spec/HEALTH.md, newest first"
alerts(state: AlertState = OPEN, storeId: UUID, first: Int! = 50, after: String): AlertPage!
"alert.read"
alertSettings: AlertSettings!
"backup.read: spec/BACKUP.md"
backupPolicy: BackupPolicy!
"backup.read: newest first; hub: true for the hub's own archives"
backups(storeId: UUID, hub: Boolean, first: Int! = 50, after: String): BackupPage!
"network.read: spec/NETWORK.md, the organization's private network"
hubNetwork: Network!
"network.read: every registered node as a peer of the hub"
networkPeers: [NetworkPeer!]!
"document.read: the chain's transfers (spec/STOCK.md, Transfers)"
hubTransfers(storeId: UUID, state: TransferState, first: Int! = 50, after: String): TransferPage!
"document.read"
hubTransfer(id: UUID!): Transfer
"stock.read: every line in transit between the chain's stores"
hubInTransit(storeId: UUID): [InTransitLine!]!
"bonus.read: by store and employee (spec/REPORTS.md, Employee bonuses)"
hubBonusReport(from: DateTime!, to: DateTime!, storeId: UUID): HubBonusReport!
"report.read: by store and partner (spec/REPORTS.md, Partners)"
hubPartnerReport(from: DateTime!, to: DateTime!, storeId: UUID): HubPartnerReport!
"release.read: rollouts, newest first (spec/RELEASES.md, Rollouts)"
rollouts(state: RolloutState, first: Int! = 50, after: String): RolloutPage!
"release.read"
rollout(id: UUID!): Rollout
"release.read: each store of a rollout with its wave, update state and gate status"
rolloutStores(id: UUID!, first: Int! = 50, after: String): RolloutStorePage!
"release.read: the hub's own update (spec/RELEASES.md, The hub's own update)"
hubUpdate: HubUpdate!
}
type Organization
type Organization {
id: UUID!
name: JSON!
defaultLanguage: String!
version: Int64!
}
type HubStore
"A store with its node's state (null before a node registers)."
type HubStore {
store: Store!
"null without node.manage, as before a node registers"
node: Node
}
enum NodeStatus
enum NodeStatus {
ACTIVE
REVOKED
}
type Node
"A store node registered with the hub and its sync state."
type Node {
id: UUID!
storeId: UUID!
status: NodeStatus!
version: String!
connected: Boolean!
lastSeenAt: DateTime
hubCursor: Int64!
hubHead: Int64!
storeAck: Int64!
storeHead: Int64!
certificateExpiresAt: DateTime!
registeredAt: DateTime!
"The store's last health report (spec/HEALTH.md), or null before the first."
health: NodeHealth
"Why the hub refuses this node at the exchange (spec/RELEASES.md, Compatibility); null otherwise."
compatibility: Compatibility
}
type NodeHealth
type NodeHealth {
reportedAt: DateTime!
startedAt: DateTime!
shiftsOpen: Int!
oldestShiftOpenedAt: DateTime
journalPending: Int64!
searchQueue: Int64!
redisOk: Boolean!
"The store's tunnel to the hub (spec/NETWORK.md); null from a node that does not report it."
tunnelState: TunnelState
"The head of the store's audit chain from its last report (spec/AUDIT.md); null from a node that does not report it."
auditHead: AuditHead
"The store's update from its last report (spec/RELEASES.md); null from a node that does not report it."
update: NodeUpdate
"The store's apps by version (spec/RELEASES.md, Reporting); empty from a node that does not report them."
apps: [AppVersionCount!]!
"The store's offers of the release it runs (spec/RELEASES.md, One device first)."
appOffers: [AppOffer!]!
}
type NodeUpdate
"The update fields of a store's health report (spec/HEALTH.md)."
type NodeUpdate {
runningVersion: String!
previousVersion: String
targetVersion: String
targetRecordVersion: Int64!
state: UpdateState!
stateSince: DateTime
step: UpdateStep
error: String
healthz: Healthz
backup: UpdateBackup
rehearsal: UpdateRehearsal
backgroundTasksRunning: Int!
backgroundTasksFailed: Int!
}
type AuditHead
type AuditHead {
id: Int64!
hash: String!
}
type ItemPrice
type ItemPrice {
itemId: UUID!
storeId: UUID!
priceMinor: Int64!
currency: String!
version: Int64!
}
type ItemPricePage
type ItemPricePage {
items: [ItemPrice!]!
next: String
}
enum MetricUnit
enum MetricUnit {
MONEY
QUANTITY_MILLI
COUNT
PPM
MINUTES
}
enum AnalyticsDimension
enum AnalyticsDimension {
STORE
DAY
WEEK
MONTH
HOUR
EMPLOYEE
ITEM
GROUP
}
type Metric
"A metric of the catalog (metrics/catalog.json)."
type Metric {
id: String!
name: JSON!
description: JSON!
unit: MetricUnit!
dimensions: [AnalyticsDimension!]!
}
input AnalyticsQuery
"The query of spec/ANALYTICS.md; the same fields as POST /v1/analytics/query."
input AnalyticsQuery {
metrics: [String!]!
dimensions: [AnalyticsDimension!]! = []
from: Date!
to: Date!
stores: [UUID!]
items: [UUID!]
groups: [UUID!]
"Convert money into this currency at the rate of each day."
currency: String
"Count a variant under its parent in the item dimension (spec/VARIANTS.md)."
rollUpVariants: Boolean! = false
"A requested metric's id or a dimension in lowercase."
orderBy: String
descending: Boolean! = false
limit: Int! = 1000
}
enum AnalyticsColumnKind
enum AnalyticsColumnKind {
DIMENSION
METRIC
}
type AnalyticsColumn
type AnalyticsColumn {
id: String!
kind: AnalyticsColumnKind!
"A metric's unit; null for a dimension."
unit: MetricUnit
}
type AnalyticsResult
type AnalyticsResult {
columns: [AnalyticsColumn!]!
"The dimensions' values, then the metrics', in the order asked: strings, numbers or null."
rows: [[JSON]!]!
currency: String
"Store currencies and days left out of the sums for want of a rate."
missingRates: [MissingRate!]!
truncated: Boolean!
}
type MissingRate
type MissingRate {
currency: String!
date: Date!
}
type ExchangeRate
"A rate by day: units of `to` one unit of `from` buys, as decimal text."
type ExchangeRate {
date: Date!
from: String!
to: String!
rate: String!
}
enum DashboardSource
enum DashboardSource {
READY_MADE
ORGANIZATION
}
type DashboardSummary
type DashboardSummary {
id: String!
title: JSON!
description: JSON
source: DashboardSource!
version: Int64!
}
type StoredDashboard
"A dashboard: the document of spec/DASHBOARDS.md as JSON."
type StoredDashboard {
dashboard: JSON!
source: DashboardSource!
version: Int64!
}
enum AlertState
enum AlertState {
OPEN
ALL
}
enum AlertStatus
enum AlertStatus {
OPEN
RESOLVED
}
enum AlertKind
enum AlertKind {
NODE_SILENT
NODE_BEHIND
SHIFT_OPEN_LONG
CERTIFICATE_EXPIRING
REDIS_DOWN
BACKUP_OVERDUE
}
enum AlertNotice
enum AlertNotice {
SENT
PENDING
FAILED
}
type Alert
type Alert {
id: UUID!
kind: AlertKind!
storeId: UUID!
nodeId: UUID!
state: AlertStatus!
openedAt: DateTime!
resolvedAt: DateTime
acknowledgedBy: UUID
acknowledgedAt: DateTime
"By kind (spec/HEALTH.md)."
details: JSON!
notice: AlertNotice
}
type AlertPage
type AlertPage {
items: [Alert!]!
next: String
}
type AlertSettings
type AlertSettings {
silentMinutes: Int!
behindEntries: Int!
behindMinutes: Int!
shiftHours: Int!
certificateDays: Int!
backupHours: Int!
"The webhook's name; its URL is never shown."
webhook: String
webhookConfigured: Boolean!
version: Int64!
}
enum BackupStorage
enum BackupStorage {
S3
DIRECTORY
}
type BackupPolicy
type BackupPolicy {
enabled: Boolean!
"age X25519 public keys"
recipients: [String!]!
dailyAt: String!
retentionDays: Int!
keepLast: Int!
storage: BackupStorage
"when the recipients last changed (spec/BACKUP.md, Changing the recipients)"
recipientsChangedAt: DateTime
"the employee who changed them"
recipientsChangedBy: UUID
version: Int64!
}
enum BackupReason
enum BackupReason {
SCHEDULE
REQUESTED
}
enum BackupStatus
enum BackupStatus {
STORED
FAILED
}
type Backup
type Backup {
id: UUID!
"null for the hub's own archive"
storeId: UUID
fileName: String!
createdAt: DateTime!
reason: BackupReason!
status: BackupStatus!
size: Int64!
sha256: String
formatVersion: Int!
schemaVersion: Int64!
nodeVersion: String!
tables: Int!
rows: Int64!
error: String
}
type BackupPage
type BackupPage {
items: [Backup!]!
next: String
}
type Network
type Network {
enabled: Boolean!
subnet: String!
endpoint: String
hubAddress: String!
hubPublicKey: String
keyPresent: Boolean!
version: Int64!
}
enum PeerState
enum PeerState {
UP
DOWN
NEVER
}
type NetworkPeer
type NetworkPeer {
nodeId: UUID!
storeId: UUID!
networkEnabled: Boolean!
address: String
publicKey: String
state: PeerState!
lastHandshakeAt: DateTime
endpoint: String
rxBytes: Int64!
txBytes: Int64!
}
type HubBonusReportRow
"spec/REPORTS.md, At the hub: a row in its store's currency"
type HubBonusReportRow {
storeId: UUID!
"The store's currency"
currency: String!
employeeId: UUID!
lines: Int64!
revenueMinor: Int64!
bonusMinor: Int64!
}
type HubBonusTotals
"The rows in one currency added up"
type HubBonusTotals {
currency: String!
lines: Int64!
revenueMinor: Int64!
bonusMinor: Int64!
}
type HubBonusReport
type HubBonusReport {
from: DateTime!
to: DateTime!
rows: [HubBonusReportRow!]!
"One entry per currency the rows are in, ordered by currency code"
totals: [HubBonusTotals!]!
}
type HubPartnerReportRow
"spec/REPORTS.md, At the hub: a row in its store's currency"
type HubPartnerReportRow {
storeId: UUID!
"The store's currency"
currency: String!
partnerId: UUID!
sales: Int64!
refunds: Int64!
revenueMinor: Int64!
costMinor: Int64!
marginMinor: Int64!
commissionMinor: Int64!
marginAfterCommissionMinor: Int64!
}
type HubPartnerTotals
"The rows in one currency added up"
type HubPartnerTotals {
currency: String!
sales: Int64!
refunds: Int64!
revenueMinor: Int64!
costMinor: Int64!
marginMinor: Int64!
commissionMinor: Int64!
marginAfterCommissionMinor: Int64!
}
type HubPartnerReport
type HubPartnerReport {
from: DateTime!
to: DateTime!
rows: [HubPartnerReportRow!]!
"One entry per currency the rows are in, ordered by currency code"
totals: [HubPartnerTotals!]!
}
enum RolloutState
enum RolloutState {
RUNNING
PAUSED
PAUSED_BY_GATE
ROLLING_BACK
ROLLED_BACK
COMPLETED
}
type RolloutWave
type RolloutWave {
"In the rollout's order (spec/RELEASES.md, Waves)."
stores: [UUID!]!
startedAt: DateTime
passedAt: DateTime
}
enum GatePauseReason
enum GatePauseReason {
FAILED
ROLLED_BACK
ALERT
APP_FAILED
}
type GatePause
type GatePause {
storeId: UUID!
reason: GatePauseReason!
alertKind: AlertKind
"For APP_FAILED, the app held first and its platform; null otherwise."
app: AppId
platform: ReleasePlatform
}
type Rollout
"A rollout of one release in waves (spec/RELEASES.md, Rollouts)."
type Rollout {
id: UUID!
release: String!
state: RolloutState!
waves: [RolloutWave!]!
"Counted from 0."
currentWave: Int!
healthyMinutes: Int!
window: UpdateWindow
"Windows per store over window, as JSON: {store id: window or null}."
storeWindows: JSON!
pausedByGate: GatePause
resumedAt: DateTime
createdBy: UUID!
createdAt: DateTime!
finishedAt: DateTime
version: Int64!
}
type RolloutPage
type RolloutPage {
items: [Rollout!]!
next: String
}
enum GateStatus
enum GateStatus {
PENDING
PASSED
HEALTHY
UPDATING
SILENT
UNHEALTHY
FAILED
ROLLED_BACK
ALERT
APP_FAILED
SKIPPED
}
type RolloutStore
type RolloutStore {
storeId: UUID!
wave: Int!
skipped: Boolean!
"From the store's last report; null before one."
state: UpdateState
gateStatus: GateStatus!
runningVersion: String
"What a rollback returns the store to."
previousVersion: String
targetVersion: String
action: UpdateAction
startedAt: DateTime
doneAt: DateTime
healthySince: DateTime
step: UpdateStep
error: String
}
type RolloutStorePage
type RolloutStorePage {
items: [RolloutStore!]!
next: String
}
type HubUpdateTarget
type HubUpdateTarget {
version: String!
"In the hub's time zone (its office store's); null for at once."
window: UpdateWindow
orderedAt: DateTime!
orderedBy: UUID!
}
type HubUpdate
"The hub's own update (spec/RELEASES.md, The hub's own update)."
type HubUpdate {
runningVersion: String!
previousVersion: String
target: HubUpdateTarget
state: UpdateState!
stateSince: DateTime
step: UpdateStep
error: String
updater: UpdaterKind!
backup: UpdateBackup
"The hub rehearses only when asked; null without a rehearsal."
rehearsal: UpdateRehearsal
backgroundTasks: [BackgroundTask!]!
"The hub's office store's apps by version."
apps: [AppVersionCount!]!
appOffers: [AppOffer!]!
}