@prave/shared 0.1.0 → 0.2.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/dist/schemas/billing.schema.d.ts +7 -7
- package/dist/schemas/billing.schema.d.ts.map +1 -1
- package/dist/schemas/billing.schema.js +2 -2
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/install.schema.d.ts +27 -5
- package/dist/schemas/install.schema.d.ts.map +1 -1
- package/dist/schemas/marketplace.schema.d.ts +2 -2
- package/dist/schemas/marketplace.schema.d.ts.map +1 -1
- package/dist/schemas/marketplace.schema.js +2 -2
- package/dist/schemas/org.schema.d.ts +3 -3
- package/dist/schemas/search.schema.d.ts +41 -3
- package/dist/schemas/search.schema.d.ts.map +1 -1
- package/dist/schemas/skill-dependency.schema.d.ts +27 -5
- package/dist/schemas/skill-dependency.schema.d.ts.map +1 -1
- package/dist/schemas/skill-pr.schema.d.ts +405 -0
- package/dist/schemas/skill-pr.schema.d.ts.map +1 -0
- package/dist/schemas/skill-pr.schema.js +64 -0
- package/dist/schemas/skill.schema.d.ts +76 -10
- package/dist/schemas/skill.schema.d.ts.map +1 -1
- package/dist/schemas/skill.schema.js +16 -1
- package/dist/types/categories.d.ts +5 -0
- package/dist/types/categories.d.ts.map +1 -0
- package/dist/types/categories.js +35 -0
- package/dist/types/index.d.ts +25 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -1
- package/dist/types/plan-limits.d.ts +62 -0
- package/dist/types/plan-limits.d.ts.map +1 -0
- package/dist/types/plan-limits.js +88 -0
- package/package.json +1 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const SKILL_CATEGORIES: readonly ["engineering", "design", "marketing", "research", "writing", "analytics", "productivity", "devops", "data", "ai", "security", "product", "workflow-orchestration", "other"];
|
|
2
|
+
export type SkillCategory = (typeof SKILL_CATEGORIES)[number];
|
|
3
|
+
export declare const CATEGORY_LABELS: Record<SkillCategory, string>;
|
|
4
|
+
export declare function isSkillCategory(value: unknown): value is SkillCategory;
|
|
5
|
+
//# sourceMappingURL=categories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"categories.d.ts","sourceRoot":"","sources":["../../src/types/categories.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,uLAenB,CAAA;AAEV,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAA;AAE7D,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,aAAa,EAAE,MAAM,CAezD,CAAA;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAEtE"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const SKILL_CATEGORIES = [
|
|
2
|
+
'engineering',
|
|
3
|
+
'design',
|
|
4
|
+
'marketing',
|
|
5
|
+
'research',
|
|
6
|
+
'writing',
|
|
7
|
+
'analytics',
|
|
8
|
+
'productivity',
|
|
9
|
+
'devops',
|
|
10
|
+
'data',
|
|
11
|
+
'ai',
|
|
12
|
+
'security',
|
|
13
|
+
'product',
|
|
14
|
+
'workflow-orchestration',
|
|
15
|
+
'other',
|
|
16
|
+
];
|
|
17
|
+
export const CATEGORY_LABELS = {
|
|
18
|
+
engineering: 'Engineering',
|
|
19
|
+
design: 'Design',
|
|
20
|
+
marketing: 'Marketing',
|
|
21
|
+
research: 'Research',
|
|
22
|
+
writing: 'Writing',
|
|
23
|
+
analytics: 'Analytics',
|
|
24
|
+
productivity: 'Productivity',
|
|
25
|
+
devops: 'DevOps',
|
|
26
|
+
data: 'Data',
|
|
27
|
+
ai: 'AI',
|
|
28
|
+
security: 'Security',
|
|
29
|
+
product: 'Product',
|
|
30
|
+
'workflow-orchestration': 'Workflow',
|
|
31
|
+
other: 'Other',
|
|
32
|
+
};
|
|
33
|
+
export function isSkillCategory(value) {
|
|
34
|
+
return typeof value === 'string' && SKILL_CATEGORIES.includes(value);
|
|
35
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './categories.js';
|
|
2
|
+
export * from './plan-limits.js';
|
|
3
|
+
export type UserPlan = 'free' | 'explorer' | 'creator';
|
|
2
4
|
export type UserRole = 'user' | 'admin';
|
|
3
5
|
export interface Profile {
|
|
4
6
|
id: string;
|
|
@@ -6,12 +8,34 @@ export interface Profile {
|
|
|
6
8
|
display_name: string | null;
|
|
7
9
|
avatar_url: string | null;
|
|
8
10
|
github_username: string | null;
|
|
11
|
+
bio: string | null;
|
|
12
|
+
website_url: string | null;
|
|
13
|
+
is_creator: boolean;
|
|
14
|
+
is_partner: boolean;
|
|
9
15
|
role: UserRole;
|
|
10
16
|
plan: UserPlan;
|
|
11
17
|
stripe_customer_id: string | null;
|
|
12
18
|
created_at: string;
|
|
13
19
|
updated_at: string;
|
|
14
20
|
}
|
|
21
|
+
/** Public-safe profile slice — no plan, no stripe ids, no role. */
|
|
22
|
+
export interface PublicProfile {
|
|
23
|
+
id: string;
|
|
24
|
+
username: string | null;
|
|
25
|
+
display_name: string | null;
|
|
26
|
+
avatar_url: string | null;
|
|
27
|
+
github_username: string | null;
|
|
28
|
+
bio: string | null;
|
|
29
|
+
website_url: string | null;
|
|
30
|
+
is_creator: boolean;
|
|
31
|
+
is_partner: boolean;
|
|
32
|
+
created_at: string;
|
|
33
|
+
}
|
|
34
|
+
export interface PublicProfilePage {
|
|
35
|
+
profile: PublicProfile;
|
|
36
|
+
skills: import('../schemas/skill.schema.js').Skill[];
|
|
37
|
+
skill_count: number;
|
|
38
|
+
}
|
|
15
39
|
export interface AuthUser {
|
|
16
40
|
id: string;
|
|
17
41
|
email: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"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CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,aAAa,CAAA;IACtB,MAAM,EAAE,OAAO,4BAA4B,EAAE,KAAK,EAAE,CAAA;IACpD,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;CACd"}
|
package/dist/types/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './categories.js';
|
|
2
|
+
export * from './plan-limits.js';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Plan } from '../schemas/billing.schema.js';
|
|
2
|
+
/**
|
|
3
|
+
* PLAN_LIMITS — single source of truth for every gate, quota and copy
|
|
4
|
+
* choice across the app. Backend uses the numeric/boolean fields to
|
|
5
|
+
* enforce rules; frontend reads the same object to render disabled
|
|
6
|
+
* states + upgrade CTAs; CLI calls /me/plan and resolves limits here so
|
|
7
|
+
* one config drives all three surfaces.
|
|
8
|
+
*
|
|
9
|
+
* `null` numeric limits = unlimited.
|
|
10
|
+
*/
|
|
11
|
+
export interface PlanLimits {
|
|
12
|
+
/** Display label used in pricing cards / Settings */
|
|
13
|
+
label: string;
|
|
14
|
+
/** Monthly price in EUR (display only — Stripe is the source of truth) */
|
|
15
|
+
price_eur_monthly: number;
|
|
16
|
+
/** Marketing tagline for the plan card */
|
|
17
|
+
tagline: string;
|
|
18
|
+
/** Marketplace creator share (0–1). Free can't sell. */
|
|
19
|
+
creator_revenue_share: number | null;
|
|
20
|
+
/** Max public skills the user can publish. null = unlimited. */
|
|
21
|
+
max_public_skills: number | null;
|
|
22
|
+
/** Can the user create private skills? */
|
|
23
|
+
can_private_skills: boolean;
|
|
24
|
+
/** Max private skills if allowed. null = unlimited. */
|
|
25
|
+
max_private_skills: number | null;
|
|
26
|
+
/** History tab + revert. */
|
|
27
|
+
can_versioning: boolean;
|
|
28
|
+
/** Max paid skills listed simultaneously. 0 = no marketplace. null = unlimited. */
|
|
29
|
+
max_marketplace_listings: number | null;
|
|
30
|
+
/** Monthly BYOK tester runs. 0 = blocked. null = unlimited. */
|
|
31
|
+
tester_credits_monthly: number | null;
|
|
32
|
+
/** Max bookmarks. null = unlimited. */
|
|
33
|
+
max_bookmarks: number | null;
|
|
34
|
+
/** Total skills the user may import via CLI. null = unlimited. */
|
|
35
|
+
cli_max_imports: number | null;
|
|
36
|
+
/** Monthly export quota via CLI. 0 = blocked. null = unlimited. */
|
|
37
|
+
cli_exports_monthly: number | null;
|
|
38
|
+
/** `prave sync` enabled. */
|
|
39
|
+
can_cli_sync: boolean;
|
|
40
|
+
/** Auto-update on `prave sync` rather than diff-only. */
|
|
41
|
+
can_cli_auto_update: boolean;
|
|
42
|
+
/** `prave install --bulk`, `prave export --bulk`. */
|
|
43
|
+
can_cli_bulk: boolean;
|
|
44
|
+
/** Drag-and-drop block builder UI. */
|
|
45
|
+
can_block_builder: boolean;
|
|
46
|
+
/** CI-style skill pipelines + automated tests. */
|
|
47
|
+
can_pipelines: boolean;
|
|
48
|
+
/** Per-skill analytics page. */
|
|
49
|
+
can_analytics: boolean;
|
|
50
|
+
/** Verified Creator badge on public profile. */
|
|
51
|
+
has_creator_badge: boolean;
|
|
52
|
+
}
|
|
53
|
+
export declare const PLAN_LIMITS: Record<Plan, PlanLimits>;
|
|
54
|
+
export declare const PLAN_RANK: Record<Plan, number>;
|
|
55
|
+
/** True when `actual` includes everything `required` does. */
|
|
56
|
+
export declare const planMeets: (actual: Plan, required: Plan) => boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Smallest plan that satisfies a feature flag. Used by the UI to render
|
|
59
|
+
* accurate "Upgrade to X" CTAs without hard-coding plan names.
|
|
60
|
+
*/
|
|
61
|
+
export declare const minPlanFor: (feature: keyof PlanLimits) => Plan | null;
|
|
62
|
+
//# sourceMappingURL=plan-limits.d.ts.map
|
|
@@ -0,0 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AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE,UAAU,CA+EhD,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE,MAAM,CAI1C,CAAA;AAED,8DAA8D;AAC9D,eAAO,MAAM,SAAS,GAAI,QAAQ,IAAI,EAAE,UAAU,IAAI,KAAG,OACf,CAAA;AAE1C;;;GAGG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,UAAU,KAAG,IAAI,GAAG,IAO7D,CAAA"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export const PLAN_LIMITS = {
|
|
2
|
+
free: {
|
|
3
|
+
label: 'Starter',
|
|
4
|
+
price_eur_monthly: 0,
|
|
5
|
+
tagline: 'Discover, install and try Prave Skills.',
|
|
6
|
+
creator_revenue_share: null,
|
|
7
|
+
max_public_skills: 3,
|
|
8
|
+
can_private_skills: false,
|
|
9
|
+
max_private_skills: 0,
|
|
10
|
+
can_versioning: false,
|
|
11
|
+
max_marketplace_listings: 0,
|
|
12
|
+
tester_credits_monthly: 0,
|
|
13
|
+
max_bookmarks: 5,
|
|
14
|
+
cli_max_imports: 10,
|
|
15
|
+
cli_exports_monthly: 0,
|
|
16
|
+
can_cli_sync: false,
|
|
17
|
+
can_cli_auto_update: false,
|
|
18
|
+
can_cli_bulk: false,
|
|
19
|
+
can_block_builder: false,
|
|
20
|
+
can_pipelines: false,
|
|
21
|
+
can_analytics: false,
|
|
22
|
+
has_creator_badge: false,
|
|
23
|
+
},
|
|
24
|
+
explorer: {
|
|
25
|
+
label: 'Explorer',
|
|
26
|
+
price_eur_monthly: 4,
|
|
27
|
+
tagline: 'For developers building, sharing and selling Skills.',
|
|
28
|
+
creator_revenue_share: 0.7,
|
|
29
|
+
max_public_skills: 20,
|
|
30
|
+
can_private_skills: true,
|
|
31
|
+
max_private_skills: 20,
|
|
32
|
+
can_versioning: true,
|
|
33
|
+
max_marketplace_listings: 5,
|
|
34
|
+
tester_credits_monthly: 30,
|
|
35
|
+
max_bookmarks: null,
|
|
36
|
+
cli_max_imports: null,
|
|
37
|
+
cli_exports_monthly: 50,
|
|
38
|
+
can_cli_sync: true,
|
|
39
|
+
can_cli_auto_update: false,
|
|
40
|
+
can_cli_bulk: false,
|
|
41
|
+
can_block_builder: false,
|
|
42
|
+
can_pipelines: false,
|
|
43
|
+
can_analytics: false,
|
|
44
|
+
has_creator_badge: false,
|
|
45
|
+
},
|
|
46
|
+
creator: {
|
|
47
|
+
label: 'Creator',
|
|
48
|
+
price_eur_monthly: 10,
|
|
49
|
+
tagline: 'For power users shipping and selling Skills daily.',
|
|
50
|
+
creator_revenue_share: 0.7,
|
|
51
|
+
max_public_skills: null,
|
|
52
|
+
can_private_skills: true,
|
|
53
|
+
max_private_skills: null,
|
|
54
|
+
can_versioning: true,
|
|
55
|
+
max_marketplace_listings: null,
|
|
56
|
+
tester_credits_monthly: 150,
|
|
57
|
+
max_bookmarks: null,
|
|
58
|
+
cli_max_imports: null,
|
|
59
|
+
cli_exports_monthly: null,
|
|
60
|
+
can_cli_sync: true,
|
|
61
|
+
can_cli_auto_update: true,
|
|
62
|
+
can_cli_bulk: true,
|
|
63
|
+
can_block_builder: true,
|
|
64
|
+
can_pipelines: true,
|
|
65
|
+
can_analytics: true,
|
|
66
|
+
has_creator_badge: true,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
export const PLAN_RANK = {
|
|
70
|
+
free: 0,
|
|
71
|
+
explorer: 1,
|
|
72
|
+
creator: 2,
|
|
73
|
+
};
|
|
74
|
+
/** True when `actual` includes everything `required` does. */
|
|
75
|
+
export const planMeets = (actual, required) => PLAN_RANK[actual] >= PLAN_RANK[required];
|
|
76
|
+
/**
|
|
77
|
+
* Smallest plan that satisfies a feature flag. Used by the UI to render
|
|
78
|
+
* accurate "Upgrade to X" CTAs without hard-coding plan names.
|
|
79
|
+
*/
|
|
80
|
+
export const minPlanFor = (feature) => {
|
|
81
|
+
const order = ['free', 'explorer', 'creator'];
|
|
82
|
+
for (const plan of order) {
|
|
83
|
+
const v = PLAN_LIMITS[plan][feature];
|
|
84
|
+
if (typeof v === 'boolean' ? v : v !== 0)
|
|
85
|
+
return plan;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
};
|