sylphx 0.3.6

The Sylphx SDK: one API, one key, every Sylphx service. Generated from the Sylphx schema registry.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
// @generated by sylphx-gen. Do not edit.
//! Identifiers: the TypeID helpers of the Sylphx SDK (owner
//! `standards/identifiers.md`).
//!
//! An entity has one id, a UUIDv7 (RFC 9562 ยง5.7). Its only text form is a
//! [TypeID](https://github.com/jetify-com/typeid/blob/main/spec/README.md):
//! `<prefix>_<26 characters>`, the suffix being the same 128 bits in lowercase
//! Crockford base32, for example `prj_01m3jzg7fpek2ayen9cq4bn2ef`. The prefixes
//! are the constants below, generated from `contracts/ids.toml`.
//!
//! ```
//! use sylphx::ids;
//!
//! let id = ids::mint(ids::PRJ);
//! assert_eq!(ids::validate(ids::PRJ, &id.to_string()).unwrap(), id);
//! assert!(ids::parse("01m3jzg7fpek2ayen9cq4bn2ef").is_err());
//! ```

use std::fmt;
use std::str::FromStr;

use uuid::Uuid;

/// Lowercase Crockford base32 (no `i`, `l`, `o`, `u`).
const ALPHABET: &[u8; 32] = b"0123456789abcdefghjkmnpqrstvwxyz";
/// Characters in a TypeID suffix: 130 bits of digits for 128 bits of value.
const SUFFIX_LEN: usize = 26;

/// One registered prefix of `contracts/ids.toml`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Prefix {
    prefix: &'static str,
    entity: &'static str,
    service: &'static str,
    collection: Option<&'static str>,
}

impl Prefix {
    pub const fn new(
        prefix: &'static str,
        entity: &'static str,
        service: &'static str,
        collection: Option<&'static str>,
    ) -> Self {
        Self {
            prefix,
            entity,
            service,
            collection,
        }
    }

    /// The prefix text, for example `prj`.
    pub const fn as_str(&self) -> &'static str {
        self.prefix
    }

    /// The entity the id names, for example `Project`.
    pub const fn entity(&self) -> &'static str {
        self.entity
    }

    /// The owning service, for example `access`.
    pub const fn service(&self) -> &'static str {
        self.service
    }

    /// The collection segment of the entity's resource name, when it has one.
    pub const fn collection(&self) -> Option<&'static str> {
        self.collection
    }

    /// The registered prefix with this text.
    pub fn of(prefix: &str) -> Option<Prefix> {
        ALL.iter().copied().find(|p| p.prefix == prefix)
    }
}

impl fmt::Display for Prefix {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.write_str(self.prefix)
    }
}

/// Why a string is not an id of the expected kind. The one accepted form is a
/// lowercase TypeID with a registered prefix.
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub enum IdError {
    /// Not `<prefix>_<suffix>` with a prefix of 2-5 lowercase letters.
    Malformed,
    /// The prefix is not in `contracts/ids.toml`.
    UnknownPrefix(String),
    /// A registered prefix, but not the one the field takes.
    WrongPrefix {
        expected: &'static str,
        found: &'static str,
    },
    /// The suffix is not 26 lowercase Crockford base32 characters within 128 bits.
    InvalidSuffix,
}

impl fmt::Display for IdError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            Self::Malformed => f.write_str("not a TypeID: expected `<prefix>_<26 characters>`"),
            Self::UnknownPrefix(p) => write!(f, "unknown id prefix `{p}`"),
            Self::WrongPrefix { expected, found } => {
                write!(f, "expected a `{expected}_` id, found `{found}_`")
            }
            Self::InvalidSuffix => {
                f.write_str("invalid TypeID suffix: expected 26 lowercase base32 characters")
            }
        }
    }
}

impl std::error::Error for IdError {}

/// A TypeID: a registered prefix over a 128-bit value.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct TypeId {
    prefix: Prefix,
    uuid: Uuid,
}

impl TypeId {
    /// The id of an existing 128-bit value, for example a `uuid` column.
    pub const fn from_uuid(prefix: Prefix, uuid: Uuid) -> Self {
        Self { prefix, uuid }
    }

    pub const fn prefix(&self) -> Prefix {
        self.prefix
    }

    /// The 128 bits, as stored in the owning service's `uuid` column.
    pub const fn uuid(&self) -> Uuid {
        self.uuid
    }

    /// The name another system needs where `_` is not legal (a DNS label, a
    /// Kubernetes name): `<prefix>-<26 characters>`.
    pub fn dns_form(&self) -> String {
        format!("{}-{}", self.prefix, suffix(self.uuid.as_u128()))
    }
}

impl fmt::Display for TypeId {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}_{}", self.prefix, suffix(self.uuid.as_u128()))
    }
}

impl FromStr for TypeId {
    type Err = IdError;

    fn from_str(s: &str) -> Result<Self, IdError> {
        parse(s)
    }
}

/// A new id with a fresh UUIDv7.
pub fn mint(prefix: Prefix) -> TypeId {
    TypeId::from_uuid(prefix, Uuid::now_v7())
}

