playcademy 0.12.9 → 0.13.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/dist/constants.d.ts +5 -2
- package/dist/constants.js +8 -3
- package/dist/db.js +15 -11
- package/dist/index.d.ts +38 -1
- package/dist/index.js +1378 -263
- package/dist/templates/api/sample-custom.ts.template +46 -0
- package/dist/templates/api/sample-database.ts.template +104 -0
- package/dist/templates/api/sample-kv.ts.template +135 -0
- package/dist/templates/playcademy-gitignore.template +1 -0
- package/dist/utils.d.ts +9 -5
- package/dist/utils.js +126 -46
- package/package.json +2 -1
package/dist/constants.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ declare const SSO_AUTH_TIMEOUT_MS = 30000;
|
|
|
38
38
|
/**
|
|
39
39
|
* Path constants for CLI directories and files
|
|
40
40
|
*/
|
|
41
|
+
declare const WORKSPACE_NAME = ".playcademy";
|
|
41
42
|
/**
|
|
42
43
|
* CLI workspace directories (local to project)
|
|
43
44
|
*/
|
|
@@ -45,7 +46,9 @@ declare const CLI_DIRECTORIES: {
|
|
|
45
46
|
/** Root directory for CLI artifacts in workspace */
|
|
46
47
|
readonly WORKSPACE: ".playcademy";
|
|
47
48
|
/** Database directory within workspace */
|
|
48
|
-
readonly DATABASE:
|
|
49
|
+
readonly DATABASE: string;
|
|
50
|
+
/** KV storage directory within workspace */
|
|
51
|
+
readonly KV: string;
|
|
49
52
|
};
|
|
50
53
|
/**
|
|
51
54
|
* CLI user directories (in home directory)
|
|
@@ -96,4 +99,4 @@ declare const CONFIG_FILE_NAMES: string[];
|
|
|
96
99
|
*/
|
|
97
100
|
declare const CLOUDFLARE_COMPATIBILITY_DATE = "2024-01-01";
|
|
98
101
|
|
|
99
|
-
export { CALLBACK_PATH, CALLBACK_PORT, CLI_DEFAULT_OUTPUTS, CLI_DIRECTORIES, CLI_FILES, CLI_USER_DIRECTORIES, CLOUDFLARE_COMPATIBILITY_DATE, CONFIG_FILE_NAMES, DEFAULT_API_ROUTES_DIRECTORY, DEFAULT_DATABASE_DIRECTORY, DEFAULT_PORTS, DEFAULT_SCHEMA_DIRECTORY, DEFAULT_SEED_FILE, SSO_AUTH_TIMEOUT_MS };
|
|
102
|
+
export { CALLBACK_PATH, CALLBACK_PORT, CLI_DEFAULT_OUTPUTS, CLI_DIRECTORIES, CLI_FILES, CLI_USER_DIRECTORIES, CLOUDFLARE_COMPATIBILITY_DATE, CONFIG_FILE_NAMES, DEFAULT_API_ROUTES_DIRECTORY, DEFAULT_DATABASE_DIRECTORY, DEFAULT_PORTS, DEFAULT_SCHEMA_DIRECTORY, DEFAULT_SEED_FILE, SSO_AUTH_TIMEOUT_MS, WORKSPACE_NAME };
|
package/dist/constants.js
CHANGED
|
@@ -12,11 +12,15 @@ var CALLBACK_PATH = "/callback";
|
|
|
12
12
|
var SSO_AUTH_TIMEOUT_MS = 3e4;
|
|
13
13
|
|
|
14
14
|
// src/constants/paths.ts
|
|
15
|
+
import { join } from "path";
|
|
16
|
+
var WORKSPACE_NAME = ".playcademy";
|
|
15
17
|
var CLI_DIRECTORIES = {
|
|
16
18
|
/** Root directory for CLI artifacts in workspace */
|
|
17
|
-
WORKSPACE:
|
|
19
|
+
WORKSPACE: WORKSPACE_NAME,
|
|
18
20
|
/** Database directory within workspace */
|
|
19
|
-
DATABASE: "
|
|
21
|
+
DATABASE: join(WORKSPACE_NAME, "db"),
|
|
22
|
+
/** KV storage directory within workspace */
|
|
23
|
+
KV: join(WORKSPACE_NAME, "kv")
|
|
20
24
|
};
|
|
21
25
|
var CLI_USER_DIRECTORIES = {
|
|
22
26
|
/** User config directory for auth, games store, etc. */
|
|
@@ -120,5 +124,6 @@ export {
|
|
|
120
124
|
GAME_WORKER_DOMAINS,
|
|
121
125
|
PLAYCADEMY_BASE_URLS,
|
|
122
126
|
PLAYCADEMY_DOMAINS,
|
|
123
|
-
SSO_AUTH_TIMEOUT_MS
|
|
127
|
+
SSO_AUTH_TIMEOUT_MS,
|
|
128
|
+
WORKSPACE_NAME
|
|
124
129
|
};
|
package/dist/db.js
CHANGED
|
@@ -20,15 +20,19 @@ var init_file_loader = __esm({
|
|
|
20
20
|
|
|
21
21
|
// src/lib/db/path.ts
|
|
22
22
|
import { copyFileSync, existsSync, mkdirSync, readdirSync, unlinkSync } from "fs";
|
|
23
|
-
import { join } from "path";
|
|
23
|
+
import { join as join2 } from "path";
|
|
24
24
|
import Database from "better-sqlite3";
|
|
25
25
|
|
|
26
26
|
// src/constants/paths.ts
|
|
27
|
+
import { join } from "path";
|
|
28
|
+
var WORKSPACE_NAME = ".playcademy";
|
|
27
29
|
var CLI_DIRECTORIES = {
|
|
28
30
|
/** Root directory for CLI artifacts in workspace */
|
|
29
|
-
WORKSPACE:
|
|
31
|
+
WORKSPACE: WORKSPACE_NAME,
|
|
30
32
|
/** Database directory within workspace */
|
|
31
|
-
DATABASE: "
|
|
33
|
+
DATABASE: join(WORKSPACE_NAME, "db"),
|
|
34
|
+
/** KV storage directory within workspace */
|
|
35
|
+
KV: join(WORKSPACE_NAME, "kv")
|
|
32
36
|
};
|
|
33
37
|
var CLI_FILES = {
|
|
34
38
|
/** Auth store file in user config directory */
|
|
@@ -85,11 +89,11 @@ var createEmptyDatabase = (path) => {
|
|
|
85
89
|
db.close();
|
|
86
90
|
};
|
|
87
91
|
var findMiniflareDatabase = (dbDir) => {
|
|
88
|
-
const miniflareDir =
|
|
92
|
+
const miniflareDir = join2(dbDir, "miniflare-D1DatabaseObject");
|
|
89
93
|
if (!existsSync(miniflareDir)) return null;
|
|
90
94
|
const sqliteFiles = readdirSync(miniflareDir).filter((file) => file.endsWith(".sqlite"));
|
|
91
95
|
if (sqliteFiles.length === 0) return null;
|
|
92
|
-
return
|
|
96
|
+
return join2(miniflareDir, sqliteFiles[0]);
|
|
93
97
|
};
|
|
94
98
|
var migrateInitialDbToTarget = (initialPath, targetPath) => {
|
|
95
99
|
if (!existsSync(initialPath)) return;
|
|
@@ -97,7 +101,7 @@ var migrateInitialDbToTarget = (initialPath, targetPath) => {
|
|
|
97
101
|
unlinkSync(initialPath);
|
|
98
102
|
};
|
|
99
103
|
function getDevDbPath() {
|
|
100
|
-
const initialDbPath =
|
|
104
|
+
const initialDbPath = join2(DB_DIRECTORY, INITIAL_DB_NAME);
|
|
101
105
|
ensureDirectoryExists(DB_DIRECTORY);
|
|
102
106
|
const miniflareDbPath = findMiniflareDatabase(DB_DIRECTORY);
|
|
103
107
|
if (miniflareDbPath) {
|
|
@@ -338,7 +342,7 @@ async function runStep(text, action, successText, options) {
|
|
|
338
342
|
// ../utils/src/package-manager.ts
|
|
339
343
|
import { execSync } from "child_process";
|
|
340
344
|
import { existsSync as existsSync2 } from "fs";
|
|
341
|
-
import { join as
|
|
345
|
+
import { join as join3 } from "path";
|
|
342
346
|
function isCommandAvailable(command) {
|
|
343
347
|
try {
|
|
344
348
|
execSync(`command -v ${command}`, { stdio: "ignore" });
|
|
@@ -348,16 +352,16 @@ function isCommandAvailable(command) {
|
|
|
348
352
|
}
|
|
349
353
|
}
|
|
350
354
|
function detectPackageManager(cwd = process.cwd()) {
|
|
351
|
-
if (existsSync2(
|
|
355
|
+
if (existsSync2(join3(cwd, "bun.lock")) || existsSync2(join3(cwd, "bun.lockb"))) {
|
|
352
356
|
return "bun";
|
|
353
357
|
}
|
|
354
|
-
if (existsSync2(
|
|
358
|
+
if (existsSync2(join3(cwd, "pnpm-lock.yaml"))) {
|
|
355
359
|
return "pnpm";
|
|
356
360
|
}
|
|
357
|
-
if (existsSync2(
|
|
361
|
+
if (existsSync2(join3(cwd, "yarn.lock"))) {
|
|
358
362
|
return "yarn";
|
|
359
363
|
}
|
|
360
|
-
if (existsSync2(
|
|
364
|
+
if (existsSync2(join3(cwd, "package-lock.json"))) {
|
|
361
365
|
return "npm";
|
|
362
366
|
}
|
|
363
367
|
return detectByCommandAvailability();
|
package/dist/index.d.ts
CHANGED
|
@@ -197,6 +197,8 @@ interface IntegrationsConfig {
|
|
|
197
197
|
customRoutes?: CustomRoutesIntegration | boolean;
|
|
198
198
|
/** Database (optional) */
|
|
199
199
|
database?: DatabaseIntegration | boolean;
|
|
200
|
+
/** Key-Value storage (optional) */
|
|
201
|
+
kv?: boolean;
|
|
200
202
|
}
|
|
201
203
|
/**
|
|
202
204
|
* Unified Playcademy configuration
|
|
@@ -865,4 +867,39 @@ interface DeploymentDiffOptions {
|
|
|
865
867
|
integrations?: IntegrationsDiff;
|
|
866
868
|
}
|
|
867
869
|
|
|
868
|
-
|
|
870
|
+
/**
|
|
871
|
+
* KV command types
|
|
872
|
+
*/
|
|
873
|
+
/**
|
|
874
|
+
* Statistics about KV storage
|
|
875
|
+
*/
|
|
876
|
+
interface KeyStats {
|
|
877
|
+
/** Total number of keys */
|
|
878
|
+
totalKeys: number;
|
|
879
|
+
/** Total size in bytes */
|
|
880
|
+
totalSize: number;
|
|
881
|
+
/** Information about the largest key */
|
|
882
|
+
largestKey?: {
|
|
883
|
+
name: string;
|
|
884
|
+
size: number;
|
|
885
|
+
};
|
|
886
|
+
/** Keys grouped by prefix pattern */
|
|
887
|
+
prefixes: Record<string, number>;
|
|
888
|
+
}
|
|
889
|
+
/**
|
|
890
|
+
* Metadata about a specific key
|
|
891
|
+
*/
|
|
892
|
+
interface KeyMetadata {
|
|
893
|
+
/** The key name */
|
|
894
|
+
key: string;
|
|
895
|
+
/** Whether the key exists */
|
|
896
|
+
exists: boolean;
|
|
897
|
+
/** Size in bytes (if key exists) */
|
|
898
|
+
size?: number;
|
|
899
|
+
/** Parsed value */
|
|
900
|
+
value?: unknown;
|
|
901
|
+
/** Type of value stored */
|
|
902
|
+
valueType?: 'json' | 'string';
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
export type { ApiConfig, ApiErrorResponse, ApiKeyListItem, ApiKeyWithSecret, ApiRequestOptions, AuthProfile, AuthStore, BackendBundle, BackendDeploymentWithHash, BackendDiff, BuildDiff, BundleOptions, CallbackServerResult, ConfigDiff, CreateApiKeyResponse, CustomRoutesIntegrationOptions, DatabaseIntegrationOptions, DeployConfig, DeployNewGameOptions, DeployedGameInfo, DeploymentChanges, DeploymentContext, DeploymentDiffOptions, DeploymentPlan, DeploymentResult, EmbeddedSourcePaths, EnvironmentAuthProfiles, GameStore, IntegrationChangeDetector, IntegrationChangeDetectors, IntegrationConfigChange, IntegrationsConfig, IntegrationsDiff, KeyMetadata, KeyStats, LoginCredentials, LoginResponse, PlaycademyConfig, PreviewOptions, PreviewResponse, SignInResponse, SsoCallbackData, TimebackIntegrationConfig, TokenType, UpdateExistingGameOptions };
|