@atproto/ozone 0.1.126 → 0.1.127
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/api/index.d.ts.map +1 -1
- package/dist/api/index.js +10 -0
- package/dist/api/index.js.map +1 -1
- package/dist/api/safelink/addRule.d.ts +4 -0
- package/dist/api/safelink/addRule.d.ts.map +1 -0
- package/dist/api/safelink/addRule.js +37 -0
- package/dist/api/safelink/addRule.js.map +1 -0
- package/dist/api/safelink/queryEvents.d.ts +4 -0
- package/dist/api/safelink/queryEvents.d.ts.map +1 -0
- package/dist/api/safelink/queryEvents.js +29 -0
- package/dist/api/safelink/queryEvents.js.map +1 -0
- package/dist/api/safelink/queryRules.d.ts +4 -0
- package/dist/api/safelink/queryRules.d.ts.map +1 -0
- package/dist/api/safelink/queryRules.js +43 -0
- package/dist/api/safelink/queryRules.js.map +1 -0
- package/dist/api/safelink/removeRule.d.ts +4 -0
- package/dist/api/safelink/removeRule.d.ts.map +1 -0
- package/dist/api/safelink/removeRule.js +35 -0
- package/dist/api/safelink/removeRule.js.map +1 -0
- package/dist/api/safelink/updateRule.d.ts +4 -0
- package/dist/api/safelink/updateRule.d.ts.map +1 -0
- package/dist/api/safelink/updateRule.js +37 -0
- package/dist/api/safelink/updateRule.js.map +1 -0
- package/dist/api/util.d.ts +8 -0
- package/dist/api/util.d.ts.map +1 -1
- package/dist/api/util.js +33 -1
- package/dist/api/util.js.map +1 -1
- package/dist/context.d.ts +3 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +12 -6
- package/dist/context.js.map +1 -1
- package/dist/db/migrations/20250609T110704000Z-safelink.d.ts +4 -0
- package/dist/db/migrations/20250609T110704000Z-safelink.d.ts.map +1 -0
- package/dist/db/migrations/20250609T110704000Z-safelink.js +51 -0
- package/dist/db/migrations/20250609T110704000Z-safelink.js.map +1 -0
- package/dist/db/migrations/index.d.ts +1 -0
- package/dist/db/migrations/index.d.ts.map +1 -1
- package/dist/db/migrations/index.js +2 -1
- package/dist/db/migrations/index.js.map +1 -1
- package/dist/db/schema/index.d.ts +2 -1
- package/dist/db/schema/index.d.ts.map +1 -1
- package/dist/db/schema/safelink.d.ts +31 -0
- package/dist/db/schema/safelink.d.ts.map +1 -0
- package/dist/db/schema/safelink.js +6 -0
- package/dist/db/schema/safelink.js.map +1 -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/mod-service/status.d.ts +6 -0
- package/dist/mod-service/status.d.ts.map +1 -1
- package/dist/safelink/service.d.ts +69 -0
- package/dist/safelink/service.d.ts.map +1 -0
- package/dist/safelink/service.js +179 -0
- package/dist/safelink/service.js.map +1 -0
- package/package.json +4 -4
- package/src/api/index.ts +10 -0
- package/src/api/safelink/addRule.ts +48 -0
- package/src/api/safelink/queryEvents.ts +32 -0
- package/src/api/safelink/queryRules.ts +58 -0
- package/src/api/safelink/removeRule.ts +42 -0
- package/src/api/safelink/updateRule.ts +48 -0
- package/src/api/util.ts +38 -0
- package/src/context.ts +11 -0
- package/src/db/migrations/20250609T110704000Z-safelink.ts +53 -0
- package/src/db/migrations/index.ts +1 -0
- package/src/db/schema/index.ts +3 -1
- package/src/db/schema/safelink.ts +39 -0
- 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/safelink/service.ts +304 -0
- package/tests/__snapshots__/safelink.test.ts.snap +179 -0
- package/tests/communication-templates.test.ts +7 -7
- package/tests/safelink.test.ts +534 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/tsconfig.tests.tsbuildinfo +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { GeneratedAlways } from 'kysely'
|
|
2
|
+
import {
|
|
3
|
+
SafelinkActionType,
|
|
4
|
+
SafelinkEventType,
|
|
5
|
+
SafelinkPatternType,
|
|
6
|
+
SafelinkReasonType,
|
|
7
|
+
} from '../../api/util'
|
|
8
|
+
|
|
9
|
+
export const safelinkRuleTableName = 'safelink_rule'
|
|
10
|
+
export const safelinkEventTableName = 'safelink_event'
|
|
11
|
+
|
|
12
|
+
export interface SafelinkRule {
|
|
13
|
+
id: GeneratedAlways<number>
|
|
14
|
+
url: string
|
|
15
|
+
pattern: SafelinkPatternType
|
|
16
|
+
action: SafelinkActionType
|
|
17
|
+
reason: SafelinkReasonType
|
|
18
|
+
createdBy: string
|
|
19
|
+
createdAt: string
|
|
20
|
+
updatedAt: string
|
|
21
|
+
comment: string | null
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface SafelinkEvent {
|
|
25
|
+
id: GeneratedAlways<number>
|
|
26
|
+
eventType: SafelinkEventType
|
|
27
|
+
url: string
|
|
28
|
+
pattern: SafelinkPatternType
|
|
29
|
+
action: SafelinkActionType
|
|
30
|
+
reason: SafelinkReasonType
|
|
31
|
+
createdBy: string
|
|
32
|
+
createdAt: string
|
|
33
|
+
comment: string | null
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type PartialDB = {
|
|
37
|
+
[safelinkRuleTableName]: SafelinkRule
|
|
38
|
+
[safelinkEventTableName]: SafelinkEvent
|
|
39
|
+
}
|
package/src/lexicon/index.ts
CHANGED
|
@@ -206,6 +206,11 @@ import * as ToolsOzoneModerationGetSubjects from './types/tools/ozone/moderation
|
|
|
206
206
|
import * as ToolsOzoneModerationQueryEvents from './types/tools/ozone/moderation/queryEvents.js'
|
|
207
207
|
import * as ToolsOzoneModerationQueryStatuses from './types/tools/ozone/moderation/queryStatuses.js'
|
|
208
208
|
import * as ToolsOzoneModerationSearchRepos from './types/tools/ozone/moderation/searchRepos.js'
|
|
209
|
+
import * as ToolsOzoneSafelinkAddRule from './types/tools/ozone/safelink/addRule.js'
|
|
210
|
+
import * as ToolsOzoneSafelinkQueryEvents from './types/tools/ozone/safelink/queryEvents.js'
|
|
211
|
+
import * as ToolsOzoneSafelinkQueryRules from './types/tools/ozone/safelink/queryRules.js'
|
|
212
|
+
import * as ToolsOzoneSafelinkRemoveRule from './types/tools/ozone/safelink/removeRule.js'
|
|
213
|
+
import * as ToolsOzoneSafelinkUpdateRule from './types/tools/ozone/safelink/updateRule.js'
|
|
209
214
|
import * as ToolsOzoneServerGetConfig from './types/tools/ozone/server/getConfig.js'
|
|
210
215
|
import * as ToolsOzoneSetAddValues from './types/tools/ozone/set/addValues.js'
|
|
211
216
|
import * as ToolsOzoneSetDeleteSet from './types/tools/ozone/set/deleteSet.js'
|
|
@@ -2571,6 +2576,7 @@ export class ToolsOzoneNS {
|
|
|
2571
2576
|
communication: ToolsOzoneCommunicationNS
|
|
2572
2577
|
hosting: ToolsOzoneHostingNS
|
|
2573
2578
|
moderation: ToolsOzoneModerationNS
|
|
2579
|
+
safelink: ToolsOzoneSafelinkNS
|
|
2574
2580
|
server: ToolsOzoneServerNS
|
|
2575
2581
|
set: ToolsOzoneSetNS
|
|
2576
2582
|
setting: ToolsOzoneSettingNS
|
|
@@ -2583,6 +2589,7 @@ export class ToolsOzoneNS {
|
|
|
2583
2589
|
this.communication = new ToolsOzoneCommunicationNS(server)
|
|
2584
2590
|
this.hosting = new ToolsOzoneHostingNS(server)
|
|
2585
2591
|
this.moderation = new ToolsOzoneModerationNS(server)
|
|
2592
|
+
this.safelink = new ToolsOzoneSafelinkNS(server)
|
|
2586
2593
|
this.server = new ToolsOzoneServerNS(server)
|
|
2587
2594
|
this.set = new ToolsOzoneSetNS(server)
|
|
2588
2595
|
this.setting = new ToolsOzoneSettingNS(server)
|
|
@@ -2792,6 +2799,69 @@ export class ToolsOzoneModerationNS {
|
|
|
2792
2799
|
}
|
|
2793
2800
|
}
|
|
2794
2801
|
|
|
2802
|
+
export class ToolsOzoneSafelinkNS {
|
|
2803
|
+
_server: Server
|
|
2804
|
+
|
|
2805
|
+
constructor(server: Server) {
|
|
2806
|
+
this._server = server
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
addRule<AV extends AuthVerifier>(
|
|
2810
|
+
cfg: ConfigOf<
|
|
2811
|
+
AV,
|
|
2812
|
+
ToolsOzoneSafelinkAddRule.Handler<ExtractAuth<AV>>,
|
|
2813
|
+
ToolsOzoneSafelinkAddRule.HandlerReqCtx<ExtractAuth<AV>>
|
|
2814
|
+
>,
|
|
2815
|
+
) {
|
|
2816
|
+
const nsid = 'tools.ozone.safelink.addRule' // @ts-ignore
|
|
2817
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2820
|
+
queryEvents<AV extends AuthVerifier>(
|
|
2821
|
+
cfg: ConfigOf<
|
|
2822
|
+
AV,
|
|
2823
|
+
ToolsOzoneSafelinkQueryEvents.Handler<ExtractAuth<AV>>,
|
|
2824
|
+
ToolsOzoneSafelinkQueryEvents.HandlerReqCtx<ExtractAuth<AV>>
|
|
2825
|
+
>,
|
|
2826
|
+
) {
|
|
2827
|
+
const nsid = 'tools.ozone.safelink.queryEvents' // @ts-ignore
|
|
2828
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
queryRules<AV extends AuthVerifier>(
|
|
2832
|
+
cfg: ConfigOf<
|
|
2833
|
+
AV,
|
|
2834
|
+
ToolsOzoneSafelinkQueryRules.Handler<ExtractAuth<AV>>,
|
|
2835
|
+
ToolsOzoneSafelinkQueryRules.HandlerReqCtx<ExtractAuth<AV>>
|
|
2836
|
+
>,
|
|
2837
|
+
) {
|
|
2838
|
+
const nsid = 'tools.ozone.safelink.queryRules' // @ts-ignore
|
|
2839
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
2840
|
+
}
|
|
2841
|
+
|
|
2842
|
+
removeRule<AV extends AuthVerifier>(
|
|
2843
|
+
cfg: ConfigOf<
|
|
2844
|
+
AV,
|
|
2845
|
+
ToolsOzoneSafelinkRemoveRule.Handler<ExtractAuth<AV>>,
|
|
2846
|
+
ToolsOzoneSafelinkRemoveRule.HandlerReqCtx<ExtractAuth<AV>>
|
|
2847
|
+
>,
|
|
2848
|
+
) {
|
|
2849
|
+
const nsid = 'tools.ozone.safelink.removeRule' // @ts-ignore
|
|
2850
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
2851
|
+
}
|
|
2852
|
+
|
|
2853
|
+
updateRule<AV extends AuthVerifier>(
|
|
2854
|
+
cfg: ConfigOf<
|
|
2855
|
+
AV,
|
|
2856
|
+
ToolsOzoneSafelinkUpdateRule.Handler<ExtractAuth<AV>>,
|
|
2857
|
+
ToolsOzoneSafelinkUpdateRule.HandlerReqCtx<ExtractAuth<AV>>
|
|
2858
|
+
>,
|
|
2859
|
+
) {
|
|
2860
|
+
const nsid = 'tools.ozone.safelink.updateRule' // @ts-ignore
|
|
2861
|
+
return this._server.xrpc.method(nsid, cfg)
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
|
|
2795
2865
|
export class ToolsOzoneServerNS {
|
|
2796
2866
|
_server: Server
|
|
2797
2867
|
|
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
|