@authenty/authapi-types 1.0.0 → 1.0.2

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.
@@ -0,0 +1,20 @@
1
+ var fs = require('fs');
2
+
3
+ console.log('Incrementing build number...');
4
+
5
+ var packageFile = 'package.json';
6
+
7
+ // Incrementa a versão no package.json
8
+ fs.readFile(packageFile, function(err, content) {
9
+ if (err) throw err;
10
+ var packageData = JSON.parse(content);
11
+
12
+ var version = packageData.version.split('.');
13
+ var newVersion = `${version[0]}.${version[1]}.${Number(version[2]) + 1}`;
14
+ packageData.version = newVersion;
15
+
16
+ fs.writeFile(packageFile, JSON.stringify(packageData, null, 2), function(err) {
17
+ if (err) throw err;
18
+ console.log(`Package.json updated to version: ${newVersion}`);
19
+ });
20
+ });
@@ -0,0 +1,8 @@
1
+ export type CronJob = {
2
+ startAt: Date | null;
3
+ latestRunErrorCount: number;
4
+ latestCompletedAt: Date | null;
5
+ };
6
+ export type CronjobsStatuses = {
7
+ purchasesStatusUpdate: CronJob;
8
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/dist/general.d.ts CHANGED
@@ -1,6 +1,235 @@
1
+ import { PrivilegeTable } from "./admin";
1
2
  export declare enum BundleType {
2
3
  BUNDLE = 0,
3
4
  SYMBOLIC_PRODUCT = 1,
4
5
  SYMBOLIC_COURSE = 2,
5
6
  SYMBOLIC_CONSULTANCY = 3
6
7
  }
8
+ export type Product = {
9
+ id: number;
10
+ title: string;
11
+ short: string;
12
+ resume: string;
13
+ video?: string;
14
+ imgUrls?: string;
15
+ logo: string;
16
+ themeImage?: string;
17
+ themeColor?: string;
18
+ themeVideo?: string;
19
+ url: string;
20
+ type: number;
21
+ period_test: number;
22
+ created: string;
23
+ deletedAt?: string | null;
24
+ Levels?: ProductLevel[];
25
+ };
26
+ export type ProductLevel = {
27
+ id: number;
28
+ productID: number;
29
+ level: number;
30
+ short: string;
31
+ Product?: Product;
32
+ store_bundles_levels: {
33
+ id: number;
34
+ bundleID: number;
35
+ levelID: number;
36
+ quantity: number;
37
+ Bundle?: Bundle;
38
+ }[];
39
+ };
40
+ export type Course = {
41
+ id: number;
42
+ type: number;
43
+ name: string;
44
+ short: string;
45
+ resume: string;
46
+ img_landscape: string;
47
+ img_square: string;
48
+ workload: number;
49
+ langID: number;
50
+ num_classes?: number;
51
+ seats: number;
52
+ url?: string;
53
+ dates: string;
54
+ local: string;
55
+ local_url: string;
56
+ date_mat_s?: string;
57
+ date_mat_e?: string;
58
+ date_ends?: string;
59
+ email_enrollment?: string;
60
+ email_before?: string;
61
+ email_after?: string;
62
+ date_c: string;
63
+ date_r?: string | null;
64
+ };
65
+ export type Consultancy = {
66
+ id: number;
67
+ teacherID: number;
68
+ type: number;
69
+ name: string;
70
+ short: string;
71
+ resume: string;
72
+ img_landscape: string;
73
+ img_square: string;
74
+ workload: number;
75
+ langID: number;
76
+ url?: string;
77
+ datetime: string;
78
+ date_mat_s?: string;
79
+ date_mat_e?: string;
80
+ date_ends?: string;
81
+ email_enrollment: string;
82
+ email_before: string;
83
+ email_after: string;
84
+ date_c: string;
85
+ date_r?: string | null;
86
+ };
87
+ export type Bundle = {
88
+ id: number;
89
+ type: number;
90
+ title?: string;
91
+ short?: string;
92
+ resume?: string;
93
+ img: string;
94
+ themeImage: string;
95
+ themeColor: string;
96
+ shareLimit: number;
97
+ created: string;
98
+ active: boolean;
99
+ showInSite: boolean;
100
+ defaultMetaArray: string;
101
+ deletedAt?: string | null;
102
+ Levels?: Array<{
103
+ id: number;
104
+ bundleID: number;
105
+ levelID: number;
106
+ quantity: number;
107
+ Level: ProductLevel;
108
+ }>;
109
+ Courses?: Array<{
110
+ id: number;
111
+ bundleID: number;
112
+ courseID: number;
113
+ quantity: number;
114
+ Course: Course;
115
+ }>;
116
+ Consultancies?: Array<{
117
+ id: number;
118
+ bundleID: number;
119
+ consultancyID: number;
120
+ quantity: number;
121
+ Consultancy: Consultancy;
122
+ }>;
123
+ store_bundles_paymethod: PaymentMethod[];
124
+ };
125
+ export type PaymentMethod = {
126
+ id: number;
127
+ bundleID: number;
128
+ price: number;
129
+ fromprice: number;
130
+ period_renew: number;
131
+ period_grace: number;
132
+ gatewayHash: string;
133
+ allowBoleto: boolean;
134
+ gatewayID: number;
135
+ Bundle?: Bundle;
136
+ };
137
+ export declare enum PurchaseStatus {
138
+ NORMAL = 0,
139
+ EXPIRED = 1,
140
+ CANCELED = 2,
141
+ OPEN = 3,
142
+ RECYCLING = 4,
143
+ PAYED = 5,
144
+ ACTIVE = 6
145
+ }
146
+ export declare enum PurchaseCycle {
147
+ UNKNOWN = 0,
148
+ ACTIVE = 1,
149
+ CANCELED = 2,
150
+ REFUNDED = 3,
151
+ REMOVED = 4,
152
+ Nonrefundable = 5
153
+ }
154
+ export declare enum PurchaseTypeStep {
155
+ SESSION = 0,
156
+ PAYMENT = 1,
157
+ SUBSCRIPTION = 2
158
+ }
159
+ export type Purchase = {
160
+ paghash: string;
161
+ id: number;
162
+ price: number;
163
+ licenseStatus: PurchaseStatus;
164
+ paymentStatus: PurchaseCycle;
165
+ type_step: PurchaseTypeStep;
166
+ PaymentMethod: PaymentMethod;
167
+ Wallet?: Wallet;
168
+ walletID: number;
169
+ createdAt: string;
170
+ paymentDueAt: string | null;
171
+ owner: string;
172
+ invoiceUrl?: string;
173
+ nfUrl?: string;
174
+ isAdmin?: boolean;
175
+ meta_data?: Record<string, any>;
176
+ };
177
+ export type Wallet = {
178
+ id: number;
179
+ userID: number;
180
+ balance?: number;
181
+ Purchases?: Purchase[];
182
+ };
183
+ export type PurchaseShare = {
184
+ id: number;
185
+ purchaseID: number;
186
+ userID: number;
187
+ Purchase: Purchase;
188
+ };
189
+ export type LocalUser = {
190
+ id: number;
191
+ fullname: string;
192
+ email: string;
193
+ lang: number;
194
+ avatar: string;
195
+ end_city?: number;
196
+ end_comp?: string;
197
+ end_country: number;
198
+ end_district?: string;
199
+ end_n?: string;
200
+ end_state?: number;
201
+ end_street?: string;
202
+ end_zip?: string;
203
+ email_verif: boolean;
204
+ terms: boolean;
205
+ cpf?: string;
206
+ newslatter?: boolean;
207
+ allow_purchase?: boolean;
208
+ allow_license?: boolean;
209
+ date_c?: Date | string;
210
+ date_r?: Date | string | null;
211
+ Wallets?: Wallet[];
212
+ PurchasesShares?: PurchaseShare[];
213
+ Sys_admUser_config?: {
214
+ campaigns_blacklist: string;
215
+ deletedAt: Date | null;
216
+ userID: number;
217
+ };
218
+ Sys_adminUser?: PrivilegeTable;
219
+ };
220
+ export type LogEntry = {
221
+ appId: string;
222
+ logCode: number;
223
+ content: string;
224
+ timestamp?: string;
225
+ metadata?: {
226
+ requestId: string;
227
+ endpoint: string;
228
+ method: string;
229
+ userId?: number;
230
+ ip?: string;
231
+ browser?: string;
232
+ system?: string;
233
+ referer?: string;
234
+ };
235
+ };
package/dist/general.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BundleType = void 0;
3
+ exports.PurchaseTypeStep = exports.PurchaseCycle = exports.PurchaseStatus = exports.BundleType = void 0;
4
4
  var BundleType;
5
5
  (function (BundleType) {
6
6
  BundleType[BundleType["BUNDLE"] = 0] = "BUNDLE";
@@ -8,3 +8,28 @@ var BundleType;
8
8
  BundleType[BundleType["SYMBOLIC_COURSE"] = 2] = "SYMBOLIC_COURSE";
9
9
  BundleType[BundleType["SYMBOLIC_CONSULTANCY"] = 3] = "SYMBOLIC_CONSULTANCY";
10
10
  })(BundleType || (exports.BundleType = BundleType = {}));
11
+ var PurchaseStatus;
12
+ (function (PurchaseStatus) {
13
+ PurchaseStatus[PurchaseStatus["NORMAL"] = 0] = "NORMAL";
14
+ PurchaseStatus[PurchaseStatus["EXPIRED"] = 1] = "EXPIRED";
15
+ PurchaseStatus[PurchaseStatus["CANCELED"] = 2] = "CANCELED";
16
+ PurchaseStatus[PurchaseStatus["OPEN"] = 3] = "OPEN";
17
+ PurchaseStatus[PurchaseStatus["RECYCLING"] = 4] = "RECYCLING";
18
+ PurchaseStatus[PurchaseStatus["PAYED"] = 5] = "PAYED";
19
+ PurchaseStatus[PurchaseStatus["ACTIVE"] = 6] = "ACTIVE";
20
+ })(PurchaseStatus || (exports.PurchaseStatus = PurchaseStatus = {}));
21
+ var PurchaseCycle;
22
+ (function (PurchaseCycle) {
23
+ PurchaseCycle[PurchaseCycle["UNKNOWN"] = 0] = "UNKNOWN";
24
+ PurchaseCycle[PurchaseCycle["ACTIVE"] = 1] = "ACTIVE";
25
+ PurchaseCycle[PurchaseCycle["CANCELED"] = 2] = "CANCELED";
26
+ PurchaseCycle[PurchaseCycle["REFUNDED"] = 3] = "REFUNDED";
27
+ PurchaseCycle[PurchaseCycle["REMOVED"] = 4] = "REMOVED";
28
+ PurchaseCycle[PurchaseCycle["Nonrefundable"] = 5] = "Nonrefundable";
29
+ })(PurchaseCycle || (exports.PurchaseCycle = PurchaseCycle = {}));
30
+ var PurchaseTypeStep;
31
+ (function (PurchaseTypeStep) {
32
+ PurchaseTypeStep[PurchaseTypeStep["SESSION"] = 0] = "SESSION";
33
+ PurchaseTypeStep[PurchaseTypeStep["PAYMENT"] = 1] = "PAYMENT";
34
+ PurchaseTypeStep[PurchaseTypeStep["SUBSCRIPTION"] = 2] = "SUBSCRIPTION";
35
+ })(PurchaseTypeStep || (exports.PurchaseTypeStep = PurchaseTypeStep = {}));
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './admin';
2
+ export * from './cronjobs';
2
3
  export * from './general';
3
4
  export * from './payment-system';
package/dist/index.js CHANGED
@@ -15,5 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./admin"), exports);
18
+ __exportStar(require("./cronjobs"), exports);
18
19
  __exportStar(require("./general"), exports);
19
20
  __exportStar(require("./payment-system"), exports);
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@authenty/authapi-types",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Shared types for Authenty API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
+ "prebuild": "node IncrementVersion.js",
8
9
  "build": "tsc",
9
10
  "dev": "tsc -w"
10
11
  },
