@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../../../src/server/fastify.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fastify.d.ts","sourceRoot":"","sources":["../../../src/server/fastify.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACZ,cAAc,EACd,oBAAoB,EAEpB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAQjB,OAAO,KAAK,EACV,uBAAuB,EACvB,iBAAiB,EACjB,eAAe,EACf,uBAAuB,EACvB,WAAW,EACX,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAElB,OAAO,QAAQ,SAAS,CAAC;IACvB,UAAU,cAAc;QACtB,aAAa,CAAC,EAAE,2BAA2B,CAAC;QAC5C,iBAAiB,CAAC,EAAE;YAClB,MAAM,CAAC,EAAE,MAAM,CAAC;YAChB,MAAM,CAAC,EAAE,MAAM,CAAC;SACjB,CAAC;KACH;CACF;AAUD,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE;IACL,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACjC,GACA,IAAI,CAUN;AAgBD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM;UAYxC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBACjB,MAAM;gBACN;QACV,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG;YACpB,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;KACH;eACU,MAAM,MAAM;aACd,QAAQ;;;;;kBATiB,CAAC;eAAoB,CAAA;mBACtC,CAAC;gBACf,CAAC;yBACK,CAAC;sBACQ,CAAC;;;;;;;;;;sBAaG,CAAC;;;;;;;UAhBjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBACjB,MAAM;gBACN;QACV,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG;YACpB,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;KACH;eACU,MAAM,MAAM;EAW1B;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,oBAAoB,CAAC,gBAAgB,CAAC,CAiBzC;AAED,wBAAgB,gCAAgC,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI,CAsC3E;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,iBAAiB,CAiB5E;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,uBAAuB,GAC/B,uBAAuB,CAkEzB;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,GAAE,CAAC,OAAO,EAAE,cAAc,KAAK,iBAAqC,EAC1E,SAAS,GAAE,eAA2C,EACtD,SAAS,GAAE,CAAC,OAAO,EAAE,uBAAuB,KAAK,uBAA2C,GAC3F,WAAW,CAkBb;AAED,eAAO,MAAM,qBAAqB,aAAqB,CAAC"}
|
|
@@ -1,10 +1,129 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.ensureSupportedClient = void 0;
|
|
7
|
+
exports.setRequestLogContext = setRequestLogContext;
|
|
8
|
+
exports.buildFastifyLogger = buildFastifyLogger;
|
|
9
|
+
exports.buildFastifyServerOptions = buildFastifyServerOptions;
|
|
10
|
+
exports.registerStructuredRequestLogging = registerStructuredRequestLogging;
|
|
4
11
|
exports.readClientHeaders = readClientHeaders;
|
|
5
12
|
exports.formatClientError = formatClientError;
|
|
6
13
|
exports.buildClientGuard = buildClientGuard;
|
|
14
|
+
const node_crypto_1 = require("node:crypto");
|
|
15
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
16
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
17
|
+
const node_stream_1 = require("node:stream");
|
|
7
18
|
const index_1 = require("../index");
|
|
19
|
+
const logging_1 = require("./logging");
|
|
20
|
+
function normalizeLogContextValue(value) {
|
|
21
|
+
if (value === undefined || value === null) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
const normalized = `${value}`.trim();
|
|
25
|
+
return normalized.length > 0 ? normalized : undefined;
|
|
26
|
+
}
|
|
27
|
+
function setRequestLogContext(request, input) {
|
|
28
|
+
const nextUserId = normalizeLogContextValue(input.userId);
|
|
29
|
+
const nextRoomId = normalizeLogContextValue(input.roomId);
|
|
30
|
+
const current = request.requestLogContext ?? {};
|
|
31
|
+
request.requestLogContext = {
|
|
32
|
+
...(current.userId ? { userId: current.userId } : {}),
|
|
33
|
+
...(current.roomId ? { roomId: current.roomId } : {}),
|
|
34
|
+
...(nextUserId ? { userId: nextUserId } : {}),
|
|
35
|
+
...(nextRoomId ? { roomId: nextRoomId } : {}),
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function createStructuredLogMirrorStream(logFilePath) {
|
|
39
|
+
node_fs_1.default.mkdirSync(node_path_1.default.dirname(logFilePath), { recursive: true });
|
|
40
|
+
const fileStream = node_fs_1.default.createWriteStream(logFilePath, { flags: 'a' });
|
|
41
|
+
return new node_stream_1.Writable({
|
|
42
|
+
write(chunk, _encoding, callback) {
|
|
43
|
+
process.stdout.write(chunk);
|
|
44
|
+
fileStream.write(chunk, callback);
|
|
45
|
+
},
|
|
46
|
+
final(callback) {
|
|
47
|
+
fileStream.end(callback);
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function buildFastifyLogger(service) {
|
|
52
|
+
const logger = {
|
|
53
|
+
level: process.env['LOG_LEVEL']?.trim() || 'info',
|
|
54
|
+
base: (0, index_1.resolveStructuredLogFields)(service),
|
|
55
|
+
messageKey: 'message',
|
|
56
|
+
formatters: {
|
|
57
|
+
level(label) {
|
|
58
|
+
return { level: label };
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
timestamp: () => `,"timestamp":"${new Date().toISOString()}"`,
|
|
62
|
+
};
|
|
63
|
+
const logFilePath = (0, logging_1.resolveStructuredLogFilePath)(service);
|
|
64
|
+
if (!logFilePath) {
|
|
65
|
+
return logger;
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
...logger,
|
|
69
|
+
stream: createStructuredLogMirrorStream(logFilePath),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function buildFastifyServerOptions(params) {
|
|
73
|
+
return {
|
|
74
|
+
logger: buildFastifyLogger(params.service),
|
|
75
|
+
disableRequestLogging: true,
|
|
76
|
+
requestIdHeader: 'x-request-id',
|
|
77
|
+
genReqId(request) {
|
|
78
|
+
const explicit = request.headers['x-request-id'];
|
|
79
|
+
if (typeof explicit === 'string' && explicit.trim().length > 0) {
|
|
80
|
+
return explicit.trim();
|
|
81
|
+
}
|
|
82
|
+
if (Array.isArray(explicit) && typeof explicit[0] === 'string' && explicit[0].trim().length > 0) {
|
|
83
|
+
return explicit[0].trim();
|
|
84
|
+
}
|
|
85
|
+
return (0, node_crypto_1.randomUUID)();
|
|
86
|
+
},
|
|
87
|
+
...(typeof params.bodyLimit === 'number' ? { bodyLimit: params.bodyLimit } : {}),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
function registerStructuredRequestLogging(app) {
|
|
91
|
+
app.addHook('onRequest', async (request, reply) => {
|
|
92
|
+
reply.header('x-request-id', request.id);
|
|
93
|
+
request.log.info({
|
|
94
|
+
request_id: request.id,
|
|
95
|
+
method: request.method,
|
|
96
|
+
path: request.url,
|
|
97
|
+
host: request.hostname,
|
|
98
|
+
remote_ip: request.ip,
|
|
99
|
+
}, 'request_started');
|
|
100
|
+
});
|
|
101
|
+
app.addHook('onError', async (request, _reply, error) => {
|
|
102
|
+
const context = request.requestLogContext ?? {};
|
|
103
|
+
request.log.error({
|
|
104
|
+
err: error,
|
|
105
|
+
request_id: request.id,
|
|
106
|
+
method: request.method,
|
|
107
|
+
path: request.url,
|
|
108
|
+
user_id: context.userId,
|
|
109
|
+
room_id: context.roomId,
|
|
110
|
+
}, 'request_failed');
|
|
111
|
+
});
|
|
112
|
+
app.addHook('onResponse', async (request, reply) => {
|
|
113
|
+
const context = request.requestLogContext ?? {};
|
|
114
|
+
const elapsedMs = typeof reply.elapsedTime === 'number' ? Math.round(reply.elapsedTime) : undefined;
|
|
115
|
+
request.log.info({
|
|
116
|
+
request_id: request.id,
|
|
117
|
+
method: request.method,
|
|
118
|
+
path: request.url,
|
|
119
|
+
route: request.routeOptions.url,
|
|
120
|
+
status_code: reply.statusCode,
|
|
121
|
+
duration_ms: elapsedMs,
|
|
122
|
+
user_id: context.userId,
|
|
123
|
+
room_id: context.roomId,
|
|
124
|
+
}, 'request_completed');
|
|
125
|
+
});
|
|
126
|
+
}
|
|
8
127
|
function readClientHeaders(request) {
|
|
9
128
|
const headers = request.headers || {};
|
|
10
129
|
const getHeader = (name) => {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function resolveStructuredLogFilePath(service: string, env?: NodeJS.ProcessEnv): string | null;
|
|
2
|
+
export declare function createStructuredLogEmitter(service: string, env?: NodeJS.ProcessEnv): (payload: Record<string, unknown>, stream?: 'stdout' | 'stderr') => void;
|
|
3
|
+
//# sourceMappingURL=logging.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../../../src/server/logging.ts"],"names":[],"mappings":"AAYA,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,MAAM,GAAG,IAAI,CAMf;AAED,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,KAAK,IAAI,CAqB1E"}
|
|
@@ -0,0 +1,46 @@
|
|
|
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.resolveStructuredLogFilePath = resolveStructuredLogFilePath;
|
|
7
|
+
exports.createStructuredLogEmitter = createStructuredLogEmitter;
|
|
8
|
+
const fs_1 = __importDefault(require("fs"));
|
|
9
|
+
const path_1 = __importDefault(require("path"));
|
|
10
|
+
function normalizeStructuredLogDir(env = process.env) {
|
|
11
|
+
const value = env['PLAYDROP_STRUCTURED_LOG_DIR'];
|
|
12
|
+
if (typeof value !== 'string') {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
const normalized = value.trim();
|
|
16
|
+
return normalized.length > 0 ? normalized : null;
|
|
17
|
+
}
|
|
18
|
+
function resolveStructuredLogFilePath(service, env = process.env) {
|
|
19
|
+
const directory = normalizeStructuredLogDir(env);
|
|
20
|
+
if (!directory) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return path_1.default.join(directory, `${service}.jsonl`);
|
|
24
|
+
}
|
|
25
|
+
function createStructuredLogEmitter(service, env = process.env) {
|
|
26
|
+
const logFilePath = resolveStructuredLogFilePath(service, env);
|
|
27
|
+
const fileStream = logFilePath
|
|
28
|
+
? fs_1.default.createWriteStream(logFilePath, { flags: 'a' })
|
|
29
|
+
: null;
|
|
30
|
+
return (payload, stream = 'stdout') => {
|
|
31
|
+
const normalizedPayload = Object.prototype.hasOwnProperty.call(payload, 'timestamp')
|
|
32
|
+
? payload
|
|
33
|
+
: {
|
|
34
|
+
timestamp: new Date().toISOString(),
|
|
35
|
+
...payload,
|
|
36
|
+
};
|
|
37
|
+
const line = `${JSON.stringify(normalizedPayload)}\n`;
|
|
38
|
+
if (stream === 'stderr') {
|
|
39
|
+
process.stderr.write(line);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
process.stdout.write(line);
|
|
43
|
+
}
|
|
44
|
+
fileStream?.write(line);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deployment.test.d.ts","sourceRoot":"","sources":["../../test/deployment.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
+
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
7
|
+
const node_test_1 = __importDefault(require("node:test"));
|
|
8
|
+
const deployment_1 = require("../src/deployment");
|
|
9
|
+
(0, node_test_1.default)('deploy role parsing stays strict', () => {
|
|
10
|
+
strict_1.default.equal((0, deployment_1.parseDeployRole)('prod'), 'prod');
|
|
11
|
+
strict_1.default.equal((0, deployment_1.parseDeployRole)('preview'), 'preview');
|
|
12
|
+
strict_1.default.equal((0, deployment_1.parseDeployRole)('blue'), null);
|
|
13
|
+
strict_1.default.equal((0, deployment_1.parseDeployRole)(undefined), null);
|
|
14
|
+
});
|
|
15
|
+
(0, node_test_1.default)('deploy slot parsing stays strict', () => {
|
|
16
|
+
strict_1.default.equal((0, deployment_1.parseDeploySlot)('blue'), 'blue');
|
|
17
|
+
strict_1.default.equal((0, deployment_1.parseDeploySlot)('green'), 'green');
|
|
18
|
+
strict_1.default.equal((0, deployment_1.parseDeploySlot)('prod'), null);
|
|
19
|
+
});
|
|
20
|
+
(0, node_test_1.default)('prod defaults resolve to public production origins', () => {
|
|
21
|
+
const env = { NODE_ENV: 'production' };
|
|
22
|
+
strict_1.default.equal((0, deployment_1.resolveDeployRole)(env), 'prod');
|
|
23
|
+
strict_1.default.equal((0, deployment_1.resolvePublicSurface)(env), 'prod');
|
|
24
|
+
strict_1.default.equal((0, deployment_1.resolveWebOrigin)(env), 'https://www.playdrop.ai');
|
|
25
|
+
strict_1.default.equal((0, deployment_1.resolveApiOrigin)(env), 'https://api.playdrop.ai');
|
|
26
|
+
strict_1.default.equal((0, deployment_1.resolveAiOrigin)(env), 'https://ai.playdrop.ai');
|
|
27
|
+
strict_1.default.equal((0, deployment_1.resolveRealtimeOrigin)(env), 'wss://play.playdrop.ai');
|
|
28
|
+
strict_1.default.equal((0, deployment_1.resolveSeoIndexingMode)(env), 'public');
|
|
29
|
+
strict_1.default.equal((0, deployment_1.isBackgroundWorkEnabled)(env), true);
|
|
30
|
+
});
|
|
31
|
+
(0, node_test_1.default)('preview defaults resolve to preview origins and noindex seo', () => {
|
|
32
|
+
const env = {
|
|
33
|
+
NODE_ENV: 'production',
|
|
34
|
+
PLAYDROP_DEPLOY_ROLE: 'preview',
|
|
35
|
+
PLAYDROP_SLOT: 'green',
|
|
36
|
+
};
|
|
37
|
+
strict_1.default.equal((0, deployment_1.resolveDeployRole)(env), 'preview');
|
|
38
|
+
strict_1.default.equal((0, deployment_1.resolvePublicSurface)(env), 'preview');
|
|
39
|
+
strict_1.default.equal((0, deployment_1.resolveWebOrigin)(env), 'https://preview.playdrop.ai');
|
|
40
|
+
strict_1.default.equal((0, deployment_1.resolveApiOrigin)(env), 'https://api.preview.playdrop.ai');
|
|
41
|
+
strict_1.default.equal((0, deployment_1.resolveAiOrigin)(env), 'https://ai.preview.playdrop.ai');
|
|
42
|
+
strict_1.default.equal((0, deployment_1.resolveRealtimeOrigin)(env), 'wss://play.preview.playdrop.ai');
|
|
43
|
+
strict_1.default.equal((0, deployment_1.resolveSeoIndexingMode)(env), 'noindex');
|
|
44
|
+
strict_1.default.equal((0, deployment_1.isBackgroundWorkEnabled)(env), false);
|
|
45
|
+
});
|
|
46
|
+
(0, node_test_1.default)('explicit origin overrides win over derived defaults', () => {
|
|
47
|
+
const env = {
|
|
48
|
+
PLAYDROP_PUBLIC_ORIGIN: 'https://blue.playdrop.ai/',
|
|
49
|
+
PLAYDROP_API_BASE_URL: 'https://api.blue.playdrop.ai/',
|
|
50
|
+
PLAYDROP_AI_BASE_URL: 'https://ai.blue.playdrop.ai/',
|
|
51
|
+
PLAYDROP_REALTIME_BASE_URL: 'wss://play.blue.playdrop.ai/ws/',
|
|
52
|
+
PLAYDROP_PUBLIC_SURFACE: 'blue',
|
|
53
|
+
};
|
|
54
|
+
strict_1.default.equal((0, deployment_1.resolvePublicSurface)(env), 'blue');
|
|
55
|
+
strict_1.default.equal((0, deployment_1.resolveWebOrigin)(env), 'https://blue.playdrop.ai');
|
|
56
|
+
strict_1.default.equal((0, deployment_1.resolveApiOrigin)(env), 'https://api.blue.playdrop.ai');
|
|
57
|
+
strict_1.default.equal((0, deployment_1.resolveAiOrigin)(env), 'https://ai.blue.playdrop.ai');
|
|
58
|
+
strict_1.default.equal((0, deployment_1.resolveRealtimeOrigin)(env), 'wss://play.blue.playdrop.ai/ws');
|
|
59
|
+
});
|
|
60
|
+
(0, node_test_1.default)('structured log fields include phase 1 deploy metadata', () => {
|
|
61
|
+
const fields = (0, deployment_1.resolveStructuredLogFields)('api-server', {
|
|
62
|
+
NODE_ENV: 'production',
|
|
63
|
+
PLAYDROP_DEPLOY_ROLE: 'preview',
|
|
64
|
+
PLAYDROP_SLOT: 'green',
|
|
65
|
+
PLAYDROP_PUBLIC_SURFACE: 'preview',
|
|
66
|
+
});
|
|
67
|
+
strict_1.default.equal(fields.environment, 'production');
|
|
68
|
+
strict_1.default.equal(fields.slot, 'green');
|
|
69
|
+
strict_1.default.equal(fields.service, 'api-server');
|
|
70
|
+
strict_1.default.equal(fields.deploy_role, 'preview');
|
|
71
|
+
strict_1.default.equal(fields.public_surface, 'preview');
|
|
72
|
+
strict_1.default.match(fields.release_version, /^\d+\.\d+\.\d+$/);
|
|
73
|
+
strict_1.default.equal(typeof fields.build_number, 'number');
|
|
74
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging.test.d.ts","sourceRoot":"","sources":["../../test/logging.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
7
|
+
const node_test_1 = __importDefault(require("node:test"));
|
|
8
|
+
const logging_1 = require("../src/server/logging");
|
|
9
|
+
(0, node_test_1.default)('structured log file path is disabled without an explicit directory', () => {
|
|
10
|
+
strict_1.default.equal((0, logging_1.resolveStructuredLogFilePath)('api-server', {}), null);
|
|
11
|
+
});
|
|
12
|
+
(0, node_test_1.default)('structured log file path resolves to a per-service jsonl file', () => {
|
|
13
|
+
const filePath = (0, logging_1.resolveStructuredLogFilePath)('api-server', {
|
|
14
|
+
PLAYDROP_STRUCTURED_LOG_DIR: '/var/log/playdrop',
|
|
15
|
+
});
|
|
16
|
+
strict_1.default.equal(filePath, '/var/log/playdrop/api-server.jsonl');
|
|
17
|
+
});
|