@casual-simulation/aux-records 3.3.7 → 3.3.8-alpha.10185283421

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.
Files changed (56) hide show
  1. package/AnthropicAIChatInterface.d.ts +18 -0
  2. package/AnthropicAIChatInterface.js +238 -0
  3. package/AnthropicAIChatInterface.js.map +1 -0
  4. package/AuthController.d.ts +2 -0
  5. package/AuthController.js +22 -12
  6. package/AuthController.js.map +1 -1
  7. package/FileRecordsStore.d.ts +4 -0
  8. package/GoogleAIChatInterface.js +5 -1
  9. package/GoogleAIChatInterface.js.map +1 -1
  10. package/InstrumentedHashHelpers.d.ts +28 -0
  11. package/InstrumentedHashHelpers.js +61 -0
  12. package/InstrumentedHashHelpers.js.map +1 -0
  13. package/MemoryModerationJobProvider.d.ts +15 -0
  14. package/MemoryModerationJobProvider.js +45 -0
  15. package/MemoryModerationJobProvider.js.map +1 -0
  16. package/MemoryStore.d.ts +9 -1
  17. package/MemoryStore.js +30 -0
  18. package/MemoryStore.js.map +1 -1
  19. package/ModerationConfiguration.d.ts +84 -0
  20. package/ModerationConfiguration.js +95 -0
  21. package/ModerationConfiguration.js.map +1 -1
  22. package/ModerationController.d.ts +59 -2
  23. package/ModerationController.js +171 -1
  24. package/ModerationController.js.map +1 -1
  25. package/ModerationJobProvider.d.ts +110 -0
  26. package/ModerationJobProvider.js +2 -0
  27. package/ModerationJobProvider.js.map +1 -0
  28. package/ModerationScanner.d.ts +1 -0
  29. package/ModerationScanner.js +1 -0
  30. package/ModerationScanner.js.map +1 -0
  31. package/ModerationStore.d.ts +90 -0
  32. package/NotificationMessenger.d.ts +42 -2
  33. package/NotificationMessenger.js +27 -0
  34. package/NotificationMessenger.js.map +1 -1
  35. package/RecordsController.d.ts +1 -0
  36. package/RecordsController.js +9 -3
  37. package/RecordsController.js.map +1 -1
  38. package/RecordsServer.d.ts +12 -0
  39. package/RecordsServer.js +82 -1
  40. package/RecordsServer.js.map +1 -1
  41. package/ServerConfig.d.ts +392 -16
  42. package/ServerConfig.js +126 -2
  43. package/ServerConfig.js.map +1 -1
  44. package/StabilityAIImageInterface.d.ts +9 -0
  45. package/StabilityAIImageInterface.js +156 -0
  46. package/StabilityAIImageInterface.js.map +1 -1
  47. package/Utils.js.map +1 -1
  48. package/index.d.ts +3 -0
  49. package/index.js +3 -0
  50. package/index.js.map +1 -1
  51. package/package.json +5 -4
  52. package/tracing/TracingDecorators.d.ts +51 -3
  53. package/tracing/TracingDecorators.js +41 -38
  54. package/tracing/TracingDecorators.js.map +1 -1
  55. package/websockets/WebsocketController.js +1 -1
  56. package/websockets/WebsocketController.js.map +1 -1
@@ -1,8 +1,9 @@
1
1
  import { NotLoggedInError, ServerError } from '@casual-simulation/aux-common';
2
- import { ModerationStore, ReportReason } from './ModerationStore';
2
+ import { ModerationFileScanResult, ModerationJob, ModerationStore, ReportReason } from './ModerationStore';
3
3
  import { ZodIssue } from 'zod';
4
4
  import { NotificationMessenger } from './NotificationMessenger';
5
5
  import { ConfigurationStore } from './ConfigurationStore';
6
+ import { ModerationJobProvider } from './ModerationJobProvider';
6
7
  /**
7
8
  * Defines a class that implements various moderation tasks.
8
9
  */