@@ -14,4 +15,4 @@
14
15
  "devDependencies": {
15
16
  "typescript": "^5.0.0"
16
17
  }
17
- }
18
+ }
@@ -0,0 +1,9 @@
1
+ export type CronJob = { //Também definido em ~/server/src/cronjobs.ts
2
+ startAt: Date|null //null se não está rodando
3
+ latestRunErrorCount: number //zero se não teve erro
4
+ latestCompletedAt: Date|null
5
+ }
6
+
7
+ export type CronjobsStatuses = {
8
+ purchasesStatusUpdate: CronJob
9
+ }
package/src/general.ts CHANGED
@@ -1,6 +1,254 @@
1
+ import { PrivilegeTable } from "./admin";
2
+
1
3
  export enum BundleType {
2
4
  BUNDLE = 0,
3
5
  SYMBOLIC_PRODUCT = 1,
4
6
  SYMBOLIC_COURSE = 2,
5
7
  SYMBOLIC_CONSULTANCY = 3,
8
+ }
9
+
10
+ export type Product = {
11
+ id: number;
12
+ title: string;
13
+ short: string;
14
+ resume: string;
15
+ video?: string;
16
+ imgUrls?: string;
17
+ logo: string;
18
+ themeImage?: string;
19
+ themeColor?: string;
20
+ themeVideo?: string;
21
+ url: string;
22
+ type: number;
23
+ period_test: number;
24
+ created: string;
25
+ deletedAt?: string | null;
26
+ Levels?: ProductLevel[];
27
+ }
28
+
29
+ export type ProductLevel = {
30
+ id: number;
31
+ productID: number;
32
+ level: number;
33
+ short: string;
34
+ Product?: Product;
35
+ store_bundles_levels: {
36
+ id: number,
37
+ bundleID: number,
38
+ levelID: number,
39
+ quantity: number,
40
+ Bundle?: Bundle
41
+ }[];
42
+ }
43
+
44
+ export type Course = {
45
+ id: number;
46
+ type: number;
47
+ name: string;
48
+ short: string;
49
+ resume: string;
50
+ img_landscape: string;
51
+ img_square: string;
52
+ workload: number;
53
+ langID: number;
54
+ num_classes?: number;
55
+ seats: number;
56
+ url?: string;
57
+ dates: string;
58
+ local: string;
59
+ local_url: string;
60
+ date_mat_s?: string;
61
+ date_mat_e?: string;
62
+ date_ends?: string;
63
+ email_enrollment?: string;
64
+ email_before?: string;
65
+ email_after?: string;
66
+ date_c: string;
67
+ date_r?: string | null;
68
+ }
69
+
70
+ export type Consultancy = {
71
+ id: number;
72
+ teacherID: number;
73
+ type: number;
74
+ name: string;
75
+ short: string;
76
+ resume: string;
77
+ img_landscape: string;
78
+ img_square: string;
79
+ workload: number;
80
+ langID: number;
81
+ url?: string;
82
+ datetime: string;
83
+ date_mat_s?: string;
84
+ date_mat_e?: string;
85
+ date_ends?: string;
86
+ email_enrollment: string;
87
+ email_before: string;
88
+ email_after: string;
89
+ date_c: string;
90
+ date_r?: string | null;
91
+ }
92
+
93
+ export type Bundle = {
94
+ id: number;
95
+ type: number;
96
+ title?: string;
97
+ short?: string;
98
+ resume?: string;
99
+ img: string;
100
+ themeImage: string;
101
+ themeColor: string;
102
+ shareLimit: number;
103
+ created: string;
104
+ active: boolean;
105
+ showInSite: boolean;
106
+ defaultMetaArray: string;
107
+ deletedAt?: string | null;
108
+ Levels?: Array<{
109
+ id: number;
110
+ bundleID: number;
111
+ levelID: number;
112
+ quantity: number;
113
+ Level: ProductLevel;
114
+ }>;
115
+ Courses?: Array<{
116
+ id: number;
117
+ bundleID: number;
118
+ courseID: number;
119
+ quantity: number;
120
+ Course: Course;
121
+ }>;
122
+ Consultancies?: Array<{
123
+ id: number;
124
+ bundleID: number;
125
+ consultancyID: number;
126
+ quantity: number;
127
+ Consultancy: Consultancy;
128
+ }>;
129
+ store_bundles_paymethod: PaymentMethod[];
130
+ }
131
+
132
+ export type PaymentMethod = {
133
+ id: number;
134
+ bundleID: number;
135
+ price: number;
136
+ fromprice: number;
137
+ period_renew: number;
138
+ period_grace: number;
139
+ gatewayHash: string;
140
+ allowBoleto: boolean;
141
+ gatewayID: number;
142
+ Bundle?: Bundle;
143
+ }
144
+
145
+ export enum PurchaseStatus {
146
+ NORMAL = 0,
147
+ EXPIRED = 1,
148
+ CANCELED = 2,
149
+ OPEN = 3,
150
+ RECYCLING = 4,
151
+ PAYED = 5,
152
+ ACTIVE = 6
153
+ }
154
+ export enum PurchaseCycle {
155
+ UNKNOWN = 0,
156
+ ACTIVE = 1,
157
+ CANCELED = 2,
158
+ REFUNDED = 3,
159
+ REMOVED = 4,
160
+ Nonrefundable = 5
161
+ }
162
+ export enum PurchaseTypeStep {
163
+ SESSION = 0,
164
+ PAYMENT = 1,
165
+ SUBSCRIPTION = 2
166
+ }
167
+
168
+ export type Purchase = {
169
+ paghash: string;
170
+ id: number;
171
+ price: number;
172
+ licenseStatus: PurchaseStatus;
173
+ paymentStatus: PurchaseCycle,
174
+ type_step: PurchaseTypeStep,
175
+ PaymentMethod: PaymentMethod;
176
+ Wallet?: Wallet;
177
+ walletID: number;
178
+ createdAt: string;
179
+ paymentDueAt: string | null;
180
+ owner: string;
181
+ invoiceUrl?: string;
182
+ nfUrl?: string;
183
+ isAdmin?: boolean;
184
+ meta_data?: Record<string, any>;
185
+ }
186
+
187
+ export type Wallet = {
188
+ id: number;
189
+ userID: number;
190
+ balance?: number;
191
+ Purchases?: Purchase[];
192
+ }
193
+
194
+ export type PurchaseShare = {
195
+ id: number;
196
+ purchaseID: number;
197
+ userID: number;
198
+ Purchase: Purchase;
199
+ }
200
+
201
+ export type LocalUser = {
202
+ id: number,
203
+ fullname: string,
204
+ email: string,
205
+ lang: number,
206
+ avatar: string,
207
+ end_city?: number,
208
+ end_comp?: string,
209
+ end_country: number,
210
+ end_district?: string,
211
+ end_n?: string,
212
+ end_state?: number,
213
+ end_street?: string,
214
+ end_zip?: string,
215
+
216
+ email_verif: boolean,
217
+ terms: boolean,
218
+
219
+ cpf?: string,
220
+ newslatter?: boolean,
221
+ allow_purchase?: boolean,
222
+ allow_license?: boolean,
223
+ date_c?: Date | string,
224
+ date_r?: Date | string | null,
225
+
226
+ Wallets?: Wallet[];
227
+ PurchasesShares?: PurchaseShare[];
228
+
229
+ Sys_admUser_config?: {
230
+ campaigns_blacklist:string,
231
+ deletedAt: Date | null,
232
+ userID: number
233
+ },
234
+ Sys_adminUser?: PrivilegeTable
235
+ }
236
+
237
+
238
+ // Tipos para logs do sistema
239
+ export type LogEntry = {
240
+ appId: string;
241
+ logCode: number;
242
+ content: string;
243
+ timestamp?: string;
244
+ metadata?: {
245
+ requestId: string;
246
+ endpoint: string;
247
+ method: string;
248
+ userId?: number;
249
+ ip?: string;
250
+ browser?: string;
251
+ system?: string;
252
+ referer?: string;
253
+ };
6
254
  }
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './admin';
2
+ export * from './cronjobs';
2
3
  export * from './general';
3
4
  export * from './payment-system';
4
5