@playdrop/playdrop-cli 0.7.0 → 0.7.2
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 +1 -0
- package/config/client-meta.json +9 -9
- package/dist/commands/devBrowser.d.ts +7 -0
- package/dist/commands/devBrowser.js +360 -0
- package/dist/commands/devServer.js +28 -1
- package/dist/commands/generation.d.ts +3 -0
- package/dist/commands/generation.js +84 -4
- package/dist/commands/versionsBrowse.js +63 -4
- package/dist/environment.d.ts +1 -1
- package/dist/environment.js +24 -1
- package/dist/index.js +32 -2
- package/dist/playwright.d.ts +7 -0
- package/dist/playwright.js +21 -2
- package/node_modules/@playdrop/ai-client/dist/index.d.ts +41 -5
- package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/ai-client/dist/index.js +11 -1
- package/node_modules/@playdrop/ai-client/package.json +1 -1
- package/node_modules/@playdrop/api-client/dist/client.d.ts +10 -2
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/client.js +74 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/core/request.js +64 -12
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts +1 -2
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/admin.js +0 -11
- package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts +4 -1
- package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/comments.js +34 -0
- package/node_modules/@playdrop/api-client/dist/index.d.ts +11 -4
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +27 -3
- package/node_modules/@playdrop/api-client/package.json +1 -1
- package/node_modules/@playdrop/boxel-core/package.json +3 -4
- package/node_modules/@playdrop/boxel-three/package.json +1 -1
- package/node_modules/@playdrop/config/client-meta.json +9 -9
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts +27 -0
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts.map +1 -0
- package/node_modules/@playdrop/config/dist/src/deployment.js +199 -0
- package/node_modules/@playdrop/config/dist/src/index.d.ts +2 -0
- package/node_modules/@playdrop/config/dist/src/index.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/index.js +2 -0
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts +26 -0
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts.map +1 -0
- package/node_modules/@playdrop/config/dist/src/public-deployment.js +148 -0
- package/node_modules/@playdrop/config/dist/src/server/fastify.d.ts +60 -1
- package/node_modules/@playdrop/config/dist/src/server/fastify.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/server/fastify.js +119 -0
- package/node_modules/@playdrop/config/dist/src/server/logging.d.ts +3 -0
- package/node_modules/@playdrop/config/dist/src/server/logging.d.ts.map +1 -0
- package/node_modules/@playdrop/config/dist/src/server/logging.js +46 -0
- package/node_modules/@playdrop/config/dist/test/deployment.test.d.ts +2 -0
- package/node_modules/@playdrop/config/dist/test/deployment.test.d.ts.map +1 -0
- package/node_modules/@playdrop/config/dist/test/deployment.test.js +74 -0
- package/node_modules/@playdrop/config/dist/test/logging.test.d.ts +2 -0
- package/node_modules/@playdrop/config/dist/test/logging.test.d.ts.map +1 -0
- package/node_modules/@playdrop/config/dist/test/logging.test.js +17 -0
- package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@playdrop/config/package.json +14 -2
- package/node_modules/@playdrop/types/dist/api.d.ts +27 -10
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +11 -0
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts +1 -0
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.d.ts +36 -4
- package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.js +20 -1
- package/node_modules/@playdrop/types/dist/version.d.ts +3 -1
- package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.js +2 -0
- package/node_modules/@playdrop/types/package.json +1 -1
- package/node_modules/@playdrop/vox-three/package.json +1 -1
- package/package.json +3 -3
|
@@ -350,6 +350,15 @@ export async function likeItem(kind, creatorUsername, itemName) {
|
|
|
350
350
|
export async function unlikeItem(kind, creatorUsername, itemName) {
|
|
351
351
|
return await getDefaultClient().unlikeItem(kind, creatorUsername, itemName);
|
|
352
352
|
}
|
|
353
|
+
export async function dislikeItem(kind, creatorUsername, itemName) {
|
|
354
|
+
return await getDefaultClient().dislikeItem(kind, creatorUsername, itemName);
|
|
355
|
+
}
|
|
356
|
+
export async function undislikeItem(kind, creatorUsername, itemName) {
|
|
357
|
+
return await getDefaultClient().undislikeItem(kind, creatorUsername, itemName);
|
|
358
|
+
}
|
|
359
|
+
export async function reportContent(kind, creatorUsername, itemName, request) {
|
|
360
|
+
return await getDefaultClient().reportContent(kind, creatorUsername, itemName, request);
|
|
361
|
+
}
|
|
353
362
|
export async function fetchContentComments(kind, creatorUsername, itemName) {
|
|
354
363
|
return await getDefaultClient().fetchContentComments(kind, creatorUsername, itemName);
|
|
355
364
|
}
|
|
@@ -362,6 +371,15 @@ export async function likeContentComment(commentId) {
|
|
|
362
371
|
export async function unlikeContentComment(commentId) {
|
|
363
372
|
return await getDefaultClient().unlikeContentComment(commentId);
|
|
364
373
|
}
|
|
374
|
+
export async function dislikeContentComment(commentId) {
|
|
375
|
+
return await getDefaultClient().dislikeContentComment(commentId);
|
|
376
|
+
}
|
|
377
|
+
export async function undislikeContentComment(commentId) {
|
|
378
|
+
return await getDefaultClient().undislikeContentComment(commentId);
|
|
379
|
+
}
|
|
380
|
+
export async function reportComment(commentId, request) {
|
|
381
|
+
return await getDefaultClient().reportComment(commentId, request);
|
|
382
|
+
}
|
|
365
383
|
export async function deleteContentComment(commentId) {
|
|
366
384
|
return await getDefaultClient().deleteContentComment(commentId);
|
|
367
385
|
}
|
|
@@ -377,6 +395,15 @@ export async function followCreator(creatorUsername) {
|
|
|
377
395
|
export async function unfollowCreator(creatorUsername) {
|
|
378
396
|
return await getDefaultClient().unfollowCreator(creatorUsername);
|
|
379
397
|
}
|
|
398
|
+
export async function reportCreator(creatorUsername, request) {
|
|
399
|
+
return await getDefaultClient().reportCreator(creatorUsername, request);
|
|
400
|
+
}
|
|
401
|
+
export async function blockCreator(creatorUsername) {
|
|
402
|
+
return await getDefaultClient().blockCreator(creatorUsername);
|
|
403
|
+
}
|
|
404
|
+
export async function unblockCreator(creatorUsername) {
|
|
405
|
+
return await getDefaultClient().unblockCreator(creatorUsername);
|
|
406
|
+
}
|
|
380
407
|
export async function fetchFollowingCreators(options = {}) {
|
|
381
408
|
return await getDefaultClient().fetchFollowingCreators(options);
|
|
382
409
|
}
|
|
@@ -633,9 +660,6 @@ export async function claimNextAdminAppVersionReview() {
|
|
|
633
660
|
export async function updateAdminAppVersionReview(versionId, request) {
|
|
634
661
|
return await getDefaultClient().updateAdminAppVersionReview(versionId, request);
|
|
635
662
|
}
|
|
636
|
-
export async function createAdminAppVersionReviewPublicComment(versionId, request) {
|
|
637
|
-
return await getDefaultClient().createAdminAppVersionReviewPublicComment(versionId, request);
|
|
638
|
-
}
|
|
639
663
|
export async function fetchAdminAppPlayerMeta(appId) {
|
|
640
664
|
return await getDefaultClient().fetchAdminAppPlayerMeta(appId);
|
|
641
665
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@playdrop/boxel-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Shared domain utilities for Playdrop boxel definitions",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -10,11 +10,10 @@
|
|
|
10
10
|
"dev": "tsc --watch",
|
|
11
11
|
"clean": "rm -rf dist"
|
|
12
12
|
},
|
|
13
|
-
"dependencies": {},
|
|
14
13
|
"devDependencies": {
|
|
15
14
|
"@types/node": "^20.10.0",
|
|
16
|
-
"
|
|
15
|
+
"@types/pngjs": "^6.0.4",
|
|
17
16
|
"pngjs": "^7.0.0",
|
|
18
|
-
"
|
|
17
|
+
"typescript": "^5.3.0"
|
|
19
18
|
}
|
|
20
19
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.7.
|
|
3
|
-
"build":
|
|
2
|
+
"version": "0.7.2",
|
|
3
|
+
"build": 12,
|
|
4
4
|
"platforms": {
|
|
5
5
|
"ios": {
|
|
6
6
|
"minimumVersion": "16.0"
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
},
|
|
27
27
|
"clients": {
|
|
28
28
|
"web": {
|
|
29
|
-
"minimumVersion": "0.7.
|
|
30
|
-
"minimumBuild":
|
|
29
|
+
"minimumVersion": "0.7.2",
|
|
30
|
+
"minimumBuild": 12
|
|
31
31
|
},
|
|
32
32
|
"admin": {
|
|
33
|
-
"minimumVersion": "0.7.
|
|
34
|
-
"minimumBuild":
|
|
33
|
+
"minimumVersion": "0.7.2",
|
|
34
|
+
"minimumBuild": 12
|
|
35
35
|
},
|
|
36
36
|
"apple": {
|
|
37
37
|
"minimumVersion": "0.3.10",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"minimumBuild": 1
|
|
47
47
|
},
|
|
48
48
|
"android-games": {
|
|
49
|
-
"minimumVersion": "0.1
|
|
50
|
-
"minimumBuild":
|
|
49
|
+
"minimumVersion": "0.7.1",
|
|
50
|
+
"minimumBuild": 5
|
|
51
51
|
},
|
|
52
52
|
"cli": {
|
|
53
|
-
"minimumVersion": "0.7.
|
|
53
|
+
"minimumVersion": "0.7.2"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type PlaydropDeployRole = 'prod' | 'preview';
|
|
2
|
+
export type PlaydropDeploySlot = 'blue' | 'green';
|
|
3
|
+
export type PlaydropPublicSurface = PlaydropDeployRole | PlaydropDeploySlot;
|
|
4
|
+
export interface StructuredLogFields {
|
|
5
|
+
environment: string;
|
|
6
|
+
slot: PlaydropDeploySlot | 'none';
|
|
7
|
+
service: string;
|
|
8
|
+
release_version: string;
|
|
9
|
+
build_number: number;
|
|
10
|
+
deploy_role: PlaydropDeployRole;
|
|
11
|
+
public_surface: PlaydropPublicSurface;
|
|
12
|
+
}
|
|
13
|
+
export declare function parseDeployRole(value: unknown): PlaydropDeployRole | null;
|
|
14
|
+
export declare function parseDeploySlot(value: unknown): PlaydropDeploySlot | null;
|
|
15
|
+
export declare function parsePublicSurface(value: unknown): PlaydropPublicSurface | null;
|
|
16
|
+
export declare function resolveDeployRole(env?: NodeJS.ProcessEnv): PlaydropDeployRole;
|
|
17
|
+
export declare function resolveDeploySlot(env?: NodeJS.ProcessEnv): PlaydropDeploySlot | null;
|
|
18
|
+
export declare function resolvePublicSurface(env?: NodeJS.ProcessEnv): PlaydropPublicSurface;
|
|
19
|
+
export declare function resolveEnvironmentName(env?: NodeJS.ProcessEnv): string;
|
|
20
|
+
export declare function isBackgroundWorkEnabled(env?: NodeJS.ProcessEnv): boolean;
|
|
21
|
+
export declare function resolveSeoIndexingMode(env?: NodeJS.ProcessEnv): 'public' | 'private' | 'noindex';
|
|
22
|
+
export declare function resolveWebOrigin(env?: NodeJS.ProcessEnv): string;
|
|
23
|
+
export declare function resolveApiOrigin(env?: NodeJS.ProcessEnv): string;
|
|
24
|
+
export declare function resolveRealtimeOrigin(env?: NodeJS.ProcessEnv): string;
|
|
25
|
+
export declare function resolveAiOrigin(env?: NodeJS.ProcessEnv): string;
|
|
26
|
+
export declare function resolveStructuredLogFields(service: string, env?: NodeJS.ProcessEnv): StructuredLogFields;
|
|
27
|
+
//# sourceMappingURL=deployment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment.d.ts","sourceRoot":"","sources":["../../src/deployment.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,SAAS,CAAC;AACpD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,CAAC;AAClD,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;AAM5E,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,kBAAkB,CAAC;IAChC,cAAc,EAAE,qBAAqB,CAAC;CACvC;AA4ED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAMzE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAMzE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,GAAG,IAAI,CAM/E;AAED,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,kBAAkB,CAG1F;AAED,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,kBAAkB,GAAG,IAAI,CAEjG;AAED,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,qBAAqB,CAUhG;AAED,wBAAgB,sBAAsB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAOnF;AAED,wBAAgB,uBAAuB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAMrF;AAED,wBAAgB,sBAAsB,CACpC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,QAAQ,GAAG,SAAS,GAAG,SAAS,CAYlC;AAED,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAU7E;AAED,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAM7E;AAED,wBAAgB,qBAAqB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAMlF;AAED,wBAAgB,eAAe,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAM5E;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,mBAAmB,CAYrH"}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseDeployRole = parseDeployRole;
|
|
7
|
+
exports.parseDeploySlot = parseDeploySlot;
|
|
8
|
+
exports.parsePublicSurface = parsePublicSurface;
|
|
9
|
+
exports.resolveDeployRole = resolveDeployRole;
|
|
10
|
+
exports.resolveDeploySlot = resolveDeploySlot;
|
|
11
|
+
exports.resolvePublicSurface = resolvePublicSurface;
|
|
12
|
+
exports.resolveEnvironmentName = resolveEnvironmentName;
|
|
13
|
+
exports.isBackgroundWorkEnabled = isBackgroundWorkEnabled;
|
|
14
|
+
exports.resolveSeoIndexingMode = resolveSeoIndexingMode;
|
|
15
|
+
exports.resolveWebOrigin = resolveWebOrigin;
|
|
16
|
+
exports.resolveApiOrigin = resolveApiOrigin;
|
|
17
|
+
exports.resolveRealtimeOrigin = resolveRealtimeOrigin;
|
|
18
|
+
exports.resolveAiOrigin = resolveAiOrigin;
|
|
19
|
+
exports.resolveStructuredLogFields = resolveStructuredLogFields;
|
|
20
|
+
const fs_1 = __importDefault(require("fs"));
|
|
21
|
+
const path_1 = __importDefault(require("path"));
|
|
22
|
+
const DEPLOY_ROLE_VALUES = new Set(['prod', 'preview']);
|
|
23
|
+
const DEPLOY_SLOT_VALUES = new Set(['blue', 'green']);
|
|
24
|
+
const PUBLIC_SURFACE_VALUES = new Set(['prod', 'preview', 'blue', 'green']);
|
|
25
|
+
let cachedClientMeta = null;
|
|
26
|
+
function resolveMetaPath() {
|
|
27
|
+
const candidates = Array.from(new Set([
|
|
28
|
+
path_1.default.resolve(process.cwd(), 'config', 'client-meta.json'),
|
|
29
|
+
path_1.default.resolve(process.cwd(), '..', 'config', 'client-meta.json'),
|
|
30
|
+
path_1.default.resolve(process.cwd(), '..', '..', 'config', 'client-meta.json'),
|
|
31
|
+
path_1.default.resolve(process.cwd(), '..', '..', '..', 'config', 'client-meta.json'),
|
|
32
|
+
path_1.default.resolve(__dirname, '../../..', 'config', 'client-meta.json'),
|
|
33
|
+
path_1.default.resolve(__dirname, '../../../..', 'config', 'client-meta.json'),
|
|
34
|
+
]));
|
|
35
|
+
for (const candidate of candidates) {
|
|
36
|
+
if (fs_1.default.existsSync(candidate)) {
|
|
37
|
+
return candidate;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
throw new Error(`missing_client_meta_json:${candidates.join('|')}`);
|
|
41
|
+
}
|
|
42
|
+
function loadReleaseMeta() {
|
|
43
|
+
if (!cachedClientMeta) {
|
|
44
|
+
const raw = fs_1.default.readFileSync(resolveMetaPath(), 'utf8');
|
|
45
|
+
const parsed = JSON.parse(raw);
|
|
46
|
+
const version = typeof parsed.version === 'string' ? parsed.version.trim() : '';
|
|
47
|
+
const build = Number(parsed.build);
|
|
48
|
+
if (!/^\d+\.\d+\.\d+$/.test(version) || !Number.isInteger(build) || build < 1) {
|
|
49
|
+
throw new Error('invalid_client_meta_for_deploy_helpers');
|
|
50
|
+
}
|
|
51
|
+
cachedClientMeta = { version, build };
|
|
52
|
+
}
|
|
53
|
+
return cachedClientMeta;
|
|
54
|
+
}
|
|
55
|
+
function normalizeValue(value) {
|
|
56
|
+
if (typeof value !== 'string') {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
const normalized = value.trim().toLowerCase();
|
|
60
|
+
return normalized.length > 0 ? normalized : null;
|
|
61
|
+
}
|
|
62
|
+
function normalizeOrigin(value) {
|
|
63
|
+
return value.trim().replace(/\/+$/, '');
|
|
64
|
+
}
|
|
65
|
+
function buildDefaultOrigin(params) {
|
|
66
|
+
const { servicePrefix, surface, websocket = false } = params;
|
|
67
|
+
const protocol = websocket ? 'wss' : 'https';
|
|
68
|
+
const host = surface === 'prod'
|
|
69
|
+
? servicePrefix ? `${servicePrefix}.playdrop.ai` : 'www.playdrop.ai'
|
|
70
|
+
: servicePrefix
|
|
71
|
+
? `${servicePrefix}.${surface}.playdrop.ai`
|
|
72
|
+
: `${surface}.playdrop.ai`;
|
|
73
|
+
return `${protocol}://${host}`;
|
|
74
|
+
}
|
|
75
|
+
function parseBoolean(value) {
|
|
76
|
+
const normalized = normalizeValue(value);
|
|
77
|
+
if (!normalized) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
if (normalized === '1' || normalized === 'true' || normalized === 'yes' || normalized === 'on') {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
if (normalized === '0' || normalized === 'false' || normalized === 'no' || normalized === 'off') {
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
function parseDeployRole(value) {
|
|
89
|
+
const normalized = normalizeValue(value);
|
|
90
|
+
if (!normalized || !DEPLOY_ROLE_VALUES.has(normalized)) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return normalized;
|
|
94
|
+
}
|
|
95
|
+
function parseDeploySlot(value) {
|
|
96
|
+
const normalized = normalizeValue(value);
|
|
97
|
+
if (!normalized || !DEPLOY_SLOT_VALUES.has(normalized)) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
return normalized;
|
|
101
|
+
}
|
|
102
|
+
function parsePublicSurface(value) {
|
|
103
|
+
const normalized = normalizeValue(value);
|
|
104
|
+
if (!normalized || !PUBLIC_SURFACE_VALUES.has(normalized)) {
|
|
105
|
+
return null;
|
|
106
|
+
}
|
|
107
|
+
return normalized;
|
|
108
|
+
}
|
|
109
|
+
function resolveDeployRole(env = process.env) {
|
|
110
|
+
return parseDeployRole(env['PLAYDROP_DEPLOY_ROLE'])
|
|
111
|
+
?? (env['NODE_ENV'] === 'production' ? 'prod' : 'preview');
|
|
112
|
+
}
|
|
113
|
+
function resolveDeploySlot(env = process.env) {
|
|
114
|
+
return parseDeploySlot(env['PLAYDROP_SLOT']);
|
|
115
|
+
}
|
|
116
|
+
function resolvePublicSurface(env = process.env) {
|
|
117
|
+
const explicit = parsePublicSurface(env['PLAYDROP_PUBLIC_SURFACE']);
|
|
118
|
+
if (explicit) {
|
|
119
|
+
return explicit;
|
|
120
|
+
}
|
|
121
|
+
const role = resolveDeployRole(env);
|
|
122
|
+
if (role === 'preview') {
|
|
123
|
+
return 'preview';
|
|
124
|
+
}
|
|
125
|
+
return 'prod';
|
|
126
|
+
}
|
|
127
|
+
function resolveEnvironmentName(env = process.env) {
|
|
128
|
+
const explicit = typeof env['PLAYDROP_ENVIRONMENT'] === 'string' ? env['PLAYDROP_ENVIRONMENT'].trim() : '';
|
|
129
|
+
if (explicit.length > 0) {
|
|
130
|
+
return explicit;
|
|
131
|
+
}
|
|
132
|
+
const nodeEnv = typeof env['NODE_ENV'] === 'string' ? env['NODE_ENV'].trim() : '';
|
|
133
|
+
return nodeEnv.length > 0 ? nodeEnv : 'development';
|
|
134
|
+
}
|
|
135
|
+
function isBackgroundWorkEnabled(env = process.env) {
|
|
136
|
+
const explicit = parseBoolean(env['PLAYDROP_BACKGROUND_WORKERS_ENABLED']);
|
|
137
|
+
if (explicit !== null) {
|
|
138
|
+
return explicit;
|
|
139
|
+
}
|
|
140
|
+
return resolveDeployRole(env) === 'prod';
|
|
141
|
+
}
|
|
142
|
+
function resolveSeoIndexingMode(env = process.env) {
|
|
143
|
+
const explicit = normalizeValue(env['PLAYDROP_SEO_INDEXING']);
|
|
144
|
+
if (explicit === 'public') {
|
|
145
|
+
return 'public';
|
|
146
|
+
}
|
|
147
|
+
if (explicit === 'private') {
|
|
148
|
+
return 'private';
|
|
149
|
+
}
|
|
150
|
+
if (explicit === 'noindex') {
|
|
151
|
+
return 'noindex';
|
|
152
|
+
}
|
|
153
|
+
return resolveDeployRole(env) === 'prod' ? 'public' : 'noindex';
|
|
154
|
+
}
|
|
155
|
+
function resolveWebOrigin(env = process.env) {
|
|
156
|
+
const explicit = typeof env['PLAYDROP_PUBLIC_ORIGIN'] === 'string' ? env['PLAYDROP_PUBLIC_ORIGIN'].trim() : '';
|
|
157
|
+
if (explicit.length > 0) {
|
|
158
|
+
return normalizeOrigin(explicit);
|
|
159
|
+
}
|
|
160
|
+
const legacy = typeof env['PLAYDROP_WEB_BASE_URL'] === 'string' ? env['PLAYDROP_WEB_BASE_URL'].trim() : '';
|
|
161
|
+
if (legacy.length > 0) {
|
|
162
|
+
return normalizeOrigin(legacy);
|
|
163
|
+
}
|
|
164
|
+
return buildDefaultOrigin({ surface: resolvePublicSurface(env) });
|
|
165
|
+
}
|
|
166
|
+
function resolveApiOrigin(env = process.env) {
|
|
167
|
+
const explicit = typeof env['PLAYDROP_API_BASE_URL'] === 'string' ? env['PLAYDROP_API_BASE_URL'].trim() : '';
|
|
168
|
+
if (explicit.length > 0) {
|
|
169
|
+
return normalizeOrigin(explicit);
|
|
170
|
+
}
|
|
171
|
+
return buildDefaultOrigin({ servicePrefix: 'api', surface: resolvePublicSurface(env) });
|
|
172
|
+
}
|
|
173
|
+
function resolveRealtimeOrigin(env = process.env) {
|
|
174
|
+
const explicit = typeof env['PLAYDROP_REALTIME_BASE_URL'] === 'string' ? env['PLAYDROP_REALTIME_BASE_URL'].trim() : '';
|
|
175
|
+
if (explicit.length > 0) {
|
|
176
|
+
return normalizeOrigin(explicit);
|
|
177
|
+
}
|
|
178
|
+
return buildDefaultOrigin({ servicePrefix: 'play', surface: resolvePublicSurface(env), websocket: true });
|
|
179
|
+
}
|
|
180
|
+
function resolveAiOrigin(env = process.env) {
|
|
181
|
+
const explicit = typeof env['PLAYDROP_AI_BASE_URL'] === 'string' ? env['PLAYDROP_AI_BASE_URL'].trim() : '';
|
|
182
|
+
if (explicit.length > 0) {
|
|
183
|
+
return normalizeOrigin(explicit);
|
|
184
|
+
}
|
|
185
|
+
return buildDefaultOrigin({ servicePrefix: 'ai', surface: resolvePublicSurface(env) });
|
|
186
|
+
}
|
|
187
|
+
function resolveStructuredLogFields(service, env = process.env) {
|
|
188
|
+
const slot = resolveDeploySlot(env);
|
|
189
|
+
const release = loadReleaseMeta();
|
|
190
|
+
return {
|
|
191
|
+
environment: resolveEnvironmentName(env),
|
|
192
|
+
slot: slot ?? 'none',
|
|
193
|
+
service,
|
|
194
|
+
release_version: release.version,
|
|
195
|
+
build_number: release.build,
|
|
196
|
+
deploy_role: resolveDeployRole(env),
|
|
197
|
+
public_surface: resolvePublicSurface(env),
|
|
198
|
+
};
|
|
199
|
+
}
|
|
@@ -6,8 +6,10 @@ export declare function getClientBuild(): number;
|
|
|
6
6
|
export declare function getClientVersionLabel(): string;
|
|
7
7
|
export { CLIENT_HEADER_NAMES };
|
|
8
8
|
export * from './constants';
|
|
9
|
+
export * from './deployment';
|
|
9
10
|
export * from './types';
|
|
10
11
|
export * from './server/fastify';
|
|
12
|
+
export * from './server/logging';
|
|
11
13
|
export declare function createClientHeaderRecord(info: ClientRuntimeInfo): Record<string, string>;
|
|
12
14
|
export declare function validateClientEnvironment(info: ClientRuntimeInfo): ClientValidationResult;
|
|
13
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EAEjB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAsBjB,wBAAgB,cAAc,IAAI,gBAAgB,CAMjD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAG9C;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AAEjC,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUxF;AAoBD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,iBAAiB,GAAG,sBAAsB,CAqEzF"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EAEjB,sBAAsB,EAEvB,MAAM,SAAS,CAAC;AAsBjB,wBAAgB,cAAc,IAAI,gBAAgB,CAMjD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAG9C;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AAEjC,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUxF;AAoBD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,iBAAiB,GAAG,sBAAsB,CAqEzF"}
|
|
@@ -64,8 +64,10 @@ function getClientVersionLabel() {
|
|
|
64
64
|
return `${meta.version} (build ${meta.build})`;
|
|
65
65
|
}
|
|
66
66
|
__exportStar(require("./constants"), exports);
|
|
67
|
+
__exportStar(require("./deployment"), exports);
|
|
67
68
|
__exportStar(require("./types"), exports);
|
|
68
69
|
__exportStar(require("./server/fastify"), exports);
|
|
70
|
+
__exportStar(require("./server/logging"), exports);
|
|
69
71
|
function createClientHeaderRecord(info) {
|
|
70
72
|
const headers = {};
|
|
71
73
|
if (info.client)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type PlaydropDeployRole = 'prod' | 'preview';
|
|
2
|
+
export type PlaydropDeploySlot = 'blue' | 'green';
|
|
3
|
+
export type PlaydropPublicSurface = PlaydropDeployRole | PlaydropDeploySlot;
|
|
4
|
+
export interface StructuredLogFields {
|
|
5
|
+
environment: string;
|
|
6
|
+
slot: PlaydropDeploySlot | 'none';
|
|
7
|
+
service: string;
|
|
8
|
+
release_version: string;
|
|
9
|
+
build_number: number;
|
|
10
|
+
deploy_role: PlaydropDeployRole;
|
|
11
|
+
public_surface: PlaydropPublicSurface;
|
|
12
|
+
}
|
|
13
|
+
export declare function parseDeployRole(value: unknown): PlaydropDeployRole | null;
|
|
14
|
+
export declare function parseDeploySlot(value: unknown): PlaydropDeploySlot | null;
|
|
15
|
+
export declare function parsePublicSurface(value: unknown): PlaydropPublicSurface | null;
|
|
16
|
+
export declare function resolveDeployRole(env?: NodeJS.ProcessEnv): PlaydropDeployRole;
|
|
17
|
+
export declare function resolveDeploySlot(env?: NodeJS.ProcessEnv): PlaydropDeploySlot | null;
|
|
18
|
+
export declare function resolvePublicSurface(env?: NodeJS.ProcessEnv): PlaydropPublicSurface;
|
|
19
|
+
export declare function resolveEnvironmentName(env?: NodeJS.ProcessEnv): string;
|
|
20
|
+
export declare function resolveSeoIndexingMode(env?: NodeJS.ProcessEnv): 'public' | 'private' | 'noindex';
|
|
21
|
+
export declare function resolveWebOrigin(env?: NodeJS.ProcessEnv): string;
|
|
22
|
+
export declare function resolveApiOrigin(env?: NodeJS.ProcessEnv): string;
|
|
23
|
+
export declare function resolveRealtimeOrigin(env?: NodeJS.ProcessEnv): string;
|
|
24
|
+
export declare function resolveAiOrigin(env?: NodeJS.ProcessEnv): string;
|
|
25
|
+
export declare function resolveStructuredLogFields(service: string, env?: NodeJS.ProcessEnv): StructuredLogFields;
|
|
26
|
+
//# sourceMappingURL=public-deployment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-deployment.d.ts","sourceRoot":"","sources":["../../src/public-deployment.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,SAAS,CAAC;AACpD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,OAAO,CAAC;AAClD,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,GAAG,kBAAkB,CAAC;AAE5E,MAAM,WAAW,mBAAmB;IAClC,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAAC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,kBAAkB,CAAC;IAChC,cAAc,EAAE,qBAAqB,CAAC;CACvC;AAsCD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAMzE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAMzE;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,qBAAqB,GAAG,IAAI,CAM/E;AAED,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,kBAAkB,CAG1F;AAED,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,kBAAkB,GAAG,IAAI,CAEjG;AAED,wBAAgB,oBAAoB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,qBAAqB,CAMhG;AAED,wBAAgB,sBAAsB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAOnF;AAED,wBAAgB,sBAAsB,CACpC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,QAAQ,GAAG,SAAS,GAAG,SAAS,CAYlC;AAED,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAU7E;AAED,wBAAgB,gBAAgB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAM7E;AAED,wBAAgB,qBAAqB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAMlF;AAED,wBAAgB,eAAe,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAM5E;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,mBAAmB,CAiBrB"}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseDeployRole = parseDeployRole;
|
|
4
|
+
exports.parseDeploySlot = parseDeploySlot;
|
|
5
|
+
exports.parsePublicSurface = parsePublicSurface;
|
|
6
|
+
exports.resolveDeployRole = resolveDeployRole;
|
|
7
|
+
exports.resolveDeploySlot = resolveDeploySlot;
|
|
8
|
+
exports.resolvePublicSurface = resolvePublicSurface;
|
|
9
|
+
exports.resolveEnvironmentName = resolveEnvironmentName;
|
|
10
|
+
exports.resolveSeoIndexingMode = resolveSeoIndexingMode;
|
|
11
|
+
exports.resolveWebOrigin = resolveWebOrigin;
|
|
12
|
+
exports.resolveApiOrigin = resolveApiOrigin;
|
|
13
|
+
exports.resolveRealtimeOrigin = resolveRealtimeOrigin;
|
|
14
|
+
exports.resolveAiOrigin = resolveAiOrigin;
|
|
15
|
+
exports.resolveStructuredLogFields = resolveStructuredLogFields;
|
|
16
|
+
const DEPLOY_ROLE_VALUES = new Set(['prod', 'preview']);
|
|
17
|
+
const DEPLOY_SLOT_VALUES = new Set(['blue', 'green']);
|
|
18
|
+
const PUBLIC_SURFACE_VALUES = new Set(['prod', 'preview', 'blue', 'green']);
|
|
19
|
+
function normalizeValue(value) {
|
|
20
|
+
if (typeof value !== 'string') {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const normalized = value.trim().toLowerCase();
|
|
24
|
+
return normalized.length > 0 ? normalized : null;
|
|
25
|
+
}
|
|
26
|
+
function normalizeOrigin(value) {
|
|
27
|
+
return value.trim().replace(/\/+$/, '');
|
|
28
|
+
}
|
|
29
|
+
function buildDefaultOrigin(params) {
|
|
30
|
+
const { servicePrefix, surface, websocket = false } = params;
|
|
31
|
+
const protocol = websocket ? 'wss' : 'https';
|
|
32
|
+
const host = surface === 'prod'
|
|
33
|
+
? servicePrefix ? `${servicePrefix}.playdrop.ai` : 'www.playdrop.ai'
|
|
34
|
+
: servicePrefix
|
|
35
|
+
? `${servicePrefix}.${surface}.playdrop.ai`
|
|
36
|
+
: `${surface}.playdrop.ai`;
|
|
37
|
+
return `${protocol}://${host}`;
|
|
38
|
+
}
|
|
39
|
+
function parseReleaseBuild(value) {
|
|
40
|
+
const parsed = Number(value);
|
|
41
|
+
return Number.isInteger(parsed) && parsed > 0 ? parsed : 0;
|
|
42
|
+
}
|
|
43
|
+
function parseDeployRole(value) {
|
|
44
|
+
const normalized = normalizeValue(value);
|
|
45
|
+
if (!normalized || !DEPLOY_ROLE_VALUES.has(normalized)) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return normalized;
|
|
49
|
+
}
|
|
50
|
+
function parseDeploySlot(value) {
|
|
51
|
+
const normalized = normalizeValue(value);
|
|
52
|
+
if (!normalized || !DEPLOY_SLOT_VALUES.has(normalized)) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return normalized;
|
|
56
|
+
}
|
|
57
|
+
function parsePublicSurface(value) {
|
|
58
|
+
const normalized = normalizeValue(value);
|
|
59
|
+
if (!normalized || !PUBLIC_SURFACE_VALUES.has(normalized)) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return normalized;
|
|
63
|
+
}
|
|
64
|
+
function resolveDeployRole(env = process.env) {
|
|
65
|
+
return parseDeployRole(env['PLAYDROP_DEPLOY_ROLE'])
|
|
66
|
+
?? (env['NODE_ENV'] === 'production' ? 'prod' : 'preview');
|
|
67
|
+
}
|
|
68
|
+
function resolveDeploySlot(env = process.env) {
|
|
69
|
+
return parseDeploySlot(env['PLAYDROP_SLOT']);
|
|
70
|
+
}
|
|
71
|
+
function resolvePublicSurface(env = process.env) {
|
|
72
|
+
const explicit = parsePublicSurface(env['PLAYDROP_PUBLIC_SURFACE']);
|
|
73
|
+
if (explicit) {
|
|
74
|
+
return explicit;
|
|
75
|
+
}
|
|
76
|
+
return resolveDeployRole(env) === 'preview' ? 'preview' : 'prod';
|
|
77
|
+
}
|
|
78
|
+
function resolveEnvironmentName(env = process.env) {
|
|
79
|
+
const explicit = typeof env['PLAYDROP_ENVIRONMENT'] === 'string' ? env['PLAYDROP_ENVIRONMENT'].trim() : '';
|
|
80
|
+
if (explicit.length > 0) {
|
|
81
|
+
return explicit;
|
|
82
|
+
}
|
|
83
|
+
const nodeEnv = typeof env['NODE_ENV'] === 'string' ? env['NODE_ENV'].trim() : '';
|
|
84
|
+
return nodeEnv.length > 0 ? nodeEnv : 'development';
|
|
85
|
+
}
|
|
86
|
+
function resolveSeoIndexingMode(env = process.env) {
|
|
87
|
+
const explicit = normalizeValue(env['PLAYDROP_SEO_INDEXING']);
|
|
88
|
+
if (explicit === 'public') {
|
|
89
|
+
return 'public';
|
|
90
|
+
}
|
|
91
|
+
if (explicit === 'private') {
|
|
92
|
+
return 'private';
|
|
93
|
+
}
|
|
94
|
+
if (explicit === 'noindex') {
|
|
95
|
+
return 'noindex';
|
|
96
|
+
}
|
|
97
|
+
return resolveDeployRole(env) === 'prod' ? 'public' : 'noindex';
|
|
98
|
+
}
|
|
99
|
+
function resolveWebOrigin(env = process.env) {
|
|
100
|
+
const explicit = typeof env['PLAYDROP_PUBLIC_ORIGIN'] === 'string' ? env['PLAYDROP_PUBLIC_ORIGIN'].trim() : '';
|
|
101
|
+
if (explicit.length > 0) {
|
|
102
|
+
return normalizeOrigin(explicit);
|
|
103
|
+
}
|
|
104
|
+
const legacy = typeof env['PLAYDROP_WEB_BASE_URL'] === 'string' ? env['PLAYDROP_WEB_BASE_URL'].trim() : '';
|
|
105
|
+
if (legacy.length > 0) {
|
|
106
|
+
return normalizeOrigin(legacy);
|
|
107
|
+
}
|
|
108
|
+
return buildDefaultOrigin({ surface: resolvePublicSurface(env) });
|
|
109
|
+
}
|
|
110
|
+
function resolveApiOrigin(env = process.env) {
|
|
111
|
+
const explicit = typeof env['PLAYDROP_API_BASE_URL'] === 'string' ? env['PLAYDROP_API_BASE_URL'].trim() : '';
|
|
112
|
+
if (explicit.length > 0) {
|
|
113
|
+
return normalizeOrigin(explicit);
|
|
114
|
+
}
|
|
115
|
+
return buildDefaultOrigin({ servicePrefix: 'api', surface: resolvePublicSurface(env) });
|
|
116
|
+
}
|
|
117
|
+
function resolveRealtimeOrigin(env = process.env) {
|
|
118
|
+
const explicit = typeof env['PLAYDROP_REALTIME_BASE_URL'] === 'string' ? env['PLAYDROP_REALTIME_BASE_URL'].trim() : '';
|
|
119
|
+
if (explicit.length > 0) {
|
|
120
|
+
return normalizeOrigin(explicit);
|
|
121
|
+
}
|
|
122
|
+
return buildDefaultOrigin({ servicePrefix: 'play', surface: resolvePublicSurface(env), websocket: true });
|
|
123
|
+
}
|
|
124
|
+
function resolveAiOrigin(env = process.env) {
|
|
125
|
+
const explicit = typeof env['PLAYDROP_AI_BASE_URL'] === 'string' ? env['PLAYDROP_AI_BASE_URL'].trim() : '';
|
|
126
|
+
if (explicit.length > 0) {
|
|
127
|
+
return normalizeOrigin(explicit);
|
|
128
|
+
}
|
|
129
|
+
return buildDefaultOrigin({ servicePrefix: 'ai', surface: resolvePublicSurface(env) });
|
|
130
|
+
}
|
|
131
|
+
function resolveStructuredLogFields(service, env = process.env) {
|
|
132
|
+
const releaseVersion = typeof env['PLAYDROP_RELEASE_VERSION'] === 'string' && env['PLAYDROP_RELEASE_VERSION'].trim().length > 0
|
|
133
|
+
? env['PLAYDROP_RELEASE_VERSION'].trim()
|
|
134
|
+
: typeof env['NEXT_PUBLIC_PLAYDROP_RELEASE_VERSION'] === 'string' && env['NEXT_PUBLIC_PLAYDROP_RELEASE_VERSION'].trim().length > 0
|
|
135
|
+
? env['NEXT_PUBLIC_PLAYDROP_RELEASE_VERSION'].trim()
|
|
136
|
+
: '0.0.0';
|
|
137
|
+
const buildNumber = parseReleaseBuild(env['PLAYDROP_BUILD_NUMBER'] ?? env['NEXT_PUBLIC_PLAYDROP_BUILD_NUMBER']);
|
|
138
|
+
const slot = resolveDeploySlot(env);
|
|
139
|
+
return {
|
|
140
|
+
environment: resolveEnvironmentName(env),
|
|
141
|
+
slot: slot ?? 'none',
|
|
142
|
+
service,
|
|
143
|
+
release_version: releaseVersion,
|
|
144
|
+
build_number: buildNumber,
|
|
145
|
+
deploy_role: resolveDeployRole(env),
|
|
146
|
+
public_surface: resolvePublicSurface(env),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
@@ -1,10 +1,69 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Writable } from 'node:stream';
|
|
2
|
+
import type { FastifyInstance, FastifyLoggerOptions, FastifyReply, FastifyRequest, FastifyServerOptions, RawServerDefault } from 'fastify';
|
|
2
3
|
import type { ClientErrorResponseBody, ClientRuntimeInfo, ClientValidator, ClientValidationFailure, ClientGuard, NormalizedClientRuntimeInfo } from '../types';
|
|
3
4
|
declare module 'fastify' {
|
|
4
5
|
interface FastifyRequest {
|
|
5
6
|
clientRuntime?: NormalizedClientRuntimeInfo;
|
|
7
|
+
requestLogContext?: {
|
|
8
|
+
userId?: string;
|
|
9
|
+
roomId?: string;
|
|
10
|
+
};
|
|
6
11
|
}
|
|
7
12
|
}
|
|
13
|
+
export declare function setRequestLogContext(request: FastifyRequest, input: {
|
|
14
|
+
userId?: string | number | null;
|
|
15
|
+
roomId?: string | number | null;
|
|
16
|
+
}): void;
|
|
17
|
+
export declare function buildFastifyLogger(service: string): (FastifyLoggerOptions<RawServerDefault, FastifyRequest<import("fastify").RouteGenericInterface, RawServerDefault, import("http").IncomingMessage, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown, import("fastify").FastifyBaseLogger, import("fastify/types/type-provider").ResolveFastifyRequestType<import("fastify").FastifyTypeProviderDefault, import("fastify").FastifySchema, import("fastify").RouteGenericInterface>>, FastifyReply<import("fastify").RouteGenericInterface, RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>> & {
|
|
18
|
+
base: Record<string, unknown>;
|
|
19
|
+
messageKey: string;
|
|
20
|
+
formatters: {
|
|
21
|
+
level(label: string): {
|
|
22
|
+
level: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
timestamp: () => string;
|
|
26
|
+
stream?: Writable;
|
|
27
|
+
}) | {
|
|
28
|
+
stream: Writable;
|
|
29
|
+
serializers?: {
|
|
30
|
+
req?: (req: FastifyRequest<import("fastify").RouteGenericInterface, RawServerDefault, import("http").IncomingMessage, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown, import("fastify").FastifyBaseLogger, import("fastify/types/type-provider").ResolveFastifyRequestType<import("fastify").FastifyTypeProviderDefault, import("fastify").FastifySchema, import("fastify").RouteGenericInterface>>) => {
|
|
31
|
+
method?: string;
|
|
32
|
+
url?: string;
|
|
33
|
+
version?: string;
|
|
34
|
+
host?: string;
|
|
35
|
+
remoteAddress?: string;
|
|
36
|
+
remotePort?: number;
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
};
|
|
39
|
+
err?: (err: import("fastify").FastifyError) => {
|
|
40
|
+
type: string;
|
|
41
|
+
message: string;
|
|
42
|
+
stack: string;
|
|
43
|
+
[key: string]: unknown;
|
|
44
|
+
};
|
|
45
|
+
res?: (res: import("fastify/types/logger").ResSerializerReply<RawServerDefault, FastifyReply<import("fastify").RouteGenericInterface, RawServerDefault, import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>, unknown, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown>>) => {
|
|
46
|
+
statusCode?: string | number;
|
|
47
|
+
[key: string]: unknown;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
level?: string;
|
|
51
|
+
file?: string;
|
|
52
|
+
genReqId?: (req: FastifyRequest<import("fastify").RouteGenericInterface, RawServerDefault, import("http").IncomingMessage, import("fastify").FastifySchema, import("fastify").FastifyTypeProviderDefault, unknown, import("fastify").FastifyBaseLogger, import("fastify/types/type-provider").ResolveFastifyRequestType<import("fastify").FastifyTypeProviderDefault, import("fastify").FastifySchema, import("fastify").RouteGenericInterface>>) => string;
|
|
53
|
+
base: Record<string, unknown>;
|
|
54
|
+
messageKey: string;
|
|
55
|
+
formatters: {
|
|
56
|
+
level(label: string): {
|
|
57
|
+
level: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
timestamp: () => string;
|
|
61
|
+
};
|
|
62
|
+
export declare function buildFastifyServerOptions(params: {
|
|
63
|
+
service: string;
|
|
64
|
+
bodyLimit?: number;
|
|
65
|
+
}): FastifyServerOptions<RawServerDefault>;
|
|
66
|
+
export declare function registerStructuredRequestLogging(app: FastifyInstance): void;
|
|
8
67
|
export declare function readClientHeaders(request: FastifyRequest): ClientRuntimeInfo;
|
|
9
68
|
export declare function formatClientError(failure: ClientValidationFailure): ClientErrorResponseBody;
|
|
10
69
|
export declare function buildClientGuard(reader?: (request: FastifyRequest) => ClientRuntimeInfo, validator?: ClientValidator, formatter?: (failure: ClientValidationFailure) => ClientErrorResponseBody): ClientGuard;
|