@atproto/ozone 0.0.2 → 0.0.4
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 +14 -0
- package/dist/api/admin/listCommunicationTemplates.d.ts +3 -0
- package/dist/api/admin/updateCommunicationTemplate.d.ts +3 -0
- package/dist/communication-service/template.d.ts +18 -0
- package/dist/context.d.ts +3 -0
- package/dist/db/index.js +18 -1
- package/dist/db/index.js.map +3 -3
- package/dist/db/migrations/20240116T085607200Z-communication-template.d.ts +3 -0
- package/dist/db/migrations/index.d.ts +1 -0
- package/dist/db/schema/communication_template.d.ts +15 -0
- package/dist/db/schema/index.d.ts +2 -1
- package/dist/index.js +861 -240
- package/dist/index.js.map +3 -3
- package/dist/lexicon/index.d.ts +8 -0
- package/dist/lexicon/lexicons.d.ts +182 -0
- package/dist/lexicon/types/{app/bsky/unspecced/getPopular.d.ts → com/atproto/admin/createCommunicationTemplate.d.ts} +11 -9
- package/dist/lexicon/types/com/atproto/admin/defs.d.ts +13 -0
- package/dist/lexicon/types/com/atproto/admin/deleteCommunicationTemplate.d.ts +25 -0
- package/dist/lexicon/types/{app/bsky/moderation/getServices.d.ts → com/atproto/admin/listCommunicationTemplates.d.ts} +2 -3
- package/dist/lexicon/types/{app/bsky/moderation/getService.d.ts → com/atproto/admin/updateCommunicationTemplate.d.ts} +15 -5
- package/package.json +8 -8
- package/src/api/admin/createCommunicationTemplate.ts +37 -0
- package/src/api/admin/deleteCommunicationTemplate.ts +23 -0
- package/src/api/admin/listCommunicationTemplates.ts +31 -0
- package/src/api/admin/updateCommunicationTemplate.ts +40 -0
- package/src/api/index.ts +8 -0
- package/src/communication-service/template.ts +105 -0
- package/src/context.ts +12 -0
- package/src/db/migrations/20240116T085607200Z-communication-template.ts +23 -0
- package/src/db/migrations/index.ts +1 -0
- package/src/db/schema/communication_template.ts +18 -0
- package/src/db/schema/index.ts +3 -1
- package/src/lexicon/index.ts +48 -0
- package/src/lexicon/lexicons.ts +199 -0
- package/src/lexicon/types/com/atproto/admin/createCommunicationTemplate.ts +54 -0
- package/src/lexicon/types/com/atproto/admin/defs.ts +35 -0
- package/src/lexicon/types/com/atproto/admin/deleteCommunicationTemplate.ts +38 -0
- package/src/lexicon/types/com/atproto/admin/listCommunicationTemplates.ts +44 -0
- package/src/lexicon/types/com/atproto/admin/updateCommunicationTemplate.ts +57 -0
- package/tests/communication-templates.test.ts +131 -0
- package/dist/api/com/atproto/admin/emitModerationEvent.d.ts +0 -3
- package/dist/api/com/atproto/admin/getModerationEvent.d.ts +0 -3
- package/dist/api/com/atproto/admin/getRecord.d.ts +0 -3
- package/dist/api/com/atproto/admin/getRepo.d.ts +0 -3
- package/dist/api/com/atproto/admin/queryModerationEvents.d.ts +0 -3
- package/dist/api/com/atproto/admin/queryModerationStatuses.d.ts +0 -3
- package/dist/api/com/atproto/admin/searchRepos.d.ts +0 -3
- package/dist/api/com/atproto/admin/util.d.ts +0 -5
- package/dist/api/com/atproto/moderation/createReport.d.ts +0 -3
- package/dist/api/com/atproto/moderation/util.d.ts +0 -4
- package/dist/api/com/atproto/temp/fetchLabels.d.ts +0 -3
- package/dist/api/util.d.ts +0 -2
- package/dist/auth-verifier.d.ts +0 -47
- package/dist/config.d.ts +0 -42
- package/dist/daemon/config.d.ts +0 -23
- package/dist/lexicon/types/app/bsky/moderation/defs.d.ts +0 -49
- package/dist/lexicon/types/app/bsky/moderation/service.d.ts +0 -17
- package/dist/sequencer/index.d.ts +0 -2
- package/dist/sequencer/outbox.d.ts +0 -16
- package/dist/sequencer/sequencer.d.ts +0 -35
- package/dist/services/index.d.ts +0 -7
- package/dist/services/moderation/index.d.ts +0 -144
- package/dist/services/moderation/status.d.ts +0 -12
- package/dist/services/moderation/subject.d.ts +0 -60
- package/dist/services/moderation/types.d.ts +0 -19
- package/dist/services/moderation/views.d.ts +0 -42
- package/dist/services/types.d.ts +0 -2
- package/dist/util/date.d.ts +0 -1
- package/dist/util/debug.d.ts +0 -1
- package/dist/util/retry.d.ts +0 -3
- package/test.log +0 -0
- /package/dist/api/{label/queryLabels.d.ts → admin/createCommunicationTemplate.d.ts} +0 -0
- /package/dist/api/{label/subscribeLabels.d.ts → admin/deleteCommunicationTemplate.d.ts} +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { lexicons } from '../../../../lexicons'
|
|
7
|
+
import { isObj, hasProp } from '../../../../util'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import { HandlerAuth } from '@atproto/xrpc-server'
|
|
10
|
+
|
|
11
|
+
export interface QueryParams {}
|
|
12
|
+
|
|
13
|
+
export interface InputSchema {
|
|
14
|
+
id: string
|
|
15
|
+
[k: string]: unknown
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface HandlerInput {
|
|
19
|
+
encoding: 'application/json'
|
|
20
|
+
body: InputSchema
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface HandlerError {
|
|
24
|
+
status: number
|
|
25
|
+
message?: string
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type HandlerOutput = HandlerError | void
|
|
29
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
30
|
+
auth: HA
|
|
31
|
+
params: QueryParams
|
|
32
|
+
input: HandlerInput
|
|
33
|
+
req: express.Request
|
|
34
|
+
res: express.Response
|
|
35
|
+
}
|
|
36
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
37
|
+
ctx: HandlerReqCtx<HA>,
|
|
38
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { lexicons } from '../../../../lexicons'
|
|
7
|
+
import { isObj, hasProp } from '../../../../util'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import { HandlerAuth } from '@atproto/xrpc-server'
|
|
10
|
+
import * as ComAtprotoAdminDefs from './defs'
|
|
11
|
+
|
|
12
|
+
export interface QueryParams {}
|
|
13
|
+
|
|
14
|
+
export type InputSchema = undefined
|
|
15
|
+
|
|
16
|
+
export interface OutputSchema {
|
|
17
|
+
communicationTemplates: ComAtprotoAdminDefs.CommunicationTemplateView[]
|
|
18
|
+
[k: string]: unknown
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type HandlerInput = undefined
|
|
22
|
+
|
|
23
|
+
export interface HandlerSuccess {
|
|
24
|
+
encoding: 'application/json'
|
|
25
|
+
body: OutputSchema
|
|
26
|
+
headers?: { [key: string]: string }
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface HandlerError {
|
|
30
|
+
status: number
|
|
31
|
+
message?: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type HandlerOutput = HandlerError | HandlerSuccess
|
|
35
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
36
|
+
auth: HA
|
|
37
|
+
params: QueryParams
|
|
38
|
+
input: HandlerInput
|
|
39
|
+
req: express.Request
|
|
40
|
+
res: express.Response
|
|
41
|
+
}
|
|
42
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
43
|
+
ctx: HandlerReqCtx<HA>,
|
|
44
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GENERATED CODE - DO NOT MODIFY
|
|
3
|
+
*/
|
|
4
|
+
import express from 'express'
|
|
5
|
+
import { ValidationResult, BlobRef } from '@atproto/lexicon'
|
|
6
|
+
import { lexicons } from '../../../../lexicons'
|
|
7
|
+
import { isObj, hasProp } from '../../../../util'
|
|
8
|
+
import { CID } from 'multiformats/cid'
|
|
9
|
+
import { HandlerAuth } from '@atproto/xrpc-server'
|
|
10
|
+
import * as ComAtprotoAdminDefs from './defs'
|
|
11
|
+
|
|
12
|
+
export interface QueryParams {}
|
|
13
|
+
|
|
14
|
+
export interface InputSchema {
|
|
15
|
+
/** ID of the template to be updated. */
|
|
16
|
+
id: string
|
|
17
|
+
/** Name of the template. */
|
|
18
|
+
name?: string
|
|
19
|
+
/** Content of the template, markdown supported, can contain variable placeholders. */
|
|
20
|
+
contentMarkdown?: string
|
|
21
|
+
/** Subject of the message, used in emails. */
|
|
22
|
+
subject?: string
|
|
23
|
+
/** DID of the user who is updating the template. */
|
|
24
|
+
updatedBy?: string
|
|
25
|
+
disabled?: boolean
|
|
26
|
+
[k: string]: unknown
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type OutputSchema = ComAtprotoAdminDefs.CommunicationTemplateView
|
|
30
|
+
|
|
31
|
+
export interface HandlerInput {
|
|
32
|
+
encoding: 'application/json'
|
|
33
|
+
body: InputSchema
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface HandlerSuccess {
|
|
37
|
+
encoding: 'application/json'
|
|
38
|
+
body: OutputSchema
|
|
39
|
+
headers?: { [key: string]: string }
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface HandlerError {
|
|
43
|
+
status: number
|
|
44
|
+
message?: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type HandlerOutput = HandlerError | HandlerSuccess
|
|
48
|
+
export type HandlerReqCtx<HA extends HandlerAuth = never> = {
|
|
49
|
+
auth: HA
|
|
50
|
+
params: QueryParams
|
|
51
|
+
input: HandlerInput
|
|
52
|
+
req: express.Request
|
|
53
|
+
res: express.Response
|
|
54
|
+
}
|
|
55
|
+
export type Handler<HA extends HandlerAuth = never> = (
|
|
56
|
+
ctx: HandlerReqCtx<HA>,
|
|
57
|
+
) => Promise<HandlerOutput> | HandlerOutput
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { TestNetwork, SeedClient, basicSeed } from '@atproto/dev-env'
|
|
2
|
+
import AtpAgent from '@atproto/api'
|
|
3
|
+
|
|
4
|
+
describe('communication-templates', () => {
|
|
5
|
+
let network: TestNetwork
|
|
6
|
+
let agent: AtpAgent
|
|
7
|
+
let sc: SeedClient
|
|
8
|
+
|
|
9
|
+
beforeAll(async () => {
|
|
10
|
+
network = await TestNetwork.create({
|
|
11
|
+
dbPostgresSchema: 'ozone_communication_templates',
|
|
12
|
+
})
|
|
13
|
+
agent = network.ozone.getClient()
|
|
14
|
+
sc = network.getSeedClient()
|
|
15
|
+
await basicSeed(sc)
|
|
16
|
+
await network.processAll()
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
afterAll(async () => {
|
|
20
|
+
await network.close()
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const templateOne = {
|
|
24
|
+
name: 'Test name 1',
|
|
25
|
+
subject: 'Test subject 1',
|
|
26
|
+
contentMarkdown: 'Test content 1',
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const listTemplates = async () => {
|
|
30
|
+
const { data } =
|
|
31
|
+
await agent.api.com.atproto.admin.listCommunicationTemplates(
|
|
32
|
+
{},
|
|
33
|
+
{
|
|
34
|
+
headers: network.ozone.adminAuthHeaders('moderator'),
|
|
35
|
+
},
|
|
36
|
+
)
|
|
37
|
+
return data.communicationTemplates
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
describe('create templates', () => {
|
|
41
|
+
it('only allows admins to create new templates', async () => {
|
|
42
|
+
const moderatorReq =
|
|
43
|
+
agent.api.com.atproto.admin.createCommunicationTemplate(
|
|
44
|
+
{ ...templateOne, createdBy: sc.dids.bob },
|
|
45
|
+
{
|
|
46
|
+
encoding: 'application/json',
|
|
47
|
+
headers: network.ozone.adminAuthHeaders('moderator'),
|
|
48
|
+
},
|
|
49
|
+
)
|
|
50
|
+
await expect(moderatorReq).rejects.toThrow(
|
|
51
|
+
'Must be an admin to create a communication template',
|
|
52
|
+
)
|
|
53
|
+
const modReq =
|
|
54
|
+
await agent.api.com.atproto.admin.createCommunicationTemplate(
|
|
55
|
+
{ ...templateOne, createdBy: sc.dids.bob },
|
|
56
|
+
{
|
|
57
|
+
encoding: 'application/json',
|
|
58
|
+
headers: network.ozone.adminAuthHeaders('admin'),
|
|
59
|
+
},
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
expect(modReq.data).toMatchObject({
|
|
63
|
+
...templateOne,
|
|
64
|
+
lastUpdatedBy: sc.dids.bob,
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
describe('list templates', () => {
|
|
69
|
+
it('returns all saved templates', async () => {
|
|
70
|
+
const listBefore = await listTemplates()
|
|
71
|
+
expect(listBefore.length).toEqual(1)
|
|
72
|
+
expect(listBefore[0]).toMatchObject(templateOne)
|
|
73
|
+
|
|
74
|
+
const templateTwo = {
|
|
75
|
+
...templateOne,
|
|
76
|
+
name: 'Test template 2',
|
|
77
|
+
}
|
|
78
|
+
await agent.api.com.atproto.admin.createCommunicationTemplate(
|
|
79
|
+
{ ...templateTwo, createdBy: sc.dids.bob },
|
|
80
|
+
{
|
|
81
|
+
encoding: 'application/json',
|
|
82
|
+
headers: network.ozone.adminAuthHeaders('admin'),
|
|
83
|
+
},
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
const listAfter = await listTemplates()
|
|
87
|
+
expect(listAfter.length).toEqual(2)
|
|
88
|
+
expect(listAfter[1]).toMatchObject(templateTwo)
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
describe('update template', () => {
|
|
92
|
+
it('allows moderators to update a template by id', async () => {
|
|
93
|
+
const { data } =
|
|
94
|
+
await agent.api.com.atproto.admin.updateCommunicationTemplate(
|
|
95
|
+
{ id: '1', updatedBy: sc.dids.bob, name: '1 Test template' },
|
|
96
|
+
{
|
|
97
|
+
encoding: 'application/json',
|
|
98
|
+
headers: network.ozone.adminAuthHeaders('admin'),
|
|
99
|
+
},
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
expect(data.name).not.toEqual(templateOne.name)
|
|
103
|
+
expect(data.name).toEqual('1 Test template')
|
|
104
|
+
})
|
|
105
|
+
})
|
|
106
|
+
describe('delete template', () => {
|
|
107
|
+
it('allows admins to remove a template by id', async () => {
|
|
108
|
+
const modReq = agent.api.com.atproto.admin.deleteCommunicationTemplate(
|
|
109
|
+
{ id: '1' },
|
|
110
|
+
{
|
|
111
|
+
encoding: 'application/json',
|
|
112
|
+
headers: network.ozone.adminAuthHeaders('moderator'),
|
|
113
|
+
},
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
await expect(modReq).rejects.toThrow(
|
|
117
|
+
'Must be an admin to delete a communication template',
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
await agent.api.com.atproto.admin.deleteCommunicationTemplate(
|
|
121
|
+
{ id: '1' },
|
|
122
|
+
{
|
|
123
|
+
encoding: 'application/json',
|
|
124
|
+
headers: network.ozone.adminAuthHeaders('admin'),
|
|
125
|
+
},
|
|
126
|
+
)
|
|
127
|
+
const list = await listTemplates()
|
|
128
|
+
expect(list.length).toEqual(1)
|
|
129
|
+
})
|
|
130
|
+
})
|
|
131
|
+
})
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import AppContext from '../../../../context';
|
|
2
|
-
import { RepoView, RepoViewDetail, AccountView } from '../../../../lexicon/types/com/atproto/admin/defs';
|
|
3
|
-
export declare const getPdsAccountInfo: (ctx: AppContext, did: string) => Promise<AccountView | null>;
|
|
4
|
-
export declare const addAccountInfoToRepoViewDetail: (repoView: RepoViewDetail, accountInfo: AccountView | null, includeEmail?: boolean) => RepoViewDetail;
|
|
5
|
-
export declare const addAccountInfoToRepoView: (repoView: RepoView, accountInfo: AccountView | null, includeEmail?: boolean) => RepoView;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { InputSchema as ReportInput } from '../../../../lexicon/types/com/atproto/moderation/createReport';
|
|
2
|
-
export declare const getReasonType: (reasonType: ReportInput['reasonType']) => string | boolean;
|
|
3
|
-
export declare const getEventType: (type: string) => "com.atproto.admin.defs#modEventTakedown" | "com.atproto.admin.defs#modEventAcknowledge" | "com.atproto.admin.defs#modEventEscalate" | "com.atproto.admin.defs#modEventComment" | "com.atproto.admin.defs#modEventLabel" | "com.atproto.admin.defs#modEventReport" | "com.atproto.admin.defs#modEventMute" | "com.atproto.admin.defs#modEventReverseTakedown" | "com.atproto.admin.defs#modEventEmail";
|
|
4
|
-
export declare const getReviewState: (reviewState?: string) => "com.atproto.admin.defs#reviewOpen" | "com.atproto.admin.defs#reviewEscalated" | "com.atproto.admin.defs#reviewClosed" | undefined;
|
package/dist/api/util.d.ts
DELETED
package/dist/auth-verifier.d.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { IdResolver } from '@atproto/identity';
|
|
2
|
-
import express from 'express';
|
|
3
|
-
type ReqCtx = {
|
|
4
|
-
req: express.Request;
|
|
5
|
-
};
|
|
6
|
-
type AdminOutput = {
|
|
7
|
-
credentials: {
|
|
8
|
-
type: 'admin';
|
|
9
|
-
aud: string;
|
|
10
|
-
iss: string;
|
|
11
|
-
isModerator: boolean;
|
|
12
|
-
isTriage: true;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
type StandardOutput = {
|
|
16
|
-
credentials: {
|
|
17
|
-
type: 'standard';
|
|
18
|
-
aud: string;
|
|
19
|
-
iss: string;
|
|
20
|
-
isModerator: boolean;
|
|
21
|
-
isTriage: boolean;
|
|
22
|
-
};
|
|
23
|
-
};
|
|
24
|
-
type NullOutput = {
|
|
25
|
-
credentials: {
|
|
26
|
-
type: 'null';
|
|
27
|
-
iss: null;
|
|
28
|
-
};
|
|
29
|
-
};
|
|
30
|
-
export type AuthVerifierOpts = {
|
|
31
|
-
serviceDid: string;
|
|
32
|
-
moderators: string[];
|
|
33
|
-
triage: string[];
|
|
34
|
-
};
|
|
35
|
-
export declare class AuthVerifier {
|
|
36
|
-
idResolver: IdResolver;
|
|
37
|
-
serviceDid: string;
|
|
38
|
-
moderators: string[];
|
|
39
|
-
triage: string[];
|
|
40
|
-
constructor(idResolver: IdResolver, opts: AuthVerifierOpts);
|
|
41
|
-
admin: (reqCtx: ReqCtx) => Promise<AdminOutput>;
|
|
42
|
-
standard: (reqCtx: ReqCtx) => Promise<StandardOutput>;
|
|
43
|
-
standardOptional: (reqCtx: ReqCtx) => Promise<StandardOutput | NullOutput>;
|
|
44
|
-
nullCreds(): NullOutput;
|
|
45
|
-
}
|
|
46
|
-
export declare const getJwtStrFromReq: (req: express.Request) => string | null;
|
|
47
|
-
export {};
|
package/dist/config.d.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
export interface ServerConfigValues {
|
|
2
|
-
version: string;
|
|
3
|
-
debugMode?: boolean;
|
|
4
|
-
port?: number;
|
|
5
|
-
publicUrl?: string;
|
|
6
|
-
serverDid: string;
|
|
7
|
-
appviewUrl: string;
|
|
8
|
-
appviewDid?: string;
|
|
9
|
-
pdsUrl?: string;
|
|
10
|
-
pdsDid?: string;
|
|
11
|
-
dbPostgresUrl: string;
|
|
12
|
-
dbPostgresSchema?: string;
|
|
13
|
-
didPlcUrl: string;
|
|
14
|
-
labelerDid: string;
|
|
15
|
-
adminPassword: string;
|
|
16
|
-
moderatorPassword?: string;
|
|
17
|
-
triagePassword?: string;
|
|
18
|
-
}
|
|
19
|
-
export declare class ServerConfig {
|
|
20
|
-
private cfg;
|
|
21
|
-
private assignedPort?;
|
|
22
|
-
constructor(cfg: ServerConfigValues);
|
|
23
|
-
static readEnv(overrides?: Partial<ServerConfigValues>): ServerConfig;
|
|
24
|
-
assignPort(port: number): void;
|
|
25
|
-
get version(): string;
|
|
26
|
-
get debugMode(): boolean;
|
|
27
|
-
get port(): number | undefined;
|
|
28
|
-
get localUrl(): string;
|
|
29
|
-
get publicUrl(): string | undefined;
|
|
30
|
-
get serverDid(): string;
|
|
31
|
-
get appviewUrl(): string;
|
|
32
|
-
get appviewDid(): string | undefined;
|
|
33
|
-
get pdsUrl(): string | undefined;
|
|
34
|
-
get pdsDid(): string | undefined;
|
|
35
|
-
get dbPostgresUrl(): string;
|
|
36
|
-
get dbPostgresSchema(): string | undefined;
|
|
37
|
-
get didPlcUrl(): string;
|
|
38
|
-
get labelerDid(): string;
|
|
39
|
-
get adminPassword(): string;
|
|
40
|
-
get moderatorPassword(): string | undefined;
|
|
41
|
-
get triagePassword(): string | undefined;
|
|
42
|
-
}
|
package/dist/daemon/config.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export interface DaemonConfigValues {
|
|
2
|
-
version: string;
|
|
3
|
-
dbPostgresUrl: string;
|
|
4
|
-
dbPostgresSchema?: string;
|
|
5
|
-
serverDid: string;
|
|
6
|
-
appviewUrl: string;
|
|
7
|
-
appviewDid?: string;
|
|
8
|
-
pdsUrl?: string;
|
|
9
|
-
pdsDid?: string;
|
|
10
|
-
}
|
|
11
|
-
export declare class DaemonConfig {
|
|
12
|
-
private cfg;
|
|
13
|
-
constructor(cfg: DaemonConfigValues);
|
|
14
|
-
static readEnv(overrides?: Partial<DaemonConfigValues>): DaemonConfig;
|
|
15
|
-
get version(): string;
|
|
16
|
-
get dbPostgresUrl(): string;
|
|
17
|
-
get dbPostgresSchema(): string | undefined;
|
|
18
|
-
get serverDid(): string;
|
|
19
|
-
get appviewUrl(): string;
|
|
20
|
-
get appviewDid(): string | undefined;
|
|
21
|
-
get pdsUrl(): string | undefined;
|
|
22
|
-
get pdsDid(): string | undefined;
|
|
23
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { ValidationResult } from '@atproto/lexicon';
|
|
2
|
-
import * as AppBskyActorDefs from '../actor/defs';
|
|
3
|
-
import * as AppBskyRichtextFacet from '../richtext/facet';
|
|
4
|
-
import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs';
|
|
5
|
-
import * as ComAtprotoModerationDefs from '../../../com/atproto/moderation/defs';
|
|
6
|
-
export interface ModServiceView {
|
|
7
|
-
uri: string;
|
|
8
|
-
cid: string;
|
|
9
|
-
creator: AppBskyActorDefs.ProfileView;
|
|
10
|
-
description?: string;
|
|
11
|
-
descriptionFacets?: AppBskyRichtextFacet.Main[];
|
|
12
|
-
likeCount?: number;
|
|
13
|
-
viewer?: ModServiceViewerState;
|
|
14
|
-
indexedAt: string;
|
|
15
|
-
labels?: ComAtprotoLabelDefs.Label[];
|
|
16
|
-
[k: string]: unknown;
|
|
17
|
-
}
|
|
18
|
-
export declare function isModServiceView(v: unknown): v is ModServiceView;
|
|
19
|
-
export declare function validateModServiceView(v: unknown): ValidationResult;
|
|
20
|
-
export interface ModServiceViewDetailed {
|
|
21
|
-
uri: string;
|
|
22
|
-
cid: string;
|
|
23
|
-
creator: AppBskyActorDefs.ProfileView;
|
|
24
|
-
description?: string;
|
|
25
|
-
descriptionFacets?: AppBskyRichtextFacet.Main[];
|
|
26
|
-
policies: ModServicePolicies;
|
|
27
|
-
likeCount?: number;
|
|
28
|
-
viewer?: ModServiceViewerState;
|
|
29
|
-
indexedAt: string;
|
|
30
|
-
labels?: ComAtprotoLabelDefs.Label[];
|
|
31
|
-
[k: string]: unknown;
|
|
32
|
-
}
|
|
33
|
-
export declare function isModServiceViewDetailed(v: unknown): v is ModServiceViewDetailed;
|
|
34
|
-
export declare function validateModServiceViewDetailed(v: unknown): ValidationResult;
|
|
35
|
-
export interface ModServiceViewerState {
|
|
36
|
-
like?: string;
|
|
37
|
-
[k: string]: unknown;
|
|
38
|
-
}
|
|
39
|
-
export declare function isModServiceViewerState(v: unknown): v is ModServiceViewerState;
|
|
40
|
-
export declare function validateModServiceViewerState(v: unknown): ValidationResult;
|
|
41
|
-
export interface ModServicePolicies {
|
|
42
|
-
description?: string;
|
|
43
|
-
descriptionFacets?: AppBskyRichtextFacet.Main[];
|
|
44
|
-
reportReasons: ComAtprotoModerationDefs.ReasonType[];
|
|
45
|
-
labelValues: ComAtprotoLabelDefs.LabelValue[];
|
|
46
|
-
[k: string]: unknown;
|
|
47
|
-
}
|
|
48
|
-
export declare function isModServicePolicies(v: unknown): v is ModServicePolicies;
|
|
49
|
-
export declare function validateModServicePolicies(v: unknown): ValidationResult;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { ValidationResult } from '@atproto/lexicon';
|
|
2
|
-
import * as AppBskyRichtextFacet from '../richtext/facet';
|
|
3
|
-
import * as AppBskyModerationDefs from './defs';
|
|
4
|
-
import * as ComAtprotoLabelDefs from '../../../com/atproto/label/defs';
|
|
5
|
-
export interface Record {
|
|
6
|
-
description?: string;
|
|
7
|
-
descriptionFacets?: AppBskyRichtextFacet.Main[];
|
|
8
|
-
policies: AppBskyModerationDefs.ModServicePolicies;
|
|
9
|
-
labels?: ComAtprotoLabelDefs.SelfLabels | {
|
|
10
|
-
$type: string;
|
|
11
|
-
[k: string]: unknown;
|
|
12
|
-
};
|
|
13
|
-
createdAt: string;
|
|
14
|
-
[k: string]: unknown;
|
|
15
|
-
}
|
|
16
|
-
export declare function isRecord(v: unknown): v is Record;
|
|
17
|
-
export declare function validateRecord(v: unknown): ValidationResult;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { AsyncBuffer } from '@atproto/common';
|
|
2
|
-
import { Sequencer, LabelsEvt } from './sequencer';
|
|
3
|
-
export type OutboxOpts = {
|
|
4
|
-
maxBufferSize: number;
|
|
5
|
-
};
|
|
6
|
-
export declare class Outbox {
|
|
7
|
-
sequencer: Sequencer;
|
|
8
|
-
private caughtUp;
|
|
9
|
-
lastSeen: number;
|
|
10
|
-
cutoverBuffer: LabelsEvt[];
|
|
11
|
-
outBuffer: AsyncBuffer<LabelsEvt>;
|
|
12
|
-
constructor(sequencer: Sequencer, opts?: Partial<OutboxOpts>);
|
|
13
|
-
events(backfillCursor?: number, signal?: AbortSignal): AsyncGenerator<LabelsEvt>;
|
|
14
|
-
getBackfill(backfillCursor: number): AsyncGenerator<LabelsEvt, void, unknown>;
|
|
15
|
-
}
|
|
16
|
-
export default Outbox;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import TypedEmitter from 'typed-emitter';
|
|
3
|
-
import Database from '../db';
|
|
4
|
-
import { Labels as LabelsEvt } from '../lexicon/types/com/atproto/label/subscribeLabels';
|
|
5
|
-
import { Label as LabelTable } from '../db/schema/label';
|
|
6
|
-
import { Selectable } from 'kysely';
|
|
7
|
-
import { ModerationService } from '../mod-service';
|
|
8
|
-
export type { Labels as LabelsEvt } from '../lexicon/types/com/atproto/label/subscribeLabels';
|
|
9
|
-
type LabelRow = Selectable<LabelTable>;
|
|
10
|
-
declare const Sequencer_base: new () => SequencerEmitter;
|
|
11
|
-
export declare class Sequencer extends Sequencer_base {
|
|
12
|
-
modService: ModerationService;
|
|
13
|
-
lastSeen: number;
|
|
14
|
-
destroyed: boolean;
|
|
15
|
-
pollPromise: Promise<void>;
|
|
16
|
-
pollTimer: NodeJS.Timer | undefined;
|
|
17
|
-
triesWithNoResults: number;
|
|
18
|
-
db: Database;
|
|
19
|
-
constructor(modService: ModerationService, lastSeen?: number);
|
|
20
|
-
start(): Promise<void>;
|
|
21
|
-
destroy(): Promise<void>;
|
|
22
|
-
curr(): Promise<number | null>;
|
|
23
|
-
next(cursor: number): Promise<LabelRow | null>;
|
|
24
|
-
requestLabelRange(opts: {
|
|
25
|
-
earliestId?: number;
|
|
26
|
-
limit?: number;
|
|
27
|
-
}): Promise<LabelsEvt[]>;
|
|
28
|
-
private poll;
|
|
29
|
-
}
|
|
30
|
-
type SequencerEvents = {
|
|
31
|
-
events: (evts: LabelsEvt[]) => void;
|
|
32
|
-
close: () => void;
|
|
33
|
-
};
|
|
34
|
-
export type SequencerEmitter = TypedEmitter<SequencerEvents>;
|
|
35
|
-
export default Sequencer;
|
package/dist/services/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import AtpAgent from '@atproto/api';
|
|
2
|
-
import { ModerationService } from './moderation';
|
|
3
|
-
import { FromDb } from './types';
|
|
4
|
-
export declare function createServices(appviewAgent: AtpAgent): Services;
|
|
5
|
-
export declare type Services = {
|
|
6
|
-
moderation: FromDb<ModerationService>;
|
|
7
|
-
};
|