@voyantjs/external-refs 0.5.0 → 0.6.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/dist/routes.d.ts +12 -12
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +6 -5
- package/dist/service.d.ts +4 -4
- package/dist/validation.d.ts +6 -6
- package/package.json +4 -4
package/dist/routes.d.ts
CHANGED
|
@@ -42,7 +42,13 @@ export declare const externalRefsRoutes: import("hono/hono-base").HonoBase<Env,
|
|
|
42
42
|
input: {};
|
|
43
43
|
output: {
|
|
44
44
|
data: {
|
|
45
|
+
metadata: {
|
|
46
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
47
|
+
} | null;
|
|
45
48
|
id: string;
|
|
49
|
+
createdAt: string;
|
|
50
|
+
updatedAt: string;
|
|
51
|
+
status: "active" | "inactive" | "archived";
|
|
46
52
|
entityType: string;
|
|
47
53
|
entityId: string;
|
|
48
54
|
sourceSystem: string;
|
|
@@ -51,13 +57,7 @@ export declare const externalRefsRoutes: import("hono/hono-base").HonoBase<Env,
|
|
|
51
57
|
externalId: string;
|
|
52
58
|
externalParentId: string | null;
|
|
53
59
|
isPrimary: boolean;
|
|
54
|
-
status: "active" | "inactive" | "archived";
|
|
55
60
|
lastSyncedAt: string | null;
|
|
56
|
-
metadata: {
|
|
57
|
-
[x: string]: import("hono/utils/types").JSONValue;
|
|
58
|
-
} | null;
|
|
59
|
-
createdAt: string;
|
|
60
|
-
updatedAt: string;
|
|
61
61
|
} | null;
|
|
62
62
|
};
|
|
63
63
|
outputFormat: "json";
|
|
@@ -225,7 +225,13 @@ export declare const externalRefsRoutes: import("hono/hono-base").HonoBase<Env,
|
|
|
225
225
|
};
|
|
226
226
|
output: {
|
|
227
227
|
data: {
|
|
228
|
+
metadata: {
|
|
229
|
+
[x: string]: import("hono/utils/types").JSONValue;
|
|
230
|
+
} | null;
|
|
228
231
|
id: string;
|
|
232
|
+
createdAt: string;
|
|
233
|
+
updatedAt: string;
|
|
234
|
+
status: "active" | "inactive" | "archived";
|
|
229
235
|
entityType: string;
|
|
230
236
|
entityId: string;
|
|
231
237
|
sourceSystem: string;
|
|
@@ -234,13 +240,7 @@ export declare const externalRefsRoutes: import("hono/hono-base").HonoBase<Env,
|
|
|
234
240
|
externalId: string;
|
|
235
241
|
externalParentId: string | null;
|
|
236
242
|
isPrimary: boolean;
|
|
237
|
-
status: "active" | "inactive" | "archived";
|
|
238
243
|
lastSyncedAt: string | null;
|
|
239
|
-
metadata: {
|
|
240
|
-
[x: string]: import("hono/utils/types").JSONValue;
|
|
241
|
-
} | null;
|
|
242
|
-
createdAt: string;
|
|
243
|
-
updatedAt: string;
|
|
244
244
|
} | null;
|
|
245
245
|
};
|
|
246
246
|
outputFormat: "json";
|
package/dist/routes.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAWjE,KAAK,GAAG,GAAG;IACT,SAAS,EAAE;QACT,EAAE,EAAE,kBAAkB,CAAA;QACtB,MAAM,CAAC,EAAE,MAAM,CAAA;KAChB,CAAA;CACF,CAAA;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+CAyD3B,CAAA;AAEJ,MAAM,MAAM,kBAAkB,GAAG,OAAO,kBAAkB,CAAA"}
|
package/dist/routes.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { parseJsonBody, parseQuery } from "@voyantjs/hono";
|
|
1
2
|
import { Hono } from "hono";
|
|
2
3
|
import { externalRefsService } from "./service.js";
|
|
3
4
|
import { externalRefListQuerySchema, insertExternalRefForEntitySchema, insertExternalRefSchema, updateExternalRefSchema, } from "./validation.js";
|
|
4
5
|
export const externalRefsRoutes = new Hono()
|
|
5
6
|
.get("/refs", async (c) => {
|
|
6
|
-
const query =
|
|
7
|
+
const query = await parseQuery(c, externalRefListQuerySchema);
|
|
7
8
|
return c.json(await externalRefsService.listExternalRefs(c.get("db"), query));
|
|
8
9
|
})
|
|
9
10
|
.post("/refs", async (c) => {
|
|
10
11
|
return c.json({
|
|
11
|
-
data: await externalRefsService.createExternalRef(c.get("db"),
|
|
12
|
+
data: await externalRefsService.createExternalRef(c.get("db"), await parseJsonBody(c, insertExternalRefSchema)),
|
|
12
13
|
}, 201);
|
|
13
14
|
})
|
|
14
15
|
.get("/refs/:id", async (c) => {
|
|
@@ -18,7 +19,7 @@ export const externalRefsRoutes = new Hono()
|
|
|
18
19
|
return c.json({ data: row });
|
|
19
20
|
})
|
|
20
21
|
.patch("/refs/:id", async (c) => {
|
|
21
|
-
const row = await externalRefsService.updateExternalRef(c.get("db"), c.req.param("id"),
|
|
22
|
+
const row = await externalRefsService.updateExternalRef(c.get("db"), c.req.param("id"), await parseJsonBody(c, updateExternalRefSchema));
|
|
22
23
|
if (!row)
|
|
23
24
|
return c.json({ error: "External reference not found" }, 404);
|
|
24
25
|
return c.json({ data: row });
|
|
@@ -32,7 +33,7 @@ export const externalRefsRoutes = new Hono()
|
|
|
32
33
|
.get("/entities/:entityType/:entityId/refs", async (c) => {
|
|
33
34
|
const params = c.req.param();
|
|
34
35
|
const query = externalRefListQuerySchema.parse({
|
|
35
|
-
...
|
|
36
|
+
...(await parseQuery(c, externalRefListQuerySchema.partial())),
|
|
36
37
|
entityType: params.entityType,
|
|
37
38
|
entityId: params.entityId,
|
|
38
39
|
});
|
|
@@ -40,7 +41,7 @@ export const externalRefsRoutes = new Hono()
|
|
|
40
41
|
})
|
|
41
42
|
.post("/entities/:entityType/:entityId/refs", async (c) => {
|
|
42
43
|
const params = c.req.param();
|
|
43
|
-
const body =
|
|
44
|
+
const body = await parseJsonBody(c, insertExternalRefForEntitySchema);
|
|
44
45
|
return c.json({
|
|
45
46
|
data: await externalRefsService.createExternalRef(c.get("db"), {
|
|
46
47
|
...body,
|
package/dist/service.d.ts
CHANGED
|
@@ -43,7 +43,11 @@ export declare const externalRefsService: {
|
|
|
43
43
|
updatedAt: Date;
|
|
44
44
|
} | null>;
|
|
45
45
|
createExternalRef(db: PostgresJsDatabase, data: CreateExternalRefInput): Promise<{
|
|
46
|
+
metadata: Record<string, unknown> | null;
|
|
46
47
|
id: string;
|
|
48
|
+
createdAt: Date;
|
|
49
|
+
updatedAt: Date;
|
|
50
|
+
status: "active" | "inactive" | "archived";
|
|
47
51
|
entityType: string;
|
|
48
52
|
entityId: string;
|
|
49
53
|
sourceSystem: string;
|
|
@@ -52,11 +56,7 @@ export declare const externalRefsService: {
|
|
|
52
56
|
externalId: string;
|
|
53
57
|
externalParentId: string | null;
|
|
54
58
|
isPrimary: boolean;
|
|
55
|
-
status: "active" | "inactive" | "archived";
|
|
56
59
|
lastSyncedAt: Date | null;
|
|
57
|
-
metadata: Record<string, unknown> | null;
|
|
58
|
-
createdAt: Date;
|
|
59
|
-
updatedAt: Date;
|
|
60
60
|
} | null>;
|
|
61
61
|
updateExternalRef(db: PostgresJsDatabase, id: string, data: UpdateExternalRefInput): Promise<{
|
|
62
62
|
id: string;
|
package/dist/validation.d.ts
CHANGED
|
@@ -39,19 +39,19 @@ export declare const updateExternalRefSchema: z.ZodObject<{
|
|
|
39
39
|
metadata: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>>;
|
|
40
40
|
}, z.core.$strip>;
|
|
41
41
|
export declare const insertExternalRefForEntitySchema: z.ZodObject<{
|
|
42
|
+
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
43
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
44
|
+
active: "active";
|
|
45
|
+
inactive: "inactive";
|
|
46
|
+
archived: "archived";
|
|
47
|
+
}>>;
|
|
42
48
|
sourceSystem: z.ZodString;
|
|
43
49
|
objectType: z.ZodString;
|
|
44
50
|
namespace: z.ZodDefault<z.ZodString>;
|
|
45
51
|
externalId: z.ZodString;
|
|
46
52
|
externalParentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
47
53
|
isPrimary: z.ZodDefault<z.ZodBoolean>;
|
|
48
|
-
status: z.ZodDefault<z.ZodEnum<{
|
|
49
|
-
active: "active";
|
|
50
|
-
inactive: "inactive";
|
|
51
|
-
archived: "archived";
|
|
52
|
-
}>>;
|
|
53
54
|
lastSyncedAt: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
-
metadata: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
55
55
|
}, z.core.$strip>;
|
|
56
56
|
export declare const externalRefListQuerySchema: z.ZodObject<{
|
|
57
57
|
limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@voyantjs/external-refs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"license": "FSL-1.1-Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
"drizzle-orm": "^0.45.2",
|
|
26
26
|
"hono": "^4.12.10",
|
|
27
27
|
"zod": "^4.3.6",
|
|
28
|
-
"@voyantjs/core": "0.
|
|
29
|
-
"@voyantjs/db": "0.
|
|
30
|
-
"@voyantjs/hono": "0.
|
|
28
|
+
"@voyantjs/core": "0.6.2",
|
|
29
|
+
"@voyantjs/db": "0.6.2",
|
|
30
|
+
"@voyantjs/hono": "0.6.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"typescript": "^6.0.2",
|