@@ -10,12 +11,22 @@ export declare class ModerationController {
10
11
  private _store;
11
12
  private _config;
12
13
  private _messenger;
13
- constructor(store: ModerationStore, config: ConfigurationStore, messenger: NotificationMessenger | null);
14
+ private _jobProvider;
15
+ constructor(store: ModerationStore, config: ConfigurationStore, messenger: NotificationMessenger | null, jobProvider: ModerationJobProvider | null);
14
16
  /**
15
17
  * Reports the given inst for a terms of service violation.
16
18
  * @param request The request.
17
19
  */
18
20
  reportInst(request: ReportInstRequest): Promise<ReportInstResult>;
21
+ /**
22
+ * Schedules a job to scan for moderation issues.
23
+ */
24
+ scheduleModerationScans(): Promise<ScheduleModerationScansResult>;
25
+ /**
26
+ * Scans the given file for moderation labels.
27
+ * @param request The request.
28
+ */
29
+ scanFile(request: ScanFileRequest): Promise<ScanFileResult>;
19
30
  }
20
31
  export interface ReportInstRequest {
21
32
  /**
@@ -81,4 +92,50 @@ export interface ReportInstFailure {
81
92
  */
82
93
  issues?: ZodIssue[];
83
94
  }
95
+ export type ScheduleModerationScansResult = ScheduleModerationScansSuccess | ScheduleModerationScansFailure;
96
+ export interface ScheduleModerationScansSuccess {
97
+ success: true;
98
+ /**
99
+ * The jobs that were started.
100
+ */
101
+ jobs: ModerationJob[];
102
+ }
103
+ export interface ScheduleModerationScansFailure {
104
+ success: false;
105
+ /**
106
+ * The error code for the failure.
107
+ */
108
+ errorCode: ServerError | 'not_supported';
109
+ /**
110
+ * The error message for the failure.
111
+ */
112
+ errorMessage: string;
113
+ }
114
+ export interface ScanFileRequest {
115
+ /**
116
+ * The name of the record that the file is in.
117
+ */
118
+ recordName: string;
119
+ /**
120
+ * The file that should be scanned.
121
+ */
122
+ fileName: string;
123
+ /**
124
+ * The ID of the job that the scan is associated with.
125
+ */
126
+ jobId?: string;
127
+ }
128
+ export type ScanFileResult = ScanFileSuccess | ScanFileFailure;
129
+ export interface ScanFileSuccess {
130
+ success: true;
131
+ /**
132
+ * The result of the file scan.
133
+ */
134
+ result: ModerationFileScanResult;
135
+ }
136
+ export interface ScanFileFailure {
137
+ success: false;
138
+ errorCode: ServerError | 'not_supported';
139
+ errorMessage: string;
140
+ }
84
141
  //# sourceMappingURL=ModerationController.d.ts.map
@@ -21,10 +21,11 @@ const TRACE_NAME = 'ModerationController';
21
21
  * Defines a class that implements various moderation tasks.
22
22
  */
