@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/README.md
CHANGED
|
@@ -29,7 +29,17 @@ npx @nilejs/cli new my-app
|
|
|
29
29
|
cd my-app && bun install && bun run dev
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
The CLI also includes generators for adding services, actions, and extracting Zod schemas with TypeScript types. See [`@nilejs/cli`](
|
|
32
|
+
The CLI also includes generators for adding services, actions, and extracting Zod schemas with TypeScript types. See [`@nilejs/cli`](https://github.com/nile-js/nile/tree/main/packages/cli) for details.
|
|
33
|
+
|
|
34
|
+
### Client Library
|
|
35
|
+
|
|
36
|
+
For frontend applications, use the standalone, type-safe client:
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
bun add @nilejs/client
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
See [`@nilejs/client`](https://github.com/nile-js/nile/tree/main/packages/client) for full usage and type-safe action invocation.
|
|
33
43
|
|
|
34
44
|
### Manual install
|
|
35
45
|
|
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
|
-
//
|
|
30
|
+
// index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
33
|
createAction: () => createAction,
|
|
@@ -46,7 +46,7 @@ __export(index_exports, {
|
|
|
46
46
|
});
|
|
47
47
|
module.exports = __toCommonJS(index_exports);
|
|
48
48
|
|
|
49
|
-
//
|
|
49
|
+
// engine/create-action.ts
|
|
50
50
|
function createAction(config) {
|
|
51
51
|
return config;
|
|
52
52
|
}
|
|
@@ -54,7 +54,7 @@ function createActions(configs) {
|
|
|
54
54
|
return configs;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
//
|
|
57
|
+
// engine/create-service.ts
|
|
58
58
|
function createService(config) {
|
|
59
59
|
return config;
|
|
60
60
|
}
|
|
@@ -62,7 +62,7 @@ function createServices(configs) {
|
|
|
62
62
|
return configs;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
//
|
|
65
|
+
// logging/logger.ts
|
|
66
66
|
var import_node_fs = require("fs");
|
|
67
67
|
var import_node_path = require("path");
|
|
68
68
|
var import_nanoid = require("nanoid");
|
|
@@ -305,7 +305,7 @@ function applyLogFilters(logs, filters) {
|
|
|
305
305
|
});
|
|
306
306
|
}
|
|
307
307
|
|
|
308
|
-
//
|
|
308
|
+
// logging/create-log.ts
|
|
309
309
|
var createLogger = (appName, config) => {
|
|
310
310
|
return {
|
|
311
311
|
info: (input) => createLog({ ...input, appName, level: "info" }, config),
|
|
@@ -314,17 +314,17 @@ var createLogger = (appName, config) => {
|
|
|
314
314
|
};
|
|
315
315
|
};
|
|
316
316
|
|
|
317
|
-
//
|
|
317
|
+
// nile/server.ts
|
|
318
318
|
var import_slang_ts7 = require("slang-ts");
|
|
319
319
|
|
|
320
|
-
//
|
|
320
|
+
// engine/engine.ts
|
|
321
321
|
var import_slang_ts4 = require("slang-ts");
|
|
322
322
|
|
|
323
|
-
//
|
|
323
|
+
// utils/db/create-model.ts
|
|
324
324
|
var import_drizzle_orm = require("drizzle-orm");
|
|
325
325
|
var import_slang_ts2 = require("slang-ts");
|
|
326
326
|
|
|
327
|
-
//
|
|
327
|
+
// utils/handle-error.ts
|
|
328
328
|
var import_slang_ts = require("slang-ts");
|
|
329
329
|
var CALLER_LINE_REGEX = /at\s+(\S+)\s+/;
|
|
330
330
|
function inferCallerName() {
|
|
@@ -360,7 +360,7 @@ function handleError(params) {
|
|
|
360
360
|
return (0, import_slang_ts.Err)(`[${logId}] ${params.message}`);
|
|
361
361
|
}
|
|
362
362
|
|
|
363
|
-
//
|
|
363
|
+
// utils/db/create-transaction-variant.ts
|
|
364
364
|
function createTransactionVariant(fn) {
|
|
365
365
|
return async (params) => {
|
|
366
366
|
const { dbx, ...rest } = params;
|
|
@@ -389,7 +389,7 @@ function createTransactionVariant(fn) {
|
|
|
389
389
|
};
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
-
//
|
|
392
|
+
// utils/db/get-zod-schema.ts
|
|
393
393
|
var import_drizzle_zod = require("drizzle-zod");
|
|
394
394
|
function getZodSchema(table) {
|
|
395
395
|
const isRelation = Object.hasOwn(table, "config") && Object.hasOwn(table, "table");
|
|
@@ -414,7 +414,7 @@ function getZodSchema(table) {
|
|
|
414
414
|
};
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
-
//
|
|
417
|
+
// utils/db/create-model.ts
|
|
418
418
|
function asDb(db) {
|
|
419
419
|
return db;
|
|
420
420
|
}
|
|
@@ -666,7 +666,7 @@ function createModel(table, options) {
|
|
|
666
666
|
};
|
|
667
667
|
}
|
|
668
668
|
|
|
669
|
-
//
|
|
669
|
+
// utils/diagnostics-log.ts
|
|
670
670
|
function isNileLogger(logger) {
|
|
671
671
|
return "warn" in logger && "error" in logger;
|
|
672
672
|
}
|
|
@@ -693,7 +693,7 @@ function createDiagnosticsLog(prefix, params) {
|
|
|
693
693
|
};
|
|
694
694
|
}
|
|
695
695
|
|
|
696
|
-
//
|
|
696
|
+
// engine/pipeline.ts
|
|
697
697
|
var import_slang_ts3 = require("slang-ts");
|
|
698
698
|
var import_zod = require("zod");
|
|
699
699
|
async function runHook(hookDef, hookAction, input, nileContext) {
|
|
@@ -803,7 +803,7 @@ async function runHandler(action, payload, nileContext, log) {
|
|
|
803
803
|
return (0, import_slang_ts3.Ok)(result.value);
|
|
804
804
|
}
|
|
805
805
|
|
|
806
|
-
//
|
|
806
|
+
// engine/engine.ts
|
|
807
807
|
function createEngine(options) {
|
|
808
808
|
const { diagnostics, services, logger } = options;
|
|
809
809
|
const log = createDiagnosticsLog("Engine", {
|
|
@@ -937,11 +937,11 @@ function createEngine(options) {
|
|
|
937
937
|
};
|
|
938
938
|
}
|
|
939
939
|
|
|
940
|
-
//
|
|
940
|
+
// rest/rest.ts
|
|
941
941
|
var import_hono = require("hono");
|
|
942
942
|
var import_zod3 = __toESM(require("zod"), 1);
|
|
943
943
|
|
|
944
|
-
//
|
|
944
|
+
// cors/cors.ts
|
|
945
945
|
var import_cors = require("hono/cors");
|
|
946
946
|
var buildDefaultCorsOptions = (config) => {
|
|
947
947
|
const getDefaultOrigin = (reqOrigin) => {
|
|
@@ -1023,7 +1023,7 @@ var evaluateResolver = (resolver, origin, c, defaultOpts) => {
|
|
|
1023
1023
|
}
|
|
1024
1024
|
};
|
|
1025
1025
|
|
|
1026
|
-
//
|
|
1026
|
+
// rest/intent-handlers.ts
|
|
1027
1027
|
var import_slang_ts5 = require("slang-ts");
|
|
1028
1028
|
var import_zod2 = __toESM(require("zod"), 1);
|
|
1029
1029
|
function toExternalResponse(result, successMessage) {
|
|
@@ -1156,7 +1156,7 @@ var intentHandlers = {
|
|
|
1156
1156
|
schema: (engine, request) => handleSchema(engine, request)
|
|
1157
1157
|
};
|
|
1158
1158
|
|
|
1159
|
-
//
|
|
1159
|
+
// rest/middleware.ts
|
|
1160
1160
|
var import_hono_rate_limiter = require("hono-rate-limiter");
|
|
1161
1161
|
var import_slang_ts6 = require("slang-ts");
|
|
1162
1162
|
var ASSETS_REGEX = /^\/assets\//;
|
|
@@ -1226,7 +1226,7 @@ function applyStaticServing(app, config, runtime, log) {
|
|
|
1226
1226
|
log("Static file serving enabled at /assets/*");
|
|
1227
1227
|
}
|
|
1228
1228
|
|
|
1229
|
-
//
|
|
1229
|
+
// rest/rest.ts
|
|
1230
1230
|
var externalRequestSchema = import_zod3.default.object({
|
|
1231
1231
|
intent: import_zod3.default.enum(["explore", "execute", "schema"]),
|
|
1232
1232
|
service: import_zod3.default.string().min(1),
|
|
@@ -1297,7 +1297,7 @@ function createRestApp(params) {
|
|
|
1297
1297
|
return app;
|
|
1298
1298
|
}
|
|
1299
1299
|
|
|
1300
|
-
//
|
|
1300
|
+
// nile/nile.ts
|
|
1301
1301
|
function createNileContext(params) {
|
|
1302
1302
|
const store = /* @__PURE__ */ new Map();
|
|
1303
1303
|
const interfaceContext = params?.interfaceContext;
|
|
@@ -1351,7 +1351,7 @@ function createNileContext(params) {
|
|
|
1351
1351
|
return context;
|
|
1352
1352
|
}
|
|
1353
1353
|
|
|
1354
|
-
//
|
|
1354
|
+
// nile/server.ts
|
|
1355
1355
|
var _nileContext = null;
|
|
1356
1356
|
function getContext() {
|
|
1357
1357
|
if (!_nileContext) {
|