@kitsuden/shared 0.0.0-stage → 0.9.0-beta

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 (84) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +65 -2
  3. package/dist/admin-registry-contract.d.ts +99 -0
  4. package/dist/admin-registry-contract.d.ts.map +1 -0
  5. package/dist/admin-view.d.ts +123 -0
  6. package/dist/admin-view.d.ts.map +1 -0
  7. package/dist/agent-permission.d.ts +161 -0
  8. package/dist/agent-permission.d.ts.map +1 -0
  9. package/dist/approvals.d.ts +164 -0
  10. package/dist/approvals.d.ts.map +1 -0
  11. package/dist/automation.d.ts +175 -0
  12. package/dist/automation.d.ts.map +1 -0
  13. package/dist/block-keys.d.ts +82 -0
  14. package/dist/block-keys.d.ts.map +1 -0
  15. package/dist/code-scan.d.ts +64 -0
  16. package/dist/code-scan.d.ts.map +1 -0
  17. package/dist/comment-subjects.d.ts +129 -0
  18. package/dist/comment-subjects.d.ts.map +1 -0
  19. package/dist/connections.d.ts +96 -0
  20. package/dist/connections.d.ts.map +1 -0
  21. package/dist/constants.d.ts +37 -0
  22. package/dist/constants.d.ts.map +1 -0
  23. package/dist/content-publishing.d.ts +34 -0
  24. package/dist/content-publishing.d.ts.map +1 -0
  25. package/dist/contracts.d.ts +87 -0
  26. package/dist/contracts.d.ts.map +1 -0
  27. package/dist/dataset-catalog.d.ts +91 -0
  28. package/dist/dataset-catalog.d.ts.map +1 -0
  29. package/dist/deck-analysis.d.ts +63 -0
  30. package/dist/deck-analysis.d.ts.map +1 -0
  31. package/dist/env.d.ts +2 -0
  32. package/dist/env.d.ts.map +1 -0
  33. package/dist/errors.d.ts +275 -0
  34. package/dist/errors.d.ts.map +1 -0
  35. package/dist/field-types.d.ts +304 -0
  36. package/dist/field-types.d.ts.map +1 -0
  37. package/dist/index.d.ts +79 -0
  38. package/dist/index.d.ts.map +1 -0
  39. package/dist/index.js +7785 -0
  40. package/dist/kon-api.d.ts +914 -0
  41. package/dist/kon-api.d.ts.map +1 -0
  42. package/dist/kon-entities.d.ts +204 -0
  43. package/dist/kon-entities.d.ts.map +1 -0
  44. package/dist/kon-events.d.ts +103 -0
  45. package/dist/kon-events.d.ts.map +1 -0
  46. package/dist/kon-package.d.ts +124 -0
  47. package/dist/kon-package.d.ts.map +1 -0
  48. package/dist/link-relations.d.ts +73 -0
  49. package/dist/link-relations.d.ts.map +1 -0
  50. package/dist/meta-levels.d.ts +81 -0
  51. package/dist/meta-levels.d.ts.map +1 -0
  52. package/dist/models-sql.d.ts +110 -0
  53. package/dist/models-sql.d.ts.map +1 -0
  54. package/dist/models.d.ts +354 -0
  55. package/dist/models.d.ts.map +1 -0
  56. package/dist/operations.d.ts +428 -0
  57. package/dist/operations.d.ts.map +1 -0
  58. package/dist/promotion.d.ts +244 -0
  59. package/dist/promotion.d.ts.map +1 -0
  60. package/dist/public-site.d.ts +106 -0
  61. package/dist/public-site.d.ts.map +1 -0
  62. package/dist/render-blocks.d.ts +150 -0
  63. package/dist/render-blocks.d.ts.map +1 -0
  64. package/dist/reports.d.ts +109 -0
  65. package/dist/reports.d.ts.map +1 -0
  66. package/dist/rls-builder.d.ts +136 -0
  67. package/dist/rls-builder.d.ts.map +1 -0
  68. package/dist/safe-pattern.d.ts +47 -0
  69. package/dist/safe-pattern.d.ts.map +1 -0
  70. package/dist/schemas.d.ts +977 -0
  71. package/dist/schemas.d.ts.map +1 -0
  72. package/dist/sensitivity.d.ts +37 -0
  73. package/dist/sensitivity.d.ts.map +1 -0
  74. package/dist/signer.d.ts +67 -0
  75. package/dist/signer.d.ts.map +1 -0
  76. package/dist/tier-ranges.d.ts +37 -0
  77. package/dist/tier-ranges.d.ts.map +1 -0
  78. package/dist/types.d.ts +261 -0
  79. package/dist/types.d.ts.map +1 -0
  80. package/dist/utils.d.ts +71 -0
  81. package/dist/utils.d.ts.map +1 -0
  82. package/dist/wiki-links.d.ts +56 -0
  83. package/dist/wiki-links.d.ts.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAarC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAcnC,CAAC;AAEL,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAM9E;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,OAAO,GAAG,iBAAiB,CAE1E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,OAAO,GACZ;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,iBAAiB,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAA;CAAE,CAMpF;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,MAAM,CAExC;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,eAAe,CA6BhF"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Field sensitivity: which values must not leave for a third party
