@ibiliaze/global-vars 1.132.0 → 1.133.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.
Files changed (71) hide show
  1. package/dist/flows.js +0 -3
  2. package/dist/test.js +2 -2
  3. package/dist/ticketops/roles/account.d.ts +99 -0
  4. package/dist/ticketops/roles/account.js +87 -0
  5. package/dist/ticketops/roles/admin.d.ts +66 -0
  6. package/dist/ticketops/roles/admin.js +28 -0
  7. package/dist/ticketops/roles/ai.d.ts +6 -0
  8. package/dist/ticketops/roles/ai.js +11 -0
  9. package/dist/ticketops/roles/blog.d.ts +26 -0
  10. package/dist/ticketops/roles/blog.js +10 -0
  11. package/dist/ticketops/roles/campaign.d.ts +41 -0
  12. package/dist/ticketops/roles/campaign.js +13 -0
  13. package/dist/ticketops/roles/category.d.ts +26 -0
  14. package/dist/ticketops/roles/category.js +10 -0
  15. package/dist/ticketops/roles/checkout.d.ts +11 -0
  16. package/dist/ticketops/roles/checkout.js +17 -0
  17. package/dist/ticketops/roles/email.d.ts +16 -0
  18. package/dist/ticketops/roles/email.js +8 -0
  19. package/dist/ticketops/roles/event.d.ts +46 -0
  20. package/dist/ticketops/roles/event.js +14 -0
  21. package/dist/ticketops/roles/fail.d.ts +21 -0
  22. package/dist/ticketops/roles/fail.js +9 -0
  23. package/dist/ticketops/roles/file.d.ts +16 -0
  24. package/dist/ticketops/roles/file.js +23 -0
  25. package/dist/ticketops/roles/fixture.d.ts +26 -0
  26. package/dist/ticketops/roles/fixture.js +10 -0
  27. package/dist/ticketops/roles/flow.d.ts +31 -0
  28. package/dist/ticketops/roles/flow.js +11 -0
  29. package/dist/ticketops/roles/google.d.ts +6 -0
  30. package/dist/ticketops/roles/google.js +11 -0
  31. package/dist/ticketops/roles/group.d.ts +26 -0
  32. package/dist/ticketops/roles/group.js +10 -0
  33. package/dist/ticketops/roles/info.d.ts +6 -0
  34. package/dist/ticketops/roles/info.js +11 -0
  35. package/dist/ticketops/roles/job.d.ts +41 -0
  36. package/dist/ticketops/roles/job.js +13 -0
  37. package/dist/ticketops/roles/log.d.ts +16 -0
  38. package/dist/ticketops/roles/log.js +8 -0
  39. package/dist/ticketops/roles/notification.d.ts +31 -0
  40. package/dist/ticketops/roles/notification.js +11 -0
  41. package/dist/ticketops/roles/page.d.ts +31 -0
  42. package/dist/ticketops/roles/page.js +11 -0
  43. package/dist/ticketops/roles/product.d.ts +26 -0
  44. package/dist/ticketops/roles/product.js +10 -0
  45. package/dist/ticketops/roles/prospect.d.ts +46 -0
  46. package/dist/ticketops/roles/prospect.js +14 -0
  47. package/dist/ticketops/roles/quota.d.ts +6 -0
  48. package/dist/ticketops/roles/quota.js +11 -0
  49. package/dist/ticketops/roles/report.d.ts +26 -0
  50. package/dist/ticketops/roles/report.js +10 -0
  51. package/dist/ticketops/roles/review.d.ts +36 -0
  52. package/dist/ticketops/roles/review.js +12 -0
  53. package/dist/ticketops/roles/role.d.ts +26 -0
  54. package/dist/ticketops/roles/role.js +10 -0
  55. package/dist/ticketops/roles/sale.d.ts +36 -0
  56. package/dist/ticketops/roles/sale.js +17 -0
  57. package/dist/ticketops/roles/schema.d.ts +6 -0
  58. package/dist/ticketops/roles/schema.js +11 -0
  59. package/dist/ticketops/roles/season.d.ts +26 -0
  60. package/dist/ticketops/roles/season.js +10 -0
  61. package/dist/ticketops/roles/seat.d.ts +66 -0
  62. package/dist/ticketops/roles/seat.js +43 -0
  63. package/dist/ticketops/roles/section.d.ts +26 -0
  64. package/dist/ticketops/roles/section.js +10 -0
  65. package/dist/ticketops/roles/staff.d.ts +61 -0
  66. package/dist/ticketops/roles/staff.js +17 -0
  67. package/dist/ticketops/roles/user.d.ts +66 -0
  68. package/dist/ticketops/roles/user.js +23 -0
  69. package/dist/ticketops/roles.d.ts +2067 -3
  70. package/dist/ticketops/roles.js +159 -111
  71. package/package.json +2 -2
