vibe-squire 4.0.0 → 5.0.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/configure-fastify-app.d.ts +2 -0
- package/dist/configure-fastify-app.js +62 -0
- package/dist/configure-fastify-app.js.map +1 -0
- package/dist/graphql/graphql.module.js +28 -25
- package/dist/graphql/graphql.module.js.map +1 -1
- package/dist/main.js +4 -8
- package/dist/main.js.map +1 -1
- package/dist/status/graphql/status-enums.d.ts +1 -1
- package/dist/status/graphql/status-enums.js +5 -5
- package/dist/status/graphql/status-enums.js.map +1 -1
- package/dist/status/status-snapshot.contract.d.ts +1 -1
- package/dist/status/status-snapshot.contract.js +8 -4
- package/dist/status/status-snapshot.contract.js.map +1 -1
- package/dist/status/status-snapshot.schema.d.ts +67 -0
- package/dist/status/status-snapshot.schema.js +70 -0
- package/dist/status/status-snapshot.schema.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +7 -8
- package/dist/configure-express-app.d.ts +0 -2
- package/dist/configure-express-app.js +0 -84
- package/dist/configure-express-app.js.map +0 -1
|
@@ -0,0 +1,62 @@
|
|
|
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.configureFastifyApp = configureFastifyApp;
|
|
7
|
+
const node_fs_1 = require("node:fs");
|
|
8
|
+
const node_path_1 = require("node:path");
|
|
9
|
+
const static_1 = __importDefault(require("@fastify/static"));
|
|
10
|
+
const CLIENT_INDEX = 'index.html';
|
|
11
|
+
function resolveClientRoot() {
|
|
12
|
+
const distClient = (0, node_path_1.join)(__dirname, 'client');
|
|
13
|
+
const monorepoDev = (0, node_path_1.join)(__dirname, '../../web/dist');
|
|
14
|
+
if ((0, node_fs_1.existsSync)((0, node_path_1.join)(distClient, CLIENT_INDEX))) {
|
|
15
|
+
return distClient;
|
|
16
|
+
}
|
|
17
|
+
if ((0, node_fs_1.existsSync)((0, node_path_1.join)(monorepoDev, CLIENT_INDEX))) {
|
|
18
|
+
return monorepoDev;
|
|
19
|
+
}
|
|
20
|
+
return distClient;
|
|
21
|
+
}
|
|
22
|
+
function shouldSkipSpaFallback(pathname, nodeEnv) {
|
|
23
|
+
if (pathname === '/api' || pathname.startsWith('/api/')) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (pathname === '/graphql' || pathname.startsWith('/graphql/')) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
if (nodeEnv !== 'production' && pathname.startsWith('/graphiql')) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
async function configureFastifyApp(app) {
|
|
35
|
+
const clientRoot = resolveClientRoot();
|
|
36
|
+
const indexPath = (0, node_path_1.join)(clientRoot, CLIENT_INDEX);
|
|
37
|
+
const indexHtml = (0, node_fs_1.existsSync)(indexPath)
|
|
38
|
+
? (0, node_fs_1.readFileSync)(indexPath, 'utf8')
|
|
39
|
+
: null;
|
|
40
|
+
await app.register(static_1.default, {
|
|
41
|
+
root: clientRoot,
|
|
42
|
+
prefix: '/',
|
|
43
|
+
wildcard: false,
|
|
44
|
+
maxAge: '1h',
|
|
45
|
+
});
|
|
46
|
+
const instance = app.getHttpAdapter().getInstance();
|
|
47
|
+
instance.addHook('onRequest', (req, reply, done) => {
|
|
48
|
+
const method = req.method;
|
|
49
|
+
const pathname = req.url.split('?')[0] ?? '/';
|
|
50
|
+
const hasFileExtension = pathname.includes('.');
|
|
51
|
+
if ((method !== 'GET' && method !== 'HEAD') ||
|
|
52
|
+
shouldSkipSpaFallback(pathname, process.env.NODE_ENV) ||
|
|
53
|
+
hasFileExtension ||
|
|
54
|
+
indexHtml === null) {
|
|
55
|
+
done();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
reply.type('text/html; charset=utf-8').send(indexHtml);
|
|
59
|
+
done();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=configure-fastify-app.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure-fastify-app.js","sourceRoot":"","sources":["../src/configure-fastify-app.ts"],"names":[],"mappings":";;;;;AA6CA,kDAmCC;AAhFD,qCAAmD;AACnD,yCAAiC;AACjC,6DAA4C;AAG5C,MAAM,YAAY,GAAG,YAAY,CAAC;AAOlC,SAAS,iBAAiB;IACxB,MAAM,UAAU,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7C,MAAM,WAAW,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;IAEtD,IAAI,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,UAAU,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC;QAC/C,OAAO,UAAU,CAAC;IACpB,CAAC;IACD,IAAI,IAAA,oBAAU,EAAC,IAAA,gBAAI,EAAC,WAAW,EAAE,YAAY,CAAC,CAAC,EAAE,CAAC;QAChD,OAAO,WAAW,CAAC;IACrB,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,qBAAqB,CAC5B,QAAgB,EAChB,OAA2B;IAE3B,IAAI,QAAQ,KAAK,MAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,QAAQ,KAAK,UAAU,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAChE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,OAAO,KAAK,YAAY,IAAI,QAAQ,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QACjE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,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CAAC,CAAC;AACL,CAAC"}
|
|
@@ -9,10 +9,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.GraphqlModule = void 0;
|
|
10
10
|
const node_path_1 = require("node:path");
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
|
-
const
|
|
13
|
-
const disabled_1 = require("@apollo/server/plugin/disabled");
|
|
14
|
-
const apollo_1 = require("@nestjs/apollo");
|
|
12
|
+
const mercurius_1 = require("@nestjs/mercurius");
|
|
15
13
|
const graphql_1 = require("@nestjs/graphql");
|
|
14
|
+
const graphql_2 = require("graphql");
|
|
16
15
|
const app_env_token_1 = require("../config/app-env.token");
|
|
17
16
|
const health_resolver_1 = require("./health.resolver");
|
|
18
17
|
const SCHEMA_FILE = (0, node_path_1.join)(process.cwd(), 'src/generated/schema.graphql');
|
|
@@ -26,7 +25,7 @@ exports.GraphqlModule = GraphqlModule = __decorate([
|
|
|
26
25
|
(0, common_1.Module)({
|
|
27
26
|
imports: [
|
|
28
27
|
graphql_1.GraphQLModule.forRootAsync({
|
|
29
|
-
driver:
|
|
28
|
+
driver: mercurius_1.MercuriusDriver,
|
|
30
29
|
inject: [app_env_token_1.APP_ENV],
|
|
31
30
|
useFactory: (appEnv) => {
|
|
32
31
|
const prod = isProduction(appEnv.nodeEnv);
|
|
@@ -34,27 +33,31 @@ exports.GraphqlModule = GraphqlModule = __decorate([
|
|
|
34
33
|
path: '/graphql',
|
|
35
34
|
autoSchemaFile: SCHEMA_FILE,
|
|
36
35
|
sortSchema: true,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
36
|
+
graphiql: !prod,
|
|
37
|
+
subscription: true,
|
|
38
|
+
validationRules: prod ? [graphql_2.NoSchemaIntrospectionCustomRule] : [],
|
|
39
|
+
errorFormatter(execution) {
|
|
40
|
+
const errors = execution.errors.map((error) => {
|
|
41
|
+
const formatted = error.toJSON();
|
|
42
|
+
const orig = error.originalError;
|
|
43
|
+
if (orig instanceof common_1.HttpException) {
|
|
44
|
+
return {
|
|
45
|
+
...formatted,
|
|
46
|
+
extensions: {
|
|
47
|
+
...formatted.extensions,
|
|
48
|
+
statusCode: orig.getStatus(),
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return formatted;
|
|
53
|
+
});
|
|
54
|
+
return {
|
|
55
|
+
statusCode: 200,
|
|
56
|
+
response: {
|
|
57
|
+
data: execution.data ?? null,
|
|
58
|
+
errors,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
58
61
|
},
|
|
59
62
|
};
|
|
60
63
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"graphql.module.js","sourceRoot":"","sources":["../../src/graphql/graphql.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yCAAiC;AACjC,2CAAuD;AACvD,
|
|
1
|
+
{"version":3,"file":"graphql.module.js","sourceRoot":"","sources":["../../src/graphql/graphql.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,yCAAiC;AACjC,2CAAuD;AACvD,iDAA2E;AAC3E,6CAAgD;AAChD,qCAA0D;AAC1D,2DAA+D;AAC/D,uDAAmD;AAEnD,MAAM,WAAW,GAAG,IAAA,gBAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,8BAA8B,CAAC,CAAC;AAExE,SAAS,YAAY,CAAC,OAA2B;IAC/C,OAAO,OAAO,KAAK,YAAY,CAAC;AAClC,CAAC;AA6CM,IAAM,aAAa,GAAnB,MAAM,aAAa;CAAG,CAAA;AAAhB,sCAAa;wBAAb,aAAa;IA3CzB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE;YACP,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|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
require("./load-dotenv");
|
|
4
|
-
const common_1 = require("@nestjs/common");
|
|
5
4
|
const core_1 = require("@nestjs/core");
|
|
5
|
+
const platform_fastify_1 = require("@nestjs/platform-fastify");
|
|
6
6
|
const nestjs_pino_1 = require("nestjs-pino");
|
|
7
7
|
const app_module_1 = require("./app.module");
|
|
8
|
-
const
|
|
8
|
+
const configure_fastify_app_1 = require("./configure-fastify-app");
|
|
9
9
|
const env_schema_1 = require("./config/env-schema");
|
|
10
10
|
const resolve_database_url_1 = require("./database/resolve-database-url");
|
|
11
11
|
const sqlite_migrate_1 = require("./database/sqlite-migrate");
|
|
@@ -13,16 +13,12 @@ async function bootstrap() {
|
|
|
13
13
|
(0, resolve_database_url_1.ensureDatabaseUrlFromEnv)();
|
|
14
14
|
(0, sqlite_migrate_1.runSqliteMigrations)((0, resolve_database_url_1.databaseUrlToFilePath)(process.env.DATABASE_URL));
|
|
15
15
|
const env = (0, env_schema_1.parseAppEnv)();
|
|
16
|
-
const app = await core_1.NestFactory.create(app_module_1.AppModule.forRoot(env), {
|
|
16
|
+
const app = await core_1.NestFactory.create(app_module_1.AppModule.forRoot(env), new platform_fastify_1.FastifyAdapter(), {
|
|
17
17
|
bufferLogs: true,
|
|
18
18
|
});
|
|
19
|
-
(0,
|
|
19
|
+
await (0, configure_fastify_app_1.configureFastifyApp)(app);
|
|
20
20
|
app.enableCors({ origin: true });
|
|
21
21
|
app.useLogger(app.get(nestjs_pino_1.Logger));
|
|
22
|
-
app.useGlobalPipes(new common_1.ValidationPipe({
|
|
23
|
-
whitelist: false,
|
|
24
|
-
transform: true,
|
|
25
|
-
}));
|
|
26
22
|
await app.listen(env.port, env.host);
|
|
27
23
|
const logger = app.get(nestjs_pino_1.Logger);
|
|
28
24
|
logger.log(`HTTP server listening on ${await app.getUrl()}`);
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,yBAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":";;AAAA,yBAAuB;AACvB,uCAA2C;AAC3C,+DAGkC;AAClC,6CAAqC;AACrC,6CAAyC;AACzC,mEAA8D;AAC9D,oDAAkD;AAClD,0EAGyC;AACzC,8DAAgE;AAEhE,KAAK,UAAU,SAAS;IACtB,IAAA,+CAAwB,GAAE,CAAC;IAC3B,IAAA,oCAAmB,EAAC,IAAA,4CAAqB,EAAC,OAAO,CAAC,GAAG,CAAC,YAAa,CAAC,CAAC,CAAC;IACtE,MAAM,GAAG,GAAG,IAAA,wBAAW,GAAE,CAAC;IAE1B,MAAM,GAAG,GAAG,MAAM,kBAAW,CAAC,MAAM,CAClC,sBAAS,CAAC,OAAO,CAAC,GAAG,CAAC,EACtB,IAAI,iCAAc,EAAE,EACpB;QACE,UAAU,EAAE,IAAI;KACjB,CACF,CAAC;IACF,MAAM,IAAA,2CAAmB,EAAC,GAAG,CAAC,CAAC;IAC/B,GAAG,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;IACjC,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,oBAAM,CAAC,CAAC,CAAC;IAE/B,MAAM,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,oBAAM,CAAC,CAAC;IAC/B,MAAM,CAAC,GAAG,CAAC,4BAA4B,MAAM,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AAC/D,CAAC;AAED,KAAK,SAAS,EAAE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dbStateValues, destStateValues, ghStateValues, scoutUiStateValues } from '
|
|
1
|
+
import { dbStateValues, destStateValues, ghStateValues, scoutUiStateValues } from '../status-snapshot.contract';
|
|
2
2
|
export declare const GhState: Record<"error" | "ok" | "unknown", "error" | "ok" | "unknown">;
|
|
3
3
|
export declare const DatabaseState: Record<"error" | "ok", "error" | "ok">;
|
|
4
4
|
export declare const DestinationState: Record<"error" | "ok" | "unknown" | "degraded", "error" | "ok" | "unknown" | "degraded">;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ScoutUiState = exports.DestinationState = exports.DatabaseState = exports.GhState = void 0;
|
|
4
4
|
const graphql_1 = require("@nestjs/graphql");
|
|
5
|
-
const
|
|
5
|
+
const status_snapshot_contract_1 = require("../status-snapshot.contract");
|
|
6
6
|
function enumFromValues(name, values) {
|
|
7
7
|
const o = {};
|
|
8
8
|
for (const v of values) {
|
|
@@ -11,8 +11,8 @@ function enumFromValues(name, values) {
|
|
|
11
11
|
(0, graphql_1.registerEnumType)(o, { name });
|
|
12
12
|
return o;
|
|
13
13
|
}
|
|
14
|
-
exports.GhState = enumFromValues('GhState',
|
|
15
|
-
exports.DatabaseState = enumFromValues('DatabaseState',
|
|
16
|
-
exports.DestinationState = enumFromValues('DestinationState',
|
|
17
|
-
exports.ScoutUiState = enumFromValues('ScoutUiState',
|
|
14
|
+
exports.GhState = enumFromValues('GhState', status_snapshot_contract_1.ghStateValues);
|
|
15
|
+
exports.DatabaseState = enumFromValues('DatabaseState', status_snapshot_contract_1.dbStateValues);
|
|
16
|
+
exports.DestinationState = enumFromValues('DestinationState', status_snapshot_contract_1.destStateValues);
|
|
17
|
+
exports.ScoutUiState = enumFromValues('ScoutUiState', status_snapshot_contract_1.scoutUiStateValues);
|
|
18
18
|
//# sourceMappingURL=status-enums.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-enums.js","sourceRoot":"","sources":["../../../src/status/graphql/status-enums.ts"],"names":[],"mappings":";;;AAAA,6CAAmD;AACnD,
|
|
1
|
+
{"version":3,"file":"status-enums.js","sourceRoot":"","sources":["../../../src/status/graphql/status-enums.ts"],"names":[],"mappings":";;;AAAA,6CAAmD;AACnD,0EAKqC;AAErC,SAAS,cAAc,CACrB,IAAY,EACZ,MAAoB;IAEpB,MAAM,CAAC,GAAG,EAAkB,CAAC;IAC7B,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE,CAAC;QACvB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACX,CAAC;IACD,IAAA,0BAAgB,EAAC,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9B,OAAO,CAAC,CAAC;AACX,CAAC;AAGY,QAAA,OAAO,GAAG,cAAc,CAAC,SAAS,EAAE,wCAAa,CAAC,CAAC;AAGnD,QAAA,aAAa,GAAG,cAAc,CAAC,eAAe,EAAE,wCAAa,CAAC,CAAC;AAG/D,QAAA,gBAAgB,GAAG,cAAc,CAC5C,kBAAkB,EAClB,0CAAe,CAChB,CAAC;AAGW,QAAA,YAAY,GAAG,cAAc,CAAC,cAAc,EAAE,6CAAkB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { statusSnapshotSchema, validateStatusSnapshot, } from '
|
|
1
|
+
export { dbStateValues, destStateValues, ghStateValues, scoutUiStateValues, statusSnapshotSchema, validateStatusSnapshot, } from './status-snapshot.schema';
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validateStatusSnapshot = exports.statusSnapshotSchema = void 0;
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.validateStatusSnapshot = exports.statusSnapshotSchema = exports.scoutUiStateValues = exports.ghStateValues = exports.destStateValues = exports.dbStateValues = void 0;
|
|
4
|
+
var status_snapshot_schema_1 = require("./status-snapshot.schema");
|
|
5
|
+
Object.defineProperty(exports, "dbStateValues", { enumerable: true, get: function () { return status_snapshot_schema_1.dbStateValues; } });
|
|
6
|
+
Object.defineProperty(exports, "destStateValues", { enumerable: true, get: function () { return status_snapshot_schema_1.destStateValues; } });
|
|
7
|
+
Object.defineProperty(exports, "ghStateValues", { enumerable: true, get: function () { return status_snapshot_schema_1.ghStateValues; } });
|
|
8
|
+
Object.defineProperty(exports, "scoutUiStateValues", { enumerable: true, get: function () { return status_snapshot_schema_1.scoutUiStateValues; } });
|
|
9
|
+
Object.defineProperty(exports, "statusSnapshotSchema", { enumerable: true, get: function () { return status_snapshot_schema_1.statusSnapshotSchema; } });
|
|
10
|
+
Object.defineProperty(exports, "validateStatusSnapshot", { enumerable: true, get: function () { return status_snapshot_schema_1.validateStatusSnapshot; } });
|
|
7
11
|
//# sourceMappingURL=status-snapshot.contract.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-snapshot.contract.js","sourceRoot":"","sources":["../../src/status/status-snapshot.contract.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"status-snapshot.contract.js","sourceRoot":"","sources":["../../src/status/status-snapshot.contract.ts"],"names":[],"mappings":";;;AAAA,mEAOkC;AANhC,uHAAA,aAAa,OAAA;AACb,yHAAA,eAAe,OAAA;AACf,uHAAA,aAAa,OAAA;AACb,4HAAA,kBAAkB,OAAA;AAClB,8HAAA,oBAAoB,OAAA;AACpB,gIAAA,sBAAsB,OAAA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ghStateValues: readonly ["ok", "error", "unknown"];
|
|
3
|
+
export declare const dbStateValues: readonly ["ok", "error"];
|
|
4
|
+
export declare const destStateValues: readonly ["ok", "degraded", "error", "unknown"];
|
|
5
|
+
export declare const scoutUiStateValues: readonly ["idle", "running", "skipped", "error"];
|
|
6
|
+
export declare const statusSnapshotSchema: z.ZodObject<{
|
|
7
|
+
timestamp: z.ZodString;
|
|
8
|
+
pending_triage_count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
9
|
+
gh: z.ZodObject<{
|
|
10
|
+
state: z.ZodEnum<{
|
|
11
|
+
error: "error";
|
|
12
|
+
ok: "ok";
|
|
13
|
+
unknown: "unknown";
|
|
14
|
+
}>;
|
|
15
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
16
|
+
}, z.core.$loose>;
|
|
17
|
+
database: z.ZodObject<{
|
|
18
|
+
state: z.ZodEnum<{
|
|
19
|
+
error: "error";
|
|
20
|
+
ok: "ok";
|
|
21
|
+
}>;
|
|
22
|
+
message: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
23
|
+
}, z.core.$loose>;
|
|
24
|
+
setup: z.ZodObject<{
|
|
25
|
+
complete: z.ZodBoolean;
|
|
26
|
+
mappingCount: z.ZodNumber;
|
|
27
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
+
}, z.core.$loose>;
|
|
29
|
+
configuration: z.ZodObject<{
|
|
30
|
+
source_type: z.ZodString;
|
|
31
|
+
destination_type: z.ZodString;
|
|
32
|
+
vibe_kanban_board_active: z.ZodBoolean;
|
|
33
|
+
}, z.core.$loose>;
|
|
34
|
+
destinations: z.ZodArray<z.ZodObject<{
|
|
35
|
+
id: z.ZodString;
|
|
36
|
+
state: z.ZodEnum<{
|
|
37
|
+
error: "error";
|
|
38
|
+
ok: "ok";
|
|
39
|
+
unknown: "unknown";
|
|
40
|
+
degraded: "degraded";
|
|
41
|
+
}>;
|
|
42
|
+
}, z.core.$loose>>;
|
|
43
|
+
scouts: z.ZodArray<z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
state: z.ZodEnum<{
|
|
46
|
+
error: "error";
|
|
47
|
+
running: "running";
|
|
48
|
+
idle: "idle";
|
|
49
|
+
skipped: "skipped";
|
|
50
|
+
}>;
|
|
51
|
+
last_poll: z.ZodObject<{
|
|
52
|
+
candidates_count: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
53
|
+
skipped_unmapped: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
54
|
+
issues_created: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
55
|
+
}, z.core.$loose>;
|
|
56
|
+
}, z.core.$loose>>;
|
|
57
|
+
manual_sync: z.ZodObject<{
|
|
58
|
+
canRun: z.ZodBoolean;
|
|
59
|
+
reason: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
60
|
+
cooldownUntil: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
+
}, z.core.$loose>;
|
|
62
|
+
scheduled_sync: z.ZodObject<{
|
|
63
|
+
enabled: z.ZodBoolean;
|
|
64
|
+
}, z.core.$loose>;
|
|
65
|
+
}, z.core.$strip>;
|
|
66
|
+
export type StatusSnapshot = z.output<typeof statusSnapshotSchema>;
|
|
67
|
+
export declare function validateStatusSnapshot(body: unknown): string | null;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.statusSnapshotSchema = exports.scoutUiStateValues = exports.destStateValues = exports.dbStateValues = exports.ghStateValues = void 0;
|
|
4
|
+
exports.validateStatusSnapshot = validateStatusSnapshot;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
exports.ghStateValues = ['ok', 'error', 'unknown'];
|
|
7
|
+
exports.dbStateValues = ['ok', 'error'];
|
|
8
|
+
exports.destStateValues = ['ok', 'degraded', 'error', 'unknown'];
|
|
9
|
+
exports.scoutUiStateValues = [
|
|
10
|
+
'idle',
|
|
11
|
+
'running',
|
|
12
|
+
'skipped',
|
|
13
|
+
'error',
|
|
14
|
+
];
|
|
15
|
+
const ghState = zod_1.z.enum(exports.ghStateValues);
|
|
16
|
+
const dbState = zod_1.z.enum(exports.dbStateValues);
|
|
17
|
+
const destState = zod_1.z.enum(exports.destStateValues);
|
|
18
|
+
const scoutUiState = zod_1.z.enum(exports.scoutUiStateValues);
|
|
19
|
+
const lastPollSchema = zod_1.z.looseObject({
|
|
20
|
+
candidates_count: zod_1.z.number().nullable().optional(),
|
|
21
|
+
skipped_unmapped: zod_1.z.number().nullable().optional(),
|
|
22
|
+
issues_created: zod_1.z.number().nullable().optional(),
|
|
23
|
+
});
|
|
24
|
+
exports.statusSnapshotSchema = zod_1.z.object({
|
|
25
|
+
timestamp: zod_1.z.string(),
|
|
26
|
+
pending_triage_count: zod_1.z.number().int().nonnegative().nullish(),
|
|
27
|
+
gh: zod_1.z.looseObject({
|
|
28
|
+
state: ghState,
|
|
29
|
+
message: zod_1.z.string().nullish(),
|
|
30
|
+
}),
|
|
31
|
+
database: zod_1.z.looseObject({
|
|
32
|
+
state: dbState,
|
|
33
|
+
message: zod_1.z.string().nullish(),
|
|
34
|
+
}),
|
|
35
|
+
setup: zod_1.z.looseObject({
|
|
36
|
+
complete: zod_1.z.boolean(),
|
|
37
|
+
mappingCount: zod_1.z.number(),
|
|
38
|
+
reason: zod_1.z.string().nullish(),
|
|
39
|
+
}),
|
|
40
|
+
configuration: zod_1.z.looseObject({
|
|
41
|
+
source_type: zod_1.z.string(),
|
|
42
|
+
destination_type: zod_1.z.string(),
|
|
43
|
+
vibe_kanban_board_active: zod_1.z.boolean(),
|
|
44
|
+
}),
|
|
45
|
+
destinations: zod_1.z.array(zod_1.z.looseObject({
|
|
46
|
+
id: zod_1.z.string(),
|
|
47
|
+
state: destState,
|
|
48
|
+
})),
|
|
49
|
+
scouts: zod_1.z.array(zod_1.z.looseObject({
|
|
50
|
+
id: zod_1.z.string(),
|
|
51
|
+
state: scoutUiState,
|
|
52
|
+
last_poll: lastPollSchema,
|
|
53
|
+
})),
|
|
54
|
+
manual_sync: zod_1.z.looseObject({
|
|
55
|
+
canRun: zod_1.z.boolean(),
|
|
56
|
+
reason: zod_1.z.string().nullish(),
|
|
57
|
+
cooldownUntil: zod_1.z.string().nullish(),
|
|
58
|
+
}),
|
|
59
|
+
scheduled_sync: zod_1.z.looseObject({
|
|
60
|
+
enabled: zod_1.z.boolean(),
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
function validateStatusSnapshot(body) {
|
|
64
|
+
const parsed = exports.statusSnapshotSchema.safeParse(body);
|
|
65
|
+
if (parsed.success) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
return parsed.error.issues.map((issue) => issue.message).join('; ');
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=status-snapshot.schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status-snapshot.schema.js","sourceRoot":"","sources":["../../src/status/status-snapshot.schema.ts"],"names":[],"mappings":";;;AAsEA,wDAMC;AA5ED,6BAAwB;AAGX,QAAA,aAAa,GAAG,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AACpD,QAAA,aAAa,GAAG,CAAC,IAAI,EAAE,OAAO,CAAU,CAAC;AACzC,QAAA,eAAe,GAAG,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AAClE,QAAA,kBAAkB,GAAG;IAChC,MAAM;IACN,SAAS;IACT,SAAS;IACT,OAAO;CACC,CAAC;AAEX,MAAM,OAAO,GAAG,OAAC,CAAC,IAAI,CAAC,qBAAa,CAAC,CAAC;AACtC,MAAM,OAAO,GAAG,OAAC,CAAC,IAAI,CAAC,qBAAa,CAAC,CAAC;AACtC,MAAM,SAAS,GAAG,OAAC,CAAC,IAAI,CAAC,uBAAe,CAAC,CAAC;AAC1C,MAAM,YAAY,GAAG,OAAC,CAAC,IAAI,CAAC,0BAAkB,CAAC,CAAC;AAEhD,MAAM,cAAc,GAAG,OAAC,CAAC,WAAW,CAAC;IACnC,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IAClD,gBAAgB,EAAE,OAAC,CAAC,MAAM,EAAE,C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