@ourofoundation/ouro-js 1.0.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.
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateTeamSchema = exports.ReadTeamsSchema = exports.ReadTeamSchema = exports.CreateTeamSchema = exports.TeamSchema = void 0;
4
+ const uuidv7_1 = require("uuidv7");
5
+ const zod_1 = require("zod");
6
+ const index_1 = require("@/schema/index");
7
+ const organizations_1 = require("./organizations");
8
+ const users_1 = require("./users");
9
+ const TeamSchema = zod_1.z.object({
10
+ id: zod_1.z.string().uuid(),
11
+ org_id: zod_1.z.string().uuid(),
12
+ name: zod_1.z.string(),
13
+ description: zod_1.z.string().nullable().optional(),
14
+ default_role: index_1.RoleSchema,
15
+ visibility: index_1.VisibilitySchema,
16
+ created_at: zod_1.z.string(),
17
+ });
18
+ exports.TeamSchema = TeamSchema;
19
+ const CreateTeamSchema = TeamSchema.extend({
20
+ id: zod_1.z.string().default(() => (0, uuidv7_1.uuidv7)()),
21
+ default_role: index_1.RoleSchema.default("write").refine((v) => v === "read" || v === "write"),
22
+ visibility: index_1.VisibilitySchema.default("public").refine((v) => v === "public" || v === "organization"),
23
+ created_at: zod_1.z.string().default(() => new Date().toISOString()),
24
+ });
25
+ exports.CreateTeamSchema = CreateTeamSchema;
26
+ const ReadTeamSchema = TeamSchema.extend({
27
+ userMembership: zod_1.z
28
+ .object({
29
+ user_id: zod_1.z.string().uuid(),
30
+ role: index_1.RoleSchema,
31
+ })
32
+ .optional()
33
+ .nullable(),
34
+ memberCount: zod_1.z.number(),
35
+ members: zod_1.z.array(zod_1.z.object({
36
+ user_id: zod_1.z.string().uuid(),
37
+ role: index_1.RoleSchema,
38
+ user: users_1.ProfileSchema.partial().optional().nullable(),
39
+ })),
40
+ organization: organizations_1.OrganizationsSchema.partial().optional().nullable(),
41
+ });
42
+ exports.ReadTeamSchema = ReadTeamSchema;
43
+ const ReadTeamsSchema = zod_1.z.array(ReadTeamSchema.extend({
44
+ label: zod_1.z.string(),
45
+ value: zod_1.z.string(),
46
+ }));
47
+ exports.ReadTeamsSchema = ReadTeamsSchema;
48
+ const UpdateTeamSchema = TeamSchema.partial()
49
+ .omit({
50
+ org_id: true,
51
+ created_at: true,
52
+ })
53
+ .extend({
54
+ id: zod_1.z.string().uuid(),
55
+ });
56
+ exports.UpdateTeamSchema = UpdateTeamSchema;
@@ -0,0 +1,123 @@
1
+ import { z } from "zod";
2
+ declare const ProfileSchema: z.ZodObject<{
3
+ id: z.ZodString;
4
+ user_id: z.ZodString;
5
+ username: z.ZodNullable<z.ZodOptional<z.ZodString>>;
6
+ avatar_path: z.ZodNullable<z.ZodOptional<z.ZodString>>;
7
+ bio: z.ZodNullable<z.ZodOptional<z.ZodString>>;
8
+ urls: z.ZodOptional<z.ZodArray<z.ZodObject<{
9
+ value: z.ZodString;
10
+ }, "strip", z.ZodTypeAny, {
11
+ value: string;
12
+ }, {
13
+ value: string;
14
+ }>, "many">>;
15
+ last_active: z.ZodString;
16
+ }, "strip", z.ZodTypeAny, {
17
+ id: string;
18
+ user_id: string;
19
+ last_active: string;
20
+ avatar_path?: string | null | undefined;
21
+ urls?: {
22
+ value: string;
23
+ }[] | undefined;
24
+ username?: string | null | undefined;
25
+ bio?: string | null | undefined;
26
+ }, {
27
+ id: string;
28
+ user_id: string;
29
+ last_active: string;
30
+ avatar_path?: string | null | undefined;
31
+ urls?: {
32
+ value: string;
33
+ }[] | undefined;
34
+ username?: string | null | undefined;
35
+ bio?: string | null | undefined;
36
+ }>;
37
+ declare const ReadProfileSchema: z.ZodObject<z.objectUtil.extendShape<{
38
+ id: z.ZodString;
39
+ user_id: z.ZodString;
40
+ username: z.ZodNullable<z.ZodOptional<z.ZodString>>;
41
+ avatar_path: z.ZodNullable<z.ZodOptional<z.ZodString>>;
42
+ bio: z.ZodNullable<z.ZodOptional<z.ZodString>>;
43
+ urls: z.ZodOptional<z.ZodArray<z.ZodObject<{
44
+ value: z.ZodString;
45
+ }, "strip", z.ZodTypeAny, {
46
+ value: string;
47
+ }, {
48
+ value: string;
49
+ }>, "many">>;
50
+ last_active: z.ZodString;
51
+ }, {
52
+ is_agent: z.ZodBoolean;
53
+ isFollowing: z.ZodBoolean;
54
+ isFollowed: z.ZodBoolean;
55
+ isSelf: z.ZodBoolean;
56
+ followers: z.ZodDefault<z.ZodNumber>;
57
+ following: z.ZodDefault<z.ZodNumber>;
58
+ }>, "strip", z.ZodTypeAny, {
59
+ id: string;
60
+ user_id: string;
61
+ last_active: string;
62
+ is_agent: boolean;
63
+ isFollowing: boolean;
64
+ isFollowed: boolean;
65
+ isSelf: boolean;
66
+ followers: number;
67
+ following: number;
68
+ avatar_path?: string | null | undefined;
69
+ urls?: {
70
+ value: string;
71
+ }[] | undefined;
72
+ username?: string | null | undefined;
73
+ bio?: string | null | undefined;
74
+ }, {
75
+ id: string;
76
+ user_id: string;
77
+ last_active: string;
78
+ is_agent: boolean;
79
+ isFollowing: boolean;
80
+ isFollowed: boolean;
81
+ isSelf: boolean;
82
+ avatar_path?: string | null | undefined;
83
+ urls?: {
84
+ value: string;
85
+ }[] | undefined;
86
+ username?: string | null | undefined;
87
+ bio?: string | null | undefined;
88
+ followers?: number | undefined;
89
+ following?: number | undefined;
90
+ }>;
91
+ declare const UpdateProfileSchema: z.ZodObject<Omit<{
92
+ id: z.ZodOptional<z.ZodString>;
93
+ user_id: z.ZodOptional<z.ZodString>;
94
+ username: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
95
+ avatar_path: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
96
+ bio: z.ZodOptional<z.ZodNullable<z.ZodOptional<z.ZodString>>>;
97
+ urls: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodObject<{
98
+ value: z.ZodString;
99
+ }, "strip", z.ZodTypeAny, {
100
+ value: string;
101
+ }, {
102
+ value: string;
103
+ }>, "many">>>;
104
+ last_active: z.ZodOptional<z.ZodString>;
105
+ }, "id" | "user_id" | "last_active">, "strip", z.ZodTypeAny, {
106
+ avatar_path?: string | null | undefined;
107
+ urls?: {
108
+ value: string;
109
+ }[] | undefined;
110
+ username?: string | null | undefined;
111
+ bio?: string | null | undefined;
112
+ }, {
113
+ avatar_path?: string | null | undefined;
114
+ urls?: {
115
+ value: string;
116
+ }[] | undefined;
117
+ username?: string | null | undefined;
118
+ bio?: string | null | undefined;
119
+ }>;
120
+ type Profile = z.infer<typeof ProfileSchema>;
121
+ type UpdateProfile = z.infer<typeof UpdateProfileSchema>;
122
+ type ReadProfile = z.infer<typeof ReadProfileSchema>;
123
+ export { ProfileSchema, ReadProfileSchema, UpdateProfileSchema, type Profile, type UpdateProfile, type ReadProfile, };
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UpdateProfileSchema = exports.ReadProfileSchema = exports.ProfileSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const ProfileSchema = zod_1.z.object({
6
+ id: zod_1.z.string().uuid(),
7
+ user_id: zod_1.z.string().uuid(),
8
+ username: zod_1.z.string().optional().nullable(),
9
+ avatar_path: zod_1.z.string().optional().nullable(),
10
+ bio: zod_1.z.string().optional().nullable(),
11
+ urls: zod_1.z
12
+ .array(zod_1.z.object({
13
+ value: zod_1.z.string().url(),
14
+ }))
15
+ .optional(),
16
+ last_active: zod_1.z.string(),
17
+ });
18
+ exports.ProfileSchema = ProfileSchema;
19
+ const ReadProfileSchema = ProfileSchema.extend({
20
+ is_agent: zod_1.z.boolean(),
21
+ isFollowing: zod_1.z.boolean(),
22
+ isFollowed: zod_1.z.boolean(),
23
+ isSelf: zod_1.z.boolean(),
24
+ followers: zod_1.z.number().default(0),
25
+ following: zod_1.z.number().default(0),
26
+ });
27
+ exports.ReadProfileSchema = ReadProfileSchema;
28
+ const UpdateProfileSchema = ProfileSchema.partial().omit({
29
+ id: true,
30
+ user_id: true,
31
+ last_active: true,
32
+ // username: true, // once set, users cannot update their username
33
+ });
34
+ exports.UpdateProfileSchema = UpdateProfileSchema;
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@ourofoundation/ouro-js",
3
+ "version": "1.0.0",
4
+ "description": "Interact with the Ouro platform in browser and node.js environments",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "build": "tsc",
8
+ "test": "echo \"Error: no test specified\" && exit 1"
9
+ },
10
+ "author": "ourofoundation",
11
+ "license": "ISC",
12
+ "devDependencies": {
13
+ "typescript": "^4.5.4"
14
+ },
15
+ "dependencies": {
16
+ "@supabase/ssr": "^0.5.1",
17
+ "@tiptap/extension-mention": "^2.8.0",
18
+ "@tiptap/html": "^2.8.0",
19
+ "@tiptap/starter-kit": "^2.8.0",
20
+ "base64-arraybuffer": "^1.0.2",
21
+ "date-fns": "^4.1.0",
22
+ "dotenv": "^16.4.5",
23
+ "image-size": "^1.1.1",
24
+ "js-yaml": "^4.1.0",
25
+ "marked": "^14.1.3",
26
+ "mime-types": "^2.1.35",
27
+ "music-metadata": "^10.5.1",
28
+ "node-sql-parser": "^5.3.3",
29
+ "openapi-types": "^12.1.3",
30
+ "papaparse": "^5.4.1",
31
+ "pg": "^8.13.0",
32
+ "resend": "^4.0.0",
33
+ "socket.io": "^4.8.0",
34
+ "uuidv7": "^1.0.2",
35
+ "zod": "^3.23.8"
36
+ }
37
+ }