/// Parses an id of any registered prefix. Exactly one form is accepted: a
/// lowercase TypeID. A raw UUID, hex, an uppercase id, a DNS form or a
/// retired form is an error.
pub fn parse(s: &str) -> Result<TypeId, IdError> {
    let (prefix, suffix) = s.split_once('_').ok_or(IdError::Malformed)?;
    if !(2..=5).contains(&prefix.len()) || !prefix.bytes().all(|b| b.is_ascii_lowercase()) {
        return Err(IdError::Malformed);
    }
    let prefix = Prefix::of(prefix).ok_or_else(|| IdError::UnknownPrefix(prefix.to_string()))?;
    Ok(TypeId::from_uuid(prefix, Uuid::from_u128(decode(suffix)?)))
}

/// Parses an id that must carry `prefix`.
pub fn validate(prefix: Prefix, s: &str) -> Result<TypeId, IdError> {
    let id = parse(s)?;
    if id.prefix == prefix {
        Ok(id)
    } else {
        Err(IdError::WrongPrefix {
            expected: prefix.as_str(),
            found: id.prefix.as_str(),
        })
    }
}

fn suffix(value: u128) -> String {
    (0..SUFFIX_LEN)
        .map(|i| ALPHABET[((value >> (125 - 5 * i)) & 31) as usize] as char)
        .collect()
}

fn decode(s: &str) -> Result<u128, IdError> {
    let bytes = s.as_bytes();
    // The first digit carries the top 3 bits only: above `7` overflows 128 bits.
    if bytes.len() != SUFFIX_LEN || bytes[0] > b'7' {
        return Err(IdError::InvalidSuffix);
    }
    let mut value: u128 = 0;
    for &b in bytes {
        let digit = ALPHABET
            .iter()
            .position(|&a| a == b)
            .ok_or(IdError::InvalidSuffix)?;
        value = (value << 5) | digit as u128;
    }
    Ok(value)
}

// The registry, generated from `contracts/ids.toml`.

