@permaweb/libs 0.0.61 → 0.0.63

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;
@@ -13,6 +13,7 @@ export type ProcessReadType = {
13
13
  path: string;
14
14
  fallbackAction: string;
15
15
  serialize?: boolean;
16
+ tags?: TagType[];
16
17
  };
17
18
  export type ProcessSpawnType = {
18
19
  module: string;
@@ -132,6 +133,7 @@ export type CommentCreateArgType = {
132
133
  parentId?: string;
133
134
  rootId?: string;
134
135
  tags?: TagType[];
136
+ metadata?: object;
135
137
  };
136
138
  export type CollectionManifestType = {
137
139
  type: string;
@@ -217,6 +219,20 @@ export type DefaultGQLResponseType = {
217
219
  export type BatchAGQLResponseType = {
218
220
  [queryKey: string]: DefaultGQLResponseType;
219
221
  };
222
+ export type ModerationStatusType = 'blocked' | 'allowed';
223
+ export type ModerationTargetType = 'comment' | 'profile';
224
+ export type ModerationEntryType = {
225
+ id: string;
226
+ targetId: string;
227
+ targetType: ModerationTargetType;
228
+ status: ModerationStatusType;
229
+ targetContext?: string;
230
+ reason?: string;
231
+ moderator: string;
232
+ dateCreated: number;
233
+ updatedAt?: number;
234
+ metadata?: any;
235
+ };
220
236
  export type TagType = {
221
237
  name: string;
222
238
  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,49 @@ declare function init(deps: Helpers.DependencyType): {
93
95
  getCollections: (args: {
94
96
  creator?: string;
95
97
  }) => Promise<Helpers.CollectionType[] | null>;
98
+ addModerationEntry: (args: {
99
+ moderationId: string;
100
+ targetType: Helpers.ModerationTargetType;
101
+ targetId: string;
102
+ status: Helpers.ModerationStatusType;
103
+ targetContext?: string;
104
+ moderator: string;
105
+ reason?: string;
106
+ metadata?: any;
107
+ }) => Promise<string | null>;
108
+ getModerationEntries: (args: {
109
+ moderationId: string;
110
+ targetType: Helpers.ModerationTargetType;
111
+ targetId?: string;
112
+ status?: Helpers.ModerationStatusType;
113
+ targetContext?: string;
114
+ moderator?: string;
115
+ }) => Promise<Helpers.ModerationEntryType[] | null>;
116
+ updateModerationEntry: (args: {
117
+ moderationId: string;
118
+ targetType: Helpers.ModerationTargetType;
119
+ targetId: string;
120
+ status: Helpers.ModerationStatusType;
121
+ moderator: string;
122
+ reason?: string;
123
+ }) => Promise<string | null>;
124
+ removeModerationEntry: (args: {
125
+ moderationId: string;
126
+ targetType: Helpers.ModerationTargetType;
127
+ targetId: string;
128
+ }) => Promise<string | null>;
129
+ addModerationSubscription: (args: {
130
+ moderationId: string;
131
+ originPortal: string;
132
+ subscriptionType?: string;
133
+ }) => Promise<string | null>;
134
+ removeModerationSubscription: (args: {
135
+ moderationId: string;
136
+ originPortal: string;
137
+ }) => Promise<string | null>;
138
+ getModerationSubscriptions: (args: {
139
+ moderationId: string;
140
+ }) => Promise<string[] | null>;
96
141
  resolveTransaction: (data: any) => Promise<any>;
97
142
  getGQLData: typeof Common.getGQLData;
98
143
  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,79 @@
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): (args: {
6
+ moderationId: string;
7
+ targetType: ModerationTargetType;
8
+ targetId: string;
9
+ status: ModerationStatusType;
10
+ targetContext?: string;
11
+ moderator: string;
12
+ reason?: string;
13
+ metadata?: any;
14
+ }) => Promise<string | null>;
15
+ /**
16
+ * Get moderation entries from the moderation process
17
+ */
18
+ export declare function getModerationEntriesWith(deps: DependencyType): (args: {
19
+ moderationId: string;
20
+ targetType: ModerationTargetType;
21
+ targetId?: string;
22
+ status?: ModerationStatusType;
23
+ targetContext?: string;
24
+ moderator?: string;
25
+ }) => Promise<ModerationEntryType[] | null>;
26
+ /**
27
+ * Update a moderation entry in the moderation process
28
+ */
29
+ export declare function updateModerationEntryWith(deps: DependencyType): (args: {
30
+ moderationId: string;
31
+ targetType: ModerationTargetType;
32
+ targetId: string;
33
+ status: ModerationStatusType;
34
+ moderator: string;
35
+ reason?: string;
36
+ }) => Promise<string | null>;
37
+ /**
38
+ * Remove a moderation entry from the moderation process
39
+ */
40
+ export declare function removeModerationEntryWith(deps: DependencyType): (args: {
41
+ moderationId: string;
42
+ targetType: ModerationTargetType;
43
+ targetId: string;
44
+ }) => Promise<string | null>;
45
+ /**
46
+ * Add a moderation subscription to the moderation process
47
+ */
48
+ export declare function addModerationSubscriptionWith(deps: DependencyType): (args: {
49
+ moderationId: string;
50
+ originPortal: string;
51
+ subscriptionType?: string;
52
+ }) => Promise<string | null>;
53
+ /**
54
+ * Remove a moderation subscription from the moderation process
55
+ */
56
+ export declare function removeModerationSubscriptionWith(deps: DependencyType): (args: {
57
+ moderationId: string;
58
+ originPortal: string;
59
+ }) => Promise<string | null>;
60
+ /**
61
+ * Get moderation subscriptions from the moderation process
62
+ */
63
+ export declare function getModerationSubscriptionsWith(deps: DependencyType): (args: {
64
+ moderationId: string;
65
+ }) => Promise<string[] | null>;
66
+ /**
67
+ * Bulk add moderation entries to the moderation process
68
+ */
69
+ export declare function bulkAddModerationEntriesWith(deps: DependencyType): (args: {
70
+ moderationId: string;
71
+ entries: Array<{
72
+ targetType: ModerationTargetType;
73
+ targetId: string;
74
+ status: ModerationStatusType;
75
+ targetContext?: string;
76
+ reason?: string;
77
+ metadata?: any;
78
+ }>;
79
+ }) => 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.61",
3
+ "version": "0.0.63",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",