@wumx-labs/noxaeapi-sdk 0.4.2 → 0.5.0
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/README.md +8 -0
- package/dist/index.cjs +190 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +180 -33
- package/dist/index.d.ts +180 -33
- package/dist/index.js +190 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -168,16 +168,67 @@ interface TopBalanceEntry {
|
|
|
168
168
|
uuid: string;
|
|
169
169
|
balance: number;
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
name: string;
|
|
173
|
-
permissions: string[];
|
|
174
|
-
}
|
|
171
|
+
/** A single LuckPerms node (permission, inheritance, prefix, etc.) as returned by the server. */
|
|
175
172
|
interface PermissionNode {
|
|
176
173
|
permission: string;
|
|
177
174
|
value: boolean;
|
|
175
|
+
/** Epoch seconds, or `0` for a permanent (non-expiring) node. */
|
|
178
176
|
expiry: number;
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
/** Server context this node applies to, or the literal `"global"` if none was set. */
|
|
178
|
+
server: string;
|
|
179
|
+
/** World context this node applies to, or the literal `"global"` if none was set. */
|
|
180
|
+
world: string;
|
|
181
|
+
}
|
|
182
|
+
interface GroupInfo {
|
|
183
|
+
name: string;
|
|
184
|
+
/** `null` if the group has no display name node set. */
|
|
185
|
+
displayName: string | null;
|
|
186
|
+
weight: number;
|
|
187
|
+
permissions: PermissionNode[];
|
|
188
|
+
}
|
|
189
|
+
/** A player's or group's resolved prefix, suffix, and custom meta key-values. */
|
|
190
|
+
interface MetaInfo {
|
|
191
|
+
prefix: string | null;
|
|
192
|
+
suffix: string | null;
|
|
193
|
+
/** LuckPerms keeps every value ever set per key; the highest-priority one wins in-game. */
|
|
194
|
+
meta: Record<string, string[]>;
|
|
195
|
+
}
|
|
196
|
+
/** A LuckPerms track (an ordered rank ladder used for promote/demote). */
|
|
197
|
+
interface TrackInfo {
|
|
198
|
+
name: string;
|
|
199
|
+
/** Ordered from lowest to highest rank. */
|
|
200
|
+
groups: string[];
|
|
201
|
+
}
|
|
202
|
+
/** Optional server/world context that scopes a node to a subset of the network. */
|
|
203
|
+
interface LuckPermsContextOptions {
|
|
204
|
+
/** e.g. `"survival"` — matches LuckPerms' `server` context key. */
|
|
205
|
+
server?: string;
|
|
206
|
+
/** e.g. `"world_nether"` — matches LuckPerms' `world` context key. */
|
|
207
|
+
world?: string;
|
|
208
|
+
}
|
|
209
|
+
interface LuckPermsCheckPermissionResult {
|
|
210
|
+
uuid: string;
|
|
211
|
+
permission: string;
|
|
212
|
+
has: boolean;
|
|
213
|
+
}
|
|
214
|
+
interface LuckPermsPrimaryGroupResult {
|
|
215
|
+
uuid: string;
|
|
216
|
+
primaryGroup: string;
|
|
217
|
+
}
|
|
218
|
+
interface LuckPermsCreateGroupResult {
|
|
219
|
+
name: string;
|
|
220
|
+
status: string;
|
|
221
|
+
}
|
|
222
|
+
/** Result of a promote/demote call along a track. */
|
|
223
|
+
interface LuckPermsTrackActionResult {
|
|
224
|
+
uuid: string;
|
|
225
|
+
track: string;
|
|
226
|
+
/** `false` for statuses like `END_OF_TRACK`/`AMBIGUOUS_CALL`, where nothing was changed. */
|
|
227
|
+
success: boolean;
|
|
228
|
+
/** Raw LuckPerms `PromotionResult`/`DemotionResult` status, e.g. `"SUCCESS"`, `"END_OF_TRACK"`. */
|
|
229
|
+
status: string;
|
|
230
|
+
from: string | null;
|
|
231
|
+
to: string | null;
|
|
181
232
|
}
|
|
182
233
|
interface Advancement {
|
|
183
234
|
key: string;
|
|
@@ -612,55 +663,151 @@ declare class PlaceholdersModule {
|
|
|
612
663
|
replace(uuid: string, message: string): Promise<string>;
|
|
613
664
|
}
|
|
614
665
|
|
|
666
|
+
/** Extra fields accepted by the node-adding endpoints, on top of the context options. */
|
|
667
|
+
interface AddPermissionOptions extends LuckPermsContextOptions {
|
|
668
|
+
/**
|
|
669
|
+
* Node value. Defaults to `true` server-side when omitted — pass `false`
|
|
670
|
+
* to add a negating node rather than a positive grant.
|
|
671
|
+
*/
|
|
672
|
+
value?: boolean;
|
|
673
|
+
/**
|
|
674
|
+
* When the node should expire. Parsed server-side by
|
|
675
|
+
* `ValidationUtils.parseExpiry` — pass an ISO-8601 instant string (e.g.
|
|
676
|
+
* `"2026-12-31T00:00:00Z"`) or an epoch-seconds string. Omit for a node
|
|
677
|
+
* that never expires.
|
|
678
|
+
*/
|
|
679
|
+
expiry?: string;
|
|
680
|
+
}
|
|
681
|
+
type SetGroupOptions = LuckPermsContextOptions & Pick<AddPermissionOptions, "expiry">;
|
|
682
|
+
interface SetMetaValueOptions extends LuckPermsContextOptions {
|
|
683
|
+
/**
|
|
684
|
+
* Sort priority — higher wins when multiple prefix/suffix nodes are
|
|
685
|
+
* active at once. Defaults to `100` server-side when omitted, matching
|
|
686
|
+
* LuckPerms' own `/lp meta setprefix|setsuffix` default.
|
|
687
|
+
*/
|
|
688
|
+
priority?: number;
|
|
689
|
+
}
|
|
615
690
|
/**
|
|
616
691
|
* Wraps the `/v1/luckperms/*` routes. These only exist on the server when
|
|
617
|
-
* the LuckPerms
|
|
618
|
-
* without it
|
|
619
|
-
* available" flag from the SDK's side;
|
|
620
|
-
* LuckPerms if you need to branch on
|
|
692
|
+
* the LuckPerms plugin is loaded — calling any method here against a
|
|
693
|
+
* server without it throws `NoxAeApiServerError` with a 503 status.
|
|
694
|
+
* There's no separate "is this available" flag from the SDK's side;
|
|
695
|
+
* check `client.plugins.list()` for LuckPerms if you need to branch on
|
|
696
|
+
* it ahead of time.
|
|
621
697
|
*
|
|
622
|
-
* Unlike most other modules,
|
|
623
|
-
* JSON (the server reads
|
|
698
|
+
* Unlike most other modules, every request body here is sent as real
|
|
699
|
+
* JSON (the server reads it with `ctx.bodyAsClass(...)`, not
|
|
624
700
|
* `ctx.formParam(...)`) — do not add `form: true` to these calls.
|
|
701
|
+
*
|
|
702
|
+
* "Context" throughout this module means LuckPerms' `server`/`world`
|
|
703
|
+
* context keys, not the Bukkit/network server this SDK talks to — pass
|
|
704
|
+
* them when a node should only apply on a specific sub-server or world,
|
|
705
|
+
* and omit them for a global node.
|
|
625
706
|
*/
|
|
626
707
|
declare class LuckPermsModule {
|
|
627
708
|
private readonly http;
|
|
628
709
|
constructor(http: HttpEngine);
|
|
629
|
-
/** Get the
|
|
710
|
+
/** Get the names of every group a player belongs to (via inheritance nodes). */
|
|
630
711
|
getPlayerGroups(uuid: string): Promise<string[]>;
|
|
631
|
-
/** Get
|
|
712
|
+
/** Get every node (permissions, inheritance, prefix/suffix, meta, ...) held directly by a player. */
|
|
632
713
|
getPlayerPermissions(uuid: string): Promise<PermissionNode[]>;
|
|
633
|
-
/** Add a permission node to a player. */
|
|
634
|
-
addPlayerPermission(uuid: string, permission: string,
|
|
635
|
-
/**
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
/** Remove a permission node from a player. */
|
|
714
|
+
/** Add a permission node to a player. Defaults to a permanent, global, `true`-valued node. */
|
|
715
|
+
addPlayerPermission(uuid: string, permission: string, options?: AddPermissionOptions): Promise<void>;
|
|
716
|
+
/**
|
|
717
|
+
* Remove a permission node from a player by key. Note this matches on
|
|
718
|
+
* the permission string only — it does not target a specific
|
|
719
|
+
* value/expiry/context combination.
|
|
720
|
+
*/
|
|
641
721
|
removePlayerPermission(uuid: string, permission: string): Promise<void>;
|
|
642
|
-
/**
|
|
643
|
-
|
|
644
|
-
|
|
722
|
+
/**
|
|
723
|
+
* Check whether a player has a given permission, using LuckPerms'
|
|
724
|
+
* native resolution (inheritance, wildcards, contexts all apply).
|
|
725
|
+
*/
|
|
726
|
+
checkPlayerPermission(uuid: string, permission: string): Promise<LuckPermsCheckPermissionResult>;
|
|
727
|
+
/** Get a player's primary group name. */
|
|
728
|
+
getPlayerPrimaryGroup(uuid: string): Promise<LuckPermsPrimaryGroupResult>;
|
|
729
|
+
/**
|
|
730
|
+
* Set a player's primary group. This both adds the corresponding
|
|
731
|
+
* inheritance node (so permissions actually resolve from the group) and
|
|
732
|
+
* updates the primary-group label — mirrors `/lp user <target> parent
|
|
733
|
+
* add <group>` plus `/lp user <target> setprimarygroup <group>`.
|
|
734
|
+
*/
|
|
735
|
+
setPlayerGroup(uuid: string, group: string, options?: SetGroupOptions): Promise<void>;
|
|
736
|
+
/**
|
|
737
|
+
* Remove a group's inheritance node from a player. Does **not** change
|
|
738
|
+
* their primary group — call `setPlayerGroup()` with the new group
|
|
739
|
+
* afterward if you're reassigning rank rather than just removing one
|
|
740
|
+
* of several parents.
|
|
741
|
+
*/
|
|
645
742
|
removePlayerGroup(uuid: string, groupName: string): Promise<void>;
|
|
646
|
-
/**
|
|
743
|
+
/**
|
|
744
|
+
* Promote a player one step up a track. If the result isn't successful
|
|
745
|
+
* (e.g. `END_OF_TRACK`, `AMBIGUOUS_CALL`), the player's data is left
|
|
746
|
+
* untouched — check `.success`/`.status` on the result rather than
|
|
747
|
+
* assuming the call always moves them.
|
|
748
|
+
*/
|
|
749
|
+
promotePlayer(uuid: string, track: string, options?: LuckPermsContextOptions): Promise<LuckPermsTrackActionResult>;
|
|
750
|
+
/** Demote a player one step down a track. See `promotePlayer()` for the result semantics. */
|
|
751
|
+
demotePlayer(uuid: string, track: string, options?: LuckPermsContextOptions): Promise<LuckPermsTrackActionResult>;
|
|
752
|
+
/** Get a player's resolved prefix, suffix, and custom meta key-values. */
|
|
753
|
+
getPlayerMeta(uuid: string): Promise<MetaInfo>;
|
|
754
|
+
/**
|
|
755
|
+
* Set a player's prefix. Behaves like a "set", not an "add" — any
|
|
756
|
+
* existing prefix node (in any context) is cleared first, so a player
|
|
757
|
+
* only ever has one active prefix from this call.
|
|
758
|
+
*/
|
|
759
|
+
setPlayerPrefix(uuid: string, prefix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
760
|
+
/** Set a player's suffix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
761
|
+
setPlayerSuffix(uuid: string, suffix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
762
|
+
/** Set a custom meta key-value pair on a player, replacing any existing value(s) for that key. */
|
|
763
|
+
setPlayerMeta(uuid: string, key: string, value: string, options?: LuckPermsContextOptions): Promise<void>;
|
|
764
|
+
/** Remove a custom meta key from a player (all values/contexts for that key). */
|
|
765
|
+
removePlayerMeta(uuid: string, key: string): Promise<void>;
|
|
766
|
+
/** List the names of every group registered in LuckPerms. */
|
|
647
767
|
getGroups(): Promise<string[]>;
|
|
648
768
|
/**
|
|
649
769
|
* Create a new LuckPerms group. The name is lowercased server-side.
|
|
650
770
|
* Throws `NoxAeApiError` with a 409 status if the group already exists.
|
|
651
771
|
*/
|
|
652
|
-
createGroup(name: string): Promise<
|
|
653
|
-
name: string;
|
|
654
|
-
status: string;
|
|
655
|
-
}>;
|
|
772
|
+
createGroup(name: string): Promise<LuckPermsCreateGroupResult>;
|
|
656
773
|
/**
|
|
657
774
|
* Delete a LuckPerms group by name.
|
|
658
775
|
* The `default` group can't be deleted (400 — every user without an
|
|
659
776
|
* explicit group inherits from it) and a 404 is thrown if it doesn't exist.
|
|
660
777
|
*/
|
|
661
778
|
deleteGroup(name: string): Promise<void>;
|
|
662
|
-
/** Get
|
|
663
|
-
getGroupPermissions(name: string): Promise<
|
|
779
|
+
/** Get every node held directly by a group. */
|
|
780
|
+
getGroupPermissions(name: string): Promise<PermissionNode[]>;
|
|
781
|
+
/** Add a permission node to a group. Same options/defaults as `addPlayerPermission()`. */
|
|
782
|
+
addGroupPermission(name: string, permission: string, options?: AddPermissionOptions): Promise<void>;
|
|
783
|
+
/** Remove a permission node from a group by key (matches on permission string only). */
|
|
784
|
+
removeGroupPermission(name: string, permission: string): Promise<void>;
|
|
785
|
+
/** Get full info for a group: name, display name, weight, and all its nodes. */
|
|
786
|
+
getGroupInfo(name: string): Promise<GroupInfo>;
|
|
787
|
+
/**
|
|
788
|
+
* Update a group's weight and/or display name. Provide at least one of
|
|
789
|
+
* the two fields — the server 400s otherwise. Passing an empty/blank
|
|
790
|
+
* `displayName` resets it to the default rather than setting a blank one.
|
|
791
|
+
* Returns the group's full updated info.
|
|
792
|
+
*/
|
|
793
|
+
updateGroup(name: string, updates: {
|
|
794
|
+
weight?: number;
|
|
795
|
+
displayName?: string | null;
|
|
796
|
+
}): Promise<GroupInfo>;
|
|
797
|
+
/** Get a group's resolved prefix, suffix, and custom meta key-values. */
|
|
798
|
+
getGroupMeta(name: string): Promise<MetaInfo>;
|
|
799
|
+
/** Set a group's prefix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
800
|
+
setGroupPrefix(name: string, prefix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
801
|
+
/** Set a group's suffix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
802
|
+
setGroupSuffix(name: string, suffix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
803
|
+
/** Set a custom meta key-value pair on a group, replacing any existing value(s) for that key. */
|
|
804
|
+
setGroupMeta(name: string, key: string, value: string, options?: LuckPermsContextOptions): Promise<void>;
|
|
805
|
+
/** Remove a custom meta key from a group (all values/contexts for that key). */
|
|
806
|
+
removeGroupMeta(name: string, key: string): Promise<void>;
|
|
807
|
+
/** List the names of every track registered in LuckPerms. */
|
|
808
|
+
getTracks(): Promise<string[]>;
|
|
809
|
+
/** Get a track's name and its ordered list of groups (lowest to highest rank). */
|
|
810
|
+
getTrack(name: string): Promise<TrackInfo>;
|
|
664
811
|
}
|
|
665
812
|
|
|
666
813
|
/**
|
|
@@ -1041,4 +1188,4 @@ declare class NoxAeApiNetworkError extends Error {
|
|
|
1041
1188
|
constructor(message: string, method: string, path: string, cause?: unknown);
|
|
1042
1189
|
}
|
|
1043
1190
|
|
|
1044
|
-
export { type Advancement, type CurrencyBalance, type CurrencyTopEntry, type EconomyInfo, type GroupInfo, type InventoryItem, type LeaderboardEntry, type LeaderboardSourceInfo, type NetworkBroadcastResponse, type NetworkFindPlayerResponse, type NetworkHealthResponse, type NetworkHealthServerEntry, type NetworkHubBroadcastResponse, type NetworkHubFindPlayerResponse, type NetworkHubNode, type NetworkHubPlayer, type NetworkHubPlayersResponse, type NetworkHubStatusResponse, type NetworkPlayersResponse, type NetworkPlayersServerEntry, type NetworkServerStatus, NoxAeApiClient, type NoxAeApiClientOptions, NoxAeApiError, NoxAeApiForbiddenError, NoxAeApiNetworkError, NoxAeApiNetworkHubClient, NoxAeApiNotFoundError, NoxAeApiRateLimitError, NoxAeApiServerError, NoxAeApiSocket, NoxAeApiUnauthorizedError, type NoxAeApiWsEvent, type NoxAeApiWsOptions, type NoxAuthPlayerInfo, type Objective, type OfflinePlayer, type OnlinePlayer, type PasswordCheckResult, type PermissionNode, type PlayerBalance, type PlayerProfile, type PlayerProfileBan, type PlayerProfileEconomy, type PlayerProfileStatTile, type PlayerProfileStatus, type PlayerProfilesResponse, type PlayerResolveResult, type PlayerStats, type Plugin, type RetryOptions, type Score, type Scoreboard, type ServerBan, type ServerHealth, type ServerInfo, type SkillInfo, type TopBalanceEntry, type WhitelistEntry, type World };
|
|
1191
|
+
export { type AddPermissionOptions, type Advancement, type CurrencyBalance, type CurrencyTopEntry, type EconomyInfo, type GroupInfo, type InventoryItem, type LeaderboardEntry, type LeaderboardSourceInfo, type LuckPermsCheckPermissionResult, type LuckPermsContextOptions, type LuckPermsCreateGroupResult, type LuckPermsPrimaryGroupResult, type LuckPermsTrackActionResult, type MetaInfo, type NetworkBroadcastResponse, type NetworkFindPlayerResponse, type NetworkHealthResponse, type NetworkHealthServerEntry, type NetworkHubBroadcastResponse, type NetworkHubFindPlayerResponse, type NetworkHubNode, type NetworkHubPlayer, type NetworkHubPlayersResponse, type NetworkHubStatusResponse, type NetworkPlayersResponse, type NetworkPlayersServerEntry, type NetworkServerStatus, NoxAeApiClient, type NoxAeApiClientOptions, NoxAeApiError, NoxAeApiForbiddenError, NoxAeApiNetworkError, NoxAeApiNetworkHubClient, NoxAeApiNotFoundError, NoxAeApiRateLimitError, NoxAeApiServerError, NoxAeApiSocket, NoxAeApiUnauthorizedError, type NoxAeApiWsEvent, type NoxAeApiWsOptions, type NoxAuthPlayerInfo, type Objective, type OfflinePlayer, type OnlinePlayer, type PasswordCheckResult, type PermissionNode, type PlayerBalance, type PlayerProfile, type PlayerProfileBan, type PlayerProfileEconomy, type PlayerProfileStatTile, type PlayerProfileStatus, type PlayerProfilesResponse, type PlayerResolveResult, type PlayerStats, type Plugin, type RetryOptions, type Score, type Scoreboard, type ServerBan, type ServerHealth, type ServerInfo, type SetGroupOptions, type SetMetaValueOptions, type SkillInfo, type TopBalanceEntry, type TrackInfo, type WhitelistEntry, type World };
|
package/dist/index.d.ts
CHANGED
|
@@ -168,16 +168,67 @@ interface TopBalanceEntry {
|
|
|
168
168
|
uuid: string;
|
|
169
169
|
balance: number;
|
|
170
170
|
}
|
|
171
|
-
|
|
172
|
-
name: string;
|
|
173
|
-
permissions: string[];
|
|
174
|
-
}
|
|
171
|
+
/** A single LuckPerms node (permission, inheritance, prefix, etc.) as returned by the server. */
|
|
175
172
|
interface PermissionNode {
|
|
176
173
|
permission: string;
|
|
177
174
|
value: boolean;
|
|
175
|
+
/** Epoch seconds, or `0` for a permanent (non-expiring) node. */
|
|
178
176
|
expiry: number;
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
/** Server context this node applies to, or the literal `"global"` if none was set. */
|
|
178
|
+
server: string;
|
|
179
|
+
/** World context this node applies to, or the literal `"global"` if none was set. */
|
|
180
|
+
world: string;
|
|
181
|
+
}
|
|
182
|
+
interface GroupInfo {
|
|
183
|
+
name: string;
|
|
184
|
+
/** `null` if the group has no display name node set. */
|
|
185
|
+
displayName: string | null;
|
|
186
|
+
weight: number;
|
|
187
|
+
permissions: PermissionNode[];
|
|
188
|
+
}
|
|
189
|
+
/** A player's or group's resolved prefix, suffix, and custom meta key-values. */
|
|
190
|
+
interface MetaInfo {
|
|
191
|
+
prefix: string | null;
|
|
192
|
+
suffix: string | null;
|
|
193
|
+
/** LuckPerms keeps every value ever set per key; the highest-priority one wins in-game. */
|
|
194
|
+
meta: Record<string, string[]>;
|
|
195
|
+
}
|
|
196
|
+
/** A LuckPerms track (an ordered rank ladder used for promote/demote). */
|
|
197
|
+
interface TrackInfo {
|
|
198
|
+
name: string;
|
|
199
|
+
/** Ordered from lowest to highest rank. */
|
|
200
|
+
groups: string[];
|
|
201
|
+
}
|
|
202
|
+
/** Optional server/world context that scopes a node to a subset of the network. */
|
|
203
|
+
interface LuckPermsContextOptions {
|
|
204
|
+
/** e.g. `"survival"` — matches LuckPerms' `server` context key. */
|
|
205
|
+
server?: string;
|
|
206
|
+
/** e.g. `"world_nether"` — matches LuckPerms' `world` context key. */
|
|
207
|
+
world?: string;
|
|
208
|
+
}
|
|
209
|
+
interface LuckPermsCheckPermissionResult {
|
|
210
|
+
uuid: string;
|
|
211
|
+
permission: string;
|
|
212
|
+
has: boolean;
|
|
213
|
+
}
|
|
214
|
+
interface LuckPermsPrimaryGroupResult {
|
|
215
|
+
uuid: string;
|
|
216
|
+
primaryGroup: string;
|
|
217
|
+
}
|
|
218
|
+
interface LuckPermsCreateGroupResult {
|
|
219
|
+
name: string;
|
|
220
|
+
status: string;
|
|
221
|
+
}
|
|
222
|
+
/** Result of a promote/demote call along a track. */
|
|
223
|
+
interface LuckPermsTrackActionResult {
|
|
224
|
+
uuid: string;
|
|
225
|
+
track: string;
|
|
226
|
+
/** `false` for statuses like `END_OF_TRACK`/`AMBIGUOUS_CALL`, where nothing was changed. */
|
|
227
|
+
success: boolean;
|
|
228
|
+
/** Raw LuckPerms `PromotionResult`/`DemotionResult` status, e.g. `"SUCCESS"`, `"END_OF_TRACK"`. */
|
|
229
|
+
status: string;
|
|
230
|
+
from: string | null;
|
|
231
|
+
to: string | null;
|
|
181
232
|
}
|
|
182
233
|
interface Advancement {
|
|
183
234
|
key: string;
|
|
@@ -612,55 +663,151 @@ declare class PlaceholdersModule {
|
|
|
612
663
|
replace(uuid: string, message: string): Promise<string>;
|
|
613
664
|
}
|
|
614
665
|
|
|
666
|
+
/** Extra fields accepted by the node-adding endpoints, on top of the context options. */
|
|
667
|
+
interface AddPermissionOptions extends LuckPermsContextOptions {
|
|
668
|
+
/**
|
|
669
|
+
* Node value. Defaults to `true` server-side when omitted — pass `false`
|
|
670
|
+
* to add a negating node rather than a positive grant.
|
|
671
|
+
*/
|
|
672
|
+
value?: boolean;
|
|
673
|
+
/**
|
|
674
|
+
* When the node should expire. Parsed server-side by
|
|
675
|
+
* `ValidationUtils.parseExpiry` — pass an ISO-8601 instant string (e.g.
|
|
676
|
+
* `"2026-12-31T00:00:00Z"`) or an epoch-seconds string. Omit for a node
|
|
677
|
+
* that never expires.
|
|
678
|
+
*/
|
|
679
|
+
expiry?: string;
|
|
680
|
+
}
|
|
681
|
+
type SetGroupOptions = LuckPermsContextOptions & Pick<AddPermissionOptions, "expiry">;
|
|
682
|
+
interface SetMetaValueOptions extends LuckPermsContextOptions {
|
|
683
|
+
/**
|
|
684
|
+
* Sort priority — higher wins when multiple prefix/suffix nodes are
|
|
685
|
+
* active at once. Defaults to `100` server-side when omitted, matching
|
|
686
|
+
* LuckPerms' own `/lp meta setprefix|setsuffix` default.
|
|
687
|
+
*/
|
|
688
|
+
priority?: number;
|
|
689
|
+
}
|
|
615
690
|
/**
|
|
616
691
|
* Wraps the `/v1/luckperms/*` routes. These only exist on the server when
|
|
617
|
-
* the LuckPerms
|
|
618
|
-
* without it
|
|
619
|
-
* available" flag from the SDK's side;
|
|
620
|
-
* LuckPerms if you need to branch on
|
|
692
|
+
* the LuckPerms plugin is loaded — calling any method here against a
|
|
693
|
+
* server without it throws `NoxAeApiServerError` with a 503 status.
|
|
694
|
+
* There's no separate "is this available" flag from the SDK's side;
|
|
695
|
+
* check `client.plugins.list()` for LuckPerms if you need to branch on
|
|
696
|
+
* it ahead of time.
|
|
621
697
|
*
|
|
622
|
-
* Unlike most other modules,
|
|
623
|
-
* JSON (the server reads
|
|
698
|
+
* Unlike most other modules, every request body here is sent as real
|
|
699
|
+
* JSON (the server reads it with `ctx.bodyAsClass(...)`, not
|
|
624
700
|
* `ctx.formParam(...)`) — do not add `form: true` to these calls.
|
|
701
|
+
*
|
|
702
|
+
* "Context" throughout this module means LuckPerms' `server`/`world`
|
|
703
|
+
* context keys, not the Bukkit/network server this SDK talks to — pass
|
|
704
|
+
* them when a node should only apply on a specific sub-server or world,
|
|
705
|
+
* and omit them for a global node.
|
|
625
706
|
*/
|
|
626
707
|
declare class LuckPermsModule {
|
|
627
708
|
private readonly http;
|
|
628
709
|
constructor(http: HttpEngine);
|
|
629
|
-
/** Get the
|
|
710
|
+
/** Get the names of every group a player belongs to (via inheritance nodes). */
|
|
630
711
|
getPlayerGroups(uuid: string): Promise<string[]>;
|
|
631
|
-
/** Get
|
|
712
|
+
/** Get every node (permissions, inheritance, prefix/suffix, meta, ...) held directly by a player. */
|
|
632
713
|
getPlayerPermissions(uuid: string): Promise<PermissionNode[]>;
|
|
633
|
-
/** Add a permission node to a player. */
|
|
634
|
-
addPlayerPermission(uuid: string, permission: string,
|
|
635
|
-
/**
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
/** Remove a permission node from a player. */
|
|
714
|
+
/** Add a permission node to a player. Defaults to a permanent, global, `true`-valued node. */
|
|
715
|
+
addPlayerPermission(uuid: string, permission: string, options?: AddPermissionOptions): Promise<void>;
|
|
716
|
+
/**
|
|
717
|
+
* Remove a permission node from a player by key. Note this matches on
|
|
718
|
+
* the permission string only — it does not target a specific
|
|
719
|
+
* value/expiry/context combination.
|
|
720
|
+
*/
|
|
641
721
|
removePlayerPermission(uuid: string, permission: string): Promise<void>;
|
|
642
|
-
/**
|
|
643
|
-
|
|
644
|
-
|
|
722
|
+
/**
|
|
723
|
+
* Check whether a player has a given permission, using LuckPerms'
|
|
724
|
+
* native resolution (inheritance, wildcards, contexts all apply).
|
|
725
|
+
*/
|
|
726
|
+
checkPlayerPermission(uuid: string, permission: string): Promise<LuckPermsCheckPermissionResult>;
|
|
727
|
+
/** Get a player's primary group name. */
|
|
728
|
+
getPlayerPrimaryGroup(uuid: string): Promise<LuckPermsPrimaryGroupResult>;
|
|
729
|
+
/**
|
|
730
|
+
* Set a player's primary group. This both adds the corresponding
|
|
731
|
+
* inheritance node (so permissions actually resolve from the group) and
|
|
732
|
+
* updates the primary-group label — mirrors `/lp user <target> parent
|
|
733
|
+
* add <group>` plus `/lp user <target> setprimarygroup <group>`.
|
|
734
|
+
*/
|
|
735
|
+
setPlayerGroup(uuid: string, group: string, options?: SetGroupOptions): Promise<void>;
|
|
736
|
+
/**
|
|
737
|
+
* Remove a group's inheritance node from a player. Does **not** change
|
|
738
|
+
* their primary group — call `setPlayerGroup()` with the new group
|
|
739
|
+
* afterward if you're reassigning rank rather than just removing one
|
|
740
|
+
* of several parents.
|
|
741
|
+
*/
|
|
645
742
|
removePlayerGroup(uuid: string, groupName: string): Promise<void>;
|
|
646
|
-
/**
|
|
743
|
+
/**
|
|
744
|
+
* Promote a player one step up a track. If the result isn't successful
|
|
745
|
+
* (e.g. `END_OF_TRACK`, `AMBIGUOUS_CALL`), the player's data is left
|
|
746
|
+
* untouched — check `.success`/`.status` on the result rather than
|
|
747
|
+
* assuming the call always moves them.
|
|
748
|
+
*/
|
|
749
|
+
promotePlayer(uuid: string, track: string, options?: LuckPermsContextOptions): Promise<LuckPermsTrackActionResult>;
|
|
750
|
+
/** Demote a player one step down a track. See `promotePlayer()` for the result semantics. */
|
|
751
|
+
demotePlayer(uuid: string, track: string, options?: LuckPermsContextOptions): Promise<LuckPermsTrackActionResult>;
|
|
752
|
+
/** Get a player's resolved prefix, suffix, and custom meta key-values. */
|
|
753
|
+
getPlayerMeta(uuid: string): Promise<MetaInfo>;
|
|
754
|
+
/**
|
|
755
|
+
* Set a player's prefix. Behaves like a "set", not an "add" — any
|
|
756
|
+
* existing prefix node (in any context) is cleared first, so a player
|
|
757
|
+
* only ever has one active prefix from this call.
|
|
758
|
+
*/
|
|
759
|
+
setPlayerPrefix(uuid: string, prefix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
760
|
+
/** Set a player's suffix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
761
|
+
setPlayerSuffix(uuid: string, suffix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
762
|
+
/** Set a custom meta key-value pair on a player, replacing any existing value(s) for that key. */
|
|
763
|
+
setPlayerMeta(uuid: string, key: string, value: string, options?: LuckPermsContextOptions): Promise<void>;
|
|
764
|
+
/** Remove a custom meta key from a player (all values/contexts for that key). */
|
|
765
|
+
removePlayerMeta(uuid: string, key: string): Promise<void>;
|
|
766
|
+
/** List the names of every group registered in LuckPerms. */
|
|
647
767
|
getGroups(): Promise<string[]>;
|
|
648
768
|
/**
|
|
649
769
|
* Create a new LuckPerms group. The name is lowercased server-side.
|
|
650
770
|
* Throws `NoxAeApiError` with a 409 status if the group already exists.
|
|
651
771
|
*/
|
|
652
|
-
createGroup(name: string): Promise<
|
|
653
|
-
name: string;
|
|
654
|
-
status: string;
|
|
655
|
-
}>;
|
|
772
|
+
createGroup(name: string): Promise<LuckPermsCreateGroupResult>;
|
|
656
773
|
/**
|
|
657
774
|
* Delete a LuckPerms group by name.
|
|
658
775
|
* The `default` group can't be deleted (400 — every user without an
|
|
659
776
|
* explicit group inherits from it) and a 404 is thrown if it doesn't exist.
|
|
660
777
|
*/
|
|
661
778
|
deleteGroup(name: string): Promise<void>;
|
|
662
|
-
/** Get
|
|
663
|
-
getGroupPermissions(name: string): Promise<
|
|
779
|
+
/** Get every node held directly by a group. */
|
|
780
|
+
getGroupPermissions(name: string): Promise<PermissionNode[]>;
|
|
781
|
+
/** Add a permission node to a group. Same options/defaults as `addPlayerPermission()`. */
|
|
782
|
+
addGroupPermission(name: string, permission: string, options?: AddPermissionOptions): Promise<void>;
|
|
783
|
+
/** Remove a permission node from a group by key (matches on permission string only). */
|
|
784
|
+
removeGroupPermission(name: string, permission: string): Promise<void>;
|
|
785
|
+
/** Get full info for a group: name, display name, weight, and all its nodes. */
|
|
786
|
+
getGroupInfo(name: string): Promise<GroupInfo>;
|
|
787
|
+
/**
|
|
788
|
+
* Update a group's weight and/or display name. Provide at least one of
|
|
789
|
+
* the two fields — the server 400s otherwise. Passing an empty/blank
|
|
790
|
+
* `displayName` resets it to the default rather than setting a blank one.
|
|
791
|
+
* Returns the group's full updated info.
|
|
792
|
+
*/
|
|
793
|
+
updateGroup(name: string, updates: {
|
|
794
|
+
weight?: number;
|
|
795
|
+
displayName?: string | null;
|
|
796
|
+
}): Promise<GroupInfo>;
|
|
797
|
+
/** Get a group's resolved prefix, suffix, and custom meta key-values. */
|
|
798
|
+
getGroupMeta(name: string): Promise<MetaInfo>;
|
|
799
|
+
/** Set a group's prefix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
800
|
+
setGroupPrefix(name: string, prefix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
801
|
+
/** Set a group's suffix. Same "set, not add" semantics as `setPlayerPrefix()`. */
|
|
802
|
+
setGroupSuffix(name: string, suffix: string, options?: SetMetaValueOptions): Promise<void>;
|
|
803
|
+
/** Set a custom meta key-value pair on a group, replacing any existing value(s) for that key. */
|
|
804
|
+
setGroupMeta(name: string, key: string, value: string, options?: LuckPermsContextOptions): Promise<void>;
|
|
805
|
+
/** Remove a custom meta key from a group (all values/contexts for that key). */
|
|
806
|
+
removeGroupMeta(name: string, key: string): Promise<void>;
|
|
807
|
+
/** List the names of every track registered in LuckPerms. */
|
|
808
|
+
getTracks(): Promise<string[]>;
|
|
809
|
+
/** Get a track's name and its ordered list of groups (lowest to highest rank). */
|
|
810
|
+
getTrack(name: string): Promise<TrackInfo>;
|
|
664
811
|
}
|
|
665
812
|
|
|
666
813
|
/**
|
|
@@ -1041,4 +1188,4 @@ declare class NoxAeApiNetworkError extends Error {
|
|
|
1041
1188
|
constructor(message: string, method: string, path: string, cause?: unknown);
|
|
1042
1189
|
}
|
|
1043
1190
|
|
|
1044
|
-
export { type Advancement, type CurrencyBalance, type CurrencyTopEntry, type EconomyInfo, type GroupInfo, type InventoryItem, type LeaderboardEntry, type LeaderboardSourceInfo, type NetworkBroadcastResponse, type NetworkFindPlayerResponse, type NetworkHealthResponse, type NetworkHealthServerEntry, type NetworkHubBroadcastResponse, type NetworkHubFindPlayerResponse, type NetworkHubNode, type NetworkHubPlayer, type NetworkHubPlayersResponse, type NetworkHubStatusResponse, type NetworkPlayersResponse, type NetworkPlayersServerEntry, type NetworkServerStatus, NoxAeApiClient, type NoxAeApiClientOptions, NoxAeApiError, NoxAeApiForbiddenError, NoxAeApiNetworkError, NoxAeApiNetworkHubClient, NoxAeApiNotFoundError, NoxAeApiRateLimitError, NoxAeApiServerError, NoxAeApiSocket, NoxAeApiUnauthorizedError, type NoxAeApiWsEvent, type NoxAeApiWsOptions, type NoxAuthPlayerInfo, type Objective, type OfflinePlayer, type OnlinePlayer, type PasswordCheckResult, type PermissionNode, type PlayerBalance, type PlayerProfile, type PlayerProfileBan, type PlayerProfileEconomy, type PlayerProfileStatTile, type PlayerProfileStatus, type PlayerProfilesResponse, type PlayerResolveResult, type PlayerStats, type Plugin, type RetryOptions, type Score, type Scoreboard, type ServerBan, type ServerHealth, type ServerInfo, type SkillInfo, type TopBalanceEntry, type WhitelistEntry, type World };
|
|
1191
|
+
export { type AddPermissionOptions, type Advancement, type CurrencyBalance, type CurrencyTopEntry, type EconomyInfo, type GroupInfo, type InventoryItem, type LeaderboardEntry, type LeaderboardSourceInfo, type LuckPermsCheckPermissionResult, type LuckPermsContextOptions, type LuckPermsCreateGroupResult, type LuckPermsPrimaryGroupResult, type LuckPermsTrackActionResult, type MetaInfo, type NetworkBroadcastResponse, type NetworkFindPlayerResponse, type NetworkHealthResponse, type NetworkHealthServerEntry, type NetworkHubBroadcastResponse, type NetworkHubFindPlayerResponse, type NetworkHubNode, type NetworkHubPlayer, type NetworkHubPlayersResponse, type NetworkHubStatusResponse, type NetworkPlayersResponse, type NetworkPlayersServerEntry, type NetworkServerStatus, NoxAeApiClient, type NoxAeApiClientOptions, NoxAeApiError, NoxAeApiForbiddenError, NoxAeApiNetworkError, NoxAeApiNetworkHubClient, NoxAeApiNotFoundError, NoxAeApiRateLimitError, NoxAeApiServerError, NoxAeApiSocket, NoxAeApiUnauthorizedError, type NoxAeApiWsEvent, type NoxAeApiWsOptions, type NoxAuthPlayerInfo, type Objective, type OfflinePlayer, type OnlinePlayer, type PasswordCheckResult, type PermissionNode, type PlayerBalance, type PlayerProfile, type PlayerProfileBan, type PlayerProfileEconomy, type PlayerProfileStatTile, type PlayerProfileStatus, type PlayerProfilesResponse, type PlayerResolveResult, type PlayerStats, type Plugin, type RetryOptions, type Score, type Scoreboard, type ServerBan, type ServerHealth, type ServerInfo, type SetGroupOptions, type SetMetaValueOptions, type SkillInfo, type TopBalanceEntry, type TrackInfo, type WhitelistEntry, type World };
|