/// Org (`org`, access).
pub const ORG: Prefix = Prefix::new("org", "Org", "access", Some("orgs"));
/// Project (`prj`, access).
pub const PRJ: Prefix = Prefix::new("prj", "Project", "access", Some("projects"));
/// Environment (`env`, access).
pub const ENV: Prefix = Prefix::new("env", "Environment", "access", Some("envs"));
/// ApiKey (`key`, access).
pub const KEY: Prefix = Prefix::new("key", "ApiKey", "access", Some("api_keys"));
/// Principal (`prn`, access).
pub const PRN: Prefix = Prefix::new("prn", "Principal", "access", None);
/// DeviceGrant (`dvg`, access).
pub const DVG: Prefix = Prefix::new("dvg", "DeviceGrant", "access", None);
/// Delegation (`dlgt`, access).
pub const DLGT: Prefix = Prefix::new("dlgt", "Delegation", "access", None);
/// OrgMember (`omb`, access).
pub const OMB: Prefix = Prefix::new("omb", "OrgMember", "access", None);
/// Member (`mbr`, auth).
pub const MBR: Prefix = Prefix::new("mbr", "Member", "auth", Some("memberships"));
/// User (`usr`, auth).
pub const USR: Prefix = Prefix::new("usr", "User", "auth", Some("end_users"));
/// Session (`sess`, auth).
pub const SESS: Prefix = Prefix::new("sess", "Session", "auth", Some("sessions"));
/// AuthConfig (`acfg`, auth).
pub const ACFG: Prefix = Prefix::new("acfg", "AuthConfig", "auth", Some("auth_configs"));
/// AuthOrganization (`aorg`, auth).
pub const AORG: Prefix = Prefix::new("aorg", "AuthOrganization", "auth", None);
/// CustomerOrganization (`cor`, auth).
pub const COR: Prefix = Prefix::new(
    "cor",
    "CustomerOrganization",
    "auth",
    Some("customer_organizations"),
);
/// EmailDomain (`edm`, auth).
pub const EDM: Prefix = Prefix::new("edm", "EmailDomain", "auth", Some("email_domains"));
/// Invitation (`ivt`, auth).
pub const IVT: Prefix = Prefix::new("ivt", "Invitation", "auth", Some("invitations"));
/// OauthClient (`oac`, auth).
pub const OAC: Prefix = Prefix::new("oac", "OauthClient", "auth", Some("oauth_clients"));
/// OrganizationRole (`orl`, auth).
pub const ORL: Prefix = Prefix::new(
    "orl",
    "OrganizationRole",
    "auth",
    Some("organization_roles"),
);
/// TrustedIssuer (`tis`, auth).
pub const TIS: Prefix = Prefix::new("tis", "TrustedIssuer", "auth", Some("trusted_issuers"));
/// Agent (`agt`, agents).
pub const AGT: Prefix = Prefix::new("agt", "Agent", "agents", Some("agents"));
/// AgentVersion (`agv`, agents).
pub const AGV: Prefix = Prefix::new("agv", "AgentVersion", "agents", Some("agent_versions"));
/// AgentSession (`ases`, agents).
pub const ASES: Prefix = Prefix::new("ases", "AgentSession", "agents", Some("agent_sessions"));
/// AgentSessionGoal (`goal`, agents).
pub const GOAL: Prefix = Prefix::new("goal", "AgentSessionGoal", "agents", Some("goals"));
/// SessionEvent (`sevt`, agents).
pub const SEVT: Prefix = Prefix::new("sevt", "SessionEvent", "agents", Some("session_events"));
/// MemoryStore (`mst`, agents).
pub const MST: Prefix = Prefix::new("mst", "MemoryStore", "agents", Some("memory_stores"));
/// Memory (`mem`, agents).
pub const MEM: Prefix = Prefix::new("mem", "Memory", "agents", Some("memories"));
/// OwnerPool (`aop`, agents).
pub const AOP: Prefix = Prefix::new("aop", "OwnerPool", "agents", Some("owner_pools"));
/// AiModel (`mdl`, ai).
pub const MDL: Prefix = Prefix::new("mdl", "AiModel", "ai", Some("ai_models"));
/// AiUsage (`ai`, ai).
pub const AI: Prefix = Prefix::new("ai", "AiUsage", "ai", None);
/// LlmLog (`llm`, ai).
pub const LLM: Prefix = Prefix::new("llm", "LlmLog", "ai", None);
/// Artifact (`art`, artifacts).
pub const ART: Prefix = Prefix::new("art", "Artifact", "artifacts", Some("artifacts"));
/// BillingAccount (`bac`, billing).
pub const BAC: Prefix = Prefix::new("bac", "BillingAccount", "billing", Some("billing_accounts"));
/// BudgetLease (`bls`, billing).
pub const BLS: Prefix = Prefix::new("bls", "BudgetLease", "billing", Some("budget_leases"));
/// Invoice (`inv`, billing).
pub const INV: Prefix = Prefix::new("inv", "Invoice", "billing", Some("invoices"));
/// Meter (`met`, billing).
pub const MET: Prefix = Prefix::new("met", "Meter", "billing", Some("meters"));
/// Plan (`plan`, billing).
pub const PLAN: Prefix = Prefix::new("plan", "Plan", "billing", Some("plans"));
/// UsageReport (`urp`, billing).
pub const URP: Prefix = Prefix::new("urp", "UsageReport", "billing", Some("usage_reports"));
/// BillingSubscription (`bsub`, billing).
pub const BSUB: Prefix = Prefix::new("bsub", "BillingSubscription", "billing", None);
/// SubscriptionItem (`sitem`, billing).
pub const SITEM: Prefix = Prefix::new("sitem", "SubscriptionItem", "billing", None);
/// ApiUsage (`ause`, billing).
pub const AUSE: Prefix = Prefix::new("ause", "ApiUsage", "billing", None);
/// LedgerAccount (`acc`, ledger).
pub const ACC: Prefix = Prefix::new("acc", "LedgerAccount", "ledger", None);
/// LedgerTransaction (`txn`, ledger).
pub const TXN: Prefix = Prefix::new("txn", "LedgerTransaction", "ledger", None);
/// TrustPolicy (`tpol`, broker).
pub const TPOL: Prefix = Prefix::new("tpol", "TrustPolicy", "broker", Some("trust_policies"));
/// TokenExchange (`tkx`, broker).
pub const TKX: Prefix = Prefix::new("tkx", "TokenExchange", "broker", Some("token_exchanges"));
/// Build (`bld`, build).
pub const BLD: Prefix = Prefix::new("bld", "Build", "build", Some("builds"));
/// BuildCache (`bcc`, build).
pub const BCC: Prefix = Prefix::new("bcc", "BuildCache", "build", Some("build_caches"));
/// ConfigChange (`chg`, config).
pub const CHG: Prefix = Prefix::new("chg", "ConfigChange", "config", Some("config_changes"));
/// ConfigFlag (`flag`, config).
pub const FLAG: Prefix = Prefix::new("flag", "ConfigFlag", "config", Some("config_flags"));
/// ConfigSegment (`seg`, config).
pub const SEG: Prefix = Prefix::new("seg", "ConfigSegment", "config", Some("config_segments"));
/// Connection (`conn`, connections).
pub const CONN: Prefix = Prefix::new("conn", "Connection", "connections", Some("connections"));
/// ConnectionProvider (`cprv`, connections).
pub const CPRV: Prefix = Prefix::new(
    "cprv",
    "ConnectionProvider",
    "connections",
    Some("connection_providers"),
);
/// Bucket (`bkt`, data).
pub const BKT: Prefix = Prefix::new("bkt", "Bucket", "data", Some("buckets"));
/// Database (`db`, data).
pub const DB: Prefix = Prefix::new("db", "Database", "data", Some("databases"));
/// KvNamespace (`kv`, data).
pub const KV: Prefix = Prefix::new("kv", "KvNamespace", "data", Some("kv_namespaces"));
/// SearchIndex (`idx`, data).
pub const IDX: Prefix = Prefix::new("idx", "SearchIndex", "data", Some("search_indexes"));
/// Customer (`cus`, data).
pub const CUS: Prefix = Prefix::new("cus", "Customer", "data", None);
/// Entitlement (`ent`, entitlement).
pub const ENT: Prefix = Prefix::new("ent", "Entitlement", "entitlement", Some("entitlements"));
/// Event (`evt`, events).
pub const EVT: Prefix = Prefix::new("evt", "Event", "events", Some("events"));
/// InboundEndpoint (`ibe`, events).
pub const IBE: Prefix = Prefix::new(
    "ibe",
    "InboundEndpoint",
    "events",
    Some("inbound_endpoints"),
);
/// Queue (`que`, events).
pub const QUE: Prefix = Prefix::new("que", "Queue", "events", Some("queues"));
/// RealtimeChannel (`rtc`, events).
pub const RTC: Prefix = Prefix::new(
    "rtc",
    "RealtimeChannel",
    "events",
    Some("realtime_channels"),
);
/// RealtimeMember (`rtm`, events).
pub const RTM: Prefix = Prefix::new("rtm", "RealtimeMember", "events", Some("realtime_members"));
/// RealtimeMessage (`rtg`, events).
pub const RTG: Prefix = Prefix::new(
    "rtg",
    "RealtimeMessage",
    "events",
    Some("realtime_messages"),
);
/// Subscription (`sub`, events).
pub const SUB: Prefix = Prefix::new("sub", "Subscription", "events", Some("subscriptions"));
/// Topic (`top`, events).
pub const TOP: Prefix = Prefix::new("top", "Topic", "events", Some("topics"));
/// WebhookDelivery (`whd`, events).
pub const WHD: Prefix = Prefix::new(
    "whd",
    "WebhookDelivery",
    "events",
    Some("webhook_deliveries"),
);
/// WebhookEndpoint (`whk`, events).
pub const WHK: Prefix = Prefix::new(
    "whk",
    "WebhookEndpoint",
    "events",
    Some("webhook_endpoints"),
);
/// Preview (`prv`, hosting).
pub const PRV: Prefix = Prefix::new("prv", "Preview", "hosting", Some("previews"));
/// ServiceRollout (`srl`, hosting).
pub const SRL: Prefix = Prefix::new("srl", "ServiceRollout", "hosting", Some("service_rollouts"));
/// Service (`svc`, hosting).
pub const SVC: Prefix = Prefix::new("svc", "Service", "hosting", Some("services"));
/// SourceLink (`slnk`, hosting).
pub const SLNK: Prefix = Prefix::new("slnk", "SourceLink", "hosting", Some("source_links"));
/// Key (`kms`, keys).
pub const KMS: Prefix = Prefix::new("kms", "Key", "keys", Some("keys"));
/// KeyVersion (`kmsv`, keys).
pub const KMSV: Prefix = Prefix::new("kmsv", "KeyVersion", "keys", Some("key_versions"));
/// Certificate (`cert`, network).
pub const CERT: Prefix = Prefix::new("cert", "Certificate", "network", Some("certificates"));
/// Domain (`dom`, network).
pub const DOM: Prefix = Prefix::new("dom", "Domain", "network", Some("domains"));
/// EgressIdentity (`egr`, network).
pub const EGR: Prefix = Prefix::new(
    "egr",
    "EgressIdentity",
    "network",
    Some("egress_identities"),
);
/// PrivateLink (`plk`, network).
pub const PLK: Prefix = Prefix::new("plk", "PrivateLink", "network", Some("private_links"));
/// Route (`rt`, network).
pub const RT: Prefix = Prefix::new("rt", "Route", "network", Some("routes"));
/// Broadcast (`bcst`, notify).
pub const BCST: Prefix = Prefix::new("bcst", "Broadcast", "notify", Some("broadcasts"));
/// InboundEmail (`iem`, notify).
pub const IEM: Prefix = Prefix::new("iem", "InboundEmail", "notify", Some("inbound_emails"));
/// InboxItem (`inbx`, notify).
pub const INBX: Prefix = Prefix::new("inbx", "InboxItem", "notify", Some("inbox_items"));
/// Mailbox (`mbx`, notify).
pub const MBX: Prefix = Prefix::new("mbx", "Mailbox", "notify", Some("mailboxes"));
/// MailboxConnectLink (`mcl`, notify).
pub const MCL: Prefix = Prefix::new(
    "mcl",
    "MailboxConnectLink",
    "notify",
    Some("mailbox_connect_links"),
);
/// MailboxOauthApp (`moa`, notify).
pub const MOA: Prefix = Prefix::new(
    "moa",
    "MailboxOauthApp",
    "notify",
    Some("mailbox_oauth_apps"),
);
/// Message (`msg`, notify).
pub const MSG: Prefix = Prefix::new("msg", "Message", "notify", Some("messages"));
/// MessageTopic (`tpc`, notify).
pub const TPC: Prefix = Prefix::new("tpc", "MessageTopic", "notify", Some("message_topics"));
/// Preference (`prf`, notify).
pub const PRF: Prefix = Prefix::new("prf", "Preference", "notify", Some("preferences"));
/// Recipient (`rcp`, notify).
pub const RCP: Prefix = Prefix::new("rcp", "Recipient", "notify", Some("recipients"));
/// Sender (`snd`, notify).
pub const SND: Prefix = Prefix::new("snd", "Sender", "notify", Some("senders"));
/// EmailDomain (`sdm`, notify).
pub const SDM: Prefix = Prefix::new("sdm", "EmailDomain", "notify", Some("mail_domains"));
/// Suppression (`sup`, notify).
pub const SUP: Prefix = Prefix::new("sup", "Suppression", "notify", Some("suppressions"));
/// Template (`tmpl`, notify).
pub const TMPL: Prefix = Prefix::new("tmpl", "Template", "notify", Some("templates"));
/// AnalyticsEvent (`aev`, analytics).
pub const AEV: Prefix = Prefix::new(
    "aev",
    "AnalyticsEvent",
    "analytics",
    Some("analytics_events"),
);
/// ErrorEvent (`eev`, observability).
pub const EEV: Prefix = Prefix::new("eev", "ErrorEvent", "observability", Some("error_events"));
/// ErrorGroup (`egrp`, observability).
pub const EGRP: Prefix = Prefix::new("egrp", "ErrorGroup", "observability", Some("error_groups"));
/// LogEntry (`log`, observability).
pub const LOG: Prefix = Prefix::new("log", "LogEntry", "observability", Some("log_entries"));
/// ScrubbingPolicy (`scrp`, observability).
pub const SCRP: Prefix = Prefix::new(
    "scrp",
    "ScrubbingPolicy",
    "observability",
    Some("scrubbing_policies"),
);
/// SourceMap (`smap`, observability).
pub const SMAP: Prefix = Prefix::new("smap", "SourceMap", "observability", Some("source_maps"));
/// Trace (`trc`, observability).
pub const TRC: Prefix = Prefix::new("trc", "Trace", "observability", Some("traces"));
/// Generation (`gen`, observability).
pub const GEN: Prefix = Prefix::new("gen", "Generation", "observability", Some("generations"));
/// ErrorRecord (`err`, observability).
pub const ERR: Prefix = Prefix::new("err", "ErrorRecord", "observability", None);
/// Release (`rel`, release).
pub const REL: Prefix = Prefix::new("rel", "Release", "release", Some("releases"));
/// Rollout (`rol`, release).
pub const ROL: Prefix = Prefix::new("rol", "Rollout", "release", Some("rollouts"));
/// Runner (`run`, runners).
pub const RUN: Prefix = Prefix::new("run", "Runner", "runners", Some("runners"));
/// ScaleSet (`sset`, runners).
pub const SSET: Prefix = Prefix::new("sset", "ScaleSet", "runners", Some("scale_sets"));
/// Lease (`lse`, sandboxes).
pub const LSE: Prefix = Prefix::new("lse", "Lease", "sandboxes", Some("leases"));
/// LeaseEvent (`lev`, sandboxes).
pub const LEV: Prefix = Prefix::new("lev", "LeaseEvent", "sandboxes", Some("lease_events"));
/// Pool (`pool`, sandboxes).
pub const POOL: Prefix = Prefix::new("pool", "Pool", "sandboxes", Some("pools"));
/// Shape (`shp`, sandboxes).
pub const SHP: Prefix = Prefix::new("shp", "Shape", "sandboxes", Some("sandbox_shapes"));
/// Snapshot (`snap`, sandboxes).
pub const SNAP: Prefix = Prefix::new("snap", "Snapshot", "sandboxes", Some("snapshots"));
/// Volume (`vol`, sandboxes).
pub const VOL: Prefix = Prefix::new("vol", "Volume", "sandboxes", Some("volumes"));
/// Sandbox (`sbx`, sandboxes).
pub const SBX: Prefix = Prefix::new("sbx", "Sandbox", "sandboxes", None);
/// Secret (`sec`, secrets).
pub const SEC: Prefix = Prefix::new("sec", "Secret", "secrets", Some("secrets"));
/// SecretVersion (`secv`, secrets).
pub const SECV: Prefix = Prefix::new("secv", "SecretVersion", "secrets", Some("secret_versions"));
/// SecretBinding (`secb`, secrets).
pub const SECB: Prefix = Prefix::new("secb", "SecretBinding", "secrets", Some("secret_bindings"));
/// Profile (`pfl`, secrets).
pub const PFL: Prefix = Prefix::new("pfl", "Profile", "secrets", Some("profiles"));
/// ProfileVersion (`pflv`, secrets).
pub const PFLV: Prefix = Prefix::new(
    "pflv",
    "ProfileVersion",
    "secrets",
    Some("profile_versions"),
);
/// ProfileAttachment (`pfla`, secrets).
pub const PFLA: Prefix = Prefix::new("pfla", "ProfileAttachment", "secrets", None);
/// Run (`job`, workflows).
pub const JOB: Prefix = Prefix::new("job", "Run", "workflows", Some("runs"));
/// Schedule (`sched`, workflows).
pub const SCHED: Prefix = Prefix::new("sched", "Schedule", "workflows", Some("schedules"));
/// Workflow (`wf`, workflows).
pub const WF: Prefix = Prefix::new("wf", "Workflow", "workflows", Some("workflows"));
/// EnvService (`esvc`, platform).
pub const ESVC: Prefix = Prefix::new("esvc", "EnvService", "platform", None);
/// Deploy (`dpl`, platform).
pub const DPL: Prefix = Prefix::new("dpl", "Deploy", "platform", None);
/// Token (`tok`, platform).
pub const TOK: Prefix = Prefix::new("tok", "Token", "platform", None);
/// Task (`task`, platform).
pub const TASK: Prefix = Prefix::new("task", "Task", "platform", None);
/// ContainerExecution (`cex`, platform).
pub const CEX: Prefix = Prefix::new("cex", "ContainerExecution", "platform", None);
/// VolumeMount (`vmnt`, platform).
pub const VMNT: Prefix = Prefix::new("vmnt", "VolumeMount", "platform", None);
/// Workspace (`wksp`, platform).
pub const WKSP: Prefix = Prefix::new("wksp", "Workspace", "platform", None);
/// MobileDeviceTest (`mdt`, platform).
pub const MDT: Prefix = Prefix::new("mdt", "MobileDeviceTest", "platform", None);
/// MobileDevice (`mdev`, platform).
pub const MDEV: Prefix = Prefix::new("mdev", "MobileDevice", "platform", None);
/// CallbackTarget (`cbt`, platform).
pub const CBT: Prefix = Prefix::new("cbt", "CallbackTarget", "platform", None);
/// DeviceSession (`dvs`, platform).
pub const DVS: Prefix = Prefix::new("dvs", "DeviceSession", "platform", None);
/// ManagedResource (`res`, platform).
pub const RES: Prefix = Prefix::new("res", "ManagedResource", "platform", None);
/// BranchDatabase (`dbbr`, platform).
pub const DBBR: Prefix = Prefix::new("dbbr", "BranchDatabase", "platform", None);
/// RestoreOperation (`rstr`, platform).
pub const RSTR: Prefix = Prefix::new("rstr", "RestoreOperation", "platform", None);
/// Proxy (`prx`, platform).
pub const PRX: Prefix = Prefix::new("prx", "Proxy", "platform", None);
/// ProxyRule (`prule`, platform).
pub const PRULE: Prefix = Prefix::new("prule", "ProxyRule", "platform", None);
/// Worker (`wrk`, platform).
pub const WRK: Prefix = Prefix::new("wrk", "Worker", "platform", None);
/// Experiment (`exp`, platform).
pub const EXP: Prefix = Prefix::new("exp", "Experiment", "platform", None);
/// Notification (`ntf`, platform).
pub const NTF: Prefix = Prefix::new("ntf", "Notification", "platform", None);
/// Dispatch (`disp`, platform).
pub const DISP: Prefix = Prefix::new("disp", "Dispatch", "platform", None);
/// TaskDefinition (`tdef`, platform).
pub const TDEF: Prefix = Prefix::new("tdef", "TaskDefinition", "platform", None);
/// Alert (`alrt`, platform).
pub const ALRT: Prefix = Prefix::new("alrt", "Alert", "platform", None);
/// Document (`doc`, platform).
pub const DOC: Prefix = Prefix::new("doc", "Document", "platform", None);
/// File (`file`, platform).
pub const FILE: Prefix = Prefix::new("file", "File", "platform", None);
/// PushSegment (`pseg`, platform).
pub const PSEG: Prefix = Prefix::new("pseg", "PushSegment", "platform", None);
/// PushCampaign (`pcam`, platform).
pub const PCAM: Prefix = Prefix::new("pcam", "PushCampaign", "platform", None);
/// PushDelivery (`pdly`, platform).
pub const PDLY: Prefix = Prefix::new("pdly", "PushDelivery", "platform", None);
/// FileVersion (`fver`, platform).
pub const FVER: Prefix = Prefix::new("fver", "FileVersion", "platform", None);
/// Achievement (`achv`, platform).
pub const ACHV: Prefix = Prefix::new("achv", "Achievement", "platform", None);
/// Leaderboard (`ldb`, platform).
pub const LDB: Prefix = Prefix::new("ldb", "Leaderboard", "platform", None);
/// Cohort (`coh`, platform).
pub const COH: Prefix = Prefix::new("coh", "Cohort", "platform", None);
/// AnalyticsDestination (`adst`, platform).
pub const ADST: Prefix = Prefix::new("adst", "AnalyticsDestination", "platform", None);
/// DestinationLog (`dlg`, platform).
pub const DLG: Prefix = Prefix::new("dlg", "DestinationLog", "platform", None);
/// Referral (`ref`, platform).
pub const REF: Prefix = Prefix::new("ref", "Referral", "platform", None);
/// PromoCode (`promo`, platform).
pub const PROMO: Prefix = Prefix::new("promo", "PromoCode", "platform", None);
/// NewsletterSubscriber (`nsub`, platform).
pub const NSUB: Prefix = Prefix::new("nsub", "NewsletterSubscriber", "platform", None);
/// NewsletterSequence (`nseq`, platform).
pub const NSEQ: Prefix = Prefix::new("nseq", "NewsletterSequence", "platform", None);
/// NewsletterStep (`nst`, platform).
pub const NST: Prefix = Prefix::new("nst", "NewsletterStep", "platform", None);
/// SamlProvider (`idp`, platform).
pub const IDP: Prefix = Prefix::new("idp", "SamlProvider", "platform", None);
/// SamlLog (`slog`, platform).
pub const SLOG: Prefix = Prefix::new("slog", "SamlLog", "platform", None);
/// ConfigFile (`cfg`, platform).
pub const CFG: Prefix = Prefix::new("cfg", "ConfigFile", "platform", None);
/// Binding (`bnd`, platform).
pub const BND: Prefix = Prefix::new("bnd", "Binding", "platform", None);
/// AuditLog (`audt`, platform).
pub const AUDT: Prefix = Prefix::new("audt", "AuditLog", "platform", None);
/// Permission (`perm`, platform).
pub const PERM: Prefix = Prefix::new("perm", "Permission", "platform", None);
/// Role (`role`, platform).
pub const ROLE: Prefix = Prefix::new("role", "Role", "platform", None);
/// ServiceAccount (`sa`, platform).
pub const SA: Prefix = Prefix::new("sa", "ServiceAccount", "platform", None);
/// Request (`req`, platform).
pub const REQ: Prefix = Prefix::new("req", "Request", "platform", None);
/// PriceCatalog (`cat`, money).
pub const CAT: Prefix = Prefix::new("cat", "PriceCatalog", "money", Some("price_catalogs"));
/// CheckoutSession (`cks`, money).
pub const CKS: Prefix = Prefix::new("cks", "CheckoutSession", "money", Some("checkout_sessions"));
/// CheckoutPolicy (`cpl`, money).
pub const CPL: Prefix = Prefix::new("cpl", "CheckoutPolicy", "money", Some("checkout_policies"));
/// CustomerSubscription (`csub`, money).
pub const CSUB: Prefix = Prefix::new(
    "csub",
    "CustomerSubscription",
    "money",
    Some("customer_subscriptions"),
);
/// EntitlementGrant (`egnt`, money).
pub const EGNT: Prefix = Prefix::new(
    "egnt",
    "EntitlementGrant",
    "money",
    Some("entitlement_grants"),
);
/// LicenceKey (`lkey`, money).
pub const LKEY: Prefix = Prefix::new("lkey", "LicenceKey", "money", Some("licence_keys"));
/// LicenceToken (`ltok`, money).
pub const LTOK: Prefix = Prefix::new("ltok", "LicenceToken", "money", Some("licence_tokens"));
/// RevenueSource (`rvs`, money).
pub const RVS: Prefix = Prefix::new("rvs", "RevenueSource", "money", Some("revenue_sources"));
/// RevenueFact (`rvf`, money).
pub const RVF: Prefix = Prefix::new("rvf", "RevenueFact", "money", Some("revenue_facts"));
/// RevenueSummary (`rvsum`, money).
pub const RVSUM: Prefix = Prefix::new("rvsum", "RevenueSummary", "money", Some("revenue"));
/// ExchangeRate (`fxr`, money).
pub const FXR: Prefix = Prefix::new("fxr", "ExchangeRate", "money", Some("exchange_rates"));
/// MerchantAccount (`mact`, money).
pub const MACT: Prefix = Prefix::new(
    "mact",
    "MerchantAccount",
    "money",
    Some("merchant_accounts"),
);
/// PortalSession (`psn`, money).
pub const PSN: Prefix = Prefix::new("psn", "PortalSession", "money", Some("portal_sessions"));
/// StoreConnection (`scn`, money).
pub const SCN: Prefix = Prefix::new("scn", "StoreConnection", "money", Some("store_connections"));
/// StorePurchase (`spu`, money).
pub const SPU: Prefix = Prefix::new("spu", "StorePurchase", "money", Some("store_purchases"));
/// UsageReservation (`ures`, money).
pub const URES: Prefix = Prefix::new(
    "ures",
    "UsageReservation",
    "money",
    Some("usage_reservations"),
);
/// UsageEvent (`uevt`, money).
pub const UEVT: Prefix = Prefix::new("uevt", "UsageEvent", "money", Some("usage_events"));
/// CreditGrant (`cgrt`, money).
pub const CGRT: Prefix = Prefix::new("cgrt", "CreditGrant", "money", Some("credit_grants"));
/// UsageInvoice (`uinv`, money).
pub const UINV: Prefix = Prefix::new("uinv", "UsageInvoice", "money", Some("usage_invoices"));
/// UsageSettings (`uset`, money).
pub const USET: Prefix = Prefix::new("uset", "UsageSettings", "money", Some("usage_settings"));
/// UsageTier (`utier`, money).
pub const UTIER: Prefix = Prefix::new("utier", "UsageTier", "money", Some("usage_tiers"));
/// UsageMeter (`umtr`, money).
pub const UMTR: Prefix = Prefix::new("umtr", "UsageMeter", "money", Some("usage_meters"));
/// UsageMeterPrice (`umpr`, money).
pub const UMPR: Prefix = Prefix::new(
    "umpr",
    "UsageMeterPrice",
    "money",
    Some("usage_meter_prices"),
);
/// Space (`spc`, knowledge).
pub const SPC: Prefix = Prefix::new("spc", "Space", "knowledge", Some("spaces"));
/// Episode (`epi`, knowledge).
pub const EPI: Prefix = Prefix::new("epi", "Episode", "knowledge", Some("episodes"));
/// Entity (`ken`, knowledge).
pub const KEN: Prefix = Prefix::new("ken", "Entity", "knowledge", Some("entities"));
/// Relation (`krel`, knowledge).
pub const KREL: Prefix = Prefix::new("krel", "Relation", "knowledge", Some("relations"));
/// KnowledgeSchema (`ksch`, knowledge).
pub const KSCH: Prefix = Prefix::new(
    "ksch",
    "KnowledgeSchema",
    "knowledge",
    Some("knowledge_schemas"),
);
/// SmsNumber (`snum`, notify).
pub const SNUM: Prefix = Prefix::new("snum", "SmsNumber", "notify", Some("sms_numbers"));
/// InboundSms (`isms`, notify).
pub const ISMS: Prefix = Prefix::new("isms", "InboundSms", "notify", Some("inbound_sms"));
/// PhoneNumber (`pnum`, notify).
pub const PNUM: Prefix = Prefix::new("pnum", "PhoneNumber", "notify", Some("phone_numbers"));
/// UptimeCheck (`upt`, observability).
pub const UPT: Prefix = Prefix::new("upt", "UptimeCheck", "observability", Some("uptime_checks"));
/// ServingRoute (`svrt`, hosting).
pub const SVRT: Prefix = Prefix::new("svrt", "ServingRoute", "hosting", Some("serving_routes"));
/// ServiceObservation (`svob`, hosting).
pub const SVOB: Prefix = Prefix::new(
    "svob",
    "ServiceObservation",
    "hosting",
    Some("service_observations"),
);
/// UptimeSource (`upsrc`, observability).
pub const UPSRC: Prefix = Prefix::new(
    "upsrc",
    "UptimeSource",
    "observability",
    Some("uptime_sources"),
);
/// UptimeManifest (`upmf`, hosting).
pub const UPMF: Prefix = Prefix::new(
    "upmf",
    "UptimeManifest",
    "hosting",
    Some("uptime_manifests"),
);
/// ProcessorEvent (`pev`, money).
pub const PEV: Prefix = Prefix::new("pev", "ProcessorEvent", "money", Some("processor_events"));

