@ai-matrx/records 0.54.0 → 0.56.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/CHANGELOG.md +78 -0
- package/dist/core/index.cjs +2485 -8
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +154 -9
- package/dist/core/index.d.ts +154 -9
- package/dist/core/index.js +2492 -8
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +111 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +250 -4
- package/dist/index.d.ts +250 -4
- package/dist/index.js +101 -4
- package/dist/index.js.map +1 -1
- package/dist/react/index.cjs +2495 -8
- package/dist/react/index.cjs.map +1 -1
- package/dist/react/index.d.cts +767 -10
- package/dist/react/index.d.ts +767 -10
- package/dist/react/index.js +2491 -8
- package/dist/react/index.js.map +1 -1
- package/dist/{field-Ct7_iYEF.d.cts → types-RxnWzAWZ.d.cts} +395 -5
- package/dist/{field-Ct7_iYEF.d.ts → types-RxnWzAWZ.d.ts} +395 -5
- package/dist/use-cases/index.cjs +15 -0
- package/dist/use-cases/index.cjs.map +1 -1
- package/dist/use-cases/index.d.cts +3 -336
- package/dist/use-cases/index.d.ts +3 -336
- package/dist/use-cases/index.js +15 -0
- package/dist/use-cases/index.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,338 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Who the data belongs to. A test organization is created under this name — the
|
|
5
|
-
* owner's law #4: every organization, table, record, form, portal, dashboard,
|
|
6
|
-
* document, checklist, booking page, capture sheet, subscription, pipeline and
|
|
7
|
-
* enrichment created for a test carries the use case's own name. Cleanup finds
|
|
8
|
-
* a test organization by `cleanupTag` in its settings, NEVER by a junk name.
|
|
9
|
-
*/
|
|
10
|
-
interface BusinessIdentity {
|
|
11
|
-
/** "Harbor Dental Group" — what goes on the organization, the invoice, the screenshot. */
|
|
12
|
-
name: string;
|
|
13
|
-
/** "Harbor Dental Group, PLLC" — used on documents that need the legal entity. */
|
|
14
|
-
legalName?: string;
|
|
15
|
-
/** One line a stranger would understand: "A six-chair family dental practice." */
|
|
16
|
-
describes: string;
|
|
17
|
-
/** Plausible and synthesized. Never a real business's real address. */
|
|
18
|
-
address: PostalAddress;
|
|
19
|
-
/** Synthesized, E.164-shaped or the local convention the document uses. */
|
|
20
|
-
phone: string;
|
|
21
|
-
/**
|
|
22
|
-
* Synthesized. NOT a `.example` domain — those read as fake on a screenshot.
|
|
23
|
-
* Optional, because the law welcomes personal-life use cases and a household
|
|
24
|
-
* renovation or a family recipe collection genuinely has no website.
|
|
25
|
-
*/
|
|
26
|
-
website?: string;
|
|
27
|
-
/** Synthesized mailbox on the same domain: "frontdesk@harbordentalgroup.com". */
|
|
28
|
-
email: string;
|
|
29
|
-
/** IANA zone, so dates in the rows make sense together. */
|
|
30
|
-
timezone: string;
|
|
31
|
-
}
|
|
32
|
-
interface PostalAddress {
|
|
33
|
-
line1: string;
|
|
34
|
-
line2?: string;
|
|
35
|
-
city: string;
|
|
36
|
-
/** State, province or region, in the country's own convention. */
|
|
37
|
-
region: string;
|
|
38
|
-
postalCode: string;
|
|
39
|
-
/** ISO 3166-1 alpha-2. */
|
|
40
|
-
country: string;
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* One table of the business, in the words the practitioner uses. `token` is the
|
|
44
|
-
* slug the store addresses it by; `name` is what a person reads.
|
|
45
|
-
*/
|
|
46
|
-
interface UseCaseTable {
|
|
47
|
-
/** snake_case, singular, the practitioner's noun: "patient", "work_order". */
|
|
48
|
-
token: string;
|
|
49
|
-
/** "Patients", "Work orders". */
|
|
50
|
-
name: string;
|
|
51
|
-
labelSingular: string;
|
|
52
|
-
labelPlural: string;
|
|
53
|
-
/** REC-32. One of the seven, closed. Most business tables are `entity`. */
|
|
54
|
-
type: TableType;
|
|
55
|
-
display: TableDisplay;
|
|
56
|
-
/** REC-4. `light` is the whole document; `heavy` is indexed on write. */
|
|
57
|
-
weight: StorageMode;
|
|
58
|
-
ordered: boolean;
|
|
59
|
-
/** A lucide icon name, so the screen is not a wall of identical rows. */
|
|
60
|
-
icon?: string;
|
|
61
|
-
/** REC-2. The field key whose value titles a record. Must be a declared field. */
|
|
62
|
-
titleField: string;
|
|
63
|
-
/** What this table is FOR, in the practitioner's words. */
|
|
64
|
-
describes: string;
|
|
65
|
-
fields: UseCaseField[];
|
|
66
|
-
/** The seed rows. Enough that the screen looks like a working business. */
|
|
67
|
-
rows: UseCaseRow[];
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* One field. `parityType` is the word a person picks in the UI and it must be
|
|
71
|
-
* one the store resolves — any parity type the store ships, any behaviour they
|
|
72
|
-
* are made of, or one of the plain synonyms (see `FieldTypeWord`). The set is
|
|
73
|
-
* `RESOLVABLE_FIELD_TYPE_WORDS`, derived from the registry; never a count or a
|
|
74
|
-
* list typed out here.
|
|
75
|
-
*/
|
|
76
|
-
interface UseCaseField {
|
|
77
|
-
/** snake_case, the practitioner's own name for it: "date_of_birth", "po_number". */
|
|
78
|
-
key: string;
|
|
79
|
-
/** "Date of birth", "PO number". Sentence case, the way the form reads. */
|
|
80
|
-
label: string;
|
|
81
|
-
parityType: FieldTypeWord;
|
|
82
|
-
/** FLD-2. The shape of the value, never a second behaviour. */
|
|
83
|
-
multi?: boolean;
|
|
84
|
-
/** FLD-2. The values carry their own dates. */
|
|
85
|
-
dated?: boolean;
|
|
86
|
-
required?: boolean;
|
|
87
|
-
/** FLD-N-1. The unit CHANGES THE MEANING and lives on the field: "USD", "lb", "mi". */
|
|
88
|
-
unit?: string | null;
|
|
89
|
-
/** "currency", "percent", "email", "phone", "url", "date". Never decoration. */
|
|
90
|
-
format?: string | null;
|
|
91
|
-
/** FLD-7. Where the values come from. Defaults to `manual`. */
|
|
92
|
-
source?: FieldSource;
|
|
93
|
-
/** FLD-9. A formula says whether it computes on read or on write. */
|
|
94
|
-
computeOn?: ComputeOn;
|
|
95
|
-
/** FLD-3. Validation rules the store will enforce. */
|
|
96
|
-
rules?: FieldRule[];
|
|
97
|
-
/**
|
|
98
|
-
* For `select` / `multi_select`: the REAL lifecycle words of this business,
|
|
99
|
-
* in the order they actually happen. "Scheduled, Confirmed, Seen, No-show" —
|
|
100
|
-
* never "Option A, Option B".
|
|
101
|
-
*/
|
|
102
|
-
choices?: string[];
|
|
103
|
-
/** For a relation field: the `token` of the table it points at. */
|
|
104
|
-
relationTarget?: string;
|
|
105
|
-
relationMax?: number;
|
|
106
|
-
/** AGT-7. The ceiling a merge field's delivery can never widen. */
|
|
107
|
-
sensitivity: FieldSensitivity;
|
|
108
|
-
/** FLD-12. Whether an agent may see this field's values at all. */
|
|
109
|
-
contextPolicy: ContextPolicy;
|
|
110
|
-
/** What the practitioner would be told about this field, if anything. */
|
|
111
|
-
help?: string;
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* One row of seed data.
|
|
115
|
-
*
|
|
116
|
-
* `key` is a stable LOCAL id (not a UUID): relationships across tables point at
|
|
117
|
-
* it, so a template is readable and a seeder can resolve the graph in one pass
|
|
118
|
-
* without inventing identifiers. Use a meaningful slug — "patient-rivera-m",
|
|
119
|
-
* not "row-7".
|
|
120
|
-
*/
|
|
121
|
-
interface UseCaseRow {
|
|
122
|
-
key: string;
|
|
123
|
-
/**
|
|
124
|
-
* Keyed by the table's field keys. A relation field's value is the `key` (or
|
|
125
|
-
* an array of keys) of rows in the target table.
|
|
126
|
-
*/
|
|
127
|
-
values: Record<string, unknown>;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* REL-1…REL-9. The domain truth, stated once: "an invoice belongs to the job it
|
|
131
|
-
* bills, and a job belongs to the client who asked for it."
|
|
132
|
-
*
|
|
133
|
-
* The field side carries `relationTarget`; this is the declaration a seeder
|
|
134
|
-
* reads, because it also carries the flavour, the cardinality, what happens to
|
|
135
|
-
* the far side on delete, and the reverse name.
|
|
136
|
-
*/
|
|
137
|
-
interface UseCaseRelationship {
|
|
138
|
-
/** One sentence of domain truth. Not "links A to B". */
|
|
139
|
-
describes: string;
|
|
140
|
-
/** The table that HOLDS the relation field. */
|
|
141
|
-
fromTable: string;
|
|
142
|
-
/** The field key on `fromTable`. Must be declared and must be a relation. */
|
|
143
|
-
fromField: string;
|
|
144
|
-
/** The `token` of the table it points at. */
|
|
145
|
-
toTable: string;
|
|
146
|
-
/** REL-1. Ownership is one fact, stored once, read from the field's side. */
|
|
147
|
-
flavor: RelationFlavor;
|
|
148
|
-
/** REL-7. */
|
|
149
|
-
cardinality: RelationCardinality;
|
|
150
|
-
/** REL-2. What happens to the far side, separate from flavour. */
|
|
151
|
-
onDelete: OnDelete;
|
|
152
|
-
/** REL-9. The reverse, visible from both ends, and NOT a second field. */
|
|
153
|
-
inverseKey: string;
|
|
154
|
-
}
|
|
155
|
-
/** Who is allowed to open a form. */
|
|
156
|
-
type FormAudience = "public" | "member" | "staff";
|
|
157
|
-
/**
|
|
158
|
-
* A form a practitioner in this business would actually put in front of someone
|
|
159
|
-
* — "the Harbor Dental new-patient intake", never "Test Form 1".
|
|
160
|
-
*/
|
|
161
|
-
interface UseCaseForm {
|
|
162
|
-
token: string;
|
|
163
|
-
name: string;
|
|
164
|
-
/** What it is for, and who fills it in. */
|
|
165
|
-
describes: string;
|
|
166
|
-
audience: FormAudience;
|
|
167
|
-
/** The table a submission becomes a record of. */
|
|
168
|
-
table: string;
|
|
169
|
-
fields: UseCaseFormField[];
|
|
170
|
-
submitLabel: string;
|
|
171
|
-
/** What the person sees after they submit. Real words, not "Success!". */
|
|
172
|
-
confirmation: string;
|
|
173
|
-
}
|
|
174
|
-
interface UseCaseFormField {
|
|
175
|
-
/** A field key on the form's table. */
|
|
176
|
-
fieldKey: string;
|
|
177
|
-
/** Override the field's own label when the form asks it differently. */
|
|
178
|
-
label?: string;
|
|
179
|
-
required?: boolean;
|
|
180
|
-
/** The helper line under the input, if a practitioner would want one. */
|
|
181
|
-
help?: string;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* The real lifecycle a record moves through in this business, in order. A
|
|
185
|
-
* pipeline's stages are the words the staff say out loud.
|
|
186
|
-
*/
|
|
187
|
-
interface UseCasePipeline {
|
|
188
|
-
token: string;
|
|
189
|
-
name: string;
|
|
190
|
-
describes: string;
|
|
191
|
-
/** The table whose records move through it. */
|
|
192
|
-
table: string;
|
|
193
|
-
/** The `select` field that holds the current stage. */
|
|
194
|
-
stageField: string;
|
|
195
|
-
stages: UseCasePipelineStage[];
|
|
196
|
-
}
|
|
197
|
-
interface UseCasePipelineStage {
|
|
198
|
-
/** Must appear in the stage field's `choices`. */
|
|
199
|
-
key: string;
|
|
200
|
-
label: string;
|
|
201
|
-
/** What is true of a record sitting here, and what moves it on. */
|
|
202
|
-
describes: string;
|
|
203
|
-
/** Roughly how long a record sits here, so a board looks believable. */
|
|
204
|
-
typicalDurationDays?: number;
|
|
205
|
-
}
|
|
206
|
-
/**
|
|
207
|
-
* The question the owner of this business actually asks a dashboard on Monday
|
|
208
|
-
* morning — "how much have we invoiced this month that hasn't been paid?" —
|
|
209
|
-
* plus how it is answered from the tables above.
|
|
210
|
-
*/
|
|
211
|
-
interface UseCaseDashboardQuestion {
|
|
212
|
-
/** The question in the practitioner's own words, ending in a question mark. */
|
|
213
|
-
question: string;
|
|
214
|
-
/** Why they care. What they DO differently depending on the answer. */
|
|
215
|
-
whyItMatters: string;
|
|
216
|
-
table: string;
|
|
217
|
-
aggregate: "count" | "sum" | "avg" | "min" | "max";
|
|
218
|
-
/** The field aggregated. Omitted only for `count`. */
|
|
219
|
-
of?: string;
|
|
220
|
-
groupBy?: string;
|
|
221
|
-
/** A plain-language filter: "status is Unpaid and due_date is before today". */
|
|
222
|
-
filter?: string;
|
|
223
|
-
/** What the number IS: "USD", "days", "appointments". */
|
|
224
|
-
answerUnit: string;
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* A document this business really sends. The body carries merge fields in
|
|
228
|
-
* `{{double_brace}}` form; every one of them is declared below and resolves to a
|
|
229
|
-
* field on the document's table (or a stated literal).
|
|
230
|
-
*/
|
|
231
|
-
interface UseCaseDocumentTemplate {
|
|
232
|
-
token: string;
|
|
233
|
-
name: string;
|
|
234
|
-
describes: string;
|
|
235
|
-
table: string;
|
|
236
|
-
/** The subject or title line, merge fields allowed. */
|
|
237
|
-
title: string;
|
|
238
|
-
/** The body. Real prose this business would send, merge fields inline. */
|
|
239
|
-
body: string;
|
|
240
|
-
mergeFields: UseCaseMergeField[];
|
|
241
|
-
}
|
|
242
|
-
interface UseCaseMergeField {
|
|
243
|
-
/** The token inside `{{ }}` in the body. */
|
|
244
|
-
key: string;
|
|
245
|
-
/**
|
|
246
|
-
* The field key it reads, on the document's table — or, when it is not a
|
|
247
|
-
* field, the word `business` (from `BusinessIdentity`) or `today`.
|
|
248
|
-
*/
|
|
249
|
-
from: string;
|
|
250
|
-
describes: string;
|
|
251
|
-
}
|
|
252
|
-
/** How a notification reaches someone. */
|
|
253
|
-
type NotificationChannel = "email" | "sms" | "in_app";
|
|
254
|
-
/**
|
|
255
|
-
* The one automatic message this business would genuinely want — the thing a
|
|
256
|
-
* practitioner sets up on day one and never turns off.
|
|
257
|
-
*/
|
|
258
|
-
interface UseCaseNotificationRule {
|
|
259
|
-
token: string;
|
|
260
|
-
name: string;
|
|
261
|
-
describes: string;
|
|
262
|
-
when: UseCaseNotificationTrigger;
|
|
263
|
-
/** Who it goes to, in the business's own words: "the assigned hygienist". */
|
|
264
|
-
audience: string;
|
|
265
|
-
channel: NotificationChannel;
|
|
266
|
-
/** The actual message. Merge fields allowed, same convention as documents. */
|
|
267
|
-
message: string;
|
|
268
|
-
}
|
|
269
|
-
interface UseCaseNotificationTrigger {
|
|
270
|
-
table: string;
|
|
271
|
-
event: "created" | "updated" | "stage_entered" | "due" | "overdue";
|
|
272
|
-
/** For `stage_entered`: the stage key. */
|
|
273
|
-
stage?: string;
|
|
274
|
-
/** For `due` / `overdue`: the date field watched. */
|
|
275
|
-
field?: string;
|
|
276
|
-
/** For `due`: how many days ahead it fires. */
|
|
277
|
-
daysBefore?: number;
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Where the shape and the values came from. `synthesized` means a person wrote
|
|
281
|
-
* plausible values out of domain knowledge; `public-data` means the numbers or
|
|
282
|
-
* names were derived from a genuinely public dataset, which is named.
|
|
283
|
-
*
|
|
284
|
-
* Either way the law holds: no real person, no real customer, no production row.
|
|
285
|
-
*/
|
|
286
|
-
interface UseCaseProvenance {
|
|
287
|
-
kind: "synthesized" | "public-data";
|
|
288
|
-
/** Named when `kind` is `public-data`. */
|
|
289
|
-
source?: string;
|
|
290
|
-
/** Who or what wrote this file, and when. */
|
|
291
|
-
authoredBy: string;
|
|
292
|
-
authoredOn: string;
|
|
293
|
-
/**
|
|
294
|
-
* The affirmation, carried in the data so a reviewer can see it: every person,
|
|
295
|
-
* address, phone and mailbox here is invented and belongs to nobody.
|
|
296
|
-
*/
|
|
297
|
-
noRealPeople: true;
|
|
298
|
-
}
|
|
299
|
-
/** One real business, and everything a test, seed, demo or screenshot needs of it. */
|
|
300
|
-
interface UseCase {
|
|
301
|
-
/** kebab-case and unique: "harbor-dental-new-patient-intake". */
|
|
302
|
-
id: string;
|
|
303
|
-
/**
|
|
304
|
-
* THE SENTENCE. Who the user is, what business they run, and what job this
|
|
305
|
-
* exact feature does for them — one sentence, at the top, before anything
|
|
306
|
-
* else. This is the first thing the law asks for and the validator checks it.
|
|
307
|
-
*/
|
|
308
|
-
useCase: string;
|
|
309
|
-
/** The industry, for rotation: "Dentistry", "Property management". */
|
|
310
|
-
industry: string;
|
|
311
|
-
business: BusinessIdentity;
|
|
312
|
-
/**
|
|
313
|
-
* The tag written into a test organization's settings so cleanup can find it.
|
|
314
|
-
* Cleanup finds test data by THIS, never by a junk name.
|
|
315
|
-
*/
|
|
316
|
-
cleanupTag: string;
|
|
317
|
-
tables: UseCaseTable[];
|
|
318
|
-
relationships: UseCaseRelationship[];
|
|
319
|
-
form: UseCaseForm;
|
|
320
|
-
pipeline: UseCasePipeline;
|
|
321
|
-
dashboardQuestion: UseCaseDashboardQuestion;
|
|
322
|
-
documentTemplate: UseCaseDocumentTemplate;
|
|
323
|
-
notificationRule: UseCaseNotificationRule;
|
|
324
|
-
provenance: UseCaseProvenance;
|
|
325
|
-
}
|
|
326
|
-
/** What the registry lists without loading a use case's rows. */
|
|
327
|
-
interface UseCaseSummary {
|
|
328
|
-
id: string;
|
|
329
|
-
useCase: string;
|
|
330
|
-
industry: string;
|
|
331
|
-
businessName: string;
|
|
332
|
-
/** How many tables and rows the file carries, so a caller can pick by size. */
|
|
333
|
-
tableCount: number;
|
|
334
|
-
rowCount: number;
|
|
335
|
-
}
|
|
1
|
+
import { U as UseCase, a as UseCaseSummary } from '../types-RxnWzAWZ.cjs';
|
|
2
|
+
export { B as BusinessIdentity, F as FormAudience, N as NotificationChannel, P as PostalAddress, b as UseCaseDashboardQuestion, c as UseCaseDocumentTemplate, d as UseCaseField, e as UseCaseForm, f as UseCaseFormField, g as UseCaseMergeField, h as UseCaseNotificationRule, i as UseCaseNotificationTrigger, j as UseCasePipeline, k as UseCasePipelineStage, l as UseCaseProvenance, m as UseCaseRelationship, n as UseCaseRow, o as UseCaseTable } from '../types-RxnWzAWZ.cjs';
|
|
336
3
|
|
|
337
4
|
/** One banned pattern, with the reason and what to do instead. */
|
|
338
5
|
interface PlaceholderPattern {
|
|
@@ -446,4 +113,4 @@ declare function listUseCases(): Promise<UseCaseSummary[]>;
|
|
|
446
113
|
*/
|
|
447
114
|
declare function useCaseFor(consumer: string): string;
|
|
448
115
|
|
|
449
|
-
export { ALLOW_PRAGMA,
|
|
116
|
+
export { ALLOW_PRAGMA, MIN_ROWS_IN_PRIMARY_TABLE, PLACEHOLDER_PATTERNS, type PlaceholderHit, type PlaceholderPattern, RESOLVABLE_FIELD_TYPE_WORDS, USE_CASE_LOADERS, UseCase, type UseCaseProblem, UseCaseSummary, type UseCaseVerdict, assertUseCase, describePlaceholder, findPlaceholders, listUseCases, loadAllUseCases, loadUseCase, summarize, useCaseFor, useCaseIds, validateUseCase };
|