@playcademy/sdk 0.0.1-beta.24 → 0.0.1-beta.26
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 +4 -6
- package/dist/core/client.d.ts +67 -47
- package/dist/core/namespaces/admin.d.ts +24 -20
- package/dist/core/namespaces/auth.d.ts +1 -1
- package/dist/core/namespaces/credits.d.ts +1 -1
- package/dist/core/namespaces/dev.d.ts +185 -15
- package/dist/core/namespaces/games.d.ts +8 -4
- package/dist/core/namespaces/levels.d.ts +2 -2
- package/dist/core/namespaces/maps.d.ts +4 -9
- package/dist/core/namespaces/runtime.d.ts +1 -2
- package/dist/core/namespaces/shop.d.ts +1 -2
- package/dist/core/namespaces/telemetry.d.ts +1 -1
- package/dist/core/namespaces/users.d.ts +18 -18
- package/dist/core/request.d.ts +1 -1
- package/dist/core/static/init.d.ts +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +575 -97
- package/dist/types.d.ts +3 -36
- package/dist/types.js +363 -8
- package/package.json +5 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { PlaycademyClient } from '
|
|
1
|
+
import type { LevelConfig, UserLevel, XPAddResult } from '@playcademy/data/types';
|
|
2
|
+
import type { PlaycademyClient } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Creates the levels namespace for the PlaycademyClient.
|
|
5
5
|
* Provides methods for managing user levels and experience points.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlaycademyClient } from '
|
|
1
|
+
import type { PlaycademyClient } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Creates the maps namespace for the PlaycademyClient.
|
|
4
4
|
* Provides methods for retrieving map data and elements.
|
|
@@ -23,15 +23,10 @@ export declare function createMapsNamespace(client: PlaycademyClient): {
|
|
|
23
23
|
*/
|
|
24
24
|
elements: (mapId: string) => Promise<{
|
|
25
25
|
id: string;
|
|
26
|
-
metadata: ({
|
|
27
|
-
description?: string | undefined;
|
|
28
|
-
sourceTiledObjects?: Record<string, unknown>[] | undefined;
|
|
29
|
-
} & {
|
|
30
|
-
[k: string]: unknown;
|
|
31
|
-
}) | null;
|
|
32
|
-
gameId: string | null;
|
|
33
26
|
mapId: string | null;
|
|
34
27
|
elementSlug: string;
|
|
35
|
-
interactionType: "
|
|
28
|
+
interactionType: "info" | "game_entry" | "game_registry" | "teleport" | "door_in" | "door_out" | "npc_interaction" | "quest_trigger";
|
|
29
|
+
metadata: Record<string, unknown> | null;
|
|
30
|
+
gameId: string | null;
|
|
36
31
|
}[]>;
|
|
37
32
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { PlaycademyClient } from '
|
|
2
|
-
import type { GameTokenResponse } from '../../types';
|
|
1
|
+
import type { GameTokenResponse, PlaycademyClient } from '../../types';
|
|
3
2
|
/**
|
|
4
3
|
* Creates the runtime namespace for the PlaycademyClient.
|
|
5
4
|
* Provides methods for managing game runtime operations and lifecycle.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { PlaycademyClient } from '
|
|
2
|
-
import type { ShopViewResponse } from '../../types';
|
|
1
|
+
import type { PlaycademyClient, ShopViewResponse } from '../../types';
|
|
3
2
|
/**
|
|
4
3
|
* Creates the shop namespace for the PlaycademyClient.
|
|
5
4
|
* Provides methods for viewing shop listings and items available for purchase.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { InventoryItemWithItem
|
|
2
|
-
import type { PlaycademyClient } from '
|
|
1
|
+
import type { InventoryItemWithItem } from '@playcademy/data/types';
|
|
2
|
+
import type { InventoryMutationResponse, PlaycademyClient } from '../../types';
|
|
3
3
|
/**
|
|
4
4
|
* Creates the users namespace for the PlaycademyClient.
|
|
5
5
|
* Provides methods for managing user data and inventory operations.
|
|
@@ -22,8 +22,6 @@ export declare function createUsersNamespace(client: PlaycademyClient): {
|
|
|
22
22
|
*/
|
|
23
23
|
me: () => Promise<{
|
|
24
24
|
id: string;
|
|
25
|
-
createdAt: Date;
|
|
26
|
-
updatedAt: Date;
|
|
27
25
|
name: string;
|
|
28
26
|
username: string | null;
|
|
29
27
|
email: string;
|
|
@@ -31,6 +29,8 @@ export declare function createUsersNamespace(client: PlaycademyClient): {
|
|
|
31
29
|
image: string | null;
|
|
32
30
|
role: "admin" | "player" | "developer";
|
|
33
31
|
developerStatus: "none" | "pending" | "approved";
|
|
32
|
+
createdAt: Date;
|
|
33
|
+
updatedAt: Date;
|
|
34
34
|
}>;
|
|
35
35
|
/**
|
|
36
36
|
* Inventory management methods for the current user.
|
|
@@ -52,17 +52,17 @@ export declare function createUsersNamespace(client: PlaycademyClient): {
|
|
|
52
52
|
get: () => Promise<InventoryItemWithItem[]>;
|
|
53
53
|
/**
|
|
54
54
|
* Adds items to the user's inventory.
|
|
55
|
-
* Accepts either an item UUID or
|
|
55
|
+
* Accepts either an item UUID or slug.
|
|
56
56
|
* Emits an 'inventoryChange' event when successful.
|
|
57
57
|
*
|
|
58
|
-
* @param identifier - The item UUID or
|
|
58
|
+
* @param identifier - The item UUID or slug
|
|
59
59
|
* @param qty - The quantity to add (must be positive)
|
|
60
60
|
* @returns Promise resolving to mutation response with new total
|
|
61
61
|
*
|
|
62
62
|
* @example
|
|
63
63
|
* ```typescript
|
|
64
|
-
* // Using
|
|
65
|
-
* const result = await client.users.inventory.add('
|
|
64
|
+
* // Using slug
|
|
65
|
+
* const result = await client.users.inventory.add('gold-coin', 100)
|
|
66
66
|
*
|
|
67
67
|
* // Using UUID
|
|
68
68
|
* const result = await client.users.inventory.add('550e8400-e29b-41d4-a716-446655440000', 100)
|
|
@@ -73,16 +73,16 @@ export declare function createUsersNamespace(client: PlaycademyClient): {
|
|
|
73
73
|
add: (identifier: string, qty: number) => Promise<InventoryMutationResponse>;
|
|
74
74
|
/**
|
|
75
75
|
* Removes items from the user's inventory.
|
|
76
|
-
* Accepts either an item UUID or
|
|
76
|
+
* Accepts either an item UUID or slug.
|
|
77
77
|
* Emits an 'inventoryChange' event when successful.
|
|
78
78
|
*
|
|
79
|
-
* @param identifier - The item UUID or
|
|
79
|
+
* @param identifier - The item UUID or slug
|
|
80
80
|
* @param qty - The quantity to remove (must be positive)
|
|
81
81
|
* @returns Promise resolving to mutation response with new total
|
|
82
82
|
*
|
|
83
83
|
* @example
|
|
84
84
|
* ```typescript
|
|
85
|
-
* // Using
|
|
85
|
+
* // Using slug
|
|
86
86
|
* const result = await client.users.inventory.remove('HEALTH_POTION', 1)
|
|
87
87
|
*
|
|
88
88
|
* // Using UUID
|
|
@@ -94,14 +94,14 @@ export declare function createUsersNamespace(client: PlaycademyClient): {
|
|
|
94
94
|
remove: (identifier: string, qty: number) => Promise<InventoryMutationResponse>;
|
|
95
95
|
/**
|
|
96
96
|
* Gets the current quantity of an item.
|
|
97
|
-
* Accepts either an item UUID or
|
|
97
|
+
* Accepts either an item UUID or slug.
|
|
98
98
|
*
|
|
99
|
-
* @param identifier - The item UUID or
|
|
99
|
+
* @param identifier - The item UUID or slug
|
|
100
100
|
* @returns Promise resolving to the current quantity (0 if not owned)
|
|
101
101
|
*
|
|
102
102
|
* @example
|
|
103
103
|
* ```typescript
|
|
104
|
-
* const qty = await client.users.inventory.quantity('
|
|
104
|
+
* const qty = await client.users.inventory.quantity('health-potion')
|
|
105
105
|
* const qty2 = await client.users.inventory.quantity('uuid-123-456')
|
|
106
106
|
* console.log('Health potions:', qty)
|
|
107
107
|
* ```
|
|
@@ -109,16 +109,16 @@ export declare function createUsersNamespace(client: PlaycademyClient): {
|
|
|
109
109
|
quantity: (identifier: string) => Promise<number>;
|
|
110
110
|
/**
|
|
111
111
|
* Checks if the user has at least the specified quantity of an item.
|
|
112
|
-
* Accepts either an item UUID or
|
|
112
|
+
* Accepts either an item UUID or slug.
|
|
113
113
|
*
|
|
114
|
-
* @param identifier - The item UUID or
|
|
114
|
+
* @param identifier - The item UUID or slug
|
|
115
115
|
* @param minQuantity - Minimum quantity required (defaults to 1)
|
|
116
116
|
* @returns Promise resolving to true if user has enough of the item
|
|
117
117
|
*
|
|
118
118
|
* @example
|
|
119
119
|
* ```typescript
|
|
120
|
-
* const hasKey = await client.users.inventory.has('
|
|
121
|
-
* const hasEnoughGold = await client.users.inventory.has('
|
|
120
|
+
* const hasKey = await client.users.inventory.has('gold-coin')
|
|
121
|
+
* const hasEnoughGold = await client.users.inventory.has('gold-coin', 100)
|
|
122
122
|
* const hasPotion = await client.users.inventory.has('uuid-123-456', 5)
|
|
123
123
|
*
|
|
124
124
|
* if (hasKey && hasEnoughGold) {
|
package/dist/core/request.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PlaycademyClient } from '
|
|
1
|
+
import type { PlaycademyClient } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Auto-initializes a PlaycademyClient with context from the environment.
|
|
4
4
|
* Works in both iframe mode (production/development) and standalone mode (local dev).
|
package/dist/index.d.ts
CHANGED