@mistriwork/engine 1.0.0-rc.60 → 1.0.0-rc.62
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/server/seed/seed.js +8 -4
- package/package.json +1 -1
package/dist/server/seed/seed.js
CHANGED
|
@@ -53,11 +53,11 @@ const PERSON = /^(customers?|clients?|contacts?|patients?|students?|drivers?|own
|
|
|
53
53
|
const COMPANY = /^(companies|company|accounts?|organi[sz]ations?|orgs?|vendors?|suppliers?|partners?|businesses|business|firms?|brands?)$/i;
|
|
54
54
|
const BORN = [/created/i, /opened/i, /received|registered|reported|requested|raised|booked|logged/i, /ordered|placed|submitted/i, /date$/i];
|
|
55
55
|
/* Columns that hold when something is to happen, not when it did: a schedule's dashboards read "today" and "next". */
|
|
56
|
-
const SCHEDULE = /(^|_)(appointment|appt|scheduled|starts?|begins?|follow_?up|planned|booked_for|check_?in|session|visit)(_|$)|^start_(at|on|date|time)$/i;
|
|
56
|
+
const SCHEDULE = /(^|_)(appointment|appt|scheduled|starts?|begins?|follow_?up|planned|booked_for|check_?in|session|visit)(_|$)|^start_(at|on|date|time)$|^(remind|run|send|publish|fire|notify|trigger|release)_(at|on)$/i;
|
|
57
57
|
/* Tables whose rows are things that happen at a time: their plain dates are when, not when the row was written. */
|
|
58
58
|
/* When a row was written, as against a plain `date` or `at` that may say when the thing it holds happens. */
|
|
59
59
|
const WRITTEN = BORN.slice(0, 4);
|
|
60
|
-
const SCHEDULE_TABLE = /^(appointments?|bookings?|visits?|sessions?|events?|reservations?|shifts?|lessons?|classes|meetings?|rentals?|viewings?)$/i;
|
|
60
|
+
const SCHEDULE_TABLE = /^(appointments?|bookings?|visits?|sessions?|events?|reservations?|shifts?|lessons?|classes|meetings?|rentals?|viewings?|slots?|schedules?|tours?|interviews?|deliver(y|ies)|pickups?)$/i;
|
|
61
61
|
/* Optional by nature: a note may well be blank; every other text column is filled nearly always. */
|
|
62
62
|
const OPTIONAL_TEXT = /(^|_)(notes?|comments?|remarks?|cancel(l?ation)?|middle_name|nickname|suffix|address_?line_?2|line_?2|fax|alt|secondary)(_|$)/i;
|
|
63
63
|
/* Roles in the building that a title is a job title for. */
|
|
@@ -88,6 +88,9 @@ function moment(column, types) {
|
|
|
88
88
|
return read;
|
|
89
89
|
if (columnKind(column.type ?? '') === 'date')
|
|
90
90
|
return /time/i.test(column.type) ? 'instant' : 'date';
|
|
91
|
+
/* A bare `at` is the moment a thing is at, as a `_at` is (a slot's `at`), though the shared reading wants the suffix. */
|
|
92
|
+
if (columnKind(column.type ?? '') === 'text' && column.name === 'at')
|
|
93
|
+
return 'instant';
|
|
91
94
|
return columnKind(column.type ?? '') === 'text' && /(^|_)date$/i.test(column.name) ? 'date' : undefined;
|
|
92
95
|
}
|
|
93
96
|
function draftedLife(table) {
|
|
@@ -805,10 +808,11 @@ function crowd(dice, options) {
|
|
|
805
808
|
},
|
|
806
809
|
};
|
|
807
810
|
}
|
|
808
|
-
/** When a scheduled thing happens: a
|
|
811
|
+
/** When a scheduled thing happens: a window of two weeks either side of today, a little of it today, as much behind as
|
|
812
|
+
* ahead, so a calendar's week and its "upcoming" and "past" lists all have rows (rows a quarter back left a week empty). */
|
|
809
813
|
function scheduledFor(dice, today) {
|
|
810
814
|
const roll = dice.next();
|
|
811
|
-
const days = roll < 0.
|
|
815
|
+
const days = roll < 0.12 ? 0 : roll < 0.56 ? dice.int(1, 14) : -dice.int(1, 14);
|
|
812
816
|
return new Date(today.getTime() + days * DAY + dice.int(8, 17) * 3_600_000 + dice.int(0, 3) * 15 * 60_000);
|
|
813
817
|
}
|
|
814
818
|
/* SQLite's INTEGER PRIMARY KEY is the rowid: the database numbers it. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mistriwork/engine",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.62",
|
|
4
4
|
"description": "The engine both products stand on: the adapters (SQLite, Postgres), the catalog, the query language, keyset pages, the HTTP kit and the shared rules. No React.",
|
|
5
5
|
"homepage": "https://mistriwork.dev",
|
|
6
6
|
"bugs": {
|