@llun/activities.schema 0.0.1 → 0.0.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.
@@ -0,0 +1 @@
1
+ export * from "./note.js";
package/dist/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./note.js";
package/dist/note.d.ts ADDED
@@ -0,0 +1,45 @@
1
+ import { z } from "zod";
2
+ export declare const Note: z.ZodObject<{
3
+ id: z.ZodString;
4
+ url: z.ZodString;
5
+ attributedTo: z.ZodString;
6
+ to: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
7
+ cc: z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>;
8
+ inReplyTo: z.ZodOptional<z.ZodString>;
9
+ summary: z.ZodOptional<z.ZodString>;
10
+ summaryMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
11
+ content: z.ZodOptional<z.ZodString>;
12
+ contentMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
13
+ published: z.ZodString;
14
+ updated: z.ZodOptional<z.ZodString>;
15
+ type: z.ZodLiteral<"Note">;
16
+ }, "strip", z.ZodTypeAny, {
17
+ id: string;
18
+ url: string;
19
+ attributedTo: string;
20
+ to: (string | string[]) & (string | string[] | undefined);
21
+ type: "Note";
22
+ cc: (string | string[]) & (string | string[] | undefined);
23
+ published: string;
24
+ inReplyTo?: string | undefined;
25
+ summary?: string | undefined;
26
+ summaryMap?: Record<string, string> | undefined;
27
+ content?: string | undefined;
28
+ contentMap?: Record<string, string> | undefined;
29
+ updated?: string | undefined;
30
+ }, {
31
+ id: string;
32
+ url: string;
33
+ attributedTo: string;
34
+ to: (string | string[]) & (string | string[] | undefined);
35
+ type: "Note";
36
+ cc: (string | string[]) & (string | string[] | undefined);
37
+ published: string;
38
+ inReplyTo?: string | undefined;
39
+ summary?: string | undefined;
40
+ summaryMap?: Record<string, string> | undefined;
41
+ content?: string | undefined;
42
+ contentMap?: Record<string, string> | undefined;
43
+ updated?: string | undefined;
44
+ }>;
45
+ export type Note = z.infer<typeof Note>;
package/dist/note.js ADDED
@@ -0,0 +1,22 @@
1
+ import { z } from "zod";
2
+ const BaseContent = z.object({
3
+ id: z.string(),
4
+ url: z.string({ description: "Note URL" }),
5
+ attributedTo: z.string({ description: "Note publisher" }),
6
+ to: z.union([z.string(), z.string().array()]),
7
+ cc: z.union([z.string(), z.string().array()]),
8
+ inReplyTo: z.string().optional(),
9
+ summary: z.string({ description: "Note short summary" }).optional(),
10
+ summaryMap: z
11
+ .record(z.string(), { description: "Note short summary in each locale" })
12
+ .optional(),
13
+ content: z.string({ description: "Note content" }).optional(),
14
+ contentMap: z
15
+ .record(z.string(), { description: "Note content in each locale" })
16
+ .optional(),
17
+ published: z.string({ description: "Object published datetime" }),
18
+ updated: z.string({ description: "Object updated datetime" }).optional(),
19
+ });
20
+ export const Note = BaseContent.extend({
21
+ type: z.literal("Note"),
22
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@llun/activities.schema",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Validate ActivityPub with Zod",
5
5
  "exports": {
6
6
  "types": "./dist/index.d.ts",
@@ -8,7 +8,8 @@
8
8
  },
9
9
  "type": "module",
10
10
  "scripts": {
11
- "build": "tsc"
11
+ "build": "tsc",
12
+ "publish": "rm -rf dist && npm run build && npm publish --access public"
12
13
  },
13
14
  "author": "Maythee Anegboonlap <null@llun.dev>",
14
15
  "license": "MIT",
package/readme.md ADDED
@@ -0,0 +1,3 @@
1
+ # Activities.schema
2
+
3
+ Schema package for validating AcitivityPub data