3
+ * ============================================================================
4
+ *
5
+ * A dataset field or a kon column can be marked:
6
+ *
7
+ * dataset field: { "key": "email", "type": "text", "sensitivity": "customer" }
8
+ * kon manifest: "sensitivity": { "crm_contacts": { "email": "customer", "notes": "personal" } }
9
+ *
10
+ * `customer` is data about the business's customers; `personal` is any other
11
+ * personal data. Both are treated the same on the way out (the API refuses or
12
+ * redacts them for hosts not allowed for customer data); the level is kept so
13
+ * the audit says which kind it was. Unmarked fields carry no restriction.
14
+ *
15
+ * Marking does NOT change who may read a field: that is still scopes and RLS.
16
+ * It limits where an execution that read it may send it (docs/agents/egress.md).
17
+ */
18
+ export declare const SENSITIVITY_LEVELS: readonly ["customer", "personal"];
19
+ export type Sensitivity = (typeof SENSITIVITY_LEVELS)[number];
20
+ export declare function isSensitivity(v: unknown): v is Sensitivity;
21
+ /**
22
+ * The marked fields of a dataset schema (either shape of `data_sets.schema`),
23
+ * repeater subfields included: `{ key → level }`.
24
+ */
25
+ export declare function markedDatasetFields(schema: unknown): Record<string, Sensitivity>;
26
+ /**
27
+ * Fields whose mark a schema change removes or weakens (`customer` → `personal`
28
+ * counts as kept: both are protected the same way). Used to stop an agent from
29
+ * unmarking a field it then wants to send out.
30
+ */
31
+ export declare function droppedSensitivity(before: unknown, after: unknown): string[];
32
+ /**
33
+ * The `sensitivity` block of a kon manifest, validated:
34
+ * `{ table → { column → level } }`. Anything malformed is ignored.
35
+ */
36
+ export declare function konSensitivity(manifest: unknown): Record<string, Record<string, Sensitivity>>;
37
+ //# sourceMappingURL=sensitivity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sensitivity.d.ts","sourceRoot":"","sources":["../src/sensitivity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,kBAAkB,mCAAoC,CAAC;AACpE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9D,wBAAgB,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,WAAW,CAE1D;AAoBD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAahF;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CAI5E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAa7F"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * The human SIGNER of an agent
3
+ * ============================================================================
4
+ *
5
+ * Each agent can have a fixed responsible human (`sponsor_user_id`), which
6
+ * an admin chooses in the panel. What the agent creates is SIGNED by that human:
7
+ * the `authorId` of a blog entry and the `owner_id` of a dataset's
8
+ * entries; `created_by_id` still says the agent wrote it.
9
+ *
10
+ * The rule is here, pure, so that the blog, the datasets
11
+ * (REST and MCP) and the API apply it the same way. The host leaves on an agent's `user`:
12
+ *
13
+ * sponsor: null → no signer configured
14
+ * sponsor: { userId, valid: true } → team signer (admin or editor)
15
+ * sponsor: { userId, valid: false } → configured but no longer valid (deleted
16
+ * or without a team role)
17
+ *
18
+ * ── THE RULE ────────────────────────────────────────────────────────────────
19
+ *
20
+ * · With a valid signer: no author requested → the signer; requested = signer →
21
+ * the signer; requested SOMEONE ELSE → only if the agent has `admin`, otherwise 403.
22
+ * · With a signer that is no longer valid: 403 `KITSUDEN_E_AGENT_SPONSOR_INVALID`
23
+ * (it creates no signed content until an admin reassigns it), except an
24
+ * agent with `admin` that names another author itself.
25
+ * · Without a signer: as before signers existed. `requested` mode (the blog): the
26
+ * author the agent sends. `nobody` mode (datasets): no owner, unless an
27
+ * agent with `admin` names one.
28
+ *
29
+ * Public guide: docs/agents/approvals.md ("Human signer").
30
+ */
31
+ export interface AgentSigner {
32
+ userId: string;
33
+ /** Exists and is on the team (`admin` or `editor`). */
34
+ valid: boolean;
35
+ /** Why it is not valid: the account does not exist or is no longer on the team. */
36
+ reason?: "not_found" | "not_staff";
37
+ }
38
+ /** The roles that can sign for an agent. */
39
+ export declare const SIGNER_ROLES: readonly ["admin", "editor"];
40
+ export declare function canSign(role: unknown): boolean;
41
+ export type SignatureResolved = {
42
+ ok: true;
43
+ /** The author / owner that is stored (`null` = none). */
44
+ author: string | null;
45
+ why: "sponsor" | "requested" | "none" | "human";
46
+ } | {
47
+ ok: false;
48
+ code: "KITSUDEN_E_AGENT_SPONSOR_INVALID" | "KITSUDEN_E_FORBIDDEN";
49
+ message: string;
50
+ };
51
+ interface UserWithSigner {
52
+ role?: unknown;
53
+ scopes?: unknown;
54
+ sponsor?: unknown;
55
+ }
56
+ /**
57
+ * The author (or owner) of what the caller creates. For a human it returns what was
58
+ * requested as is (each route keeps its usual rule); for an agent it
59
+ * applies the signer rule.
60
+ *
61
+ * @param modeWithoutSigner what to do with an agent WITHOUT a signer: `requested`
62
+ * accepts the author it sends (blog, as before); `nobody` leaves it without an owner
63
+ * unless the agent has `admin` (datasets, as before).
64
+ */
65
+ export declare function agentSignature(user: UserWithSigner | null | undefined, request: string | null | undefined, modeWithoutSigner: "requested" | "nobody"): SignatureResolved;
66
+ export {};
67
+ //# sourceMappingURL=signer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../src/signer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAIH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,uDAAuD;IACvD,KAAK,EAAE,OAAO,CAAC;IACf,mFAAmF;IACnF,MAAM,CAAC,EAAE,WAAW,GAAG,WAAW,CAAC;CACpC;AAED,4CAA4C;AAC5C,eAAO,MAAM,YAAY,8BAA+B,CAAC;AAEzD,wBAAgB,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAE9C;AAED,MAAM,MAAM,iBAAiB,GACzB;IACE,EAAE,EAAE,IAAI,CAAC;IACT,yDAAyD;IACzD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,GAAG,EAAE,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC;CACjD,GACD;IACE,EAAE,EAAE,KAAK,CAAC;IACV,IAAI,EAAE,kCAAkC,GAAG,sBAAsB,CAAC;IAClE,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEN,UAAU,cAAc;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAMD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,cAAc,GAAG,IAAI,GAAG,SAAS,EACvC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAClC,iBAAiB,EAAE,WAAW,GAAG,QAAQ,GACxC,iBAAiB,CAiCnB"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * The bands of a CALCULATED tier list
3
+ * ============================================================================
4
+ *
5
+ * A tier list that comes from a figure —an archetype's share, a base
6
+ * stat— is not placed by anyone by hand: it is sorted and cut by percentiles. The
7
+ * cut lives here because two places that cannot see each other use it:
8
+ *
9
+ * · the LOADER, which writes the tier list and its note;
10
+ * · the WEB, which draws the letter next to an archetype on the game's home page.
11
+ *
12
+ * While it was only in the loader, the web had nowhere to get it from and the
13
+ * only way out was to copy the numbers. Two copies of a percentile cut
14
+ * diverge as soon as someone touches one, and the home page's letter would stop
15
+ * matching the tier list's without anything failing.
16
+ *
17
+ * The NOTE goes with the bands on purpose: a letter without saying what it means
18
+ * reads as a rating, and this rates nothing — it says how much it is played.
19
+ */
20
+ export interface TierBracket {
21
+ id: string;
22
+ label: string;
23
+ color: string;
24
+ /** Percentile it extends to, from 0 to 1. */
25
+ until: number;
26
+ }
27
+ export declare const TIERS: TierBracket[];
28
+ export declare const BRACKETS = "S = top 10% \u00B7 A = next 20% \u00B7 B = next 30% \u00B7 C = next 25% \u00B7 D = bottom 15%";
29
+ /**
30
+ * The band of whoever is at position `index` of `total`.
31
+ *
32
+ * `index` is 0 for the first. A tie is resolved outside: the caller passes
33
+ * the position of the FIRST one with that value, so that two equal figures fall in
34
+ * the same letter.
35
+ */
36
+ export declare function bracketByPosition(index: number, total: number): TierBracket;
37
+ //# sourceMappingURL=tier-ranges.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tier-ranges.d.ts","sourceRoot":"","sources":["../src/tier-ranges.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,KAAK,EAAE,WAAW,EAM9B,CAAC;AAEF,eAAO,MAAM,QAAQ,kGAA8E,CAAC;AAEpG;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,CAI3E"}
@@ -0,0 +1,261 @@
1
+ /**
2
+ * Kitsuden Shared Types
3
+ * These types mirror the Drizzle schema for frontend use
4
+ */
5
+ export interface PageBlock {
6
+ id: string;
7
+ type: string;
8
+ data: Record<string, any>;
9
+ order: number;
10
+ /**
11
+ * Editorial layer (game blocks): what the team edits by hand, e.g.
12
+ * with Inti. `data` belongs to the loaders and is regenerated on every reload; this
13
+ * is not, and reloads keep it by `id`. See `BlockEditorial`.
14
+ */
15
+ editorial?: BlockEditorial;
16
+ }
17
+ /**
18
+ * What is edited in a block without touching its `data`.
19
+ *
20
+ * Whoever draws uses `editorial.title ?? data.title`,
21
+ * `editorial.description ?? data.description`, skips those with `hidden === true` and
22
+ * sorts by `editorial.order ?? order`. Without `editorial`, everything as before.
23
+ * (Up to 0.8 these keys were `titulo`, `descripcion`, `oculto`, `orden`: see `block-keys.ts`.)
24
+ */
25
+ export interface BlockEditorial {
26
+ title?: string;
27
+ description?: string;
28
+ hidden?: boolean;
29
+ order?: number;
30
+ }
31
+ export interface SEOMeta {
32
+ title?: string;
33
+ description?: string;
34
+ image?: MediaItem;
35
+ canonicalUrl?: string;
36
+ noIndex?: boolean;
37
+ }
38
+ export interface MediaItem {
39
+ id: string;
40
+ url: string;
41
+ alt: string;
42
+ caption?: string;
43
+ width?: number;
44
+ height?: number;
45
+ sizes?: {
46
+ thumbnail?: {
47
+ url: string;
48
+ width: number;
49
+ height: number;
50
+ };
51
+ card?: {
52
+ url: string;
53
+ width: number;
54
+ height: number;
55
+ };
56
+ hero?: {
57
+ url: string;
58
+ width: number;
59
+ height: number;
60
+ };
61
+ og?: {
62
+ url: string;
63
+ width: number;
64
+ height: number;
65
+ };
66
+ };
67
+ }
68
+ export interface Platform {
69
+ id: string;
70
+ name: string;
71
+ slug: string;
72
+ shortName?: string;
73
+ manufacturer?: string;
74
+ icon?: MediaItem;
75
+ }
76
+ export interface Tag {
77
+ id: string;
78
+ name: string;
79
+ slug: string;
80
+ color?: string;
81
+ category?: "genre" | "feature" | "topic" | "series";
82
+ }
83
+ export interface Game {
84
+ id: string;
85
+ title: string;
86
+ slug: string;
87
+ subtitle?: string;
88
+ description?: unknown;
89
+ excerpt?: string;
90
+ releaseDate?: string;
91
+ status: "draft" | "published" | "archived";
92
+ platforms?: Platform[];
93
+ tags?: Tag[];
94
+ developer?: string;
95
+ publisher?: string;
96
+ metacriticScore?: number;
97
+ userRating?: number;
98
+ coverArt?: MediaItem;
99
+ screenshots?: Array<{
100
+ image: MediaItem;
101
+ caption?: string;
102
+ }>;
103
+ externalIds?: {
104
+ igdbId?: number;
105
+ steamAppId?: number;
106
+ twitchGameId?: string;
107
+ };
108
+ trailerUrl?: string;
109
+ streamers?: Streamer[];
110
+ blocks?: PageBlock[];
111
+ }
112
+ export interface BlogPost {
113
+ id: string;
114
+ title: string;
115
+ slug: string;
116
+ content: unknown;
117
+ excerpt?: string;
118
+ status: "draft" | "published" | "scheduled";
119
+ publishedAt?: string;
120
+ /**
121
+ * When the content last changed.
122
+ *
123
+ * The API already sent it —the by-slug route returns the whole row— and it was not
124
+ * declared here, so nobody used it: guides came out with `Article`
125
+ * without `dateModified` even if they had been entirely rewritten that same day.
126
+ */
127
+ updatedAt?: string;
128
+ author: {
129
+ id: string;
130
+ displayName: string;
131
+ avatar?: MediaItem;
132
+ };
133
+ tags?: Tag[];
134
+ relatedGames?: Game[];
135
+ featuredImage?: MediaItem;
136
+ readingTime?: number;
137
+ seoOverrides?: {
138
+ canonicalUrl?: string;
139
+ noIndex?: boolean;
140
+ structuredDataType?: string;
141
+ };
142
+ meta?: SEOMeta;
143
+ blocks?: PageBlock[];
144
+ }
145
+ /**
146
+ * Defines the structure of a Vertical (App) installed on top of Kitsuden Core.
147
+ * @example
148
+ * export default defineApp({ id: 'kitsuden-cms', name: 'Gaming CMS' ... })
149
+ */
150
+ export interface AppManifest {
151
+ /** The app's unique identifier (slug). It will be used to mount routes at /api/apps/:id */
152
+ id: string;
153
+ /**
154
+ * The dynamic schemas this app will inject into the core database.
155
+ * These schemas will be stored inside the JSONB of `data_entries`.
156
+ */
157
+ schemas: SchemaDefinition[];
158
+ /**
159
+ * Visual blocks specific to this vertical that will be exposed to Inti.js.
160
+ * E.g.: 'tournament-bracket', 'twitch-player'.
161
+ */
162
+ blocks?: any[];
163
+ }
164
+ /**
165
+ * Defines the dynamic structure of a table or collection injected by a Vertical.
166
+ * It tells the AppRegistry how to validate and structure the data in the JSONB.
167
+ */
168
+ export interface SchemaDefinition {
169
+ /** The internal name of the field that will be used as the key in the JSONB */
170
+ fieldName: string;
171
+ /** The visual and structural data type (string, number, relation, boolean, etc.) */
172
+ fieldType: string;
173
+ /** Determines whether the field is strict and required when saving */
174
+ required?: boolean;
175
+ /** Extra settings such as option selectors, references to other tables, etc. */
176
+ options?: string;
177
+ /** Default initial value when instantiating a new record */
178
+ defaultValue?: string;
179
+ }
180
+ export interface DataSet {
181
+ id: string;
182
+ name: string;
183
+ slug: string;
184
+ description?: string;
185
+ game: Game;
186
+ icon?: string;
187
+ schema: SchemaDefinition[];
188
+ displayConfig?: {
189
+ titleField?: string;
190
+ sortField?: string;
191
+ sortDirection?: "asc" | "desc";
192
+ };
193
+ }
194
+ /**
195
+ * Master Persistence Contract (DataEntry).
196
+ * Represents a dynamic data record coming from a Vertical,
197
+ * serialized and stored globally in JSONB format.
198
+ */
199
+ export interface DataEntry {
200
+ /** Unique record ID (UUID) */
201
+ id: string;
202
+ /** Representative record title for the admin panel */
203
+ title: string;
204
+ /** The schema/dataset this entry belongs to, indicating which Vertical controls it */
205
+ dataSet: DataSet;
206
+ /** Dynamic JSONB payload with the actual data of the Vertical's structure */
207
+ data: Record<string, unknown>;
208
+ /** Optional thumbnail image to show in grids/lists */
209
+ thumbnail?: MediaItem;
210
+ /** Relative sort position of the record */
211
+ sortOrder?: number;
212
+ /** Publication status (Draft or Published) */
213
+ status: "draft" | "published";
214
+ }
215
+ export interface Streamer {
216
+ id: string;
217
+ displayName: string;
218
+ slug: string;
219
+ platform: "twitch" | "youtube" | "kick";
220
+ channelId: string;
221
+ channelUrl?: string;
222
+ isLive?: boolean;
223
+ currentStreamTitle?: string;
224
+ viewerCount?: number;
225
+ followerCount?: number;
226
+ avatar?: MediaItem;
227
+ thumbnailUrl?: string;
228
+ games?: Game[];
229
+ lastSyncedAt?: string;
230
+ }
231
+ export interface SiteSettings {
232
+ siteName: string;
233
+ siteDescription?: string;
234
+ siteUrl: string;
235
+ branding?: {
236
+ logo?: MediaItem;
237
+ favicon?: MediaItem;
238
+ ogImage?: MediaItem;
239
+ primaryColor?: string;
240
+ accentColor?: string;
241
+ };
242
+ mainNav?: Array<{
243
+ label: string;
244
+ url: string;
245
+ openInNewTab?: boolean;
246
+ }>;
247
+ social?: {
248
+ twitter?: string;
249
+ discord?: string;
250
+ youtube?: string;
251
+ twitch?: string;
252
+ github?: string;
253
+ };
254
+ analytics?: {
255
+ googleAnalyticsId?: string;
256
+ plausibleDomain?: string;
257
+ };
258
+ footerText?: string;
259
+ }
260
+ export type { PaginatedResponse } from "./utils";
261
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAGD,MAAM,WAAW,OAAO;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE;QACN,SAAS,CAAC,EAAE;YAAE,GAAG,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,CAAA;SAAE,CAAC;QAC3D,IAAI,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C,EAAE,OAAO,CAAC;KACxB,CAAC,CAAC;IACH,MAAM,CAAC,EAAE;QACP,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,CAAC;IACF,SAAS,CAAC,EAAE;QACV,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;KAC1B,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Kitsuden Shared Utilities
3
+ */
4
+ /**
5
+ * Format a date string for display
6
+ */
7
+ export declare function formatDate(dateStr: string | undefined, locale?: string, options?: Intl.DateTimeFormatOptions): string;
8
+ /**
9
+ * Truncate text to a max length with ellipsis
10
+ */
11
+ export declare function truncate(text: string, maxLength: number): string;
12
+ /**
13
+ * Build CMS API URL for a collection
14
+ */
15
+ export declare function buildCmsUrl(baseUrl: string, collection: string, params?: Record<string, string | number | boolean>): string;
16
+ /**
17
+ * Build full API URL
18
+ */
19
+ export declare function buildApiUrl(baseUrl: string, path: string): string;
20
+ /**
21
+ * Generate JSON-LD structured data for a Video Game
22
+ */
23
+ export declare function gameJsonLd(game: {
24
+ title: string;
25
+ description?: string;
26
+ releaseDate?: string;
27
+ developer?: string;
28
+ publisher?: string;
29
+ metacriticScore?: number;
30
+ coverArt?: {
31
+ url: string;
32
+ };
33
+ }): Record<string, unknown>;
34
+ /**
35
+ * Generate JSON-LD structured data for an Article
36
+ */
37
+ export declare function articleJsonLd(post: {
38
+ title: string;
39
+ excerpt?: string;
40
+ publishedAt?: string;
41
+ author?: {
42
+ displayName: string;
43
+ };
44
+ featuredImage?: {
45
+ url: string;
46
+ };
47
+ siteUrl: string;
48
+ slug: string;
49
+ }): Record<string, unknown>;
50
+ /**
51
+ * Standard paginated response
52
+ */
53
+ export interface PaginatedResponse<T> {
54
+ docs: T[];
55
+ totalDocs: number;
56
+ totalPages: number;
57
+ page: number;
58
+ limit: number;
59
+ hasNextPage: boolean;
60
+ hasPrevPage: boolean;
61
+ }
62
+ /**
63
+ * Helper to create a paginated response
64
+ */
65
+ export declare function createPaginatedResponse<T>(docs: T[], totalDocs: number, page: number, limit: number): PaginatedResponse<T>;
66
+ /**
67
+ * `text` without the runs of `char` at its start and end. An index loop, because
68
+ * `/^-+|-+$/` and `/\/+$/` take quadratic time on a long run of that character.
69
+ */
70
+ export declare function trimChar(text: string, char: string, ends?: "both" | "end"): string;
71
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,wBAAgB,UAAU,CACxB,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,MAAM,SAAU,EAChB,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,GACnC,MAAM,CASR;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAGhE;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,GACjD,MAAM,CAQR;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACr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AAc,GAAG,MAAM,CAM1F"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Wiki links: page slug, `[[links]]` and their rendering
3
+ * ============================================================================
4
+ *
5
+ * They used to live in the kon-wiki engine. They moved here because TWO sides
6
+ * have to apply exactly the same rule:
7
+ *
8
+ * · the server, which indexes the links on save (backlinks, "requested");
9
+ * · the public frontend, which renders them as `<a>` inside the subdomain.
10
+ *
11
+ * With a copy on each side, the day one of them changed, the frontend would
12
+ * link to slugs the server never indexed: "requested" pages that already exist
13
+ * and links that lead to a 404. kon-wiki re-exports them under their usual
14
+ * names (`slugify`, `extractLinks`, `renderLinks`).
15
+ */
16
+ /**
17
+ * Title → stable slug.
18
+ *
19
+ * Strips accents but keeps letters: "Baldur's Gate 3" → "baldurs-gate-3",
20
+ * "Pokémon Cards" → "pokemon-cards". The slug is the page's IDENTITY
21
+ * — two titles that normalize the same ARE the same page, which is what
22
+ * prevents "Long Sword" and "long sword" from being duplicated.
23
+ */
24
+ export declare function wikiPageSlug(title: string): string;
25
+ export interface WikiLink {
26
+ /** Text as written: "Long Sword". */
27
+ target: string;
28
+ /** Target slug. */
29
+ slug: string;
30
+ /** Text to display if it differs: `[[Long Sword|the sword]]`. */
31
+ label: string | null;
32
+ }
33
+ /**
34
+ * Extracts the `[[links]]` from a text.
35
+ *
36
+ * Backlinks are computed from HERE: when a revision is saved its links are
37
+ * indexed, and "which pages point to this one" is a query, not a crawl. A link
38
+ * to a nonexistent page is VALID — it is the wiki mechanic of creating a page
39
+ * by writing the link first.
40
+ */
41
+ export declare function extractWikiLinks(content: string): WikiLink[];
42
+ /** Replaces `[[links]]` with the HTML from the renderer passed in. */
43
+ export declare function renderWikiLinks(content: string, render: (link: WikiLink) => string): string;
44
+ /**
45
+ * Content of a wiki page → HTML ready to render.
46
+ *
47
+ * `[[links]]` are converted to MARKDOWN links, not to a hand-written `<a>`,
48
+ * and then everything goes through `safeMarkdown`. This is on purpose: if HTML
49
+ * were inserted before converting, the escaping of `<` (which is what stops
50
+ * tags from sneaking into a page anyone can edit) would break it, and removing
51
+ * that escaping to let it through would open the door to everything else.
52
+ *
53
+ * `pageHref` decides the address: in the wiki's subdomain it is `/<slug>`.
54
+ */
55
+ export declare function renderWikiPage(content: string, pageHref: (slug: string) => string): string;
56
+ //# sourceMappingURL=wiki-links.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wiki-links.d.ts","sourceRoot":"","sources":["../src/wiki-links.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAalD;AAID,MAAM,WAAW,QAAQ;IACvB,qCAAqC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAuED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,QAAQ,EAAE,CAY5D;AAED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,GAAG,MAAM,CAe3F;AAID;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAO1F"}
package/package.json CHANGED
@@ -1,6 +1,56 @@
1
1
  {
2
2
  "name": "@kitsuden/shared",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.9.0-beta",
4
+ "description": "Shared types, schemas, and utilities for Kitsuden",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Kitsuden/kitsuden.git",
9
+ "directory": "packages/shared"
10
+ },
11
+ "homepage": "https://github.com/Kitsuden/kitsuden/tree/main/packages/shared#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/Kitsuden/kitsuden/issues"
14
+ },
15
+ "type": "module",
16
+ "main": "./dist/index.js",
17
+ "types": "./dist/index.d.ts",
18
+ "files": [
19
+ "dist",
20
+ "README.md"
21
+ ],
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.js"
26
+ },
27
+ "./package.json": "./package.json"
28
+ },
29
+ "keywords": [
30
+ "kitsuden",
31
+ "cms",
32
+ "baas",
33
+ "types",
34
+ "schemas",
35
+ "zod",
36
+ "typescript"
37
+ ],
38
+ "dependencies": {
39
+ "marked": "^18.2.1",
40
+ "zod": "^4.6.7"
41
+ },
42
+ "devDependencies": {
43
+ "typescript": "^5.9.3"
44
+ },
45
+ "engines": {
46
+ "node": ">=18.0.0"
47
+ },
48
+ "publishConfig": {
49
+ "access": "public"
50
+ },
51
+ "scripts": {
52
+ "build": "bun run scripts/build.ts",
53
+ "dev": "bun run scripts/build.ts --watch",
54
+ "typecheck": "pnpm exec tsc --noEmit"
55
+ }
6
56
  }