23
23
  export class ModerationController {
24
- constructor(store, config, messenger) {
24
+ constructor(store, config, messenger, jobProvider) {
25
25
  this._store = store;
26
26
  this._config = config;
27
27
  this._messenger = messenger;
28
+ this._jobProvider = jobProvider;
28
29
  }
29
30
  /**
30
31
  * Reports the given inst for a terms of service violation.
@@ -94,8 +95,177 @@ export class ModerationController {
94
95
  }
95
96
  });
96
97
  }
98
+ /**
99
+ * Schedules a job to scan for moderation issues.
100
+ */
101
+ scheduleModerationScans() {
102
+ var _a, _b;
103
+ return __awaiter(this, void 0, void 0, function* () {
104
+ try {
105
+ if (!this._jobProvider) {
106
+ console.warn('[ModerationController] No job provider available to schedule moderation scans.');
107
+ return {
108
+ success: false,
109
+ errorCode: 'not_supported',
110
+ errorMessage: 'This operation is not supported.',
111
+ };
112
+ }
113
+ const config = yield this._config.getModerationConfig();
114
+ if (!config) {
115
+ return {
116
+ success: false,
117
+ errorCode: 'not_supported',
118
+ errorMessage: 'This operation is not supported.',
119
+ };
120
+ }
121
+ const jobs = [];
122
+ if ((_b = (_a = config.jobs) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b.enabled) {
123
+ console.log('[ModerationController] Starting file moderation job...');
124
+ let filter = {};
125
+ if (config.jobs.files.fileExtensions) {
126
+ filter.keyNameConstraint = {
127
+ matchAnySuffix: config.jobs.files.fileExtensions,
128
+ };
129
+ }
130
+ const lastFileJob = yield this._store.findMostRecentJobOfType('files');
131
+ if (lastFileJob) {
132
+ filter.createdAfterMs = lastFileJob.createdAtMs;
133
+ }
134
+ const job = yield this._jobProvider.startFilesJob(filter);
135
+ yield this._store.addModerationJob(job);
136
+ jobs.push(job);
137
+ console.log('[ModerationController] File moderation job started:', job);
138
+ }
139
+ return {
140
+ success: true,
141
+ jobs,
142
+ };
143
+ }
144
+ catch (err) {
145
+ const span = trace.getActiveSpan();
146
+ span === null || span === void 0 ? void 0 : span.recordException(err);
147
+ span === null || span === void 0 ? void 0 : span.setStatus({ code: SpanStatusCode.ERROR });
148
+ console.error('[ModerationController] Failed to start moderation jobs:', err);
149
+ return {
150
+ success: false,
151
+ errorCode: 'server_error',
152
+ errorMessage: 'A server error occurred.',
153
+ };
154
+ }
155
+ });
156
+ }
157
+ /**
158
+ * Scans the given file for moderation labels.
159
+ * @param request The request.
160
+ */
161
+ scanFile(request) {
162
+ var _a, _b, _c;
163
+ return __awaiter(this, void 0, void 0, function* () {
164
+ try {
165
+ if (!this._jobProvider) {
166
+ console.warn('[ModerationController] No job provider available to scan files.');
167
+ return {
168
+ success: false,
169
+ errorCode: 'not_supported',
170
+ errorMessage: 'This operation is not supported.',
171
+ };
172
+ }
173
+ const config = yield this._config.getModerationConfig();
174
+ if (!config) {
175
+ return {
176
+ success: false,
177
+ errorCode: 'not_supported',
178
+ errorMessage: 'This operation is not supported.',
179
+ };
180
+ }
181
+ if (!((_b = (_a = config.jobs) === null || _a === void 0 ? void 0 : _a.files) === null || _b === void 0 ? void 0 : _b.enabled)) {
182
+ return {
183
+ success: false,
184
+ errorCode: 'not_supported',
185
+ errorMessage: 'This operation is not supported.',
186
+ };
187
+ }
188
+ if (config.jobs.files.fileExtensions) {
189
+ if (config.jobs.files.fileExtensions.every((ext) => !request.fileName.endsWith(ext))) {
190
+ return {
191
+ success: false,
192
+ errorCode: 'not_supported',
193
+ errorMessage: 'The file extension is not supported.',
194
+ };
195
+ }
196
+ }
197
+ const createdAtMs = Date.now();
198
+ const scan = yield this._jobProvider.scanFile({
199
+ recordName: request.recordName,
200
+ fileName: request.fileName,
201
+ minConfidence: config.jobs.files.minConfidence,
202
+ });
203
+ const resultId = uuid();
204
+ let bannedLabel = null;
205
+ for (let label of config.jobs.files.bannedLabels) {
206
+ if (label.label) {
207
+ bannedLabel = scan.labels.find((l) => l.name.localeCompare(label.label, undefined, {
208
+ sensitivity: 'base',
209
+ }) === 0 && l.confidence >= label.threshold);
210
+ }
211
+ if (bannedLabel) {
212
+ console.log(`[ModerationController] Banned label (${bannedLabel.name}) detected in file: ${request.fileName}`);
213
+ if (label.actions.includes('notify') && this._messenger) {
214
+ yield this._messenger.sendRecordNotification({
215
+ resource: 'file',
216
+ action: 'scanned',
217
+ recordName: request.recordName,
218
+ resourceId: request.fileName,
219
+ resultId,
220
+ labels: scan.labels,
221
+ timeMs: createdAtMs,
222
+ bannedLabel,
223
+ message: `Banned label (${bannedLabel.category
224
+ ? bannedLabel.category + ':'
225
+ : ''}${(_c = bannedLabel.name) !== null && _c !== void 0 ? _c : ''}) detected in file (${request.recordName}/${request.fileName}).`,
226
+ });
227
+ }
228
+ break;
229
+ }
230
+ }
231
+ const result = {
232
+ id: resultId,
233
+ recordName: request.recordName,
234
+ fileName: request.fileName,
235
+ jobId: request.jobId,
236
+ labels: scan.labels,
237
+ modelVersion: scan.modelVersion,
238
+ createdAtMs,
239
+ updatedAtMs: Date.now(),
240
+ appearsToMatchBannedContent: !!bannedLabel,
241
+ };
242
+ this._store.addFileModerationResult(result);
243
+ return {
244
+ success: true,
245
+ result,
246
+ };
247
+ }
248
+ catch (err) {
249
+ const span = trace.getActiveSpan();
250
+ span === null || span === void 0 ? void 0 : span.recordException(err);
251
+ span === null || span === void 0 ? void 0 : span.setStatus({ code: SpanStatusCode.ERROR });
252
+ console.error('[ModerationController] Failed to scan file:', err);
253
+ return {
254
+ success: false,
255
+ errorCode: 'server_error',
256
+ errorMessage: 'A server error occurred.',
257
+ };
258
+ }
259
+ });
260
+ }
97
261
  }
98
262
  __decorate([
99
263
  traced(TRACE_NAME)
100
264
  ], ModerationController.prototype, "reportInst", null);
265
+ __decorate([
266
+ traced(TRACE_NAME)
267
+ ], ModerationController.prototype, "scheduleModerationScans", null);
268
+ __decorate([
269
+ traced(TRACE_NAME)
270
+ ], ModerationController.prototype, "scanFile", null);
101
271
  //# sourceMappingURL=ModerationController.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ModerationController.js","sourceRoot":"","sources":["ModerationController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAOA,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAGlC,OAAO,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAE1C;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAK7B,YACI,KAAsB,EACtB,MAA0B,EAC1B,SAAuC;QAEvC,IAAI,CAAC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eAAe,CAAC,GAAG,CAAC,CAAC;gBAC3B,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,CAAC,EAAE,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,CAAC,CAAC;gBAEhD,OAAO,CAAC,KAAK,CAAC,6CAA6C,EAAE,GAAG,CAAC,CAAC;gBAClE,OAAO;oBACH,OAAO,EAAE,KAAK;oBACd,SAAS,EAAE,cAAc;oBACzB,YAAY,EAAE,0BAA0B;iBAC3C,CAAC;YACN,CAAC;;KACJ;CACJ;AA1RS;IADL,MAAM,CAAC,UAAU,CAAC;sDAuElB;AAMK;IADL,MAAM,CAAC,UAAU,CAAC;mEA6ElB;AAOK;IADL,MAAM,CAAC,UAAU,CAAC;oDA2HlB"}
@@ -0,0 +1,110 @@
1
+ import { ModerationJob } from './ModerationStore';
2
+ /**
3
+ * Defines a class that is able to start moderation jobs.
4
+ * This can include scanning files, messages, etc.
5
+ */
6
+ export interface ModerationJobProvider {
7
+ /**
8
+ * Starts a moderation scan for files with the given filter.
9
+ * Returns the ID of the job.
10
+ * @param filter The filter to use.
11
+ */
12
+ startFilesJob(filter: ModerationJobFilesFilter): Promise<ModerationJob>;
13
+ /**
14
+ * Scans the given file for moderation labels.
15
+ *
16
+ * Returns a promise that resolves with the result of the scan.
17
+ * Implementers should ensure that one label is returned per detected label and one per detected category.
18
+ *
19
+ * @param options the options for the scan.
20
+ */
21
+ scanFile(options: ScanFileOptions): Promise<ModerationFileScan>;
22
+ }
23
+ /**
24
+ * Defines an interface that is able to filter files for a moderation job.
25
+ */
26
+ export interface ModerationJobFilesFilter {
27
+ /**
28
+ * If provided, only files that were created after this timestamp will be included.
29
+ * Time is in unix time in milliseconds.
30
+ */
31
+ createdAfterMs?: number;
32
+ /**
33
+ * If provided, only files that were created before this timestamp will be included.
34
+ * Time is in unix time in milliseconds.
35
+ */
36
+ createdBeforeMs?: number;
37
+ /**
38
+ * Constraints on the name of files that should be included in the job.
39
+ */
40
+ keyNameConstraint?: {
41
+ /**
42
+ * Includes files that match any of the given substrings.
43
+ */
44
+ matchAnySubstring?: string[];
45
+ /**
46
+ * Includes files that match any of the given prefixes.
47
+ */
48
+ matchAnyPrefix?: string[];
49
+ /**
50
+ * Includes files that match any of the given suffixes.
51
+ */
52
+ matchAnySuffix?: string[];
53
+ };
54
+ }
55
+ export interface ScanFileOptions {
56
+ /**
57
+ * The name of the record that the file is in.
58
+ */
59
+ recordName: string;
60
+ /**
61
+ * The name of the file that should be scanned.
62
+ */
63
+ fileName: string;
64
+ /**
65
+ * The minimum confidence to consider a detected label.
66
+ */
67
+ minConfidence?: number;
68
+ }
69
+ /**
70
+ * Defines an interface that represents the result of a file scan.
71
+ */
72
+ export interface ModerationFileScan {
73
+ /**
74
+ * The name of the record that the file is associated with.
75
+ */
76
+ recordName: string;
77
+ /**
78
+ * The name of the file that was scanned.
79
+ */
80
+ fileName: string;
81
+ /**
82
+ * The labels that were detected in the file.
83
+ * There should be one label per detected label and one per detected category.
84
+ */
85
+ labels: ModerationFileScanLabel[];
86
+ /**
87
+ * The version of the model that was used to scan the file.
88
+ */
89
+ modelVersion: string;
90
+ }
91
+ /**
92
+ * Defines an interface that represents a label that was detected in a file scan.
93
+ */
94
+ export interface ModerationFileScanLabel {
95
+ /**
96
+ * The name of the label.
97
+ */
98
+ name: string;
99
+ /**
100
+ * The category of the label.
101
+ * Used to group similar labels together.
102
+ */
103
+ category?: string;
104
+ /**
105
+ * The confidence that the label is correct.
106
+ * Should be a value between 0 and 1, where 0 is no confidence and 1 is full confidence.
107
+ */
108
+ confidence: number;
109
+ }
110
+ //# sourceMappingURL=ModerationJobProvider.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=ModerationJobProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModerationJobProvider.js","sourceRoot":"","sources":["ModerationJobProvider.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=ModerationScanner.d.ts.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=ModerationScanner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ModerationScanner.js","sourceRoot":"","sources":["ModerationScanner.ts"],"names":[],"mappings":""}
@@ -7,6 +7,22 @@ export interface ModerationStore {
7
7
  * @param report The report to save.
8
8
  */
9
9
  saveUserInstReport(report: UserInstReport): Promise<void>;
10
+ /**
11
+ * Inserts the given moderation job.
12
+ * @param job The job that should be saved.
13
+ */
14
+ addModerationJob(job: ModerationJob): Promise<void>;
15
+ /**
16
+ * Attempts to find the most recent job of the given type.
17
+ * If no job is found, returns null.
18
+ * @param type The type of the job.
19
+ */
20
+ findMostRecentJobOfType(type: ModerationJob['type']): Promise<ModerationJob | null>;
21
+ /**
22
+ * Inserts the result of a file moderation scan.
23
+ * @param result The result to save.
24
+ */
25
+ addFileModerationResult(result: ModerationFileScanResult): Promise<void>;
10
26
  }
11
27
  export interface UserInstReport {
12
28
  /**
@@ -62,4 +78,78 @@ export interface UserInstReport {
62
78
  updatedAtMs: number;
63
79
  }
64
80
  export type ReportReason = 'poor-performance' | 'spam' | 'harassment' | 'copyright-infringement' | 'obscene' | 'illegal' | 'other';
81
+ export interface ModerationJob {
82
+ /**
83
+ * The ID of the moderation job.
84
+ */
85
+ id: string;
86
+ /**
87
+ * The type of the moderation job.
88
+ */
89
+ type: 'files';
90
+ /**
91
+ * The ID of the s3 batch job that is being used to scan the files.
92
+ */
93
+ s3Id?: string;
94
+ /**
95
+ * The unix time in milliseconds that the job was created.
96
+ */
97
+ createdAtMs: number;
98
+ /**
99
+ * The unix time in milliseconds that the job was last updated.
100
+ */
101
+ updatedAtMs: number;
102
+ }
103
+ export interface ModerationFileScanResult {
104
+ /**
105
+ * The ID of the scan.
106
+ */
107
+ id: string;
108
+ /**
109
+ * The ID of the job that the scan is associated with.
110
+ */
111
+ jobId: string | null;
112
+ /**
113
+ * The name of the record that the file was stored inside.
114
+ */
115
+ recordName: string;
116
+ /**
117
+ * The name of the file.
118
+ */
119
+ fileName: string;
120
+ /**
121
+ * Whether the file has detected labels that are banned.
122
+ */
123
+ appearsToMatchBannedContent: boolean;
124
+ /**
125
+ * The labels that were detected in the file.
126
+ */
127
+ labels: ModerationFileScanResultLabel[];
128
+ /**
129
+ * The version of the model that was used to scan the file.
130
+ */
131
+ modelVersion: string;
132
+ /**
133
+ * The unix time in milliseconds that the scan was created.
134
+ */
135
+ createdAtMs: number;
136
+ /**
137
+ * The unix time in milliseconds that the scan was last updated.
138
+ */
139
+ updatedAtMs: number;
140
+ }
141
+ export interface ModerationFileScanResultLabel {
142
+ /**
143
+ * The name of the label.
144
+ */
145
+ name: string;
146
+ /**
147
+ * The category of the label.
148
+ */
149
+ category?: string;
150
+ /**
151
+ * The confidence of the label.
152
+ */
153
+ confidence: number;
154
+ }
65
155
  //# sourceMappingURL=ModerationStore.d.ts.map
@@ -1,6 +1,8 @@
1
1
  import { StudioComIdRequest } from './RecordsStore';
2
2
  import { UserInstReport } from './ModerationStore';
3
3
  import { z } from 'zod';
4
+ import { ModerationFileScanLabel } from './ModerationJobProvider';
5
+ import { ResourceKinds } from '@casual-simulation/aux-common';
4
6
  /**
5
7
  * Defines an interface for a class that is able to send records notifications.
6
8
  */
@@ -21,7 +23,7 @@ export declare class MultiNotificationMessenger implements NotificationMessenger
21
23
  addMessenger(messenger: NotificationMessenger): void;
22
24
  sendRecordNotification(notification: UserInstReportNotification): Promise<void>;
23
25
  }
24
- export type RecordsNotification = UserInstReportNotification | StudioComIdRequestNotification;
26
+ export type RecordsNotification = UserInstReportNotification | ModerationResourceScanNotification | StudioComIdRequestNotification;
25
27
  /**
26
28
  * Defines a base interface for a notification that is related to a record.
27
29
  */
@@ -56,6 +58,43 @@ export interface UserInstReportNotification extends ResourceNotification {
56
58
  */
57
59
  report: UserInstReport;
58
60
  }
61
+ /**
62
+ * Defines a notification that is for a user inst report.
63
+ */
64
+ export interface ModerationResourceScanNotification extends ResourceNotification {
65
+ /**
66
+ * The kind of the resource that was scanned.
67
+ */
68
+ resource: ResourceKinds;
69
+ /**
70
+ * The name of the record that the resource was scanned in.
71
+ */
72
+ recordName: string | null;
73
+ /**
74
+ * The ID of the resource that was scanned.
75
+ */
76
+ resourceId: string;
77
+ /**
78
+ * The ID of the moderation result that was created for the resource.
79
+ */
80
+ resultId: string;
81
+ /**
82
+ * The labels that were detected in the file.
83
+ */
84
+ labels: ModerationFileScanLabel[];
85
+ /**
86
+ * The time of the scan in unix time in milliseconds.
87
+ */
88
+ timeMs: number;
89
+ /**
90
+ * The message that should be sent with the notification.
91
+ */
92
+ message: string;
93
+ /**
94
+ * The label that caused the resource to be banned.
95
+ */
96
+ bannedLabel?: ModerationFileScanLabel;
97
+ }
59
98
  export interface StudioComIdRequestNotification extends ResourceNotification {
60
99
  resource: 'studio_com_id_request';
61
100
  /**
@@ -63,7 +102,7 @@ export interface StudioComIdRequestNotification extends ResourceNotification {
63
102
  */
64
103
  request: StudioComIdRequest;
65
104
  }
66
- export type NotificationResourceActions = 'created' | 'updated' | 'deleted';
105
+ export type NotificationResourceActions = 'created' | 'updated' | 'deleted' | 'scanned';
67
106
  export declare const slackSchema: z.ZodObject<{
68
107
  webhookUrl: z.ZodString;
69
108
  }, "strip", z.ZodTypeAny, {
@@ -150,4 +189,5 @@ export type NotificationOptions = z.infer<typeof notificationsSchema>;
150
189
  export declare function formatNotificationAsString(notification: RecordsNotification): string;
151
190
  export declare function formatUserInstReportNotificationAsString(notification: UserInstReportNotification): string;
152
191
  export declare function formatStudioComIdRequestNotificationAsString(notification: StudioComIdRequestNotification): string;
192
+ export declare function formatResourceNotificationAsString(notification: ModerationResourceScanNotification): string;
153
193
  //# sourceMappingURL=NotificationMessenger.d.ts.map
@@ -79,6 +79,13 @@ export function formatNotificationAsString(notification) {
79
79
  return formatUserInstReportNotificationAsString(notification);
80
80
  case 'studio_com_id_request':
81
81
  return formatStudioComIdRequestNotificationAsString(notification);
82
+ case 'file':
83
+ case 'data':
84
+ case 'event':
85
+ case 'inst':
86
+ return formatResourceNotificationAsString(notification);
87
+ default:
88
+ return JSON.stringify(notification, undefined, 2);
82
89
  }
83
90
  }
84
91
  export function formatUserInstReportNotificationAsString(notification) {
@@ -113,4 +120,24 @@ Time: ${time}
113
120
  Reporting User: ${(_a = notification.request.userId) !== null && _a !== void 0 ? _a : '(null)'}
114
121
  Requesting IP: ${(_b = notification.request.requestingIpAddress) !== null && _b !== void 0 ? _b : '(null)'}`;
115
122
  }
123
+ export function formatResourceNotificationAsString(notification) {
124
+ const time = DateTime.fromMillis(notification.timeMs, {
125
+ zone: 'utc',
126
+ }).toISO();
127
+ return `A ${notification.resource} was ${notification.action} for moderation labels.
128
+
129
+ Message: ${notification.message}
130
+ RecordName: ${notification.recordName}
131
+ FileName: ${notification.resourceId}
132
+ ResultId: ${notification.resultId}
133
+ BannedLabel: ${notification.bannedLabel
134
+ ? formatLabel(notification.bannedLabel)
135
+ : '(null)'}
136
+ Labels:
137
+ ${notification.labels.map(formatLabel).join('\n')}
138
+ Time: ${time}`;
139
+ function formatLabel(label) {
140
+ return `- ${label.name}${label.category ? ':' + label.category : ''} (${label.confidence})`;
141
+ }
142
+ }
116
143
  //# sourceMappingURL=NotificationMessenger.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationMessenger.js","sourceRoot":"","sources":["NotificationMessenger.ts"],"names":[],"mappings":";;;;;;;;;AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB;;GAEG;AACH,MAAM,OAAO,0BAA0B;IAInC,YAAY,OAA4B;QACpC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IAC1B,CAAC;IAED,YAAY,CAAC,SAAgC;QACzC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IAEK,sBAAsB,CACxB,YAA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,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,GAAG,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,KAC/D,KAAK,CAAC,UACV,GAAG,CAAC;IACR,CAAC;AACL,CAAC"}
@@ -37,6 +37,7 @@ export declare class RecordsController {
37
37
  * @returns
38
38
  */
39
39
  createPublicRecordKey(name: string, policy: PublicRecordKeyPolicy, userId: string): Promise<CreatePublicRecordKeyResult>;
40
+ hashHighEntropyPasswordWithSalt(sessionSecret: string, sessionId: string): string;
40
41
  /**
41
42
  * Validates the given record key. Returns success if the key is valid and can be used to publish things to its bucket.
42
43
  * @param key The key that should be validated.