@@ -1,114 +1,162 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = [
4
- // ALBUM
5
- { path: 'GET:/album', name: 'View Album' },
6
- { path: 'POST:/album', name: 'Create Album' },
7
- { path: 'PUT:/album', name: 'Update Album' },
8
- { path: 'DELETE:/album', name: 'Delete Album' },
9
- // BLOG
10
- { path: 'GET:/blog', name: 'View Blog' },
11
- { path: 'POST:/blog', name: 'Create Blog' },
12
- { path: 'PUT:/blog', name: 'Update Blog' },
13
- { path: 'DELETE:/blog', name: 'Delete Blog' },
14
- // CAMPAIGN
15
- { path: 'GET:/campaign', name: 'View Campaign' },
16
- { path: 'POST:/campaign', name: 'Create Campaign' },
17
- { path: 'PUT:/campaign', name: 'Update Campaign' },
18
- { path: 'DELETE:/campaign', name: 'Delete Campaign' },
19
- // EMAIL
20
- { path: 'GET:/email', name: 'View Email' },
21
- { path: 'POST:/email', name: 'Create Email' },
22
- { path: 'PUT:/email', name: 'Update Email' },
23
- { path: 'DELETE:/email', name: 'Delete Email' },
24
- // ESTIMATOR
25
- { path: 'GET:/estimator', name: 'View Estimator' },
26
- { path: 'POST:/estimator', name: 'Create Estimator' },
27
- { path: 'PUT:/estimator', name: 'Update Estimator' },
28
- { path: 'DELETE:/estimator', name: 'Delete Estimator' },
29
- // EVENT
30
- { path: 'GET:/event', name: 'View Event' },
31
- { path: 'POST:/event', name: 'Create Event' },
32
- { path: 'PUT:/event', name: 'Update Event' },
33
- { path: 'DELETE:/event', name: 'Delete Event' },
34
- // FIXTURE
35
- { path: 'GET:/fixture', name: 'View Fixture' },
36
- { path: 'POST:/fixture', name: 'Create Fixture' },
37
- { path: 'PUT:/fixture', name: 'Update Fixture' },
38
- { path: 'DELETE:/fixture', name: 'Delete Fixture' },
39
- // GROUP
40
- { path: 'GET:/group', name: 'View Group' },
41
- { path: 'POST:/group', name: 'Create Group' },
42
- { path: 'PUT:/group', name: 'Update Group' },
43
- { path: 'DELETE:/group', name: 'Delete Group' },
44
- // JOB
45
- { path: 'GET:/job', name: 'View Job' },
46
- { path: 'POST:/job', name: 'Create Job' },
47
- { path: 'PUT:/job', name: 'Update Job' },
48
- { path: 'DELETE:/job', name: 'Delete Job' },
49
- // LOG
50
- { path: 'GET:/log', name: 'View Log' },
51
- { path: 'POST:/log', name: 'Create Log' },
52
- { path: 'PUT:/log', name: 'Update Log' },
53
- { path: 'DELETE:/log', name: 'Delete Log' },
54
- // PAGE
55
- { path: 'GET:/page', name: 'View Page' },
56
- { path: 'POST:/page', name: 'Create Page' },
57
- { path: 'PUT:/page', name: 'Update Page' },
58
- { path: 'DELETE:/page', name: 'Delete Page' },
59
- // PIPELINE
60
- { path: 'GET:/pipeline', name: 'View Pipeline' },
61
- { path: 'POST:/pipeline', name: 'Create Pipeline' },
62
- { path: 'PUT:/pipeline', name: 'Update Pipeline' },
63
- { path: 'DELETE:/pipeline', name: 'Delete Pipeline' },
64
- // PRODUCT
65
- { path: 'GET:/product', name: 'View Product' },
66
- { path: 'POST:/product', name: 'Create Product' },
67
- { path: 'PUT:/product', name: 'Update Product' },
68
- { path: 'DELETE:/product', name: 'Delete Product' },
69
- // PROJECT
70
- { path: 'GET:/project', name: 'View Project' },
71
- { path: 'POST:/project', name: 'Create Project' },
72
- { path: 'PUT:/project', name: 'Update Project' },
73
- { path: 'DELETE:/project', name: 'Delete Project' },
74
- // PROSPECT
75
- { path: 'GET:/prospect', name: 'View Prospect' },
76
- { path: 'POST:/prospect', name: 'Create Prospect' },
77
- { path: 'PUT:/prospect', name: 'Update Prospect' },
78
- { path: 'DELETE:/prospect', name: 'Delete Prospect' },
79
- // QUOTE
80
- { path: 'GET:/quote', name: 'View Quote' },
81
- { path: 'POST:/quote', name: 'Create Quote' },
82
- { path: 'PUT:/quote', name: 'Update Quote' },
83
- { path: 'DELETE:/quote', name: 'Delete Quote' },
84
- // REPORT
85
- { path: 'GET:/report', name: 'View Report' },
86
- { path: 'POST:/report', name: 'Create Report' },
87
- { path: 'PUT:/report', name: 'Update Report' },
88
- { path: 'DELETE:/report', name: 'Delete Report' },
89
- // REVIEW
90
- { path: 'GET:/review', name: 'View Review' },
91
- { path: 'POST:/review', name: 'Create Review' },
92
- { path: 'PUT:/review', name: 'Update Review' },
93
- { path: 'DELETE:/review', name: 'Delete Review' },
94
- // SALE
95
- { path: 'GET:/sale', name: 'View Sale' },
96
- { path: 'POST:/sale', name: 'Create Sale' },
97
- { path: 'PUT:/sale', name: 'Update Sale' },
98
- { path: 'DELETE:/sale', name: 'Delete Sale' },
99
- // SECTION
100
- { path: 'GET:/section', name: 'View Section' },
101
- { path: 'POST:/section', name: 'Create Section' },
102
- { path: 'PUT:/section', name: 'Update Section' },
103
- { path: 'DELETE:/section', name: 'Delete Section' },
104
- // TICKET
105
- { path: 'GET:/ticket', name: 'View Ticket' },
106
- { path: 'POST:/ticket', name: 'Create Ticket' },
107
- { path: 'PUT:/ticket', name: 'Update Ticket' },
108
- { path: 'DELETE:/ticket', name: 'Delete Ticket' },
109
- // USER
110
- { path: 'GET:/user', name: 'View User' },
111
- { path: 'POST:/user', name: 'Create User' },
112
- { path: 'PUT:/user', name: 'Update User' },
113
- { path: 'DELETE:/user', name: 'Delete User' },
3
+ exports.apiGroups = exports.getRoleFor = exports.p = exports.roles = exports.apis = void 0;
4
+ const email_1 = require("./roles/email");
5
+ const account_1 = require("./roles/account");
6
+ const admin_1 = require("./roles/admin");
7
+ const blog_1 = require("./roles/blog");
8
+ const campaign_1 = require("./roles/campaign");
9
+ const category_1 = require("./roles/category");
10
+ const event_1 = require("./roles/event");
11
+ const flow_1 = require("./roles/flow");
12
+ const fail_1 = require("./roles/fail");
13
+ const fixture_1 = require("./roles/fixture");
14
+ const group_1 = require("./roles/group");
15
+ const job_1 = require("./roles/job");
16
+ const log_1 = require("./roles/log");
17
+ const notification_1 = require("./roles/notification");
18
+ const page_1 = require("./roles/page");
19
+ const product_1 = require("./roles/product");
20
+ const prospect_1 = require("./roles/prospect");
21
+ const report_1 = require("./roles/report");
22
+ const review_1 = require("./roles/review");
23
+ const sale_1 = require("./roles/sale");
24
+ const season_1 = require("./roles/season");
25
+ const seat_1 = require("./roles/seat");
26
+ const section_1 = require("./roles/section");
27
+ const staff_1 = require("./roles/staff");
28
+ const user_1 = require("./roles/user");
29
+ const ai_1 = require("./roles/ai");
30
+ const checkout_1 = require("./roles/checkout");
31
+ const file_1 = require("./roles/file");
32
+ const google_1 = require("./roles/google");
33
+ const info_1 = require("./roles/info");
34
+ const quota_1 = require("./roles/quota");
35
+ const schema_1 = require("./roles/schema");
36
+ const role_1 = require("./roles/role");
37
+ /**
38
+ * Generic route factory.
39
+ *
40
+ * Frontend can do:
41
+ * const routes = apis<string, string>();
42
+ *
43
+ * Backend can do:
44
+ * const routes = apis<Types.ObjectId, Date>();
45
+ */
46
+ const apis = () => [
47
+ // Routes
48
+ ...(0, account_1.accountRoleDefs)(),
49
+ ...admin_1.adminRoleDefs,
50
+ ...blog_1.blogRoleDefs,
51
+ ...campaign_1.campaignRoleDefs,
52
+ ...category_1.categoryRoleDefs,
53
+ ...email_1.emailRoleDefs,
54
+ ...event_1.eventRoleDefs,
55
+ ...fail_1.failRoleDefs,
56
+ ...flow_1.flowFlowDefs,
57
+ ...fixture_1.fixtureRoleDefs,
58
+ ...group_1.groupRoleDefs,
59
+ ...job_1.jobRoleDefs,
60
+ ...log_1.logRoleDefs,
61
+ ...notification_1.notificationRoleDefs,
62
+ ...page_1.pageRoleDefs,
63
+ ...product_1.productRoleDefs,
64
+ ...prospect_1.prospectRoleDefs,
65
+ ...report_1.reportRoleDefs,
66
+ ...review_1.reviewRoleDefs,
67
+ ...role_1.roleRoleDefs,
68
+ ...sale_1.saleRoleDefs,
69
+ ...season_1.seasonRoleDefs,
70
+ ...seat_1.occupanceRoleDefs,
71
+ ...section_1.sectionRoleDefs,
72
+ ...staff_1.staffRoleDefs,
73
+ ...user_1.userRoleDefs,
74
+ // Util routes
75
+ ...ai_1.aiRoleDefs,
76
+ ...checkout_1.checkoutRoleDefs,
77
+ ...file_1.fileRoleDefs,
78
+ ...google_1.googleRoleDefs,
79
+ ...info_1.infoRoleDefs,
80
+ ...quota_1.quotaRoleDefs,
81
+ ...schema_1.schemaRoleDefs,
114
82
  ];
83
+ exports.apis = apis;
84
+ // ──────────────────────────
85
+ // Shared maps / RoleName
86
+ // ─────────────────────────-
87
+ // Build a literal array once, using <any, any> for the generic bits,
88
+ // without forcing it through ApiRoute — this preserves literal role strings.
89
+ const allApis = [
90
+ ...(0, account_1.accountRoleDefs)(),
91
+ ...admin_1.adminRoleDefs,
92
+ ...blog_1.blogRoleDefs,
93
+ ...campaign_1.campaignRoleDefs,
94
+ ...category_1.categoryRoleDefs,
95
+ ...email_1.emailRoleDefs,
96
+ ...event_1.eventRoleDefs,
97
+ ...fail_1.failRoleDefs,
98
+ ...flow_1.flowFlowDefs,
99
+ ...fixture_1.fixtureRoleDefs,
100
+ ...group_1.groupRoleDefs,
101
+ ...job_1.jobRoleDefs,
102
+ ...log_1.logRoleDefs,
103
+ ...notification_1.notificationRoleDefs,
104
+ ...page_1.pageRoleDefs,
105
+ ...product_1.productRoleDefs,
106
+ ...prospect_1.prospectRoleDefs,
107
+ ...report_1.reportRoleDefs,
108
+ ...review_1.reviewRoleDefs,
109
+ ...role_1.roleRoleDefs,
110
+ ...sale_1.saleRoleDefs,
111
+ ...season_1.seasonRoleDefs,
112
+ ...seat_1.occupanceRoleDefs,
113
+ ...section_1.sectionRoleDefs,
114
+ ...staff_1.staffRoleDefs,
115
+ ...user_1.userRoleDefs,
116
+ ...ai_1.aiRoleDefs,
117
+ ...checkout_1.checkoutRoleDefs,
118
+ ...file_1.fileRoleDefs,
119
+ ...google_1.googleRoleDefs,
120
+ ...info_1.infoRoleDefs,
121
+ ...quota_1.quotaRoleDefs,
122
+ ...schema_1.schemaRoleDefs,
123
+ ];
124
+ exports.roles = new Map();
125
+ for (const api of allApis) {
126
+ exports.roles.set({ [api.method]: api.path }, {
127
+ role: api.role,
128
+ name: api.name,
129
+ });
130
+ }
131
+ // role -> path
132
+ const roleToPath = new Map();
133
+ // method+path -> role
134
+ const methodPathToRole = new Map();
135
+ for (const api of allApis) {
136
+ roleToPath.set(api.role, api.path);
137
+ const key = `${api.method.toLowerCase()}:${api.path.toLowerCase()}`;
138
+ methodPathToRole.set(key, api.role);
139
+ }
140
+ const p = (role) => {
141
+ const path = roleToPath.get(role);
142
+ if (!path) {
143
+ throw new Error(`No path found for role "${role}"`);
144
+ }
145
+ return path;
146
+ };
147
+ exports.p = p;
148
+ const getRoleFor = (method, path) => {
149
+ const key = `${method.toLowerCase()}:${path.toLowerCase()}`;
150
+ return methodPathToRole.get(key);
151
+ };
152
+ exports.getRoleFor = getRoleFor;
153
+ const apiGroups = () => allApis.reduce((acc, api) => {
154
+ const segments = api.path.split('/').filter(Boolean);
155
+ const groupKey = segments[0] || 'root';
156
+ if (!acc[groupKey]) {
157
+ acc[groupKey] = [];
158
+ }
159
+ acc[groupKey].push(api);
160
+ return acc;
161
+ }, {});
162
+ exports.apiGroups = apiGroups;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiliaze/global-vars",
3
- "version": "1.132.0",
3
+ "version": "1.133.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.132.0 -m 'v1.132.0'; git push origin v1.132.0; git push",
25
+ "git": "git add .; git commit -m 'changes'; git tag -a v1.133.0 -m 'v1.133.0'; git push origin v1.133.0; git push",
26
26
  "push": "npm run build; npm run git; npm run pub"
27
27
  },
28
28
  "author": "Ibi Hasanli",