@prave/shared 0.1.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.
Files changed (46) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/index.d.ts.map +1 -0
  3. package/dist/index.js +2 -0
  4. package/dist/schemas/ai-description.schema.d.ts +82 -0
  5. package/dist/schemas/ai-description.schema.d.ts.map +1 -0
  6. package/dist/schemas/ai-description.schema.js +36 -0
  7. package/dist/schemas/api-response.schema.d.ts +22 -0
  8. package/dist/schemas/api-response.schema.d.ts.map +1 -0
  9. package/dist/schemas/api-response.schema.js +8 -0
  10. package/dist/schemas/billing.schema.d.ts +58 -0
  11. package/dist/schemas/billing.schema.d.ts.map +1 -0
  12. package/dist/schemas/billing.schema.js +33 -0
  13. package/dist/schemas/cli.schema.d.ts +57 -0
  14. package/dist/schemas/cli.schema.d.ts.map +1 -0
  15. package/dist/schemas/cli.schema.js +21 -0
  16. package/dist/schemas/index.d.ts +13 -0
  17. package/dist/schemas/index.d.ts.map +1 -0
  18. package/dist/schemas/index.js +12 -0
  19. package/dist/schemas/install.schema.d.ts +115 -0
  20. package/dist/schemas/install.schema.d.ts.map +1 -0
  21. package/dist/schemas/install.schema.js +28 -0
  22. package/dist/schemas/marketplace.schema.d.ts +200 -0
  23. package/dist/schemas/marketplace.schema.d.ts.map +1 -0
  24. package/dist/schemas/marketplace.schema.js +51 -0
  25. package/dist/schemas/org.schema.d.ts +112 -0
  26. package/dist/schemas/org.schema.d.ts.map +1 -0
  27. package/dist/schemas/org.schema.js +34 -0
  28. package/dist/schemas/search.schema.d.ts +105 -0
  29. package/dist/schemas/search.schema.d.ts.map +1 -0
  30. package/dist/schemas/search.schema.js +20 -0
  31. package/dist/schemas/skill-dependency.schema.d.ts +137 -0
  32. package/dist/schemas/skill-dependency.schema.d.ts.map +1 -0
  33. package/dist/schemas/skill-dependency.schema.js +32 -0
  34. package/dist/schemas/skill-test.schema.d.ts +65 -0
  35. package/dist/schemas/skill-test.schema.d.ts.map +1 -0
  36. package/dist/schemas/skill-test.schema.js +30 -0
  37. package/dist/schemas/skill-version.schema.d.ts +69 -0
  38. package/dist/schemas/skill-version.schema.d.ts.map +1 -0
  39. package/dist/schemas/skill-version.schema.js +21 -0
  40. package/dist/schemas/skill.schema.d.ts +180 -0
  41. package/dist/schemas/skill.schema.d.ts.map +1 -0
  42. package/dist/schemas/skill.schema.js +69 -0
  43. package/dist/types/index.d.ts +19 -0
  44. package/dist/types/index.d.ts.map +1 -0
  45. package/dist/types/index.js +1 -0
  46. package/package.json +43 -0
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ import { skillSchema } from './skill.schema.js';
3
+ /** A single `skill → depends_on` edge as stored in `skill_dependencies`. */
4
+ export const skillDependencySchema = z.object({
5
+ skill_id: z.string().uuid(),
6
+ depends_on_skill_id: z.string().uuid(),
7
+ version_pin: z.number().int().positive().nullable(),
8
+ sort_order: z.number().int().nonnegative().default(0),
9
+ created_at: z.string().datetime(),
10
+ });
11
+ /**
12
+ * Hydrated dependency row — same as SkillDependency, but with the
13
+ * target Skill joined in so the UI can render names + slugs without
14
+ * a second round-trip.
15
+ */
16
+ export const dependencyRowSchema = skillDependencySchema.extend({
17
+ target: skillSchema.pick({
18
+ id: true,
19
+ slug: true,
20
+ name: true,
21
+ description: true,
22
+ visibility: true,
23
+ }),
24
+ });
25
+ export const addDependencyInputSchema = z.object({
26
+ depends_on_slug: z
27
+ .string()
28
+ .min(1)
29
+ .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'slug must be kebab-case'),
30
+ version_pin: z.number().int().positive().nullable().optional(),
31
+ sort_order: z.number().int().nonnegative().optional(),
32
+ });
@@ -0,0 +1,65 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * BYOK (Bring Your Own Key) tester input. The API **never** persists
4
+ * the caller's Anthropic key — it's used once for the round-trip and
5
+ * dropped. Store hashes of keys only if rate-limiting is added later.
6
+ */
7
+ export declare const skillTestInputSchema: z.ZodObject<{
8
+ prompt: z.ZodString;
9
+ api_key: z.ZodString;
10
+ model: z.ZodOptional<z.ZodString>;
11
+ max_tokens: z.ZodOptional<z.ZodNumber>;
12
+ temperature: z.ZodOptional<z.ZodNumber>;
13
+ }, "strip", z.ZodTypeAny, {
14
+ prompt: string;
15
+ api_key: string;
16
+ model?: string | undefined;
17
+ max_tokens?: number | undefined;
18
+ temperature?: number | undefined;
19
+ }, {
20
+ prompt: string;
21
+ api_key: string;
22
+ model?: string | undefined;
23
+ max_tokens?: number | undefined;
24
+ temperature?: number | undefined;
25
+ }>;
26
+ export type SkillTestInput = z.infer<typeof skillTestInputSchema>;
27
+ export declare const skillTestResultSchema: z.ZodObject<{
28
+ id: z.ZodString;
29
+ skill_id: z.ZodString;
30
+ model: z.ZodString;
31
+ input_prompt: z.ZodString;
32
+ output: z.ZodString;
33
+ latency_ms: z.ZodNumber;
34
+ input_tokens: z.ZodNullable<z.ZodNumber>;
35
+ output_tokens: z.ZodNullable<z.ZodNumber>;
36
+ status: z.ZodEnum<["pending", "success", "error"]>;
37
+ error_message: z.ZodNullable<z.ZodString>;
38
+ created_at: z.ZodString;
39
+ }, "strip", z.ZodTypeAny, {
40
+ status: "success" | "error" | "pending";
41
+ id: string;
42
+ created_at: string;
43
+ skill_id: string;
44
+ model: string;
45
+ input_tokens: number | null;
46
+ output_tokens: number | null;
47
+ input_prompt: string;
48
+ output: string;
49
+ latency_ms: number;
50
+ error_message: string | null;
51
+ }, {
52
+ status: "success" | "error" | "pending";
53
+ id: string;
54
+ created_at: string;
55
+ skill_id: string;
56
+ model: string;
57
+ input_tokens: number | null;
58
+ output_tokens: number | null;
59
+ input_prompt: string;
60
+ output: string;
61
+ latency_ms: number;
62
+ error_message: string | null;
63
+ }>;
64
+ export type SkillTestResult = z.infer<typeof skillTestResultSchema>;
65
+ //# sourceMappingURL=skill-test.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-test.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/skill-test.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;EAU/B,CAAA;AACF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAYhC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * BYOK (Bring Your Own Key) tester input. The API **never** persists
4
+ * the caller's Anthropic key — it's used once for the round-trip and
5
+ * dropped. Store hashes of keys only if rate-limiting is added later.
6
+ */
7
+ export const skillTestInputSchema = z.object({
8
+ prompt: z.string().min(1).max(12_000),
9
+ api_key: z
10
+ .string()
11
+ .min(10)
12
+ .max(256)
13
+ .regex(/^sk-ant-/, 'Must be an Anthropic key (starts with sk-ant-)'),
14
+ model: z.string().min(1).max(80).optional(),
15
+ max_tokens: z.number().int().min(1).max(8192).optional(),
16
+ temperature: z.number().min(0).max(1).optional(),
17
+ });
18
+ export const skillTestResultSchema = z.object({
19
+ id: z.string().uuid(),
20
+ skill_id: z.string().uuid(),
21
+ model: z.string(),
22
+ input_prompt: z.string(),
23
+ output: z.string(),
24
+ latency_ms: z.number().int().nonnegative(),
25
+ input_tokens: z.number().int().nullable(),
26
+ output_tokens: z.number().int().nullable(),
27
+ status: z.enum(['pending', 'success', 'error']),
28
+ error_message: z.string().nullable(),
29
+ created_at: z.string().datetime(),
30
+ });
@@ -0,0 +1,69 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * A snapshot of a Skill's `content` at one point in time. Written
4
+ * automatically by the API whenever the content changes, plus explicitly
5
+ * on revert. Monotonic per-skill `version` integer, starting at 1.
6
+ */
7
+ export declare const skillVersionSchema: z.ZodObject<{
8
+ id: z.ZodString;
9
+ skill_id: z.ZodString;
10
+ version: z.ZodNumber;
11
+ content: z.ZodString;
12
+ commit_message: z.ZodNullable<z.ZodString>;
13
+ created_by: z.ZodNullable<z.ZodString>;
14
+ created_at: z.ZodString;
15
+ }, "strip", z.ZodTypeAny, {
16
+ id: string;
17
+ content: string;
18
+ created_at: string;
19
+ commit_message: string | null;
20
+ skill_id: string;
21
+ version: number;
22
+ created_by: string | null;
23
+ }, {
24
+ id: string;
25
+ content: string;
26
+ created_at: string;
27
+ commit_message: string | null;
28
+ skill_id: string;
29
+ version: number;
30
+ created_by: string | null;
31
+ }>;
32
+ export type SkillVersion = z.infer<typeof skillVersionSchema>;
33
+ /** Compact list row — omits the full `content` blob so timelines stay cheap. */
34
+ export declare const skillVersionSummarySchema: z.ZodObject<Omit<{
35
+ id: z.ZodString;
36
+ skill_id: z.ZodString;
37
+ version: z.ZodNumber;
38
+ content: z.ZodString;
39
+ commit_message: z.ZodNullable<z.ZodString>;
40
+ created_by: z.ZodNullable<z.ZodString>;
41
+ created_at: z.ZodString;
42
+ }, "content">, "strip", z.ZodTypeAny, {
43
+ id: string;
44
+ created_at: string;
45
+ commit_message: string | null;
46
+ skill_id: string;
47
+ version: number;
48
+ created_by: string | null;
49
+ }, {
50
+ id: string;
51
+ created_at: string;
52
+ commit_message: string | null;
53
+ skill_id: string;
54
+ version: number;
55
+ created_by: string | null;
56
+ }>;
57
+ export type SkillVersionSummary = z.infer<typeof skillVersionSummarySchema>;
58
+ export declare const revertSkillInputSchema: z.ZodObject<{
59
+ version: z.ZodNumber;
60
+ commit_message: z.ZodOptional<z.ZodString>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ version: number;
63
+ commit_message?: string | undefined;
64
+ }, {
65
+ version: number;
66
+ commit_message?: string | undefined;
67
+ }>;
68
+ export type RevertSkillInput = z.infer<typeof revertSkillInputSchema>;
69
+ //# sourceMappingURL=skill-version.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill-version.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/skill-version.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;EAQ7B,CAAA;AACF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAE7D,gFAAgF;AAChF,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;EAA6C,CAAA;AACnF,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAE3E,eAAO,MAAM,sBAAsB;;;;;;;;;EAGjC,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * A snapshot of a Skill's `content` at one point in time. Written
4
+ * automatically by the API whenever the content changes, plus explicitly
5
+ * on revert. Monotonic per-skill `version` integer, starting at 1.
6
+ */
7
+ export const skillVersionSchema = z.object({
8
+ id: z.string().uuid(),
9
+ skill_id: z.string().uuid(),
10
+ version: z.number().int().positive(),
11
+ content: z.string(),
12
+ commit_message: z.string().nullable(),
13
+ created_by: z.string().uuid().nullable(),
14
+ created_at: z.string().datetime(),
15
+ });
16
+ /** Compact list row — omits the full `content` blob so timelines stay cheap. */
17
+ export const skillVersionSummarySchema = skillVersionSchema.omit({ content: true });
18
+ export const revertSkillInputSchema = z.object({
19
+ version: z.number().int().positive(),
20
+ commit_message: z.string().max(200).optional(),
21
+ });
@@ -0,0 +1,180 @@
1
+ import { z } from 'zod';
2
+ export declare const skillVisibilitySchema: z.ZodEnum<["public", "private", "org"]>;
3
+ export type SkillVisibility = z.infer<typeof skillVisibilitySchema>;
4
+ export declare const skillSchema: z.ZodObject<{
5
+ id: z.ZodString;
6
+ owner_id: z.ZodString;
7
+ name: z.ZodString;
8
+ slug: z.ZodString;
9
+ description: z.ZodNullable<z.ZodString>;
10
+ content: z.ZodNullable<z.ZodString>;
11
+ visibility: z.ZodDefault<z.ZodEnum<["public", "private", "org"]>>;
12
+ source_repo: z.ZodNullable<z.ZodString>;
13
+ license: z.ZodDefault<z.ZodString>;
14
+ category: z.ZodNullable<z.ZodString>;
15
+ tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
16
+ install_count: z.ZodDefault<z.ZodNumber>;
17
+ bookmark_count: z.ZodDefault<z.ZodNumber>;
18
+ is_verified: z.ZodDefault<z.ZodBoolean>;
19
+ price_cents: z.ZodDefault<z.ZodNumber>;
20
+ currency: z.ZodDefault<z.ZodString>;
21
+ /** Attached by the API on GET: true if the caller has paid for the Skill. */
22
+ purchased: z.ZodOptional<z.ZodBoolean>;
23
+ /** Attached by the API on GET: true if the caller is the owner. */
24
+ is_owner: z.ZodOptional<z.ZodBoolean>;
25
+ /** Attached by the API on GET: true if the caller has bookmarked the Skill. */
26
+ bookmarked: z.ZodOptional<z.ZodBoolean>;
27
+ created_at: z.ZodString;
28
+ updated_at: z.ZodString;
29
+ }, "strip", z.ZodTypeAny, {
30
+ id: string;
31
+ owner_id: string;
32
+ name: string;
33
+ slug: string;
34
+ description: string | null;
35
+ content: string | null;
36
+ visibility: "public" | "private" | "org";
37
+ source_repo: string | null;
38
+ license: string;
39
+ category: string | null;
40
+ tags: string[];
41
+ install_count: number;
42
+ bookmark_count: number;
43
+ is_verified: boolean;
44
+ price_cents: number;
45
+ currency: string;
46
+ created_at: string;
47
+ updated_at: string;
48
+ purchased?: boolean | undefined;
49
+ is_owner?: boolean | undefined;
50
+ bookmarked?: boolean | undefined;
51
+ }, {
52
+ id: string;
53
+ owner_id: string;
54
+ name: string;
55
+ slug: string;
56
+ description: string | null;
57
+ content: string | null;
58
+ source_repo: string | null;
59
+ category: string | null;
60
+ created_at: string;
61
+ updated_at: string;
62
+ visibility?: "public" | "private" | "org" | undefined;
63
+ license?: string | undefined;
64
+ tags?: string[] | undefined;
65
+ install_count?: number | undefined;
66
+ bookmark_count?: number | undefined;
67
+ is_verified?: boolean | undefined;
68
+ price_cents?: number | undefined;
69
+ currency?: string | undefined;
70
+ purchased?: boolean | undefined;
71
+ is_owner?: boolean | undefined;
72
+ bookmarked?: boolean | undefined;
73
+ }>;
74
+ export type Skill = z.infer<typeof skillSchema>;
75
+ export declare const createSkillInputSchema: z.ZodObject<{
76
+ name: z.ZodString;
77
+ slug: z.ZodString;
78
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
+ content: z.ZodOptional<z.ZodNullable<z.ZodString>>;
80
+ visibility: z.ZodOptional<z.ZodDefault<z.ZodEnum<["public", "private", "org"]>>>;
81
+ source_repo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
+ license: z.ZodOptional<z.ZodDefault<z.ZodString>>;
83
+ category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
+ tags: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>;
85
+ price_cents: z.ZodOptional<z.ZodDefault<z.ZodNumber>>;
86
+ currency: z.ZodOptional<z.ZodDefault<z.ZodString>>;
87
+ }, "strip", z.ZodTypeAny, {
88
+ name: string;
89
+ slug: string;
90
+ description?: string | null | undefined;
91
+ content?: string | null | undefined;
92
+ visibility?: "public" | "private" | "org" | undefined;
93
+ source_repo?: string | null | undefined;
94
+ license?: string | undefined;
95
+ category?: string | null | undefined;
96
+ tags?: string[] | undefined;
97
+ price_cents?: number | undefined;
98
+ currency?: string | undefined;
99
+ }, {
100
+ name: string;
101
+ slug: string;
102
+ description?: string | null | undefined;
103
+ content?: string | null | undefined;
104
+ visibility?: "public" | "private" | "org" | undefined;
105
+ source_repo?: string | null | undefined;
106
+ license?: string | undefined;
107
+ category?: string | null | undefined;
108
+ tags?: string[] | undefined;
109
+ price_cents?: number | undefined;
110
+ currency?: string | undefined;
111
+ }>;
112
+ export type CreateSkillInput = z.infer<typeof createSkillInputSchema>;
113
+ export declare const updateSkillInputSchema: z.ZodObject<{
114
+ name: z.ZodOptional<z.ZodString>;
115
+ slug: z.ZodOptional<z.ZodString>;
116
+ description: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
117
+ content: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
118
+ visibility: z.ZodOptional<z.ZodOptional<z.ZodDefault<z.ZodEnum<["public", "private", "org"]>>>>;
119
+ source_repo: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
120
+ license: z.ZodOptional<z.ZodOptional<z.ZodDefault<z.ZodString>>>;
121
+ category: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
122
+ tags: z.ZodOptional<z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodString, "many">>>>;
123
+ price_cents: z.ZodOptional<z.ZodOptional<z.ZodDefault<z.ZodNumber>>>;
124
+ currency: z.ZodOptional<z.ZodOptional<z.ZodDefault<z.ZodString>>>;
125
+ } & {
126
+ commit_message: z.ZodOptional<z.ZodString>;
127
+ }, "strip", z.ZodTypeAny, {
128
+ name?: string | undefined;
129
+ slug?: string | undefined;
130
+ description?: string | null | undefined;
131
+ content?: string | null | undefined;
132
+ visibility?: "public" | "private" | "org" | undefined;
133
+ source_repo?: string | null | undefined;
134
+ license?: string | undefined;
135
+ category?: string | null | undefined;
136
+ tags?: string[] | undefined;
137
+ price_cents?: number | undefined;
138
+ currency?: string | undefined;
139
+ commit_message?: string | undefined;
140
+ }, {
141
+ name?: string | undefined;
142
+ slug?: string | undefined;
143
+ description?: string | null | undefined;
144
+ content?: string | null | undefined;
145
+ visibility?: "public" | "private" | "org" | undefined;
146
+ source_repo?: string | null | undefined;
147
+ license?: string | undefined;
148
+ category?: string | null | undefined;
149
+ tags?: string[] | undefined;
150
+ price_cents?: number | undefined;
151
+ currency?: string | undefined;
152
+ commit_message?: string | undefined;
153
+ }>;
154
+ export type UpdateSkillInput = z.infer<typeof updateSkillInputSchema>;
155
+ export declare const skillSortSchema: z.ZodEnum<["trending", "popular", "newest", "relevance"]>;
156
+ export type SkillSort = z.infer<typeof skillSortSchema>;
157
+ export declare const skillSearchQuerySchema: z.ZodObject<{
158
+ q: z.ZodOptional<z.ZodString>;
159
+ category: z.ZodOptional<z.ZodString>;
160
+ tag: z.ZodOptional<z.ZodString>;
161
+ sort: z.ZodDefault<z.ZodEnum<["trending", "popular", "newest", "relevance"]>>;
162
+ limit: z.ZodDefault<z.ZodNumber>;
163
+ offset: z.ZodDefault<z.ZodNumber>;
164
+ }, "strip", z.ZodTypeAny, {
165
+ sort: "trending" | "popular" | "newest" | "relevance";
166
+ limit: number;
167
+ offset: number;
168
+ category?: string | undefined;
169
+ q?: string | undefined;
170
+ tag?: string | undefined;
171
+ }, {
172
+ sort?: "trending" | "popular" | "newest" | "relevance" | undefined;
173
+ category?: string | undefined;
174
+ q?: string | undefined;
175
+ tag?: string | undefined;
176
+ limit?: number | undefined;
177
+ offset?: number | undefined;
178
+ }>;
179
+ export type SkillSearchQuery = z.infer<typeof skillSearchQuerySchema>;
180
+ //# sourceMappingURL=skill.schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"skill.schema.d.ts","sourceRoot":"","sources":["../../src/schemas/skill.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,qBAAqB,yCAAuC,CAAA;AACzE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;IAqBtB,6EAA6E;;IAE7E,mEAAmE;;IAEnE,+EAA+E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAI/E,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAA;AAE/C,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwB/B,CAAA;AACJ,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAErE,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEjC,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA;AAErE,eAAO,MAAM,eAAe,2DAAyD,CAAA;AACrF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA;AAEvD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;EAOjC,CAAA;AACF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAA"}
@@ -0,0 +1,69 @@
1
+ import { z } from 'zod';
2
+ export const skillVisibilitySchema = z.enum(['public', 'private', 'org']);
3
+ export const skillSchema = z.object({
4
+ id: z.string().uuid(),
5
+ owner_id: z.string().uuid(),
6
+ name: z.string().min(1).max(120),
7
+ slug: z
8
+ .string()
9
+ .min(1)
10
+ .max(120)
11
+ .regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/, 'slug must be kebab-case'),
12
+ description: z.string().max(500).nullable(),
13
+ content: z.string().nullable(),
14
+ visibility: skillVisibilitySchema.default('public'),
15
+ source_repo: z.string().url().nullable(),
16
+ license: z.string().default('MIT'),
17
+ category: z.string().nullable(),
18
+ tags: z.array(z.string()).default([]),
19
+ install_count: z.number().int().nonnegative().default(0),
20
+ bookmark_count: z.number().int().nonnegative().default(0),
21
+ is_verified: z.boolean().default(false),
22
+ price_cents: z.number().int().nonnegative().default(0),
23
+ currency: z.string().default('EUR'),
24
+ /** Attached by the API on GET: true if the caller has paid for the Skill. */
25
+ purchased: z.boolean().optional(),
26
+ /** Attached by the API on GET: true if the caller is the owner. */
27
+ is_owner: z.boolean().optional(),
28
+ /** Attached by the API on GET: true if the caller has bookmarked the Skill. */
29
+ bookmarked: z.boolean().optional(),
30
+ created_at: z.string().datetime(),
31
+ updated_at: z.string().datetime(),
32
+ });
33
+ export const createSkillInputSchema = skillSchema
34
+ .pick({
35
+ name: true,
36
+ slug: true,
37
+ description: true,
38
+ content: true,
39
+ visibility: true,
40
+ source_repo: true,
41
+ license: true,
42
+ category: true,
43
+ tags: true,
44
+ price_cents: true,
45
+ currency: true,
46
+ })
47
+ .partial({
48
+ description: true,
49
+ content: true,
50
+ visibility: true,
51
+ source_repo: true,
52
+ license: true,
53
+ category: true,
54
+ tags: true,
55
+ price_cents: true,
56
+ currency: true,
57
+ });
58
+ export const updateSkillInputSchema = createSkillInputSchema.partial().extend({
59
+ commit_message: z.string().max(200).optional(),
60
+ });
61
+ export const skillSortSchema = z.enum(['trending', 'popular', 'newest', 'relevance']);
62
+ export const skillSearchQuerySchema = z.object({
63
+ q: z.string().trim().max(200).optional(),
64
+ category: z.string().optional(),
65
+ tag: z.string().optional(),
66
+ sort: skillSortSchema.default('trending'),
67
+ limit: z.coerce.number().int().min(1).max(100).default(24),
68
+ offset: z.coerce.number().int().nonnegative().default(0),
69
+ });
@@ -0,0 +1,19 @@
1
+ export type UserPlan = 'free' | 'pro' | 'team';
2
+ export type UserRole = 'user' | 'admin';
3
+ export interface Profile {
4
+ id: string;
5
+ username: string | null;
6
+ display_name: string | null;
7
+ avatar_url: string | null;
8
+ github_username: string | null;
9
+ role: UserRole;
10
+ plan: UserPlan;
11
+ stripe_customer_id: string | null;
12
+ created_at: string;
13
+ updated_at: string;
14
+ }
15
+ export interface AuthUser {
16
+ id: string;
17
+ email: string;
18
+ }
19
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAA;AAC9C,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAEvC,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,QAAQ,CAAA;IACd,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;CACd"}
@@ -0,0 +1 @@
1
+ export {};
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@prave/shared",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "main": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "files": [
11
+ "dist"
12
+ ],
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "development": "./src/index.ts",
17
+ "import": "./dist/index.js",
18
+ "default": "./dist/index.js"
19
+ },
20
+ "./schemas": {
21
+ "types": "./dist/schemas/index.d.ts",
22
+ "development": "./src/schemas/index.ts",
23
+ "import": "./dist/schemas/index.js",
24
+ "default": "./dist/schemas/index.js"
25
+ },
26
+ "./types": {
27
+ "types": "./dist/types/index.d.ts",
28
+ "development": "./src/types/index.ts",
29
+ "import": "./dist/types/index.js",
30
+ "default": "./dist/types/index.js"
31
+ }
32
+ },
33
+ "dependencies": {
34
+ "zod": "^3.23.8"
35
+ },
36
+ "devDependencies": {
37
+ "typescript": "^5.4.5"
38
+ },
39
+ "scripts": {
40
+ "build": "tsc -p tsconfig.json",
41
+ "typecheck": "tsc -p tsconfig.json --noEmit"
42
+ }
43
+ }