@things-factory/work-shift 10.0.19 → 10.1.1
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-client/pages/work-shift.d.ts +0 -1
- package/dist-client/pages/work-shift.js +5 -5
- package/dist-client/pages/work-shift.js.map +1 -1
- package/dist-client/tsconfig.tsbuildinfo +1 -1
- package/dist-server/service/index.d.ts +1 -0
- package/dist-server/service/index.js +7 -0
- package/dist-server/service/index.js.map +1 -1
- package/dist-server/service/work-shift/days-of-week.d.ts +30 -0
- package/dist-server/service/work-shift/days-of-week.js +74 -0
- package/dist-server/service/work-shift/days-of-week.js.map +1 -0
- package/dist-server/service/work-shift/index.d.ts +1 -0
- package/dist-server/service/work-shift/index.js +7 -0
- package/dist-server/service/work-shift/index.js.map +1 -1
- package/dist-server/service/work-shift/work-shift-type.d.ts +7 -0
- package/dist-server/service/work-shift/work-shift-type.js +4 -0
- package/dist-server/service/work-shift/work-shift-type.js.map +1 -1
- package/dist-server/service/work-shift/work-shift.d.ts +32 -0
- package/dist-server/service/work-shift/work-shift.js +5 -0
- package/dist-server/service/work-shift/work-shift.js.map +1 -1
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/helps/page/work-shift.ko.md +5 -0
- package/helps/page/work-shift.md +13 -0
- package/package.json +5 -5
- package/translations/en.json +2 -2
- package/translations/ja.json +1 -1
- package/translations/ko.json +1 -1
- package/translations/ms.json +1 -1
- package/translations/zh.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './work-shift/work-shift';
|
|
2
2
|
export * from './work-shift/work-shift-revision';
|
|
3
3
|
export * from './work-shift/work-shift-revision-service';
|
|
4
|
+
export * from './work-shift/days-of-week';
|
|
4
5
|
export declare const entities: (typeof import("./work-shift/work-shift").WorkShift | typeof import("./work-shift/work-shift-revision").WorkShiftRevision)[];
|
|
5
6
|
export declare const schema: {
|
|
6
7
|
resolverClasses: (typeof import("./work-shift/work-shift-query").DomainWorkShiftQuery | typeof import("./work-shift/work-shift-query").WorkShiftQuery | typeof import("./work-shift/work-shift-mutation").WorkShiftMutation | typeof import("./work-shift/work-shift-revision-query").WorkShiftRevisionQuery)[];
|
|
@@ -6,6 +6,13 @@ const tslib_1 = require("tslib");
|
|
|
6
6
|
tslib_1.__exportStar(require("./work-shift/work-shift"), exports);
|
|
7
7
|
tslib_1.__exportStar(require("./work-shift/work-shift-revision"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./work-shift/work-shift-revision-service"), exports);
|
|
9
|
+
/*
|
|
10
|
+
* This file names each source file rather than re-exporting the folder barrel, so anything added
|
|
11
|
+
* to that barrel stops at the package boundary unless it is also listed here. `daysOfWeek` is
|
|
12
|
+
* stored as a CSV and every consumer has to parse it, so the parser has to be reachable — a
|
|
13
|
+
* consumer that cannot import it writes its own, and the two disagree quietly.
|
|
14
|
+
*/
|
|
15
|
+
tslib_1.__exportStar(require("./work-shift/days-of-week"), exports);
|
|
9
16
|
/* IMPORT ENTITIES AND RESOLVERS */
|
|
10
17
|
const work_shift_1 = require("./work-shift");
|
|
11
18
|
exports.entities = [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,kEAAuC;AACvC,2EAAgD;AAChD,mFAAwD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../server/service/index.ts"],"names":[],"mappings":";;;;AAAA,yBAAyB;AACzB,kEAAuC;AACvC,2EAAgD;AAChD,mFAAwD;AACxD;;;;;GAKG;AACH,oEAAyC;AAEzC,mCAAmC;AACnC,6CAA6F;AAEhF,QAAA,QAAQ,GAAG;IACtB,cAAc;IACf,GAAG,qBAAiB;CACpB,CAAA;AAGY,QAAA,MAAM,GAAG;IACpB,eAAe,EAAE;QACf,sBAAsB;QACxB,GAAG,sBAAkB;KACpB;CACF,CAAA","sourcesContent":["/* EXPORT ENTITY TYPES */\nexport * from './work-shift/work-shift'\nexport * from './work-shift/work-shift-revision'\nexport * from './work-shift/work-shift-revision-service'\n/*\n * This file names each source file rather than re-exporting the folder barrel, so anything added\n * to that barrel stops at the package boundary unless it is also listed here. `daysOfWeek` is\n * stored as a CSV and every consumer has to parse it, so the parser has to be reachable — a\n * consumer that cannot import it writes its own, and the two disagree quietly.\n */\nexport * from './work-shift/days-of-week'\n\n/* IMPORT ENTITIES AND RESOLVERS */\nimport { entities as WorkShiftEntities, resolvers as WorkShiftResolvers } from './work-shift'\n\nexport const entities = [ \n /* ENTITIES */\n\t...WorkShiftEntities,\n] \n\n\nexport const schema = {\n resolverClasses: [\n /* RESOLVER CLASSES */\n\t\t...WorkShiftResolvers,\n ] \n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** 0 Sunday … 6 Saturday, the same numbering `Date.getDay()` uses. */
|
|
2
|
+
export type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
3
|
+
/**
|
|
4
|
+
* The weekdays this shift runs on, or `undefined` when it runs every day.
|
|
5
|
+
*
|
|
6
|
+
* Junk is dropped rather than throwing. This value comes from a column that a person can
|
|
7
|
+
* edit and from clients written before the field existed; refusing to read a row because
|
|
8
|
+
* one segment is wrong would take a whole site's calendar down for a typo. What is
|
|
9
|
+
* dropped is a segment, and if every segment is junk the result is `undefined` — which is
|
|
10
|
+
* the pre-existing behaviour, not a made-up restriction.
|
|
11
|
+
*/
|
|
12
|
+
export declare function readDaysOfWeek(csv?: string | null): Weekday[] | undefined;
|
|
13
|
+
/**
|
|
14
|
+
* The stored form of a weekday list, or `undefined` for every day.
|
|
15
|
+
*
|
|
16
|
+
* Sorted and de-duplicated so that two ways of saying the same thing produce the same
|
|
17
|
+
* string — otherwise a row looks changed when it is not, and the revision history fills
|
|
18
|
+
* with edits nobody made.
|
|
19
|
+
*/
|
|
20
|
+
export declare function writeDaysOfWeek(days?: readonly number[] | null): string | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* Does this shift run on that date?
|
|
23
|
+
*
|
|
24
|
+
* ⚠ The weekday is read in the caller's timezone, because `Date.getDay()` is local. A
|
|
25
|
+
* shift's days are stated against the site's calendar, so the date handed in must already
|
|
26
|
+
* be in the site's time base — the same rule the shift's `HH:MM` already follows
|
|
27
|
+
* (§`withSpaceTimeBase`). Handing in a UTC date for a site that is not on UTC will get
|
|
28
|
+
* the wrong answer near midnight, silently.
|
|
29
|
+
*/
|
|
30
|
+
export declare function runsOn(csv: string | null | undefined, when: Date): boolean;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Reading and writing a shift's weekdays — pure, one place.
|
|
4
|
+
*
|
|
5
|
+
* ── Why this is not left to each consumer ─────────────────────────────────
|
|
6
|
+
* The column is a CSV because array columns are not portable across the five drivers
|
|
7
|
+
* things-factory supports. That means every reader has to parse it, and a parser written
|
|
8
|
+
* twice will disagree eventually — on whitespace, on an out-of-range digit, on what an
|
|
9
|
+
* empty string means. The disagreement would not raise anything: one consumer would think
|
|
10
|
+
* the site rests on Sunday and another would not, and both would keep computing.
|
|
11
|
+
*
|
|
12
|
+
* So the string is written and read here, and the meaning is decided once.
|
|
13
|
+
*
|
|
14
|
+
* ── Empty means every day ─────────────────────────────────────────────────
|
|
15
|
+
* Rows that predate the column have no value, and they must keep behaving as they did.
|
|
16
|
+
* `undefined` is returned for that case rather than a full list of seven, so a caller can
|
|
17
|
+
* still tell "no restriction was ever stated" from "someone chose all seven days". The
|
|
18
|
+
* two are the same in effect and different in intent, and the second one is a person's
|
|
19
|
+
* decision worth keeping.
|
|
20
|
+
*/
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.readDaysOfWeek = readDaysOfWeek;
|
|
23
|
+
exports.writeDaysOfWeek = writeDaysOfWeek;
|
|
24
|
+
exports.runsOn = runsOn;
|
|
25
|
+
/**
|
|
26
|
+
* The weekdays this shift runs on, or `undefined` when it runs every day.
|
|
27
|
+
*
|
|
28
|
+
* Junk is dropped rather than throwing. This value comes from a column that a person can
|
|
29
|
+
* edit and from clients written before the field existed; refusing to read a row because
|
|
30
|
+
* one segment is wrong would take a whole site's calendar down for a typo. What is
|
|
31
|
+
* dropped is a segment, and if every segment is junk the result is `undefined` — which is
|
|
32
|
+
* the pre-existing behaviour, not a made-up restriction.
|
|
33
|
+
*/
|
|
34
|
+
function readDaysOfWeek(csv) {
|
|
35
|
+
if (!csv || !csv.trim()) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const days = new Set();
|
|
39
|
+
for (const part of csv.split(',')) {
|
|
40
|
+
const n = Number(part.trim());
|
|
41
|
+
if (Number.isInteger(n) && n >= 0 && n <= 6) {
|
|
42
|
+
days.add(n);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return days.size ? [...days].sort((a, b) => a - b) : undefined;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The stored form of a weekday list, or `undefined` for every day.
|
|
49
|
+
*
|
|
50
|
+
* Sorted and de-duplicated so that two ways of saying the same thing produce the same
|
|
51
|
+
* string — otherwise a row looks changed when it is not, and the revision history fills
|
|
52
|
+
* with edits nobody made.
|
|
53
|
+
*/
|
|
54
|
+
function writeDaysOfWeek(days) {
|
|
55
|
+
if (!days?.length) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
const kept = readDaysOfWeek(days.join(','));
|
|
59
|
+
return kept?.join(',');
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Does this shift run on that date?
|
|
63
|
+
*
|
|
64
|
+
* ⚠ The weekday is read in the caller's timezone, because `Date.getDay()` is local. A
|
|
65
|
+
* shift's days are stated against the site's calendar, so the date handed in must already
|
|
66
|
+
* be in the site's time base — the same rule the shift's `HH:MM` already follows
|
|
67
|
+
* (§`withSpaceTimeBase`). Handing in a UTC date for a site that is not on UTC will get
|
|
68
|
+
* the wrong answer near midnight, silently.
|
|
69
|
+
*/
|
|
70
|
+
function runsOn(csv, when) {
|
|
71
|
+
const days = readDaysOfWeek(csv);
|
|
72
|
+
return days === undefined || days.includes(when.getDay());
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=days-of-week.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"days-of-week.js","sourceRoot":"","sources":["../../../server/service/work-shift/days-of-week.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;AAcH,wCAgBC;AASD,0CAQC;AAWD,wBAIC;AAzDD;;;;;;;;GAQG;AACH,SAAgB,cAAc,CAAC,GAAmB;IAChD,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC;QACxB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,IAAI,GAAG,IAAI,GAAG,EAAW,CAAA;IAE/B,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QAClC,MAAM,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QAE7B,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5C,IAAI,CAAC,GAAG,CAAC,CAAY,CAAC,CAAA;QACxB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;AAChE,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,IAA+B;IAC7D,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,IAAI,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAA;IAE3C,OAAO,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,CAAA;AACxB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,MAAM,CAAC,GAA8B,EAAE,IAAU;IAC/D,MAAM,IAAI,GAAG,cAAc,CAAC,GAAG,CAAC,CAAA;IAEhC,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAa,CAAC,CAAA;AACtE,CAAC","sourcesContent":["/*\n * Reading and writing a shift's weekdays — pure, one place.\n *\n * ── Why this is not left to each consumer ─────────────────────────────────\n * The column is a CSV because array columns are not portable across the five drivers\n * things-factory supports. That means every reader has to parse it, and a parser written\n * twice will disagree eventually — on whitespace, on an out-of-range digit, on what an\n * empty string means. The disagreement would not raise anything: one consumer would think\n * the site rests on Sunday and another would not, and both would keep computing.\n *\n * So the string is written and read here, and the meaning is decided once.\n *\n * ── Empty means every day ─────────────────────────────────────────────────\n * Rows that predate the column have no value, and they must keep behaving as they did.\n * `undefined` is returned for that case rather than a full list of seven, so a caller can\n * still tell \"no restriction was ever stated\" from \"someone chose all seven days\". The\n * two are the same in effect and different in intent, and the second one is a person's\n * decision worth keeping.\n */\n\n/** 0 Sunday … 6 Saturday, the same numbering `Date.getDay()` uses. */\nexport type Weekday = 0 | 1 | 2 | 3 | 4 | 5 | 6\n\n/**\n * The weekdays this shift runs on, or `undefined` when it runs every day.\n *\n * Junk is dropped rather than throwing. This value comes from a column that a person can\n * edit and from clients written before the field existed; refusing to read a row because\n * one segment is wrong would take a whole site's calendar down for a typo. What is\n * dropped is a segment, and if every segment is junk the result is `undefined` — which is\n * the pre-existing behaviour, not a made-up restriction.\n */\nexport function readDaysOfWeek(csv?: string | null): Weekday[] | undefined {\n if (!csv || !csv.trim()) {\n return undefined\n }\n\n const days = new Set<Weekday>()\n\n for (const part of csv.split(',')) {\n const n = Number(part.trim())\n\n if (Number.isInteger(n) && n >= 0 && n <= 6) {\n days.add(n as Weekday)\n }\n }\n\n return days.size ? [...days].sort((a, b) => a - b) : undefined\n}\n\n/**\n * The stored form of a weekday list, or `undefined` for every day.\n *\n * Sorted and de-duplicated so that two ways of saying the same thing produce the same\n * string — otherwise a row looks changed when it is not, and the revision history fills\n * with edits nobody made.\n */\nexport function writeDaysOfWeek(days?: readonly number[] | null): string | undefined {\n if (!days?.length) {\n return undefined\n }\n\n const kept = readDaysOfWeek(days.join(','))\n\n return kept?.join(',')\n}\n\n/**\n * Does this shift run on that date?\n *\n * ⚠ The weekday is read in the caller's timezone, because `Date.getDay()` is local. A\n * shift's days are stated against the site's calendar, so the date handed in must already\n * be in the site's time base — the same rule the shift's `HH:MM` already follows\n * (§`withSpaceTimeBase`). Handing in a UTC date for a site that is not on UTC will get\n * the wrong answer near midnight, silently.\n */\nexport function runsOn(csv: string | null | undefined, when: Date): boolean {\n const days = readDaysOfWeek(csv)\n\n return days === undefined || days.includes(when.getDay() as Weekday)\n}\n"]}
|
|
@@ -3,5 +3,6 @@ import { WorkShift } from './work-shift';
|
|
|
3
3
|
import { WorkShiftMutation } from './work-shift-mutation';
|
|
4
4
|
import { WorkShiftRevision } from './work-shift-revision';
|
|
5
5
|
import { WorkShiftRevisionQuery } from './work-shift-revision-query';
|
|
6
|
+
export * from './days-of-week';
|
|
6
7
|
export declare const entities: (typeof WorkShift | typeof WorkShiftRevision)[];
|
|
7
8
|
export declare const resolvers: (typeof DomainWorkShiftQuery | typeof WorkShiftQuery | typeof WorkShiftMutation | typeof WorkShiftRevisionQuery)[];
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolvers = exports.entities = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const work_shift_query_1 = require("./work-shift-query");
|
|
5
6
|
const work_shift_1 = require("./work-shift");
|
|
6
7
|
const work_shift_mutation_1 = require("./work-shift-mutation");
|
|
7
8
|
const work_shift_revision_1 = require("./work-shift-revision");
|
|
8
9
|
const work_shift_revision_query_1 = require("./work-shift-revision-query");
|
|
10
|
+
/*
|
|
11
|
+
* The weekday rule is exported so consumers read the column through one parser. It is a CSV
|
|
12
|
+
* because array columns are not portable across the five drivers, and a parser written twice
|
|
13
|
+
* disagrees eventually — quietly, since both halves keep computing (§`days-of-week.ts`).
|
|
14
|
+
*/
|
|
15
|
+
tslib_1.__exportStar(require("./days-of-week"), exports);
|
|
9
16
|
exports.entities = [work_shift_1.WorkShift, work_shift_revision_1.WorkShiftRevision];
|
|
10
17
|
exports.resolvers = [work_shift_query_1.DomainWorkShiftQuery, work_shift_query_1.WorkShiftQuery, work_shift_mutation_1.WorkShiftMutation, work_shift_revision_query_1.WorkShiftRevisionQuery];
|
|
11
18
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/work-shift/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/work-shift/index.ts"],"names":[],"mappings":";;;;AAAA,yDAAyE;AAEzE,6CAAwC;AACxC,+DAAyD;AACzD,+DAAyD;AACzD,2EAAoE;AAEpE;;;;GAIG;AACH,yDAA8B;AAEjB,QAAA,QAAQ,GAAG,CAAC,sBAAS,EAAE,uCAAiB,CAAC,CAAA;AACzC,QAAA,SAAS,GAAG,CAAC,uCAAoB,EAAE,iCAAc,EAAE,uCAAiB,EAAE,kDAAsB,CAAC,CAAA","sourcesContent":["import { DomainWorkShiftQuery, WorkShiftQuery } from './work-shift-query'\n\nimport { WorkShift } from './work-shift'\nimport { WorkShiftMutation } from './work-shift-mutation'\nimport { WorkShiftRevision } from './work-shift-revision'\nimport { WorkShiftRevisionQuery } from './work-shift-revision-query'\n\n/*\n * The weekday rule is exported so consumers read the column through one parser. It is a CSV\n * because array columns are not portable across the five drivers, and a parser written twice\n * disagrees eventually — quietly, since both halves keep computing (§`days-of-week.ts`).\n */\nexport * from './days-of-week'\n\nexport const entities = [WorkShift, WorkShiftRevision]\nexport const resolvers = [DomainWorkShiftQuery, WorkShiftQuery, WorkShiftMutation, WorkShiftRevisionQuery]\n"]}
|
|
@@ -7,6 +7,13 @@ export declare class WorkShiftPatch {
|
|
|
7
7
|
fromTime: string;
|
|
8
8
|
toDate: WorkShiftDateType;
|
|
9
9
|
toTime: string;
|
|
10
|
+
/**
|
|
11
|
+
* Which weekdays this shift runs on — 0 Sunday … 6 Saturday, empty for every day.
|
|
12
|
+
*
|
|
13
|
+
* Nullable so that a client written before this field existed keeps working: an
|
|
14
|
+
* absent value means every day, which is exactly what those clients meant.
|
|
15
|
+
*/
|
|
16
|
+
daysOfWeek?: string;
|
|
10
17
|
}
|
|
11
18
|
export declare class WorkShiftList {
|
|
12
19
|
items: WorkShift[];
|
|
@@ -32,6 +32,10 @@ tslib_1.__decorate([
|
|
|
32
32
|
(0, type_graphql_1.Field)(),
|
|
33
33
|
tslib_1.__metadata("design:type", String)
|
|
34
34
|
], WorkShiftPatch.prototype, "toTime", void 0);
|
|
35
|
+
tslib_1.__decorate([
|
|
36
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Weekdays this shift runs on as a CSV of 0(Sun)..6(Sat). Empty means every day' }),
|
|
37
|
+
tslib_1.__metadata("design:type", String)
|
|
38
|
+
], WorkShiftPatch.prototype, "daysOfWeek", void 0);
|
|
35
39
|
exports.WorkShiftPatch = WorkShiftPatch = tslib_1.__decorate([
|
|
36
40
|
(0, type_graphql_1.InputType)()
|
|
37
41
|
], WorkShiftPatch);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"work-shift-type.js","sourceRoot":"","sources":["../../../server/service/work-shift/work-shift-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAsF;AACtF,6CAA2D;AAC3D,+DAAyD;AAGlD,IAAM,cAAc,GAApB,MAAM,cAAc;
|
|
1
|
+
{"version":3,"file":"work-shift-type.js","sourceRoot":"","sources":["../../../server/service/work-shift/work-shift-type.ts"],"names":[],"mappings":";;;;AAAA,+CAAsF;AACtF,6CAA2D;AAC3D,+DAAyD;AAGlD,IAAM,cAAc,GAApB,MAAM,cAAc;CA2B1B,CAAA;AA3BY,wCAAc;AAEzB;IADC,IAAA,oBAAK,GAAE;;4CACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAGpB;IADC,IAAA,oBAAK,GAAE;;gDACmB;AAG3B;IADC,IAAA,oBAAK,GAAE;;gDACQ;AAGhB;IADC,IAAA,oBAAK,GAAE;;8CACiB;AAGzB;IADC,IAAA,oBAAK,GAAE;;8CACM;AASd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,+EAA+E,EAAE,CAAC;;kDACrG;yBA1BR,cAAc;IAD1B,IAAA,wBAAS,GAAE;GACC,cAAc,CA2B1B;AAGM,IAAM,aAAa,GAAnB,MAAM,aAAa;CAMzB,CAAA;AANY,sCAAa;AAExB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,sBAAS,CAAC,CAAC;;4CACT;AAGlB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;4CACN;wBALF,aAAa;IADzB,IAAA,yBAAU,GAAE;GACA,aAAa,CAMzB;AAGM,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;CAMjC,CAAA;AANY,sDAAqB;AAEhC;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,uCAAiB,CAAC,CAAC;;oDACT;AAG1B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,CAAC;;oDACN;gCALF,qBAAqB;IADjC,IAAA,yBAAU,GAAE;GACA,qBAAqB,CAMjC;AAGM,IAAM,aAAa,GAAnB,MAAM,aAAa;CAYzB,CAAA;AAZY,sCAAa;AAExB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACT;AAGjB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACR;AAGlB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACxB;AAGlB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACvB;wBAXR,aAAa;IADzB,IAAA,yBAAU,GAAE;GACA,aAAa,CAYzB","sourcesContent":["import { Field, ID, InputType, Int, ObjectType, registerEnumType } from 'type-graphql'\nimport { WorkShift, WorkShiftDateType } from './work-shift'\nimport { WorkShiftRevision } from './work-shift-revision'\n\n@InputType()\nexport class WorkShiftPatch {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field()\n fromDate: WorkShiftDateType\n\n @Field()\n fromTime: string\n\n @Field()\n toDate: WorkShiftDateType\n\n @Field()\n toTime: string\n\n /**\n * Which weekdays this shift runs on — 0 Sunday … 6 Saturday, empty for every day.\n *\n * Nullable so that a client written before this field existed keeps working: an\n * absent value means every day, which is exactly what those clients meant.\n */\n @Field({ nullable: true, description: 'Weekdays this shift runs on as a CSV of 0(Sun)..6(Sat). Empty means every day' })\n daysOfWeek?: string\n}\n\n@ObjectType()\nexport class WorkShiftList {\n @Field(type => [WorkShift])\n items: WorkShift[]\n\n @Field(type => Int)\n total: number\n}\n\n@ObjectType()\nexport class WorkShiftRevisionList {\n @Field(type => [WorkShiftRevision])\n items: WorkShiftRevision[]\n\n @Field(type => Int)\n total: number\n}\n\n@ObjectType()\nexport class WorkShiftInfo {\n @Field({ nullable: true })\n workDate?: string\n\n @Field({ nullable: true })\n workShift?: string\n\n @Field(type => [Date], { nullable: true })\n dateRange?: Date[]\n\n @Field(type => [Date], { nullable: true })\n shiftRange?: Date[]\n}\n"]}
|
|
@@ -15,6 +15,38 @@ export declare class WorkShift {
|
|
|
15
15
|
fromTime: string;
|
|
16
16
|
toDate: WorkShiftDateType;
|
|
17
17
|
toTime: string;
|
|
18
|
+
/**
|
|
19
|
+
* Which weekdays this shift runs on — 0 Sunday … 6 Saturday. Empty means every day.
|
|
20
|
+
*
|
|
21
|
+
* ── What was wrong without it (2026-09-07) ────────────────────────────────
|
|
22
|
+
* A shift could only say what time of day it covers, never which days. So a site that
|
|
23
|
+
* rests on Saturday and Sunday was modelled as running 24 hours a day, seven days a
|
|
24
|
+
* week, and everything computed from available time inflated: OEE's planned production
|
|
25
|
+
* time, capacity, and the throughput predicted from them.
|
|
26
|
+
*
|
|
27
|
+
* The standard vocabulary already carried this. `WorkCalendarEntry` in
|
|
28
|
+
* `@operato/ops-contract` — ISA-95's `WorkCalendarEntryType` — has `daysOfWeek`, and
|
|
29
|
+
* operato-plant hands these rows to `equipment.workCalendar` as those entries. The
|
|
30
|
+
* field arrived at the boundary empty because there was nowhere here to read it from.
|
|
31
|
+
*
|
|
32
|
+
* ── Why a string and not a relation or an array column ────────────────────
|
|
33
|
+
* things-factory runs on five drivers and array columns are not portable across them
|
|
34
|
+
* (postgres spells them one way, sqlite has none). A short CSV of digits — `1,2,3,4,5`
|
|
35
|
+
* for a weekday-only shift — reads the same everywhere and is legible in a table
|
|
36
|
+
* during an incident.
|
|
37
|
+
*
|
|
38
|
+
* ── Empty means every day, and that is not the same as none ───────────────
|
|
39
|
+
* Existing rows have no value here and must keep behaving exactly as before, so absent
|
|
40
|
+
* reads as "every day". A shift that runs on no day at all is not a thing anyone means;
|
|
41
|
+
* if that ever needs saying, it is a shift that should be deleted or deactivated.
|
|
42
|
+
*
|
|
43
|
+
* ── One-off dates do not belong here ──────────────────────────────────────
|
|
44
|
+
* A holiday, a shutdown week, a maintenance window on one particular date is an
|
|
45
|
+
* absolute interval, and `@things-factory/calendar` already stores those as `Event`
|
|
46
|
+
* rows with `startDateTime`/`endDateTime`. Putting them here as well would give the
|
|
47
|
+
* same fact two homes and split which screen a person registers August 15th on.
|
|
48
|
+
*/
|
|
49
|
+
daysOfWeek?: string;
|
|
18
50
|
createdAt?: Date;
|
|
19
51
|
updatedAt?: Date;
|
|
20
52
|
creator?: User;
|
|
@@ -65,6 +65,11 @@ tslib_1.__decorate([
|
|
|
65
65
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
66
66
|
tslib_1.__metadata("design:type", String)
|
|
67
67
|
], WorkShift.prototype, "toTime", void 0);
|
|
68
|
+
tslib_1.__decorate([
|
|
69
|
+
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
70
|
+
(0, type_graphql_1.Field)({ nullable: true, description: 'Weekdays this shift runs on as a CSV of 0(Sun)..6(Sat). Empty means every day' }),
|
|
71
|
+
tslib_1.__metadata("design:type", String)
|
|
72
|
+
], WorkShift.prototype, "daysOfWeek", void 0);
|
|
68
73
|
tslib_1.__decorate([
|
|
69
74
|
(0, typeorm_1.CreateDateColumn)(),
|
|
70
75
|
(0, type_graphql_1.Field)({ nullable: true }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"work-shift.js","sourceRoot":"","sources":["../../../server/service/work-shift/work-shift.ts"],"names":[],"mappings":";;;;AAAA,qCASgB;AAChB,+CAA2E;AAE3E,iDAA8C;AAC9C,yDAAgD;AAEhD,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,0EAAiB,CAAA;IACjB,6DAAU,CAAA;IACV,uEAAe,CAAA;AACjB,CAAC,EAJW,iBAAiB,iCAAjB,iBAAiB,QAI5B;AAED,IAAA,+BAAgB,EAAC,iBAAiB,EAAE;IAClC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,6BAA6B;CAC3C,CAA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AGd;IADC,IAAA,oBAAU,EAAC,CAAC,SAAoB,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC;;4CACtC;oBA7FP,SAAS;IANrB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,iBAAiB,EAAE,CAAC,SAAoB,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IACxG,IAAA,eAAK,EAAC,iBAAiB,EAAE,CAAC,SAAoB,EAAE,EAAE,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,QAAQ,CAAC,EAAE;QAC9G,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,sBAAsB,EAAE,CAAC;GACvC,SAAS,CA8FrB","sourcesContent":["import {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\nimport { Field, ID, Int, ObjectType, registerEnumType } from 'type-graphql'\n\nimport { Domain } from '@things-factory/shell'\nimport { User } from '@things-factory/auth-base'\n\nexport enum WorkShiftDateType {\n TheDayBefore = -1,\n TheDay = 0,\n TheDayAfter = 1\n}\n\nregisterEnumType(WorkShiftDateType, {\n name: 'WorkShiftDateType',\n description: 'enumeration of a shift date'\n})\n\n@Entity()\n@Index('ix_work_shift_0', (workShift: WorkShift) => [workShift.domain, workShift.name], { unique: true })\n@Index('ix_work_shift_1', (workShift: WorkShift) => [workShift.domain, workShift.fromDate, workShift.fromTime], {\n unique: true\n})\n@ObjectType({ description: 'Entity for WorkShift' })\nexport class WorkShift {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain?: Domain\n\n @RelationId((workShift: WorkShift) => workShift.domain)\n domainId?: string\n\n @Column()\n @Field()\n name: string\n\n @Column({\n nullable: true\n })\n @Field({ nullable: true })\n description?: string\n\n @Column()\n @Field({ nullable: true })\n fromDate: WorkShiftDateType\n\n @Column()\n @Field({ nullable: true })\n fromTime: string\n\n @Column()\n @Field({ nullable: true })\n toDate: WorkShiftDateType\n\n @Column()\n @Field({ nullable: true })\n toTime: string\n\n /**\n * Which weekdays this shift runs on — 0 Sunday … 6 Saturday. Empty means every day.\n *\n * ── What was wrong without it (2026-09-07) ────────────────────────────────\n * A shift could only say what time of day it covers, never which days. So a site that\n * rests on Saturday and Sunday was modelled as running 24 hours a day, seven days a\n * week, and everything computed from available time inflated: OEE's planned production\n * time, capacity, and the throughput predicted from them.\n *\n * The standard vocabulary already carried this. `WorkCalendarEntry` in\n * `@operato/ops-contract` — ISA-95's `WorkCalendarEntryType` — has `daysOfWeek`, and\n * operato-plant hands these rows to `equipment.workCalendar` as those entries. The\n * field arrived at the boundary empty because there was nowhere here to read it from.\n *\n * ── Why a string and not a relation or an array column ────────────────────\n * things-factory runs on five drivers and array columns are not portable across them\n * (postgres spells them one way, sqlite has none). A short CSV of digits — `1,2,3,4,5`\n * for a weekday-only shift — reads the same everywhere and is legible in a table\n * during an incident.\n *\n * ── Empty means every day, and that is not the same as none ───────────────\n * Existing rows have no value here and must keep behaving exactly as before, so absent\n * reads as \"every day\". A shift that runs on no day at all is not a thing anyone means;\n * if that ever needs saying, it is a shift that should be deleted or deactivated.\n *\n * ── One-off dates do not belong here ──────────────────────────────────────\n * A holiday, a shutdown week, a maintenance window on one particular date is an\n * absolute interval, and `@things-factory/calendar` already stores those as `Event`\n * rows with `startDateTime`/`endDateTime`. Putting them here as well would give the\n * same fact two homes and split which screen a person registers August 15th on.\n */\n @Column({ type: 'varchar', nullable: true })\n @Field({ nullable: true, description: 'Weekdays this shift runs on as a CSV of 0(Sun)..6(Sat). Empty means every day' })\n daysOfWeek?: string\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((workShift: WorkShift) => workShift.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((workShift: WorkShift) => workShift.updater)\n updaterId?: string\n}\n"]}
|