@ibiliaze/global-vars 1.183.0 → 1.184.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/dist/flows.d.ts CHANGED
@@ -32,6 +32,7 @@ export interface CanISeeSeatArgs<Id, TDate> {
32
32
  where: WhereOf<Id, TDate>;
33
33
  userFlowIds: UserFlowIdsOf<Id, TDate>;
34
34
  occupanceCategory?: OccupanceCategoryOf<Id, TDate>;
35
+ sectionCategory?: OccupanceCategoryOf<Id, TDate>;
35
36
  eventCategories: EventCategoryOf<Id>[];
36
37
  signedFlowId?: Id | null;
37
38
  }
package/dist/flows.js CHANGED
@@ -36,7 +36,7 @@ function makeSaleLogic() {
36
36
  const guestSeesOnline = (flow) => flow.type === 'Online';
37
37
  const cashierSeesOffline = (flow, userFlowIds) => flow.type === 'Offline' && (0, exports.arrayHasId)(userFlowIds, flow.flowId);
38
38
  const comesFromSpecialLink = (flow, signedFlowId) => flow.type === 'Special link' && (0, exports.idsEqual)(flow.flowId, signedFlowId);
39
- const authoriser = ({ who, where, effectiveFlows, signedFlowId, userFlowIds, }) => {
39
+ const authoriser = ({ who, where, effectiveFlows, signedFlowId, userFlowIds }) => {
40
40
  // Guest
41
41
  if (who === 'guest') {
42
42
  if (where === 'Offline')
@@ -59,17 +59,17 @@ function makeSaleLogic() {
59
59
  }
60
60
  return false;
61
61
  };
62
- function canISeeSection({ who, where, sectionId, userFlowIds, signedFlowId, eventCategories, }) {
62
+ function canISeeSection({ who, where, sectionId, userFlowIds, signedFlowId, eventCategories }) {
63
63
  try {
64
64
  if (who === 'root')
65
65
  return true;
66
66
  if (!eventCategories || !eventCategories.length)
67
67
  return false;
68
68
  const sectionFlows = [
69
- ...eventCategories.flatMap(link => link.sections?.flatMap(section => ((0, exports.idsEqual)(section.sectionId, sectionId) ? section.flows : []))),
69
+ ...eventCategories.flatMap(link => link.sections?.flatMap(section => ((0, exports.idsEqual)(section.sectionId, sectionId) ? section?.flows ?? [] : []))),
70
70
  ];
71
71
  const categoryFlows = [
72
- ...eventCategories.flatMap(link => link.sections?.some(section => (0, exports.idsEqual)(section.sectionId, sectionId)) ? link.flows : []),
72
+ ...eventCategories.flatMap(link => (link.sections?.some(section => (0, exports.idsEqual)(section.sectionId, sectionId)) ? link?.flows ?? [] : [])),
73
73
  ];
74
74
  const effectiveFlows = sectionFlows.length ? sectionFlows : categoryFlows;
75
75
  return authoriser({ who, where, effectiveFlows, signedFlowId, userFlowIds });
@@ -78,15 +78,14 @@ function makeSaleLogic() {
78
78
  return false;
79
79
  }
80
80
  }
81
- function canISeeSeat({ who, where, signedFlowId, userFlowIds, occupanceCategory, eventCategories, }) {
81
+ function canISeeSeat({ who, where, signedFlowId, userFlowIds, occupanceCategory, eventCategories, sectionCategory }) {
82
82
  try {
83
83
  if (who === 'root')
84
84
  return true;
85
- if (!occupanceCategory || !occupanceCategory.categoryId)
86
- return true;
87
- const effectiveFlows = (eventCategories || [])
88
- .filter(link => (0, exports.idsEqual)(link.categoryId, occupanceCategory.categoryId))
89
- .flatMap(link => link.flows);
85
+ const effectiveCategory = occupanceCategory || sectionCategory;
86
+ if (!effectiveCategory || !effectiveCategory.categoryId)
87
+ return false;
88
+ const effectiveFlows = (eventCategories || []).filter(link => (0, exports.idsEqual)(link.categoryId, effectiveCategory.categoryId)).flatMap(link => link?.flows ?? []);
90
89
  return authoriser({ who, where, effectiveFlows, signedFlowId, userFlowIds });
91
90
  }
92
91
  catch {
@@ -110,7 +109,7 @@ function makeSaleLogic() {
110
109
  return undefined;
111
110
  }
112
111
  }
113
- function getOccupanceCategory({ occupanceCategory, eventCategories, }) {
112
+ function getOccupanceCategory({ occupanceCategory, eventCategories }) {
114
113
  try {
115
114
  const occupanceCat = eventCategories?.find(link => (0, exports.idsEqual)(link.categoryId, occupanceCategory?.categoryId));
116
115
  return {
@@ -12,22 +12,6 @@ export declare const sectionRoleDefs: <TId, TDate>() => readonly [{
12
12
  message: string;
13
13
  error: string;
14
14
  };
15
- }, {
16
- readonly method: "post";
17
- readonly path: "/section/seats/:id";
18
- readonly role: "postSectionSeatsById";
19
- readonly name: "Create section seats";
20
- readonly response_201: {
21
- section: SectionBase<TId, TDate>;
22
- message: string;
23
- };
24
- readonly response_404: {
25
- message: string;
26
- };
27
- readonly response_500: {
28
- message: string;
29
- error: string;
30
- };
31
15
  }, {
32
16
  readonly method: "get";
33
17
  readonly path: "/section";
@@ -11,15 +11,6 @@ const sectionRoleDefs = () => {
11
11
  response_201: {},
12
12
  response_500: {},
13
13
  },
14
- {
15
- method: 'post',
16
- path: '/section/seats/:id',
17
- role: 'postSectionSeatsById',
18
- name: 'Create section seats',
19
- response_201: {},
20
- response_404: {},
21
- response_500: {},
22
- },
23
14
  {
24
15
  method: 'get',
25
16
  path: '/section',
@@ -1972,22 +1972,6 @@ export declare const apis: <TId, TDate>() => readonly [{
1972
1972
  message: string;
1973
1973
  error: string;
1974
1974
  };
1975
- }, {
1976
- readonly method: "post";
1977
- readonly path: "/section/seats/:id";
1978
- readonly role: "postSectionSeatsById";
1979
- readonly name: "Create section seats";
1980
- readonly response_201: {
1981
- section: import("./inputsDefault").SectionBase<TId_22, TDate_22>;
1982
- message: string;
1983
- };
1984
- readonly response_404: {
1985
- message: string;
1986
- };
1987
- readonly response_500: {
1988
- message: string;
1989
- error: string;
1990
- };
1991
1975
  }, {
1992
1976
  readonly method: "get";
1993
1977
  readonly path: "/section";
@@ -4464,22 +4448,6 @@ declare const allApis: readonly [{
4464
4448
  message: string;
4465
4449
  error: string;
4466
4450
  };
4467
- }, {
4468
- readonly method: "post";
4469
- readonly path: "/section/seats/:id";
4470
- readonly role: "postSectionSeatsById";
4471
- readonly name: "Create section seats";
4472
- readonly response_201: {
4473
- section: import("./inputsDefault").SectionBase<TId_21, TDate_21>;
4474
- message: string;
4475
- };
4476
- readonly response_404: {
4477
- message: string;
4478
- };
4479
- readonly response_500: {
4480
- message: string;
4481
- error: string;
4482
- };
4483
4451
  }, {
4484
4452
  readonly method: "get";
4485
4453
  readonly path: "/section";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiliaze/global-vars",
3
- "version": "1.183.0",
3
+ "version": "1.184.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "sideEffects": false,
@@ -22,7 +22,7 @@
22
22
  "scripts": {
23
23
  "build": "tsc",
24
24
  "pub": "npm publish --access public",
25
- "git": "git add .; git commit -m 'changes'; git tag -a v1.183.0 -m 'v1.183.0'; git push origin v1.183.0; git push",
25
+ "git": "git add .; git commit -m 'changes'; git tag -a v1.184.0 -m 'v1.184.0'; git push origin v1.184.0; git push",
26
26
  "push": "npm run build; npm run git; npm run pub"
27
27
  },
28
28
  "author": "Ibi Hasanli",