@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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H,CAAC;SACH,CAAC;KACH,CACF,CAAC;CACH;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,aAAa,GAAG,aAAa,CAE3D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,KAAK,IAAI,GAAG,gBAAgB,CAMhG;AAQD;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IAGxB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,MAAM;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAHxC,OAAO,EAAE,MAAM,EACR,IAAI,EAAE,MAAM,EACZ,UAAU,GAAE,MAAY,EACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA;IAM1C,MAAM;;;;;CAOP;AAED;;GAEG;AACH,eAAO,MAAM,SAAS;kCACC,MAAM,OAAO,MAAM;;;mCAOlB,MAAM,YAAY,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;iCAG3C,MAAM;CAClB,CAAC"}
@@ -0,0 +1,204 @@
1
+ /**
2
+ * Kon entities and kon secrets: what a kon may ask the host for
3
+ * ============================================================================
4
+ *
5
+ * ── ENTITIES (docs/kons/entities.md) ───────────────────────────────────────
6
+ *
7
+ * A kon that needs a table writes a migration. A kon that needs a table whose
8
+ * FIELDS the installation decides (a CRM's "custom objects", the extra fields
9
+ * of a registration form) cannot: the columns are not known when the kon is
10
+ * written.
11
+ *
12
+ * An entity is a dataset the kon owns. The kon declares it:
13
+ *
14
+ * defineKon({ entities: [{ slug: "crm-vehicle", name: "Vehicle",
15
+ * fields: [{ key: "plate", type: "text", required: true }] }] })
16
+ *
17
+ * and the host creates the dataset at load, with no SQL. Records are rows of
18
+ * `data_entries`, validated against the fields on every write, with the same
19
+ * policies, history, search and MCP tools as any other dataset.
20
+ *
21
+ * ── SECRETS (docs/kons/secrets.md) ─────────────────────────────────────────
22
+ *
23
+ * A kon that stores a third party's credential (an OAuth refresh token, an
24
+ * API key) must not store it readable. `ctx.secrets` seals it with the
25
+ * installation's secrets key and records every time it is opened.
26
+ */
27
+ /** One field of an entity. `type` is a name from the field type registry. */
28
+ export interface KonEntityField {
29
+ key: string;
30
+ /** `text`, `number`, `boolean`, `date`, `select`, `relation`… (FIELD_TYPES). */
31
+ type: string;
32
+ label?: string;
33
+ required?: boolean;
34
+ /** For `select` and `multiselect`. */
35
+ options?: Array<string | {
36
+ value: string;
37
+ label?: string;
38
+ }>;
39
+ description?: string;
40
+ /** `customer` or `personal`: tracked by the egress guard (docs/agents/egress.md). */
41
+ sensitivity?: "customer" | "personal";
42
+ /**
43
+ * Anything else is stored with the field as it is: the limits the field
44
+ * compiler reads (`minValue`, `maxValue`, `minLength`, `maxLength`,
45
+ * `validationRegex`, `showIf`) and keys the kon keeps for itself.
46
+ */
47
+ [extra: string]: unknown;
48
+ }
49
+ export type KonEntityAccess = "admin" | "authenticated" | "public";
50
+ export interface KonEntityDefinition {
51
+ /**
52
+ * The dataset slug. Prefix it with the kon's name (`crm-vehicle`): slugs are
53
+ * global, and a kon must not take a name a person may want.
54
+ */
55
+ slug: string;
56
+ name: string;
57
+ description?: string;
58
+ icon?: string;
59
+ fields: KonEntityField[];
60
+ /** Who may read and write records. Default: staff only (`admin`). */
61
+ access?: {
62
+ read?: KonEntityAccess;
63
+ write?: KonEntityAccess;
64
+ };
65
+ /**
66
+ * Settings the kon keeps for this entity (numbering, a default pipeline,
67
+ * flags). Stored with the definition and returned by `describe`; the core
68
+ * never reads it.
69
+ */
70
+ settings?: Record<string, unknown>;
71
+ }
72
+ export declare const KON_ENTITY_SLUG: RegExp;
73
+ export declare const KON_ENTITY_FIELD_KEY: RegExp;
74
+ export declare const MAX_KON_ENTITY_FIELDS = 200;
75
+ /** Why an entity cannot be declared, or `null`. Field TYPES are the host's check. */
76
+ export declare function konEntityProblem(entity: unknown): string | null;
77
+ export interface KonEntityRecord {
78
+ id: string;
79
+ title: string;
80
+ data: Record<string, unknown>;
81
+ status: string | null;
82
+ ownerId: string | null;
83
+ createdAt: Date | string;
84
+ updatedAt: Date | string;
85
+ }
86
+ export interface KonEntityWrite {
87
+ /** Shown in lists and search. Required on create. */
88
+ title?: string;
89
+ data?: Record<string, unknown>;
90
+ status?: string;
91
+ /** Owner of the record, for the dataset's row policies. */
92
+ ownerId?: string | null;
93
+ }
94
+ export interface KonEntityListOptions {
95
+ /** Equality on fields of `data`: `{ plate: "ABC-123" }`. */
96
+ where?: Record<string, string | number | boolean>;
97
+ limit?: number;
98
+ offset?: number;
99
+ }
100
+ /** A write the fields rejected: one message per field. */
101
+ export declare class KonEntityValidationError extends Error {
102
+ readonly issues: Array<{
103
+ field: string;
104
+ message: string;
105
+ }>;
106
+ constructor(slug: string, issues: Array<{
107
+ field: string;
108
+ message: string;
109
+ }>);
110
+ }
111
+ /**
112
+ * `ctx.entities`. Every call runs on the request's connection, so the
113
+ * dataset's row policies apply to whoever is asking; outside a request it is
114
+ * the system.
115
+ */
116
+ export interface KonEntities {
117
+ /** The definition as stored, or `null` when the entity does not exist. */
118
+ describe(slug: string): Promise<KonEntityDefinition | null>;
119
+ /**
120
+ * Creates an entity at runtime, or replaces its definition: for entity TYPES
121
+ * a person creates in the settings of the kon, which no declaration can know
122
+ * in advance. Persisted; survives restarts. `konId` is the id of the kon
123
+ * itself. Throws when the definition is malformed or the slug belongs to
124
+ * someone else. Always written as the system: check the permission of
125
+ * whoever is asking first.
126
+ */
127
+ define(konId: string, definition: KonEntityDefinition): Promise<KonEntityDefinition>;
128
+ /**
129
+ * Removes an entity the kon owns. Refuses while it has records, unless
130
+ * `withRecords` is set, which deletes them too. `false` when the kon owns no
131
+ * such entity.
132
+ */
133
+ undefine(konId: string, slug: string, options?: {
134
+ withRecords?: boolean;
135
+ }): Promise<boolean>;
136
+ /** Every entity the kon owns, declared or defined at runtime. */
137
+ definitions(konId: string): Promise<KonEntityDefinition[]>;
138
+ /**
139
+ * Checks `data` against the fields of the entity WITHOUT storing it, and
140
+ * returns it as validated: for values the kon keeps in a column of its own
141
+ * table (the custom fields of a deal). Throws `KonEntityValidationError`.
142
+ */
143
+ validate(slug: string, data: Record<string, unknown>): Promise<Record<string, unknown>>;
144
+ list(slug: string, options?: KonEntityListOptions): Promise<KonEntityRecord[]>;
145
+ get(slug: string, id: string): Promise<KonEntityRecord | null>;
146
+ /** Throws `KonEntityValidationError` when `data` does not meet the fields. */
147
+ create(slug: string, input: KonEntityWrite & {
148
+ title: string;
149
+ }): Promise<KonEntityRecord>;
150
+ /** `data` is MERGED into what is stored; a key set to `null` is cleared. */
151
+ update(slug: string, id: string, input: KonEntityWrite): Promise<KonEntityRecord | null>;
152
+ remove(slug: string, id: string): Promise<boolean>;
153
+ }
154
+ /**
155
+ * A sealed secret, as the kon stores it (in a `jsonb` column). Name the column
156
+ * so it ends in `secret` or `token` (`refresh_token`, `api_secret`): the
157
+ * generic surfaces hide columns with those names.
158
+ */
159
+ export interface SealedSecret {
160
+ /** Format version. */
161
+ v: 1;
162
+ /** The kon it was sealed for. Authenticated: changing it makes the value unopenable. */
163
+ kon: string;
164
+ valueEncrypted: string;
165
+ iv: string;
166
+ authTag: string;
167
+ }
168
+ export interface SecretAccess {
169
+ /** Why it is being opened: `sync-mailbox`, `refresh-token`. Recorded. */
170
+ purpose: string;
171
+ /** What the secret belongs to: `connection:<id>`. Recorded, never the value. */
172
+ subject?: string;
173
+ /** The account on whose behalf it is opened, when there is one. */
174
+ actorUserId?: string | null;
175
+ }
176
+ export declare function isSealedSecret(value: unknown): value is SealedSecret;
177
+ /**
178
+ * A column where a kon stores sealed secrets: `defineKon({ secretColumns })`.
179
+ * Declaring it is what lets a change of the installation's secrets key
180
+ * re-encrypt the kon's rows too; an undeclared column is left behind and its
181
+ * secrets stop opening.
182
+ */
183
+ export interface KonSecretColumn {
184
+ table: string;
185
+ /** A `jsonb` column holding a `SealedSecret`. */
186
+ column: string;
187
+ /** Primary key column. Default `id`. */
188
+ idColumn?: string;
189
+ }
190
+ /**
191
+ * `ctx.secrets`. `konId` is the kon's own id: a secret sealed for one kon does
192
+ * not open for another.
193
+ */
194
+ export interface KonSecrets {
195
+ /** Encrypts. Synchronous: sealing never touches the database. */
196
+ seal(konId: string, plaintext: string): SealedSecret;
197
+ /**
198
+ * Decrypts and records the access (kon, purpose, subject, actor, time).
199
+ * Rejects when the value was sealed for another kon, was tampered with, or
200
+ * the installation's key changed without a rekey.
201
+ */
202
+ open(konId: string, sealed: SealedSecret, access: SecretAccess): Promise<string>;
203
+ }
204
+ //# sourceMappingURL=kon-entities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kon-entities.d.ts","sourceRoot":"","sources":["../src/kon-entities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAMH,6EAA6E;AAC7E,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,gFAAgF;IAChF,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qFAAqF;IACrF,WAAW,CAAC,EAAE,UAAU,GAAG,UAAU,CAAC;IACtC;;;;OAIG;IACH,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,eAAe,GAAG,QAAQ,CAAC;AAEnE,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE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AAY,CAAC;IACrD;;;;OAIG;IACH,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAClF"}
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Kon events: the contract (docs/kons/events.md)
3
+ * ============================================================================
4
+ *
5
+ * A kon tells the rest of the installation that something happened with
6
+ * `ctx.events.emit("crm:deal.won", { ... })`. Another kon, or an automation rule
7
+ * a person wrote in the panel, reacts to it. Neither side imports the other.
8
+ *
9
+ * What lives here is the part both sides must agree on: the shape of a name,
10
+ * and the DECLARATION a kon makes of what it emits and what it listens to.
11
+ * The declaration is what turns "grep the kon for emit(" into a catalog the
12
+ * panel, an agent and the docs can read.
13
+ *
14
+ * ── THE NAME ───────────────────────────────────────────────────────────────
15
+ *
16
+ * <source>:<entity>.<what-happened> crm:deal.won shop:order.paid
17
+ *
18
+ * `source` is the kon without its `kon-` prefix. `what-happened` is a past
19
+ * participle: an event states a fact, it does not ask for anything. Older
20
+ * events (`crm:deal:stage-changed`, `payment:subscription.created`) keep their
21
+ * names: `KON_EVENT_NAME` accepts both separators, and renaming an event
22
+ * breaks every rule that listens to it.
23
+ *
24
+ * ── WHAT THE HOST PROMISES ─────────────────────────────────────────────────
25
+ *
26
+ * See docs/kons/events.md. In short: delivered after the request commits,
27
+ * never for a write that rolled back, in this process only, at most once.
28
+ */
29
+ /** `<source>:<rest>`: lower case, digits, and `: . _ -` in the rest. */
30
+ export declare const KON_EVENT_NAME: RegExp;
31
+ /** The recommended shape for a NEW event: `<source>:<entity>.<what-happened>`. */
32
+ export declare const KON_EVENT_RECOMMENDED: RegExp;
33
+ export declare function isKonEventName(name: unknown): name is string;
34
+ /** One event a kon emits. */
35
+ export interface KonEventDeclaration {
36
+ /** One sentence: what happened, in the past tense. */
37
+ description: string;
38
+ /**
39
+ * The payload, field by field: `{ dealId: "uuid of the deal", amount: "number, in cents" }`.
40
+ * Documentation, not validation: it is what a person reads when writing a
41
+ * rule condition, and what an agent reads before listening.
42
+ */
43
+ payload?: Record<string, string>;
44
+ }
45
+ /** What a kon says about its events in `defineKon({ events })`. */
46
+ export interface KonEventsDeclaration {
47
+ /** Events this kon emits, by full name. */
48
+ emits?: Record<string, KonEventDeclaration>;
49
+ /**
50
+ * Events of OTHER kons this one reacts to. Declared so the catalog can
51
+ * answer "who hears this?"; listening itself is still `ctx.events.on`.
52
+ * A name that nobody emits is fine: the other kon may not be installed.
53
+ */
54
+ listens?: string[];
55
+ /**
56
+ * This kon's own events that ANY other kon may listen to: full names
57
+ * (`blog:post.published`) or a prefix ending in `*` (`blog:post.*`).
58
+ * Everything else this kon emits reaches only itself, the core and the
59
+ * kons named in `subscribers` (docs/kons/events.md, "Who may listen").
60
+ * A pattern outside the kon's own namespace has no effect.
61
+ */
62
+ public?: string[];
63
+ /**
64
+ * Other kons that may listen to some of this kon's events, by kon id:
65
+ * `{ "kon-crm": ["shop:order.paid"], "kon-dc": ["shop:order.*"] }`.
66
+ */
67
+ subscribers?: Record<string, string[]>;
68
+ }
69
+ /**
70
+ * An event name, or a prefix of one ending in `*`, as `public` and
71
+ * `subscribers` take them. The namespace (before the first `:`) is always
72
+ * spelled out: `*` alone, or `shop*`, would reach past the kon's own events.
73
+ */
74
+ export declare const KON_EVENT_PATTERN: RegExp;
75
+ /** The namespace of an event (`shop` for `shop:order.paid`), or `null` when it has none. */
76
+ export declare function konEventNamespace(name: string): string | null;
77
+ /** Whether `name` is `pattern`, or starts with it when the pattern ends in `*`. */
78
+ export declare function matchesKonEventPattern(pattern: string, name: string): boolean;
79
+ /**
80
+ * The declaration in code (`defineKon({ events })`) with the one in kon.json
81
+ * (`"events": { ... }`) laid over it: lists are joined, `emits` and
82
+ * `subscribers` merged by key. Either may be missing.
83
+ */
84
+ export declare function mergeKonEventDeclarations(fromCode: KonEventsDeclaration | undefined, fromManifest: unknown): KonEventsDeclaration | undefined;
85
+ /** A row of the catalog the host builds from every loaded kon. */
86
+ export interface KonEventCatalogEntry {
87
+ name: string;
88
+ /** The kon that declared it as emitted. */
89
+ source: string;
90
+ description: string;
91
+ payload: Record<string, string>;
92
+ /** Kons that declared they listen to it. */
93
+ listeners: string[];
94
+ }
95
+ /**
96
+ * Why a declaration cannot be accepted, or `null`. A kon with a malformed
97
+ * event name is a programming error: better to say it at load than to have a
98
+ * rule that never fires.
99
+ */
100
+ export declare function konEventsProblem(declaration: KonEventsDeclaration | undefined): string | null;
101
+ /** Builds the catalog from what each kon declared. Pure: the host keeps the map. */
102
+ export declare function buildKonEventCatalog(declarations: ReadonlyMap<string, KonEventsDeclaration>): KonEventCatalogEntry[];
103
+ //# sourceMappingURL=kon-events.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kon-events.d.ts","sourceRoot":"","sources":["../src/kon-events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,wEAAwE;AACxE,eAAO,MAAM,cAAc,QAAkD,CAAC;AAE9E,kFAAkF;AAClF,eAAO,MAAM,qBAAqB,QAA0D,CAAC;AAE7F,wBAAgB,cAAc,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,IAAI,MAAM,CAE5D;AAED,6BAA6B;AAC7B,MAAM,WAAW,mBAAmB;IAClC,sDAAsD;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,mEAAmE;AACnE,MAAM,WAAW,oBAAoB;IACnC,2CAA2C;IAC3C,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC5C;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACxC;AAED;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAC6C,CAAC;AAE5E,4FAA4F;AAC5F,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAG7D;AAED,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7E;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,oBAAoB,GAAG,SAAS,EAC1C,YAAY,EAAE,OAAO,GACpB,oBAAoB,GAAG,SAAS,CAsBlC;AAED,kEAAkE;AAClE,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,4CAA4C;IAC5C,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,oBAAoB,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAyC7F;AAED,oFAAoF;AACpF,wBAAgB,oBAAoB,CAClC,YAAY,EAAE,WAAW,CAAC,MAAM,EAAE,oBAAoB,CAAC,GACtD,oBAAoB,EAAE,CAsBxB"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * ============================================================================
3
+ * KON PACKAGE — Standard contract for kon npm packages
4
+ * ============================================================================
5
+ *
6
+ * Defines the structure that any npm package installable
7
+ * as a Kitsuden kon must meet.
8
+ *
9
+ * Usage:
10
+ * - package.json → "kitsuden" field meets KonPackage
11
+ * - kon.json (standalone) meets KonPackage
12
+ * - CLI validates before install
13
+ * - API validates before loading from node_modules
14
+ */
15
+ /**
16
+ * Dependencies on another kon (by ID, not by npm package name).
17
+ * The loader resolves the ID to the corresponding npm package.
18
+ */
19
+ export interface KonDependencies {
20
+ /** Required kon IDs (installed automatically) */
21
+ kons?: string[];
22
+ /** Optional kon IDs (suggested to the user) */
23
+ optional?: string[];
24
+ /** Minimum required versions of each kon */
25
+ konsMinVersion?: Record<string, string>;
26
+ }
27
+ /**
28
+ * Mount configuration of the kon's router in the API.
29
+ */
30
+ export interface KonMountConfig {
31
+ /** Base path of the router (e.g. /api/crm) */
32
+ path?: string;
33
+ /** Whether it requires authentication on all routes */
34
+ requireAuth?: boolean;
35
+ /** Allowed roles */
36
+ allowedRoles?: string[];
37
+ }
38
+ /**
39
+ * Definition of a table exposed by the kon for the schema merger.
40
+ */
41
+ export interface KonTableConfig {
42
+ name: string;
43
+ /** Name of the table in Drizzle (if it differs from name) */
44
+ table?: string;
45
+ label?: string;
46
+ icon?: string;
47
+ description?: string;
48
+ primaryKey?: string;
49
+ searchableFields?: string[];
50
+ filterableFields?: string[];
51
+ readonly?: boolean;
52
+ }
53
+ /**
54
+ * Lifecycle hooks of the kon (optional).
55
+ */
56
+ export interface KonLifecycleHooks {
57
+ /** Run when the kon is mounted in the API */
58
+ onStartup?: string;
59
+ /** Run when the kon is unmounted */
60
+ onShutdown?: string;
61
+ }
62
+ /**
63
+ * Full contract of a kon npm package.
64
+ *
65
+ * It can be declared in:
66
+ * 1. A `kon.json` file at the package root.
67
+ * 2. The `kitsuden` field inside `package.json`.
68
+ */
69
+ export interface KonPackage {
70
+ /** Unique kon ID (e.g. "kon-crm") */
71
+ id: string;
72
+ /** Human-readable name */
73
+ name: string;
74
+ /** Semver version */
75
+ version: string;
76
+ /** Type is always "kon" for npm packages */
77
+ type: "kon";
78
+ /** Short description */
79
+ description?: string;
80
+ /** Icon (icon name or URL) */
81
+ icon?: string;
82
+ /** Package author */
83
+ author?: string;
84
+ /** Category of the kon */
85
+ category?: "core" | "core-den" | "optional" | string;
86
+ /** Whether it is a core kon that must always be loaded */
87
+ core?: boolean;
88
+ /** Admin path in the frontend (e.g. /g/crm) */
89
+ adminRoute?: string;
90
+ /** Tables exposed for the schema merger */
91
+ tables?: (string | KonTableConfig)[];
92
+ /** Router mount configuration */
93
+ mount?: KonMountConfig;
94
+ /** Dependencies on other kons */
95
+ dependencies?: KonDependencies;
96
+ /** Lifecycle hooks (names of exported functions) */
97
+ hooks?: KonLifecycleHooks;
98
+ /** OpenAPI schema exported by the kon */
99
+ openApi?: {
100
+ tags?: Array<{
101
+ name: string;
102
+ description?: string;
103
+ }>;
104
+ paths?: Record<string, any>;
105
+ };
106
+ /** Whether the kon handles its own migrations (schema is not merged) */
107
+ selfMigrating?: boolean;
108
+ /**
109
+ * Columns that hold customer or personal data, per table:
110
+ * `{ "crm_contacts": { "email": "customer" } }`. An execution that reads them
111
+ * cannot send them to a host not allowed for customer data (docs/agents/egress.md).
112
+ */
113
+ sensitivity?: Record<string, Record<string, "customer" | "personal">>;
114
+ }
115
+ /**
116
+ * Minimum contract version (required fields only).
117
+ */
118
+ export type KonPackageMinimal = Pick<KonPackage, "id" | "name" | "version" | "type">;
119
+ /**
120
+ * Validates whether an object meets the minimum KonPackage contract.
121
+ * It does not validate semver or deep structure.
122
+ */
123
+ export declare function isValidKonPackage(obj: unknown): obj is KonPackage;
124
+ //# sourceMappingURL=kon-package.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kon-package.d.ts","sourceRoot":"","sources":["../src/kon-package.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,8CAA8C;IAC9C,IAAI,CAAC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pB,2CAA2C;IAC3C,MAAM,CAAC,EAAE,CAAC,MAAM,GAAG,cAAc,CAAC,EAAE,CAAC;IACrC,iCAAiC;IACjC,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,iCAAiC;IACjC,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,oDAAoD;IACpD,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAC1B,yCAAyC;IACzC,OAAO,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,WAAW,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;QACrD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KAC7B,CAAC;IACF,wEAAwE;IACxE,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC,CAAC,CAAC;CACvE;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAAU,EAAE,IAAI,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,CAAC;AAErF;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,UAAU,CAYjE"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Link relations: the common vocabulary (docs/kons/links.md)
3
+ * ============================================================================
4
+ *
5
+ * `kitsuden_links.relation` is free text, and it stays free: a kon may invent
6
+ * `invited_by` tomorrow without asking anyone. But two kons that mean the same
7
+ * thing must write the same word, or the order a shop linked with `buyer` is
8
+ * invisible to the CRM that reads `ordered_by`.
9
+ *
10
+ * These are the relations more than one kon is expected to share. Each says
11
+ * which end is which, because "A ordered_by B" read backwards is nonsense and
12
+ * nothing in the table would complain.
13
+ *
14
+ * `symmetric` relations have no direction. The engine stores them with the two
15
+ * ends in a canonical order, so writing A–B and then B–A gives ONE row.
16
+ */
17
+ export interface LinkRelationSpec {
18
+ /** No direction: `same_person(A, B)` is `same_person(B, A)`. */
19
+ symmetric: boolean;
20
+ /** What the link states, as a sentence with `from` and `to`. */
21
+ meaning: string;
22
+ /** What `from` usually is. */
23
+ from: string;
24
+ /** What `to` usually is. */
25
+ to: string;
26
+ }
27
+ export declare const LINK_RELATIONS: {
28
+ readonly related: {
29
+ readonly symmetric: true;
30
+ readonly meaning: "`from` and `to` have something to do with each other; nothing more is claimed.";
31
+ readonly from: "anything";
32
+ readonly to: "anything";
33
+ };
34
+ readonly same_person: {
35
+ readonly symmetric: true;
36
+ readonly meaning: "`from` and `to` are records of the same human being in two kons.";
37
+ readonly from: "a person record (a CRM contact, a newsletter member, a player)";
38
+ readonly to: "another person record";
39
+ };
40
+ readonly ordered_by: {
41
+ readonly symmetric: false;
42
+ readonly meaning: "the order `from` was placed by the person `to`.";
43
+ readonly from: "an order, a booking, a registration";
44
+ readonly to: "a person record";
45
+ };
46
+ readonly paid_by: {
47
+ readonly symmetric: false;
48
+ readonly meaning: "the payment `from` was made by the person or organisation `to`.";
49
+ readonly from: "a payment, a subscription, an invoice";
50
+ readonly to: "a person or company record";
51
+ };
52
+ readonly about: {
53
+ readonly symmetric: false;
54
+ readonly meaning: "the item `from` concerns the record `to`.";
55
+ readonly from: "a message, a meeting, a note, a document, a task";
56
+ readonly to: "the contact, deal, order or project it is about";
57
+ };
58
+ };
59
+ export type CommonLinkRelation = keyof typeof LINK_RELATIONS;
60
+ /** Relations the engine stores in canonical order. Unknown relations are directed. */
61
+ export declare function isSymmetricRelation(relation: string): boolean;
62
+ /** `related`, `same_person`: letters, digits and `_`, at most 64 characters. */
63
+ export declare const LINK_RELATION_NAME: RegExp;
64
+ export declare function isLinkRelationName(relation: unknown): relation is string;
65
+ /**
66
+ * The two ends of a symmetric link in the order they are stored: by type, then
67
+ * by id. Deterministic, so both writers land on the same row.
68
+ */
69
+ export declare function canonicalEnds<T extends {
70
+ type: string;
71
+ id: string;
72
+ }>(a: T, b: T): [T, T];
73
+ //# sourceMappingURL=link-relations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-relations.d.ts","sourceRoot":"","sources":["../src/link-relations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,gEAAgE;IAChE,SAAS,EAAE,OAAO,CAAC;IACnB,gEAAgE;IAChE,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+B0B,CAAC;AAEtD,MAAM,MAAM,kBAAkB,GAAG,MAAM,OAAO,cAAc,CAAC;AAE7D,sFAAsF;AACtF,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG7D;AAED,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,QAA2B,CAAC;AAE3D,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,OAAO,GAAG,QAAQ,IAAI,MAAM,CAExE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAIxF"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * The level of a meta archetype: a letter, or why it does not have one
3
+ * ============================================================================
4
+ *
5
+ * A meta table has to say something more than the percentage, because "4.1%"
6
+ * cannot be compared on its own: you need to know whether that is among the top or in the tail.
7
+ * That is the letter.
8
+ *
9
+ * ── WHY NOT ALL OF THEM GET A LETTER ───────────────────────────────────────
10
+ *
11
+ * Because not everything is known about all of them. An archetype with three decks counted
12
+ * can come out 1st or 40th depending on which tournament is looked at, and giving it an "F" would
13
+ * be claiming something the sample does not support. Those that do not reach the minimum
14
+ * keep a LABEL that says what situation they are in:
15
+ *
16
+ * · **Emerging** — appeared in this cycle; nothing to compare with yet.
17
+ * · **Promising** — small sample, but rising.
18
+ * · **Unclassified** — small sample and no signal.
19
+ *
20
+ * It is the difference between "it is bad" and "I don't know", and mixing them is the mistake that
21
+ * turns a data table into a disguised opinion.
22
+ *
23
+ * ── THE LETTER IS SHARE, NOT QUALITY ───────────────────────────────────────
24
+ *
25
+ * It comes from the percentile of SHARE —how much it is played—, which is what the sources
26
+ * publish. It is not win rate: nobody we read from publishes who wins, so
27
+ * a wins column here would be made up. The legend says so.
28
+ */
29
+ export interface MetaLevel {
30
+ id: string;
31
+ label: string;
32
+ color: string;
33
+ /** Its band in the tier list (1, 2 or 3), or `null` if it does not appear in it. */
34
+ tier: 1 | 2 | 3 | null;
35
+ /** `true` for A–F; `false` for the labels. */
36
+ isLetter: boolean;
37
+ /** What it means, for the legend. */
38
+ description: string;
39
+ }
40
+ /**
41
+ * The six letters, by share percentile.
42
+ *
43
+ * The FIRST THREE are the tier list: A = Tier 1, B = Tier 2, C = Tier 3. The cuts
44
+ * are where they are so that Tier 1 is a handful of decks —what
45
+ * really dominates— and not half the table.
46
+ */
47
+ export declare const LETTERS: Array<MetaLevel & {
48
+ until: number;
49
+ }>;
50
+ export declare const TAGS: Record<"promising" | "emerging" | "unclassified", MetaLevel>;
51
+ /** All levels, in the order they are read and filtered. */
52
+ export declare const LEVELS: MetaLevel[];
53
+ /**
54
+ * How many decks are needed to deserve a letter.
55
+ *
56
+ * 1% of what was counted, with a floor of five. The percentage makes the
57
+ * criterion independent of the dump's size —a minimum of
58
+ * five out of 450 decks is not the same as out of 40,000— and the floor prevents one deck
59
+ * from being enough in a small sample.
60
+ */
61
+ export declare const minForLetter: (sample: number) => number;
62
+ export interface GradableArchetype {
63
+ id: string;
64
+ quota: number;
65
+ decks: number;
66
+ /** Points it rose or fell; `null` if there is no earlier window. */
67
+ difference: number | null;
68
+ }
69
+ export declare const LEVELS_NOTE: string;
70
+ /**
71
+ * The level of each archetype, by its id.
72
+ *
73
+ * `sample` is the total of decks counted in the window; the minimum comes from it.
74
+ * The percentile is calculated ONLY among those that reach the minimum: if
75
+ * those with three decks also entered, an "A" would stop meaning "among the most
76
+ * played" and would come to mean "of those we have data on, the best".
77
+ *
78
+ * Two equal shares share a letter, as in the tier list.
79
+ */
80
+ export declare function metaLevels(archetypes: GradableArchetype[], sample: number): Map<string, MetaLevel>;
81
+ //# sourceMappingURL=meta-levels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"meta-levels.d.ts","sourceRoot":"","sources":["../src/meta-levels.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,IAAI,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;IACvB,8CAA8C;IAC9C,QAAQ,EAAE,OAAO,CAAC;IAClB,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,SAAS,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAuDxD,CAAC;AAEF,eAAO,MAAM,IAAI,EAAE,MAAM,CAAC,WAAW,GAAG,UAAU,GAAG,cAAc,EAAE,SAAS,CAyB7E,CAAC;AAEF,2DAA2D;AAC3D,eAAO,MAAM,MAAM,EAAE,SAAS,EAK7B,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,MAAgD,CAAC;AAE/F,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AA2CD,eAAO,MAAM,WAAW,QAKoE,CAAC;AAE7F;;;;;;;;;GASG;AACH,wBAAgB,UAAU,CACxB,UAAU,EAAE,iBAAiB,EAAE,EAC/B,MAAM,EAAE,MAAM,GACb,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAyBxB"}