@dnax/core 0.4.8 → 0.5.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/app/hono.ts CHANGED
@@ -41,8 +41,11 @@ function HonoInstance(): typeof app {
41
41
  let session = sessionStorage();
42
42
  var token = jwt.getToken("Bearer", c.req.header()["authorization"]) || "";
43
43
  var { decode, valid, error } = jwt.verify(token);
44
- c.set("_STUDIO_SECRET_KEY_", secretKeyStudio);
45
- c.set("isStudio", isStudio(secretKeyStudio));
44
+ if (valid && decode?.studio) {
45
+ // FIX STUDIO INFO
46
+ c.set("_STUDIO_SECRET_KEY_", secretKeyStudio);
47
+ c.set("isStudio", isStudio(secretKeyStudio));
48
+ }
46
49
  let _v = {
47
50
  token: token || null,
48
51
  ip:
@@ -390,9 +393,10 @@ function HonoInstance(): typeof app {
390
393
  }
391
394
  });
392
395
 
393
- app.post("/api/studio", (c, next) => {
396
+ app.post("/api/studio", async (c, next) => {
394
397
  let cookie = getCookie(c);
395
- let secretKeyStudio = cookie["_STUDIO_SECRET_KEY_"];
398
+ let body = await c?.req?.json();
399
+ let secretKeyStudio = body?.secret || cookie["_STUDIO_SECRET_KEY_"];
396
400
  let canPerform = isStudio(secretKeyStudio);
397
401
  let cf = {
398
402
  collections: Cfg.collections?.map((c) =>
@@ -405,6 +409,7 @@ function HonoInstance(): typeof app {
405
409
  return c.json({
406
410
  auth: true,
407
411
  data: cf,
412
+ token: jwt.sign({ studio: true }),
408
413
  });
409
414
  } else {
410
415
  c.status(403);
@@ -9,7 +9,12 @@ export type optionsType = {
9
9
  | "string"
10
10
  | "number"
11
11
  | "boolean"
12
- | Vector<number>
12
+ | `vector[${number}]`
13
+ | "enum[]"
14
+ | "enum"
15
+ | "string[]"
16
+ | "number[]"
17
+ | "boolean[]"
13
18
  | "geopoint";
14
19
  };
15
20
  settings?: {
@@ -87,4 +87,11 @@ class searchEngine {
87
87
  }
88
88
  }
89
89
 
90
+ const engine = new searchEngine({
91
+ schema: {},
92
+ store: {
93
+ filename: "data.db",
94
+ },
95
+ });
96
+
90
97
  export { searchEngine };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dnax/core",
3
- "version": "0.4.8",
3
+ "version": "0.5.0",
4
4
  "module": "index.ts",
5
5
  "type": "module",
6
6
  "bin": {