@rimori/client 2.5.23 → 2.5.24-next.1
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/dist/index.d.ts +1 -0
- package/dist/plugin/CommunicationHandler.d.ts +1 -0
- package/dist/plugin/module/DbModule.d.ts +12 -0
- package/dist/plugin/module/DbModule.js +37 -0
- package/dist/plugin/module/PluginModule.d.ts +1 -0
- package/dist/plugin/module/PluginModule.js +1 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -20,3 +20,4 @@ export { TIER_ORDER, ROLE_ORDER } from './plugin/module/PluginModule';
|
|
|
20
20
|
export type { SharedContent, BasicSharedContent, ContentStatus } from './plugin/module/SharedContentController';
|
|
21
21
|
export type { MacroAccomplishmentPayload, MicroAccomplishmentPayload } from './controller/AccomplishmentController';
|
|
22
22
|
export { StorageModule } from './plugin/module/StorageModule';
|
|
23
|
+
export type { PublicityLevel } from './plugin/module/DbModule';
|
|
@@ -20,6 +20,7 @@ type DbQueryBuilder<Row extends Record<string, unknown>> = Omit<PostgrestQueryBu
|
|
|
20
20
|
count?: 'exact' | 'planned' | 'estimated';
|
|
21
21
|
}): PostgrestFilterBuilder<any, any, Row, Row[], string, any, 'GET'>;
|
|
22
22
|
};
|
|
23
|
+
export type PublicityLevel = 'own' | 'guild';
|
|
23
24
|
/**
|
|
24
25
|
* Database module for plugin database operations.
|
|
25
26
|
* Provides access to plugin tables with automatic prefixing and schema management.
|
|
@@ -51,5 +52,16 @@ export declare class DbModule {
|
|
|
51
52
|
* @returns The full table name.
|
|
52
53
|
*/
|
|
53
54
|
getTableName(table: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Sets the publicity level of a plugin DB entry via the backend.
|
|
57
|
+
*
|
|
58
|
+
* - 'own' — visible only to the creator (created_by=uid, guild_id=null)
|
|
59
|
+
* - 'guild' — visible to all guild members (users: created_by=uid; moderators/admins: created_by=null; both with guild_id set)
|
|
60
|
+
*
|
|
61
|
+
* @param table The plugin table name (without prefix, e.g. 'pages')
|
|
62
|
+
* @param entryId The UUID of the entry to update
|
|
63
|
+
* @param publicity The desired publicity level
|
|
64
|
+
*/
|
|
65
|
+
setPublicity(table: string, entryId: string, publicity: PublicityLevel): Promise<void>;
|
|
54
66
|
}
|
|
55
67
|
export {};
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
1
10
|
/**
|
|
2
11
|
* Database module for plugin database operations.
|
|
3
12
|
* Provides access to plugin tables with automatic prefixing and schema management.
|
|
@@ -49,4 +58,32 @@ export class DbModule {
|
|
|
49
58
|
}
|
|
50
59
|
return this.tablePrefix + '_' + table;
|
|
51
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Sets the publicity level of a plugin DB entry via the backend.
|
|
63
|
+
*
|
|
64
|
+
* - 'own' — visible only to the creator (created_by=uid, guild_id=null)
|
|
65
|
+
* - 'guild' — visible to all guild members (users: created_by=uid; moderators/admins: created_by=null; both with guild_id set)
|
|
66
|
+
*
|
|
67
|
+
* @param table The plugin table name (without prefix, e.g. 'pages')
|
|
68
|
+
* @param entryId The UUID of the entry to update
|
|
69
|
+
* @param publicity The desired publicity level
|
|
70
|
+
*/
|
|
71
|
+
setPublicity(table, entryId, publicity) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const tableName = this.getTableName(table);
|
|
74
|
+
yield fetch(`${this.rimoriInfo.backendUrl}/db-entry/publicity`, {
|
|
75
|
+
method: 'POST',
|
|
76
|
+
headers: {
|
|
77
|
+
'Content-Type': 'application/json',
|
|
78
|
+
Authorization: `Bearer ${this.rimoriInfo.token}`,
|
|
79
|
+
},
|
|
80
|
+
body: JSON.stringify({
|
|
81
|
+
table_name: tableName,
|
|
82
|
+
schema: this.rimoriInfo.dbSchema,
|
|
83
|
+
entry_id: entryId,
|
|
84
|
+
publicity,
|
|
85
|
+
}),
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
}
|
|
52
89
|
}
|