@atproto/pds 0.4.156 → 0.4.157
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.
- package/CHANGELOG.md +9 -0
- package/dist/lexicon/index.d.ts +15 -0
- package/dist/lexicon/index.d.ts.map +1 -1
- package/dist/lexicon/index.js +40 -1
- package/dist/lexicon/index.js.map +1 -1
- package/dist/lexicon/lexicons.d.ts +10972 -10140
- package/dist/lexicon/lexicons.d.ts.map +1 -1
- package/dist/lexicon/lexicons.js +446 -0
- package/dist/lexicon/lexicons.js.map +1 -1
- package/dist/lexicon/types/tools/ozone/safelink/addRule.d.ts +47 -0
- package/dist/lexicon/types/tools/ozone/safelink/addRule.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/safelink/addRule.js +7 -0
- package/dist/lexicon/types/tools/ozone/safelink/addRule.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/safelink/defs.d.ts +47 -0
- package/dist/lexicon/types/tools/ozone/safelink/defs.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/safelink/defs.js +25 -0
- package/dist/lexicon/types/tools/ozone/safelink/defs.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/safelink/queryEvents.d.ts +51 -0
- package/dist/lexicon/types/tools/ozone/safelink/queryEvents.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/safelink/queryEvents.js +7 -0
- package/dist/lexicon/types/tools/ozone/safelink/queryEvents.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/safelink/queryRules.d.ts +57 -0
- package/dist/lexicon/types/tools/ozone/safelink/queryRules.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/safelink/queryRules.js +7 -0
- package/dist/lexicon/types/tools/ozone/safelink/queryRules.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/safelink/removeRule.d.ts +45 -0
- package/dist/lexicon/types/tools/ozone/safelink/removeRule.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/safelink/removeRule.js +7 -0
- package/dist/lexicon/types/tools/ozone/safelink/removeRule.js.map +1 -0
- package/dist/lexicon/types/tools/ozone/safelink/updateRule.d.ts +47 -0
- package/dist/lexicon/types/tools/ozone/safelink/updateRule.d.ts.map +1 -0
- package/dist/lexicon/types/tools/ozone/safelink/updateRule.js +7 -0
- package/dist/lexicon/types/tools/ozone/safelink/updateRule.js.map +1 -0
- package/dist/pipethrough.js +5 -0
- package/dist/pipethrough.js.map +1 -1
- package/package.json +5 -5
- package/src/lexicon/index.ts +70 -0
- package/src/lexicon/lexicons.ts +451 -0
- package/src/lexicon/types/tools/ozone/safelink/addRule.ts +64 -0
- package/src/lexicon/types/tools/ozone/safelink/defs.ts +76 -0
- package/src/lexicon/types/tools/ozone/safelink/queryEvents.ts +68 -0
- package/src/lexicon/types/tools/ozone/safelink/queryRules.ts +74 -0
- package/src/lexicon/types/tools/ozone/safelink/removeRule.ts +62 -0
- package/src/lexicon/types/tools/ozone/safelink/updateRule.ts +64 -0
- package/src/pipethrough.ts +5 -0
- package/tsconfig.build.tsbuildinfo +1 -1
package/src/lexicon/lexicons.ts
CHANGED
@@ -15386,6 +15386,451 @@ export const schemaDict = {
|
|
15386
15386
|
},
|
15387
15387
|
},
|
15388
15388
|
},
|
15389
|
+
ToolsOzoneSafelinkAddRule: {
|
15390
|
+
lexicon: 1,
|
15391
|
+
id: 'tools.ozone.safelink.addRule',
|
15392
|
+
defs: {
|
15393
|
+
main: {
|
15394
|
+
type: 'procedure',
|
15395
|
+
description: 'Add a new URL safety rule',
|
15396
|
+
input: {
|
15397
|
+
encoding: 'application/json',
|
15398
|
+
schema: {
|
15399
|
+
type: 'object',
|
15400
|
+
required: ['url', 'pattern', 'action', 'reason'],
|
15401
|
+
properties: {
|
15402
|
+
url: {
|
15403
|
+
type: 'string',
|
15404
|
+
description: 'The URL or domain to apply the rule to',
|
15405
|
+
},
|
15406
|
+
pattern: {
|
15407
|
+
type: 'ref',
|
15408
|
+
ref: 'lex:tools.ozone.safelink.defs#patternType',
|
15409
|
+
},
|
15410
|
+
action: {
|
15411
|
+
type: 'ref',
|
15412
|
+
ref: 'lex:tools.ozone.safelink.defs#actionType',
|
15413
|
+
},
|
15414
|
+
reason: {
|
15415
|
+
type: 'ref',
|
15416
|
+
ref: 'lex:tools.ozone.safelink.defs#reasonType',
|
15417
|
+
},
|
15418
|
+
comment: {
|
15419
|
+
type: 'string',
|
15420
|
+
description: 'Optional comment about the decision',
|
15421
|
+
},
|
15422
|
+
createdBy: {
|
15423
|
+
type: 'string',
|
15424
|
+
format: 'did',
|
15425
|
+
description: 'Author DID. Only respected when using admin auth',
|
15426
|
+
},
|
15427
|
+
},
|
15428
|
+
},
|
15429
|
+
},
|
15430
|
+
output: {
|
15431
|
+
encoding: 'application/json',
|
15432
|
+
schema: {
|
15433
|
+
type: 'ref',
|
15434
|
+
ref: 'lex:tools.ozone.safelink.defs#event',
|
15435
|
+
},
|
15436
|
+
},
|
15437
|
+
errors: [
|
15438
|
+
{
|
15439
|
+
name: 'InvalidUrl',
|
15440
|
+
description: 'The provided URL is invalid',
|
15441
|
+
},
|
15442
|
+
{
|
15443
|
+
name: 'RuleAlreadyExists',
|
15444
|
+
description: 'A rule for this URL/domain already exists',
|
15445
|
+
},
|
15446
|
+
],
|
15447
|
+
},
|
15448
|
+
},
|
15449
|
+
},
|
15450
|
+
ToolsOzoneSafelinkDefs: {
|
15451
|
+
lexicon: 1,
|
15452
|
+
id: 'tools.ozone.safelink.defs',
|
15453
|
+
defs: {
|
15454
|
+
event: {
|
15455
|
+
type: 'object',
|
15456
|
+
description: 'An event for URL safety decisions',
|
15457
|
+
required: [
|
15458
|
+
'id',
|
15459
|
+
'eventType',
|
15460
|
+
'url',
|
15461
|
+
'pattern',
|
15462
|
+
'action',
|
15463
|
+
'reason',
|
15464
|
+
'createdBy',
|
15465
|
+
'createdAt',
|
15466
|
+
],
|
15467
|
+
properties: {
|
15468
|
+
id: {
|
15469
|
+
type: 'integer',
|
15470
|
+
description: 'Auto-incrementing row ID',
|
15471
|
+
},
|
15472
|
+
eventType: {
|
15473
|
+
type: 'ref',
|
15474
|
+
ref: 'lex:tools.ozone.safelink.defs#eventType',
|
15475
|
+
},
|
15476
|
+
url: {
|
15477
|
+
type: 'string',
|
15478
|
+
description: 'The URL that this rule applies to',
|
15479
|
+
},
|
15480
|
+
pattern: {
|
15481
|
+
type: 'ref',
|
15482
|
+
ref: 'lex:tools.ozone.safelink.defs#patternType',
|
15483
|
+
},
|
15484
|
+
action: {
|
15485
|
+
type: 'ref',
|
15486
|
+
ref: 'lex:tools.ozone.safelink.defs#actionType',
|
15487
|
+
},
|
15488
|
+
reason: {
|
15489
|
+
type: 'ref',
|
15490
|
+
ref: 'lex:tools.ozone.safelink.defs#reasonType',
|
15491
|
+
},
|
15492
|
+
createdBy: {
|
15493
|
+
type: 'string',
|
15494
|
+
format: 'did',
|
15495
|
+
description: 'DID of the user who created this rule',
|
15496
|
+
},
|
15497
|
+
createdAt: {
|
15498
|
+
type: 'string',
|
15499
|
+
format: 'datetime',
|
15500
|
+
},
|
15501
|
+
comment: {
|
15502
|
+
type: 'string',
|
15503
|
+
description: 'Optional comment about the decision',
|
15504
|
+
},
|
15505
|
+
},
|
15506
|
+
},
|
15507
|
+
eventType: {
|
15508
|
+
type: 'string',
|
15509
|
+
knownValues: ['addRule', 'updateRule', 'removeRule'],
|
15510
|
+
},
|
15511
|
+
patternType: {
|
15512
|
+
type: 'string',
|
15513
|
+
knownValues: ['domain', 'url'],
|
15514
|
+
},
|
15515
|
+
actionType: {
|
15516
|
+
type: 'string',
|
15517
|
+
knownValues: ['block', 'warn', 'whitelist'],
|
15518
|
+
},
|
15519
|
+
reasonType: {
|
15520
|
+
type: 'string',
|
15521
|
+
knownValues: ['csam', 'spam', 'phishing', 'none'],
|
15522
|
+
},
|
15523
|
+
urlRule: {
|
15524
|
+
type: 'object',
|
15525
|
+
description: 'Input for creating a URL safety rule',
|
15526
|
+
required: [
|
15527
|
+
'url',
|
15528
|
+
'pattern',
|
15529
|
+
'action',
|
15530
|
+
'reason',
|
15531
|
+
'createdBy',
|
15532
|
+
'createdAt',
|
15533
|
+
'updatedAt',
|
15534
|
+
],
|
15535
|
+
properties: {
|
15536
|
+
url: {
|
15537
|
+
type: 'string',
|
15538
|
+
description: 'The URL or domain to apply the rule to',
|
15539
|
+
},
|
15540
|
+
pattern: {
|
15541
|
+
type: 'ref',
|
15542
|
+
ref: 'lex:tools.ozone.safelink.defs#patternType',
|
15543
|
+
},
|
15544
|
+
action: {
|
15545
|
+
type: 'ref',
|
15546
|
+
ref: 'lex:tools.ozone.safelink.defs#actionType',
|
15547
|
+
},
|
15548
|
+
reason: {
|
15549
|
+
type: 'ref',
|
15550
|
+
ref: 'lex:tools.ozone.safelink.defs#reasonType',
|
15551
|
+
},
|
15552
|
+
comment: {
|
15553
|
+
type: 'string',
|
15554
|
+
description: 'Optional comment about the decision',
|
15555
|
+
},
|
15556
|
+
createdBy: {
|
15557
|
+
type: 'string',
|
15558
|
+
format: 'did',
|
15559
|
+
description: 'DID of the user added the rule.',
|
15560
|
+
},
|
15561
|
+
createdAt: {
|
15562
|
+
type: 'string',
|
15563
|
+
format: 'datetime',
|
15564
|
+
description: 'Timestamp when the rule was created',
|
15565
|
+
},
|
15566
|
+
updatedAt: {
|
15567
|
+
type: 'string',
|
15568
|
+
format: 'datetime',
|
15569
|
+
description: 'Timestamp when the rule was last updated',
|
15570
|
+
},
|
15571
|
+
},
|
15572
|
+
},
|
15573
|
+
},
|
15574
|
+
},
|
15575
|
+
ToolsOzoneSafelinkQueryEvents: {
|
15576
|
+
lexicon: 1,
|
15577
|
+
id: 'tools.ozone.safelink.queryEvents',
|
15578
|
+
defs: {
|
15579
|
+
main: {
|
15580
|
+
type: 'procedure',
|
15581
|
+
description: 'Query URL safety audit events',
|
15582
|
+
input: {
|
15583
|
+
encoding: 'application/json',
|
15584
|
+
schema: {
|
15585
|
+
type: 'object',
|
15586
|
+
properties: {
|
15587
|
+
cursor: {
|
15588
|
+
type: 'string',
|
15589
|
+
description: 'Cursor for pagination',
|
15590
|
+
},
|
15591
|
+
limit: {
|
15592
|
+
type: 'integer',
|
15593
|
+
minimum: 1,
|
15594
|
+
maximum: 100,
|
15595
|
+
default: 50,
|
15596
|
+
description: 'Maximum number of results to return',
|
15597
|
+
},
|
15598
|
+
urls: {
|
15599
|
+
type: 'array',
|
15600
|
+
items: {
|
15601
|
+
type: 'string',
|
15602
|
+
},
|
15603
|
+
description: 'Filter by specific URLs or domains',
|
15604
|
+
},
|
15605
|
+
patternType: {
|
15606
|
+
type: 'string',
|
15607
|
+
description: 'Filter by pattern type',
|
15608
|
+
},
|
15609
|
+
sortDirection: {
|
15610
|
+
type: 'string',
|
15611
|
+
knownValues: ['asc', 'desc'],
|
15612
|
+
default: 'desc',
|
15613
|
+
description: 'Sort direction',
|
15614
|
+
},
|
15615
|
+
},
|
15616
|
+
},
|
15617
|
+
},
|
15618
|
+
output: {
|
15619
|
+
encoding: 'application/json',
|
15620
|
+
schema: {
|
15621
|
+
type: 'object',
|
15622
|
+
required: ['events'],
|
15623
|
+
properties: {
|
15624
|
+
cursor: {
|
15625
|
+
type: 'string',
|
15626
|
+
description:
|
15627
|
+
'Next cursor for pagination. Only present if there are more results.',
|
15628
|
+
},
|
15629
|
+
events: {
|
15630
|
+
type: 'array',
|
15631
|
+
items: {
|
15632
|
+
type: 'ref',
|
15633
|
+
ref: 'lex:tools.ozone.safelink.defs#event',
|
15634
|
+
},
|
15635
|
+
},
|
15636
|
+
},
|
15637
|
+
},
|
15638
|
+
},
|
15639
|
+
},
|
15640
|
+
},
|
15641
|
+
},
|
15642
|
+
ToolsOzoneSafelinkQueryRules: {
|
15643
|
+
lexicon: 1,
|
15644
|
+
id: 'tools.ozone.safelink.queryRules',
|
15645
|
+
defs: {
|
15646
|
+
main: {
|
15647
|
+
type: 'procedure',
|
15648
|
+
description: 'Query URL safety rules',
|
15649
|
+
input: {
|
15650
|
+
encoding: 'application/json',
|
15651
|
+
schema: {
|
15652
|
+
type: 'object',
|
15653
|
+
properties: {
|
15654
|
+
cursor: {
|
15655
|
+
type: 'string',
|
15656
|
+
description: 'Cursor for pagination',
|
15657
|
+
},
|
15658
|
+
limit: {
|
15659
|
+
type: 'integer',
|
15660
|
+
minimum: 1,
|
15661
|
+
maximum: 100,
|
15662
|
+
default: 50,
|
15663
|
+
description: 'Maximum number of results to return',
|
15664
|
+
},
|
15665
|
+
urls: {
|
15666
|
+
type: 'array',
|
15667
|
+
items: {
|
15668
|
+
type: 'string',
|
15669
|
+
},
|
15670
|
+
description: 'Filter by specific URLs or domains',
|
15671
|
+
},
|
15672
|
+
patternType: {
|
15673
|
+
type: 'string',
|
15674
|
+
description: 'Filter by pattern type',
|
15675
|
+
},
|
15676
|
+
actions: {
|
15677
|
+
type: 'array',
|
15678
|
+
items: {
|
15679
|
+
type: 'string',
|
15680
|
+
},
|
15681
|
+
description: 'Filter by action types',
|
15682
|
+
},
|
15683
|
+
reason: {
|
15684
|
+
type: 'string',
|
15685
|
+
description: 'Filter by reason type',
|
15686
|
+
},
|
15687
|
+
createdBy: {
|
15688
|
+
type: 'string',
|
15689
|
+
format: 'did',
|
15690
|
+
description: 'Filter by rule creator',
|
15691
|
+
},
|
15692
|
+
sortDirection: {
|
15693
|
+
type: 'string',
|
15694
|
+
knownValues: ['asc', 'desc'],
|
15695
|
+
default: 'desc',
|
15696
|
+
description: 'Sort direction',
|
15697
|
+
},
|
15698
|
+
},
|
15699
|
+
},
|
15700
|
+
},
|
15701
|
+
output: {
|
15702
|
+
encoding: 'application/json',
|
15703
|
+
schema: {
|
15704
|
+
type: 'object',
|
15705
|
+
required: ['rules'],
|
15706
|
+
properties: {
|
15707
|
+
cursor: {
|
15708
|
+
type: 'string',
|
15709
|
+
description:
|
15710
|
+
'Next cursor for pagination. Only present if there are more results.',
|
15711
|
+
},
|
15712
|
+
rules: {
|
15713
|
+
type: 'array',
|
15714
|
+
items: {
|
15715
|
+
type: 'ref',
|
15716
|
+
ref: 'lex:tools.ozone.safelink.defs#urlRule',
|
15717
|
+
},
|
15718
|
+
},
|
15719
|
+
},
|
15720
|
+
},
|
15721
|
+
},
|
15722
|
+
},
|
15723
|
+
},
|
15724
|
+
},
|
15725
|
+
ToolsOzoneSafelinkRemoveRule: {
|
15726
|
+
lexicon: 1,
|
15727
|
+
id: 'tools.ozone.safelink.removeRule',
|
15728
|
+
defs: {
|
15729
|
+
main: {
|
15730
|
+
type: 'procedure',
|
15731
|
+
description: 'Remove an existing URL safety rule',
|
15732
|
+
input: {
|
15733
|
+
encoding: 'application/json',
|
15734
|
+
schema: {
|
15735
|
+
type: 'object',
|
15736
|
+
required: ['url', 'pattern'],
|
15737
|
+
properties: {
|
15738
|
+
url: {
|
15739
|
+
type: 'string',
|
15740
|
+
description: 'The URL or domain to remove the rule for',
|
15741
|
+
},
|
15742
|
+
pattern: {
|
15743
|
+
type: 'ref',
|
15744
|
+
ref: 'lex:tools.ozone.safelink.defs#patternType',
|
15745
|
+
},
|
15746
|
+
comment: {
|
15747
|
+
type: 'string',
|
15748
|
+
description:
|
15749
|
+
'Optional comment about why the rule is being removed',
|
15750
|
+
},
|
15751
|
+
createdBy: {
|
15752
|
+
type: 'string',
|
15753
|
+
format: 'did',
|
15754
|
+
description:
|
15755
|
+
'Optional DID of the user. Only respected when using admin auth.',
|
15756
|
+
},
|
15757
|
+
},
|
15758
|
+
},
|
15759
|
+
},
|
15760
|
+
output: {
|
15761
|
+
encoding: 'application/json',
|
15762
|
+
schema: {
|
15763
|
+
type: 'ref',
|
15764
|
+
ref: 'lex:tools.ozone.safelink.defs#event',
|
15765
|
+
},
|
15766
|
+
},
|
15767
|
+
errors: [
|
15768
|
+
{
|
15769
|
+
name: 'RuleNotFound',
|
15770
|
+
description: 'No active rule found for this URL/domain',
|
15771
|
+
},
|
15772
|
+
],
|
15773
|
+
},
|
15774
|
+
},
|
15775
|
+
},
|
15776
|
+
ToolsOzoneSafelinkUpdateRule: {
|
15777
|
+
lexicon: 1,
|
15778
|
+
id: 'tools.ozone.safelink.updateRule',
|
15779
|
+
defs: {
|
15780
|
+
main: {
|
15781
|
+
type: 'procedure',
|
15782
|
+
description: 'Update an existing URL safety rule',
|
15783
|
+
input: {
|
15784
|
+
encoding: 'application/json',
|
15785
|
+
schema: {
|
15786
|
+
type: 'object',
|
15787
|
+
required: ['url', 'pattern', 'action', 'reason'],
|
15788
|
+
properties: {
|
15789
|
+
url: {
|
15790
|
+
type: 'string',
|
15791
|
+
description: 'The URL or domain to update the rule for',
|
15792
|
+
},
|
15793
|
+
pattern: {
|
15794
|
+
type: 'ref',
|
15795
|
+
ref: 'lex:tools.ozone.safelink.defs#patternType',
|
15796
|
+
},
|
15797
|
+
action: {
|
15798
|
+
type: 'ref',
|
15799
|
+
ref: 'lex:tools.ozone.safelink.defs#actionType',
|
15800
|
+
},
|
15801
|
+
reason: {
|
15802
|
+
type: 'ref',
|
15803
|
+
ref: 'lex:tools.ozone.safelink.defs#reasonType',
|
15804
|
+
},
|
15805
|
+
comment: {
|
15806
|
+
type: 'string',
|
15807
|
+
description: 'Optional comment about the update',
|
15808
|
+
},
|
15809
|
+
createdBy: {
|
15810
|
+
type: 'string',
|
15811
|
+
format: 'did',
|
15812
|
+
description:
|
15813
|
+
'Optional DID to credit as the creator. Only respected for admin_token authentication.',
|
15814
|
+
},
|
15815
|
+
},
|
15816
|
+
},
|
15817
|
+
},
|
15818
|
+
output: {
|
15819
|
+
encoding: 'application/json',
|
15820
|
+
schema: {
|
15821
|
+
type: 'ref',
|
15822
|
+
ref: 'lex:tools.ozone.safelink.defs#event',
|
15823
|
+
},
|
15824
|
+
},
|
15825
|
+
errors: [
|
15826
|
+
{
|
15827
|
+
name: 'RuleNotFound',
|
15828
|
+
description: 'No active rule found for this URL/domain',
|
15829
|
+
},
|
15830
|
+
],
|
15831
|
+
},
|
15832
|
+
},
|
15833
|
+
},
|
15389
15834
|
ToolsOzoneServerGetConfig: {
|
15390
15835
|
lexicon: 1,
|
15391
15836
|
id: 'tools.ozone.server.getConfig',
|
@@ -17041,6 +17486,12 @@ export const ids = {
|
|
17041
17486
|
ToolsOzoneModerationQueryEvents: 'tools.ozone.moderation.queryEvents',
|
17042
17487
|
ToolsOzoneModerationQueryStatuses: 'tools.ozone.moderation.queryStatuses',
|
17043
17488
|
ToolsOzoneModerationSearchRepos: 'tools.ozone.moderation.searchRepos',
|
17489
|
+
ToolsOzoneSafelinkAddRule: 'tools.ozone.safelink.addRule',
|
17490
|
+
ToolsOzoneSafelinkDefs: 'tools.ozone.safelink.defs',
|
17491
|
+
ToolsOzoneSafelinkQueryEvents: 'tools.ozone.safelink.queryEvents',
|
17492
|
+
ToolsOzoneSafelinkQueryRules: 'tools.ozone.safelink.queryRules',
|
17493
|
+
ToolsOzoneSafelinkRemoveRule: 'tools.ozone.safelink.removeRule',
|
17494
|
+
ToolsOzoneSafelinkUpdateRule: 'tools.ozone.safelink.updateRule',
|
17044
17495
|
ToolsOzoneServerGetConfig: 'tools.ozone.server.getConfig',
|
17045
17496
|
ToolsOzoneSetAddValues: 'tools.ozone.set.addValues',
|
17046
17497
|
ToolsOzoneSetDefs: 'tools.ozone.set.defs',
|
@@ -0,0 +1,64 @@
|
|
1
|
+
/**
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
3
|
+
*/
|
4
|
+
import express from 'express'
|
5
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
6
|
+
import { CID } from 'multiformats/cid'
|
7
|
+
import { validate as _validate } from '../../../../lexicons'
|
8
|
+
import {
|
9
|
+
type $Typed,
|
10
|
+
is$typed as _is$typed,
|
11
|
+
type OmitKey,
|
12
|
+
} from '../../../../util'
|
13
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
14
|
+
import type * as ToolsOzoneSafelinkDefs from './defs.js'
|
15
|
+
|
16
|
+
const is$typed = _is$typed,
|
17
|
+
validate = _validate
|
18
|
+
const id = 'tools.ozone.safelink.addRule'
|
19
|
+
|
20
|
+
export interface QueryParams {}
|
21
|
+
|
22
|
+
export interface InputSchema {
|
23
|
+
/** The URL or domain to apply the rule to */
|
24
|
+
url: string
|
25
|
+
pattern: ToolsOzoneSafelinkDefs.PatternType
|
26
|
+
action: ToolsOzoneSafelinkDefs.ActionType
|
27
|
+
reason: ToolsOzoneSafelinkDefs.ReasonType
|
28
|
+
/** Optional comment about the decision */
|
29
|
+
comment?: string
|
30
|
+
/** Author DID. Only respected when using admin auth */
|
31
|
+
createdBy?: string
|
32
|
+
}
|
33
|
+
|
34
|
+
export type OutputSchema = ToolsOzoneSafelinkDefs.Event
|
35
|
+
|
36
|
+
export interface HandlerInput {
|
37
|
+
encoding: 'application/json'
|
38
|
+
body: InputSchema
|
39
|
+
}
|
40
|
+
|
41
|
+
export interface HandlerSuccess {
|
42
|
+
encoding: 'application/json'
|
43
|
+
body: OutputSchema
|
44
|
+
headers?: { [key: string]: string }
|
45
|
+
}
|
46
|
+
|
47
|
+
export interface HandlerError {
|
48
|
+
status: number
|
49
|
+
message?: string
|
50
|
+
error?: 'InvalidUrl' | 'RuleAlreadyExists'
|
51
|
+
}
|
52
|
+
|
53
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
54
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
55
|
+
auth: HA
|
56
|
+
params: QueryParams
|
57
|
+
input: HandlerInput
|
58
|
+
req: express.Request
|
59
|
+
res: express.Response
|
60
|
+
resetRouteRateLimits: () => Promise<void>
|
61
|
+
}
|
62
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
63
|
+
ctx: HandlerReqCtx<HA>,
|
64
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
@@ -0,0 +1,76 @@
|
|
1
|
+
/**
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
3
|
+
*/
|
4
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
5
|
+
import { CID } from 'multiformats/cid'
|
6
|
+
import { validate as _validate } from '../../../../lexicons'
|
7
|
+
import {
|
8
|
+
type $Typed,
|
9
|
+
is$typed as _is$typed,
|
10
|
+
type OmitKey,
|
11
|
+
} from '../../../../util'
|
12
|
+
|
13
|
+
const is$typed = _is$typed,
|
14
|
+
validate = _validate
|
15
|
+
const id = 'tools.ozone.safelink.defs'
|
16
|
+
|
17
|
+
/** An event for URL safety decisions */
|
18
|
+
export interface Event {
|
19
|
+
$type?: 'tools.ozone.safelink.defs#event'
|
20
|
+
/** Auto-incrementing row ID */
|
21
|
+
id: number
|
22
|
+
eventType: EventType
|
23
|
+
/** The URL that this rule applies to */
|
24
|
+
url: string
|
25
|
+
pattern: PatternType
|
26
|
+
action: ActionType
|
27
|
+
reason: ReasonType
|
28
|
+
/** DID of the user who created this rule */
|
29
|
+
createdBy: string
|
30
|
+
createdAt: string
|
31
|
+
/** Optional comment about the decision */
|
32
|
+
comment?: string
|
33
|
+
}
|
34
|
+
|
35
|
+
const hashEvent = 'event'
|
36
|
+
|
37
|
+
export function isEvent<V>(v: V) {
|
38
|
+
return is$typed(v, id, hashEvent)
|
39
|
+
}
|
40
|
+
|
41
|
+
export function validateEvent<V>(v: V) {
|
42
|
+
return validate<Event & V>(v, id, hashEvent)
|
43
|
+
}
|
44
|
+
|
45
|
+
export type EventType = 'addRule' | 'updateRule' | 'removeRule' | (string & {})
|
46
|
+
export type PatternType = 'domain' | 'url' | (string & {})
|
47
|
+
export type ActionType = 'block' | 'warn' | 'whitelist' | (string & {})
|
48
|
+
export type ReasonType = 'csam' | 'spam' | 'phishing' | 'none' | (string & {})
|
49
|
+
|
50
|
+
/** Input for creating a URL safety rule */
|
51
|
+
export interface UrlRule {
|
52
|
+
$type?: 'tools.ozone.safelink.defs#urlRule'
|
53
|
+
/** The URL or domain to apply the rule to */
|
54
|
+
url: string
|
55
|
+
pattern: PatternType
|
56
|
+
action: ActionType
|
57
|
+
reason: ReasonType
|
58
|
+
/** Optional comment about the decision */
|
59
|
+
comment?: string
|
60
|
+
/** DID of the user added the rule. */
|
61
|
+
createdBy: string
|
62
|
+
/** Timestamp when the rule was created */
|
63
|
+
createdAt: string
|
64
|
+
/** Timestamp when the rule was last updated */
|
65
|
+
updatedAt: string
|
66
|
+
}
|
67
|
+
|
68
|
+
const hashUrlRule = 'urlRule'
|
69
|
+
|
70
|
+
export function isUrlRule<V>(v: V) {
|
71
|
+
return is$typed(v, id, hashUrlRule)
|
72
|
+
}
|
73
|
+
|
74
|
+
export function validateUrlRule<V>(v: V) {
|
75
|
+
return validate<UrlRule & V>(v, id, hashUrlRule)
|
76
|
+
}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
/**
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
3
|
+
*/
|
4
|
+
import express from 'express'
|
5
|
+
import { type ValidationResult, BlobRef } from '@atproto/lexicon'
|
6
|
+
import { CID } from 'multiformats/cid'
|
7
|
+
import { validate as _validate } from '../../../../lexicons'
|
8
|
+
import {
|
9
|
+
type $Typed,
|
10
|
+
is$typed as _is$typed,
|
11
|
+
type OmitKey,
|
12
|
+
} from '../../../../util'
|
13
|
+
import { HandlerAuth, HandlerPipeThrough } from '@atproto/xrpc-server'
|
14
|
+
import type * as ToolsOzoneSafelinkDefs from './defs.js'
|
15
|
+
|
16
|
+
const is$typed = _is$typed,
|
17
|
+
validate = _validate
|
18
|
+
const id = 'tools.ozone.safelink.queryEvents'
|
19
|
+
|
20
|
+
export interface QueryParams {}
|
21
|
+
|
22
|
+
export interface InputSchema {
|
23
|
+
/** Cursor for pagination */
|
24
|
+
cursor?: string
|
25
|
+
/** Maximum number of results to return */
|
26
|
+
limit: number
|
27
|
+
/** Filter by specific URLs or domains */
|
28
|
+
urls?: string[]
|
29
|
+
/** Filter by pattern type */
|
30
|
+
patternType?: string
|
31
|
+
/** Sort direction */
|
32
|
+
sortDirection: 'asc' | 'desc' | (string & {})
|
33
|
+
}
|
34
|
+
|
35
|
+
export interface OutputSchema {
|
36
|
+
/** Next cursor for pagination. Only present if there are more results. */
|
37
|
+
cursor?: string
|
38
|
+
events: ToolsOzoneSafelinkDefs.Event[]
|
39
|
+
}
|
40
|
+
|
41
|
+
export interface HandlerInput {
|
42
|
+
encoding: 'application/json'
|
43
|
+
body: InputSchema
|
44
|
+
}
|
45
|
+
|
46
|
+
export interface HandlerSuccess {
|
47
|
+
encoding: 'application/json'
|
48
|
+
body: OutputSchema
|
49
|
+
headers?: { [key: string]: string }
|
50
|
+
}
|
51
|
+
|
52
|
+
export interface HandlerError {
|
53
|
+
status: number
|
54
|
+
message?: string
|
55
|
+
}
|
56
|
+
|
57
|
+
export type HandlerOutput = HandlerError | HandlerSuccess | HandlerPipeThrough
|
58
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
59
|
+
auth: HA
|
60
|
+
params: QueryParams
|
61
|
+
input: HandlerInput
|
62
|
+
req: express.Request
|
63
|
+
res: express.Response
|
64
|
+
resetRouteRateLimits: () => Promise<void>
|
65
|
+
}
|
66
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
67
|
+
ctx: HandlerReqCtx<HA>,
|
68
|
+
) => Promise<HandlerOutput> | HandlerOutput
|