@ibiliaze/global-vars 1.182.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 {
@@ -21,6 +21,9 @@ export declare const eventRoleDefs: <TId, TDate>() => readonly [{
21
21
  event: EventBase<TId, TDate>;
22
22
  message: string;
23
23
  };
24
+ readonly response_404: {
25
+ message: string;
26
+ };
24
27
  readonly response_500: {
25
28
  message: string;
26
29
  error: string;
@@ -17,6 +17,7 @@ const eventRoleDefs = () => {
17
17
  role: 'postEventOccupanciesById',
18
18
  name: 'Create event seats',
19
19
  response_201: {},
20
+ response_404: {},
20
21
  response_500: {},
21
22
  },
22
23
  {
@@ -773,6 +773,9 @@ export declare const apis: <TId, TDate>() => readonly [{
773
773
  event: import("./inputsDefault").EventBase<TId_9, TDate_9>;
774
774
  message: string;
775
775
  };
776
+ readonly response_404: {
777
+ message: string;
778
+ };
776
779
  readonly response_500: {
777
780
  message: string;
778
781
  error: string;
@@ -3246,6 +3249,9 @@ declare const allApis: readonly [{
3246
3249
  event: import("./inputsDefault").EventBase<TId_8, TDate_8>;
3247
3250
  message: string;
3248
3251
  };
3252
+ readonly response_404: {
3253
+ message: string;
3254
+ };
3249
3255
  readonly response_500: {
3250
3256
  message: string;
3251
3257
  error: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiliaze/global-vars",
3
- "version": "1.182.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.182.0 -m 'v1.182.0'; git push origin v1.182.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",