@nilejs/nile 0.0.4 → 0.0.6
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 +11 -1
- package/dist/index.cjs +22 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -21
- package/dist/index.js.map +1 -1
- package/package.json +17 -20
- package/LICENSE +0 -21
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// engine/create-action.ts
|
|
2
2
|
function createAction(config) {
|
|
3
3
|
return config;
|
|
4
4
|
}
|
|
@@ -6,7 +6,7 @@ function createActions(configs) {
|
|
|
6
6
|
return configs;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// engine/create-service.ts
|
|
10
10
|
function createService(config) {
|
|
11
11
|
return config;
|
|
12
12
|
}
|
|
@@ -14,7 +14,7 @@ function createServices(configs) {
|
|
|
14
14
|
return configs;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
//
|
|
17
|
+
// logging/logger.ts
|
|
18
18
|
import {
|
|
19
19
|
appendFileSync,
|
|
20
20
|
existsSync,
|
|
@@ -263,7 +263,7 @@ function applyLogFilters(logs, filters) {
|
|
|
263
263
|
});
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
//
|
|
266
|
+
// logging/create-log.ts
|
|
267
267
|
var createLogger = (appName, config) => {
|
|
268
268
|
return {
|
|
269
269
|
info: (input) => createLog({ ...input, appName, level: "info" }, config),
|
|
@@ -272,17 +272,17 @@ var createLogger = (appName, config) => {
|
|
|
272
272
|
};
|
|
273
273
|
};
|
|
274
274
|
|
|
275
|
-
//
|
|
275
|
+
// nile/server.ts
|
|
276
276
|
import { safeTry as safeTry4 } from "slang-ts";
|
|
277
277
|
|
|
278
|
-
//
|
|
278
|
+
// engine/engine.ts
|
|
279
279
|
import { Err as Err3, Ok as Ok3 } from "slang-ts";
|
|
280
280
|
|
|
281
|
-
//
|
|
281
|
+
// utils/db/create-model.ts
|
|
282
282
|
import { count, desc, eq, lt } from "drizzle-orm";
|
|
283
283
|
import { Ok, safeTry } from "slang-ts";
|
|
284
284
|
|
|
285
|
-
//
|
|
285
|
+
// utils/handle-error.ts
|
|
286
286
|
import { Err } from "slang-ts";
|
|
287
287
|
var CALLER_LINE_REGEX = /at\s+(\S+)\s+/;
|
|
288
288
|
function inferCallerName() {
|
|
@@ -318,7 +318,7 @@ function handleError(params) {
|
|
|
318
318
|
return Err(`[${logId}] ${params.message}`);
|
|
319
319
|
}
|
|
320
320
|
|
|
321
|
-
//
|
|
321
|
+
// utils/db/create-transaction-variant.ts
|
|
322
322
|
function createTransactionVariant(fn) {
|
|
323
323
|
return async (params) => {
|
|
324
324
|
const { dbx, ...rest } = params;
|
|
@@ -347,7 +347,7 @@ function createTransactionVariant(fn) {
|
|
|
347
347
|
};
|
|
348
348
|
}
|
|
349
349
|
|
|
350
|
-
//
|
|
350
|
+
// utils/db/get-zod-schema.ts
|
|
351
351
|
import {
|
|
352
352
|
createInsertSchema,
|
|
353
353
|
createSelectSchema,
|
|
@@ -376,7 +376,7 @@ function getZodSchema(table) {
|
|
|
376
376
|
};
|
|
377
377
|
}
|
|
378
378
|
|
|
379
|
-
//
|
|
379
|
+
// utils/db/create-model.ts
|
|
380
380
|
function asDb(db) {
|
|
381
381
|
return db;
|
|
382
382
|
}
|
|
@@ -628,7 +628,7 @@ function createModel(table, options) {
|
|
|
628
628
|
};
|
|
629
629
|
}
|
|
630
630
|
|
|
631
|
-
//
|
|
631
|
+
// utils/diagnostics-log.ts
|
|
632
632
|
function isNileLogger(logger) {
|
|
633
633
|
return "warn" in logger && "error" in logger;
|
|
634
634
|
}
|
|
@@ -655,7 +655,7 @@ function createDiagnosticsLog(prefix, params) {
|
|
|
655
655
|
};
|
|
656
656
|
}
|
|
657
657
|
|
|
658
|
-
//
|
|
658
|
+
// engine/pipeline.ts
|
|
659
659
|
import { Err as Err2, Ok as Ok2, safeTry as safeTry2 } from "slang-ts";
|
|
660
660
|
import { prettifyError } from "zod";
|
|
661
661
|
async function runHook(hookDef, hookAction, input, nileContext) {
|
|
@@ -765,7 +765,7 @@ async function runHandler(action, payload, nileContext, log) {
|
|
|
765
765
|
return Ok2(result.value);
|
|
766
766
|
}
|
|
767
767
|
|
|
768
|
-
//
|
|
768
|
+
// engine/engine.ts
|
|
769
769
|
function createEngine(options) {
|
|
770
770
|
const { diagnostics, services, logger } = options;
|
|
771
771
|
const log = createDiagnosticsLog("Engine", {
|
|
@@ -899,11 +899,11 @@ function createEngine(options) {
|
|
|
899
899
|
};
|
|
900
900
|
}
|
|
901
901
|
|
|
902
|
-
//
|
|
902
|
+
// rest/rest.ts
|
|
903
903
|
import { Hono } from "hono";
|
|
904
904
|
import z2 from "zod";
|
|
905
905
|
|
|
906
|
-
//
|
|
906
|
+
// cors/cors.ts
|
|
907
907
|
import { cors } from "hono/cors";
|
|
908
908
|
var buildDefaultCorsOptions = (config) => {
|
|
909
909
|
const getDefaultOrigin = (reqOrigin) => {
|
|
@@ -985,7 +985,7 @@ var evaluateResolver = (resolver, origin, c, defaultOpts) => {
|
|
|
985
985
|
}
|
|
986
986
|
};
|
|
987
987
|
|
|
988
|
-
//
|
|
988
|
+
// rest/intent-handlers.ts
|
|
989
989
|
import { Ok as Ok4 } from "slang-ts";
|
|
990
990
|
import z from "zod";
|
|
991
991
|
function toExternalResponse(result, successMessage) {
|
|
@@ -1118,7 +1118,7 @@ var intentHandlers = {
|
|
|
1118
1118
|
schema: (engine, request) => handleSchema(engine, request)
|
|
1119
1119
|
};
|
|
1120
1120
|
|
|
1121
|
-
//
|
|
1121
|
+
// rest/middleware.ts
|
|
1122
1122
|
import { rateLimiter } from "hono-rate-limiter";
|
|
1123
1123
|
import { safeTry as safeTry3 } from "slang-ts";
|
|
1124
1124
|
var ASSETS_REGEX = /^\/assets\//;
|
|
@@ -1188,7 +1188,7 @@ function applyStaticServing(app, config, runtime, log) {
|
|
|
1188
1188
|
log("Static file serving enabled at /assets/*");
|
|
1189
1189
|
}
|
|
1190
1190
|
|
|
1191
|
-
//
|
|
1191
|
+
// rest/rest.ts
|
|
1192
1192
|
var externalRequestSchema = z2.object({
|
|
1193
1193
|
intent: z2.enum(["explore", "execute", "schema"]),
|
|
1194
1194
|
service: z2.string().min(1),
|
|
@@ -1259,7 +1259,7 @@ function createRestApp(params) {
|
|
|
1259
1259
|
return app;
|
|
1260
1260
|
}
|
|
1261
1261
|
|
|
1262
|
-
//
|
|
1262
|
+
// nile/nile.ts
|
|
1263
1263
|
function createNileContext(params) {
|
|
1264
1264
|
const store = /* @__PURE__ */ new Map();
|
|
1265
1265
|
const interfaceContext = params?.interfaceContext;
|
|
@@ -1313,7 +1313,7 @@ function createNileContext(params) {
|
|
|
1313
1313
|
return context;
|
|
1314
1314
|
}
|
|
1315
1315
|
|
|
1316
|
-
//
|
|
1316
|
+
// nile/server.ts
|
|
1317
1317
|
var _nileContext = null;
|
|
1318
1318
|
function getContext() {
|
|
1319
1319
|
if (!_nileContext) {
|