@permaweb/libs 0.0.60 → 0.0.62

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.
@@ -7,6 +7,7 @@ export declare const AO: {
7
7
  collection: string;
8
8
  collectionActivity: string;
9
9
  comments: string;
10
+ moderation: string;
10
11
  zone: {
11
12
  id: string;
12
13
  version: string;
@@ -132,6 +132,7 @@ export type CommentCreateArgType = {
132
132
  parentId?: string;
133
133
  rootId?: string;
134
134
  tags?: TagType[];
135
+ metadata?: object;
135
136
  };
136
137
  export type CollectionManifestType = {
137
138
  type: string;
@@ -217,6 +218,17 @@ export type DefaultGQLResponseType = {
217
218
  export type BatchAGQLResponseType = {
218
219
  [queryKey: string]: DefaultGQLResponseType;
219
220
  };
221
+ export type ModerationStatusType = 'blocked' | 'allowed';
222
+ export type ModerationTargetType = 'comment' | 'profile';
223
+ export type ModerationEntryType = {
224
+ targetId: string;
225
+ status: ModerationStatusType;
226
+ targetContext?: string;
227
+ reason?: string;
228
+ moderator: string;
229
+ dateCreated: number;
230
+ metadata?: any;
231
+ };
220
232
  export type TagType = {
221
233
  name: string;
222
234
  value: string;
@@ -7,6 +7,8 @@ declare function init(deps: Helpers.DependencyType): {
7
7
  createZone: (args: {
8
8
  data?: any;
9
9
  tags?: Helpers.TagType[];
10
+ spawnModeration?: boolean;
11
+ authUsers?: string[];
10
12
  }, callback?: (status: any) => void) => Promise<string | null>;
11
13
  updateZone: (args: object, zoneId: string) => Promise<string | null>;
12
14
  addToZone: (args: {
@@ -93,6 +95,29 @@ declare function init(deps: Helpers.DependencyType): {
93
95
  getCollections: (args: {
94
96
  creator?: string;
95
97
  }) => Promise<Helpers.CollectionType[] | null>;
98
+ addModerationEntry: (zoneId: string, targetType: Helpers.ModerationTargetType, entry: {
99
+ targetId: string;
100
+ status: Helpers.ModerationStatusType;
101
+ targetContext?: string;
102
+ moderator: string;
103
+ reason?: string;
104
+ metadata?: any;
105
+ }) => Promise<string | null>;
106
+ getModerationEntries: (zoneId: string, targetType: Helpers.ModerationTargetType, filters?: {
107
+ targetId?: string;
108
+ status?: Helpers.ModerationStatusType;
109
+ targetContext?: string;
110
+ moderator?: string;
111
+ }) => Promise<Helpers.ModerationEntryType[] | null>;
112
+ updateModerationEntry: (zoneId: string, targetType: Helpers.ModerationTargetType, targetId: string, update: {
113
+ status: Helpers.ModerationStatusType;
114
+ moderator: string;
115
+ reason?: string;
116
+ }) => Promise<string | null>;
117
+ removeModerationEntry: (zoneId: string, targetType: Helpers.ModerationTargetType, targetId: string) => Promise<string | null>;
118
+ addModerationSubscription: (zoneId: string, moderationId: string, subscriptionType?: string) => Promise<string | null>;
119
+ removeModerationSubscription: (zoneId: string, moderationId: string) => Promise<string | null>;
120
+ getModerationSubscriptions: (zoneId: string) => Promise<string[] | null>;
96
121
  resolveTransaction: (data: any) => Promise<any>;
97
122
  getGQLData: typeof Common.getGQLData;
98
123
  getAggregatedGQLData: typeof Common.getAggregatedGQLData;
@@ -1,5 +1,6 @@
1
1
  export * from './assets.ts';
2
2
  export * from './collections.ts';
3
3
  export * from './comments.ts';
4
+ export * from './moderation.ts';
4
5
  export * from './profiles.ts';
5
6
  export * from './zones.ts';
@@ -0,0 +1,56 @@
1
+ import { DependencyType, ModerationEntryType, ModerationStatusType, ModerationTargetType } from '../helpers/types.ts';
2
+ /**
3
+ * Add a moderation entry to the moderation process
4
+ */
5
+ export declare function addModerationEntryWith(deps: DependencyType): (zoneId: string, targetType: ModerationTargetType, entry: {
6
+ targetId: string;
7
+ status: ModerationStatusType;
8
+ targetContext?: string;
9
+ moderator: string;
10
+ reason?: string;
11
+ metadata?: any;
12
+ }) => Promise<string | null>;
13
+ /**
14
+ * Get moderation entries from the moderation process
15
+ */
16
+ export declare function getModerationEntriesWith(deps: DependencyType): (zoneId: string, targetType: ModerationTargetType, filters?: {
17
+ targetId?: string;
18
+ status?: ModerationStatusType;
19
+ targetContext?: string;
20
+ moderator?: string;
21
+ }) => Promise<ModerationEntryType[] | null>;
22
+ /**
23
+ * Update a moderation entry in the moderation process
24
+ */
25
+ export declare function updateModerationEntryWith(deps: DependencyType): (zoneId: string, targetType: ModerationTargetType, targetId: string, update: {
26
+ status: ModerationStatusType;
27
+ moderator: string;
28
+ reason?: string;
29
+ }) => Promise<string | null>;
30
+ /**
31
+ * Remove a moderation entry from the moderation process
32
+ */
33
+ export declare function removeModerationEntryWith(deps: DependencyType): (zoneId: string, targetType: ModerationTargetType, targetId: string) => Promise<string | null>;
34
+ /**
35
+ * Add a moderation subscription to the moderation process
36
+ */
37
+ export declare function addModerationSubscriptionWith(deps: DependencyType): (zoneId: string, moderationId: string, subscriptionType?: string) => Promise<string | null>;
38
+ /**
39
+ * Remove a moderation subscription from the moderation process
40
+ */
41
+ export declare function removeModerationSubscriptionWith(deps: DependencyType): (zoneId: string, moderationId: string) => Promise<string | null>;
42
+ /**
43
+ * Get moderation subscriptions from the moderation process
44
+ */
45
+ export declare function getModerationSubscriptionsWith(deps: DependencyType): (zoneId: string) => Promise<string[] | null>;
46
+ /**
47
+ * Bulk add moderation entries to the moderation process
48
+ */
49
+ export declare function bulkAddModerationEntriesWith(deps: DependencyType): (zoneId: string, entries: Array<{
50
+ targetType: ModerationTargetType;
51
+ targetId: string;
52
+ status: ModerationStatusType;
53
+ targetContext?: string;
54
+ reason?: string;
55
+ metadata?: any;
56
+ }>) => Promise<string | null>;
@@ -2,6 +2,8 @@ import { DependencyType, TagType } from '../helpers/types.ts';
2
2
  export declare function createZoneWith(deps: DependencyType): (args: {
3
3
  data?: any;
4
4
  tags?: TagType[];
5
+ spawnModeration?: boolean;
6
+ authUsers?: string[];
5
7
  }, callback?: (status: any) => void) => Promise<string | null>;
6
8
  export declare function updateZoneWith(deps: DependencyType): (args: object, zoneId: string) => Promise<string | null>;
7
9
  export declare function addToZoneWith(deps: DependencyType): (args: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@permaweb/libs",
3
- "version": "0.0.60",
3
+ "version": "0.0.62",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",