/// Every registered prefix, in registry order.
pub const ALL: &[Prefix] = &[
    ORG, PRJ, ENV, KEY, PRN, DVG, DLGT, OMB, MBR, USR, SESS, ACFG, AORG, COR, EDM, IVT, OAC, ORL,
    TIS, AGT, AGV, ASES, GOAL, SEVT, MST, MEM, AOP, MDL, AI, LLM, ART, BAC, BLS, INV, MET, PLAN,
    URP, BSUB, SITEM, AUSE, ACC, TXN, TPOL, TKX, BLD, BCC, CHG, FLAG, SEG, CONN, CPRV, BKT, DB, KV,
    IDX, CUS, ENT, EVT, IBE, QUE, RTC, RTM, RTG, SUB, TOP, WHD, WHK, PRV, SRL, SVC, SLNK, KMS,
    KMSV, CERT, DOM, EGR, PLK, RT, BCST, IEM, INBX, MBX, MCL, MOA, MSG, TPC, PRF, RCP, SND, SDM,
    SUP, TMPL, AEV, EEV, EGRP, LOG, SCRP, SMAP, TRC, GEN, ERR, REL, ROL, RUN, SSET, LSE, LEV, POOL,
    SHP, SNAP, VOL, SBX, SEC, SECV, SECB, PFL, PFLV, PFLA, JOB, SCHED, WF, ESVC, DPL, TOK, TASK,
    CEX, VMNT, WKSP, MDT, MDEV, CBT, DVS, RES, DBBR, RSTR, PRX, PRULE, WRK, EXP, NTF, DISP, TDEF,
    ALRT, DOC, FILE, PSEG, PCAM, PDLY, FVER, ACHV, LDB, COH, ADST, DLG, REF, PROMO, NSUB, NSEQ,
    NST, IDP, SLOG, CFG, BND, AUDT, PERM, ROLE, SA, REQ, CAT, CKS, CPL, CSUB, EGNT, LKEY, LTOK,
    RVS, RVF, RVSUM, FXR, MACT, PSN, SCN, SPU, URES, UEVT, CGRT, UINV, USET, UTIER, UMTR, UMPR,
    SPC, EPI, KEN, KREL, KSCH, SNUM, ISMS, PNUM, UPT, SVRT, SVOB, UPSRC, UPMF, PEV,
];