chore: lint + add source code link

This commit is contained in:
Nugraha 2022-12-02 23:11:03 +07:00
parent f3db64fa38
commit 35424ceb94
Signed by: ii64
GPG key ID: E41C08AD390E7C49
41 changed files with 15150 additions and 45895 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@ docs/
app.db app.db
docker/server docker/server
server server
__debug_bin
# Editor directories and files # Editor directories and files
.vscode/* .vscode/*

View file

@ -12,7 +12,7 @@ CXXFLAGS ?=
CXXFLAGS += -target $(TARGET_TRIPLE) CXXFLAGS += -target $(TARGET_TRIPLE)
GOFLAGS ?= GOFLAGS ?=
GOFLAGS += -x -o docker/server GOFLAGS += -x -trimpath -o docker/server
all: all:
gen: gen-backend-thrift gen-frontend-thrift gen: gen-backend-thrift gen-frontend-thrift

View file

@ -1,7 +0,0 @@
{
"plugins": [
"minify-dead-code-elimination",
"@babel/plugin-transform-classes",
"@babel/plugin-syntax-class-properties",
]
}

2
frontend/.gitignore vendored
View file

@ -8,8 +8,6 @@ pnpm-debug.log*
lerna-debug.log* lerna-debug.log*
node_modules node_modules
node_modules_linux
node_modules_windows
dist dist
dist-ssr dist-ssr
*.local *.local

View file

@ -11,65 +11,135 @@ import Int64 = require('node-int64');
import structs_ttypes = require('./structs_types'); import structs_ttypes = require('./structs_types');
import exceptions_ttypes = require('./exceptions_types'); import exceptions_ttypes = require('./exceptions_types');
import ttypes = require('./service_types'); import ttypes = require('./service_types');
declare class Client { declare class Client {
private output: thrift.TTransport; private output: thrift.TTransport;
private pClass: thrift.TProtocol; private pClass: thrift.TProtocol;
private _seqid: number; private _seqid: number;
constructor(output: thrift.TTransport, pClass: { new(trans: thrift.TTransport): thrift.TProtocol }); constructor(
output: thrift.TTransport,
pClass: { new (trans: thrift.TTransport): thrift.TProtocol },
);
login(request: structs_ttypes.LoginRequest): Promise<structs_ttypes.LoginResponse>; login(request: structs_ttypes.LoginRequest): Promise<structs_ttypes.LoginResponse>;
login(request: structs_ttypes.LoginRequest, callback?: (error: exceptions_ttypes.CoreServicesException, response: structs_ttypes.LoginResponse)=>void): void; login(
request: structs_ttypes.LoginRequest,
callback?: (
error: exceptions_ttypes.CoreServicesException,
response: structs_ttypes.LoginResponse,
) => void,
): void;
getProfile(request: structs_ttypes.GetProfileRequest): Promise<structs_ttypes.GetProfileResponse>; getProfile(request: structs_ttypes.GetProfileRequest): Promise<structs_ttypes.GetProfileResponse>;
getProfile(request: structs_ttypes.GetProfileRequest, callback?: (error: exceptions_ttypes.CoreServicesException, response: structs_ttypes.GetProfileResponse)=>void): void; getProfile(
request: structs_ttypes.GetProfileRequest,
callback?: (
error: exceptions_ttypes.CoreServicesException,
response: structs_ttypes.GetProfileResponse,
) => void,
): void;
logout(request: structs_ttypes.LogoutRequest): Promise<structs_ttypes.LogoutResponse>; logout(request: structs_ttypes.LogoutRequest): Promise<structs_ttypes.LogoutResponse>;
logout(request: structs_ttypes.LogoutRequest, callback?: (error: exceptions_ttypes.CoreServicesException, response: structs_ttypes.LogoutResponse)=>void): void; logout(
request: structs_ttypes.LogoutRequest,
callback?: (
error: exceptions_ttypes.CoreServicesException,
response: structs_ttypes.LogoutResponse,
) => void,
): void;
getUserList(request: structs_ttypes.GetUserListRequest): Promise<structs_ttypes.GetUserListResponse>; getUserList(
request: structs_ttypes.GetUserListRequest,
): Promise<structs_ttypes.GetUserListResponse>;
getUserList(request: structs_ttypes.GetUserListRequest, callback?: (error: exceptions_ttypes.CoreServicesException, response: structs_ttypes.GetUserListResponse)=>void): void; getUserList(
request: structs_ttypes.GetUserListRequest,
callback?: (
error: exceptions_ttypes.CoreServicesException,
response: structs_ttypes.GetUserListResponse,
) => void,
): void;
createUser(request: structs_ttypes.CreateUserRequest): Promise<structs_ttypes.CreateUserResponse>; createUser(request: structs_ttypes.CreateUserRequest): Promise<structs_ttypes.CreateUserResponse>;
createUser(request: structs_ttypes.CreateUserRequest, callback?: (error: exceptions_ttypes.CoreServicesException, response: structs_ttypes.CreateUserResponse)=>void): void; createUser(
request: structs_ttypes.CreateUserRequest,
callback?: (
error: exceptions_ttypes.CoreServicesException,
response: structs_ttypes.CreateUserResponse,
) => void,
): void;
deleteUsers(request: structs_ttypes.DeleteUsersRequest): Promise<structs_ttypes.DeleteUsersResponse>; deleteUsers(
request: structs_ttypes.DeleteUsersRequest,
): Promise<structs_ttypes.DeleteUsersResponse>;
deleteUsers(request: structs_ttypes.DeleteUsersRequest, callback?: (error: exceptions_ttypes.CoreServicesException, response: structs_ttypes.DeleteUsersResponse)=>void): void; deleteUsers(
request: structs_ttypes.DeleteUsersRequest,
callback?: (
error: exceptions_ttypes.CoreServicesException,
response: structs_ttypes.DeleteUsersResponse,
) => void,
): void;
getWajibPajakList(request: structs_ttypes.GetWajibPajakListRequest): Promise<structs_ttypes.GetWajibPajakListResponse>; getWajibPajakList(
request: structs_ttypes.GetWajibPajakListRequest,
): Promise<structs_ttypes.GetWajibPajakListResponse>;
getWajibPajakList(request: structs_ttypes.GetWajibPajakListRequest, callback?: (error: exceptions_ttypes.CoreServicesException, response: structs_ttypes.GetWajibPajakListResponse)=>void): void; getWajibPajakList(
request: structs_ttypes.GetWajibPajakListRequest,
callback?: (
error: exceptions_ttypes.CoreServicesException,
response: structs_ttypes.GetWajibPajakListResponse,
) => void,
): void;
createWajibPajak(request: structs_ttypes.CreateWajibPajakRequest): Promise<structs_ttypes.CreateWajibPajakResponse>; createWajibPajak(
request: structs_ttypes.CreateWajibPajakRequest,
): Promise<structs_ttypes.CreateWajibPajakResponse>;
createWajibPajak(request: structs_ttypes.CreateWajibPajakRequest, callback?: (error: exceptions_ttypes.CoreServicesException, response: structs_ttypes.CreateWajibPajakResponse)=>void): void; createWajibPajak(
request: structs_ttypes.CreateWajibPajakRequest,
callback?: (
error: exceptions_ttypes.CoreServicesException,
response: structs_ttypes.CreateWajibPajakResponse,
) => void,
): void;
deleteWajibPajakList(request: structs_ttypes.DeleteWajibpajakListRequest): Promise<structs_ttypes.DeleteWajibpajakListResponse>; deleteWajibPajakList(
request: structs_ttypes.DeleteWajibpajakListRequest,
): Promise<structs_ttypes.DeleteWajibpajakListResponse>;
deleteWajibPajakList(request: structs_ttypes.DeleteWajibpajakListRequest, callback?: (error: exceptions_ttypes.CoreServicesException, response: structs_ttypes.DeleteWajibpajakListResponse)=>void): void; deleteWajibPajakList(
} request: structs_ttypes.DeleteWajibpajakListRequest,
callback?: (
error: exceptions_ttypes.CoreServicesException,
response: structs_ttypes.DeleteWajibpajakListResponse,
) => void,
): void;
}
declare class Processor { declare class Processor {
private _handler: object; private _handler: object;
constructor(handler: object); constructor(handler: object);
process(input: thrift.TProtocol, output: thrift.TProtocol): void; process(input: thrift.TProtocol, output: thrift.TProtocol): void;
process_login(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void; process_login(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void;
process_getProfile(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void; process_getProfile(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void;
process_logout(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void; process_logout(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void;
process_getUserList(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void; process_getUserList(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void;
process_createUser(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void; process_createUser(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void;
process_deleteUsers(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void; process_deleteUsers(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void;
process_getWajibPajakList(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void; process_getWajibPajakList(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void;
process_createWajibPajak(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void; process_createWajibPajak(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void;
process_deleteWajibPajakList(seqid: number, input: thrift.TProtocol, output: thrift.TProtocol): void; process_deleteWajibPajakList(
seqid: number,
input: thrift.TProtocol,
output: thrift.TProtocol,
): void;
} }

File diff suppressed because it is too large Load diff

View file

@ -8,11 +8,10 @@ import Thrift = thrift.Thrift;
import Q = thrift.Q; import Q = thrift.Q;
import Int64 = require('node-int64'); import Int64 = require('node-int64');
declare class CoreServicesException extends Thrift.TException { declare class CoreServicesException extends Thrift.TException {
public code: number; public code: number;
public message: string; public message: string;
public parameters: { [k: string]: string; }; public parameters: { [k: string]: string };
constructor(args?: { code: number; message: string; parameters: { [k: string]: string; }; }); constructor(args?: { code: number; message: string; parameters: { [k: string]: string } });
} }

View file

@ -3,18 +3,19 @@
// //
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
// //
"use strict"; 'use strict';
const thrift = require('thrift'); const thrift = require('thrift');
const Thrift = thrift.Thrift; const Thrift = thrift.Thrift;
const Int64 = require('node-int64'); const Int64 = require('node-int64');
const ttypes = (module.exports = {});
const ttypes = module.exports = {}; const CoreServicesException = (module.exports.CoreServicesException = class extends (
const CoreServicesException = module.exports.CoreServicesException = class extends Thrift.TException { Thrift.TException
) {
constructor(args) { constructor(args) {
super(args); super(args);
this.name = "CoreServicesException"; this.name = 'CoreServicesException';
this.code = null; this.code = null;
this.message = null; this.message = null;
this.parameters = null; this.parameters = null;
@ -31,7 +32,7 @@ const CoreServicesException = module.exports.CoreServicesException = class exten
} }
} }
read (input) { read(input) {
input.readStructBegin(); input.readStructBegin();
while (true) { while (true) {
const ret = input.readFieldBegin(); const ret = input.readFieldBegin();
@ -42,36 +43,36 @@ const CoreServicesException = module.exports.CoreServicesException = class exten
} }
switch (fid) { switch (fid) {
case 1: case 1:
if (ftype == Thrift.Type.I32) { if (ftype == Thrift.Type.I32) {
this.code = input.readI32(); this.code = input.readI32();
} else { } else {
input.skip(ftype); input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.STRING) {
this.message = input.readString();
} else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.MAP) {
this.parameters = {};
const _rtmp31 = input.readMapBegin();
const _size0 = _rtmp31.size || 0;
for (let _i2 = 0; _i2 < _size0; ++_i2) {
let key3 = null;
let val4 = null;
key3 = input.readString();
val4 = input.readString();
this.parameters[key3] = val4;
} }
input.readMapEnd(); break;
} else { case 2:
input.skip(ftype); if (ftype == Thrift.Type.STRING) {
} this.message = input.readString();
break; } else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.MAP) {
this.parameters = {};
const _rtmp31 = input.readMapBegin();
const _size0 = _rtmp31.size || 0;
for (let _i2 = 0; _i2 < _size0; ++_i2) {
let key3 = null;
let val4 = null;
key3 = input.readString();
val4 = input.readString();
this.parameters[key3] = val4;
}
input.readMapEnd();
} else {
input.skip(ftype);
}
break;
default: default:
input.skip(ftype); input.skip(ftype);
} }
@ -81,7 +82,7 @@ const CoreServicesException = module.exports.CoreServicesException = class exten
return; return;
} }
write (output) { write(output) {
output.writeStructBegin('CoreServicesException'); output.writeStructBegin('CoreServicesException');
if (this.code !== null && this.code !== undefined) { if (this.code !== null && this.code !== undefined) {
output.writeFieldBegin('code', Thrift.Type.I32, 1); output.writeFieldBegin('code', Thrift.Type.I32, 1);
@ -95,10 +96,14 @@ const CoreServicesException = module.exports.CoreServicesException = class exten
} }
if (this.parameters !== null && this.parameters !== undefined) { if (this.parameters !== null && this.parameters !== undefined) {
output.writeFieldBegin('parameters', Thrift.Type.MAP, 3); output.writeFieldBegin('parameters', Thrift.Type.MAP, 3);
output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.parameters)); output.writeMapBegin(
for (let kiter5 in this.parameters) { Thrift.Type.STRING,
Thrift.Type.STRING,
Thrift.objectLength(this.parameters),
);
for (const kiter5 in this.parameters) {
if (this.parameters.hasOwnProperty(kiter5)) { if (this.parameters.hasOwnProperty(kiter5)) {
let viter6 = this.parameters[kiter5]; const viter6 = this.parameters[kiter5];
output.writeString(kiter5); output.writeString(kiter5);
output.writeString(viter6); output.writeString(viter6);
} }
@ -110,5 +115,4 @@ const CoreServicesException = module.exports.CoreServicesException = class exten
output.writeStructEnd(); output.writeStructEnd();
return; return;
} }
});
};

View file

@ -8,11 +8,10 @@ import Thrift = thrift.Thrift;
import Q = thrift.Q; import Q = thrift.Q;
import Int64 = require('node-int64'); import Int64 = require('node-int64');
declare class CommonException extends Thrift.TException { declare class CommonException extends Thrift.TException {
public code: number; public code: number;
public message: string; public message: string;
public metadata?: { [k: string]: string; }; public metadata?: { [k: string]: string };
constructor(args?: { code: number; message: string; metadata?: { [k: string]: string; }; }); constructor(args?: { code: number; message: string; metadata?: { [k: string]: string } });
} }

View file

@ -3,18 +3,17 @@
// //
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
// //
"use strict"; 'use strict';
const thrift = require('thrift'); const thrift = require('thrift');
const Thrift = thrift.Thrift; const Thrift = thrift.Thrift;
const Int64 = require('node-int64'); const Int64 = require('node-int64');
const ttypes = (module.exports = {});
const ttypes = module.exports = {}; const CommonException = (module.exports.CommonException = class extends Thrift.TException {
const CommonException = module.exports.CommonException = class extends Thrift.TException {
constructor(args) { constructor(args) {
super(args); super(args);
this.name = "CommonException"; this.name = 'CommonException';
this.code = null; this.code = null;
this.message = null; this.message = null;
this.metadata = null; this.metadata = null;
@ -31,7 +30,7 @@ const CommonException = module.exports.CommonException = class extends Thrift.TE
} }
} }
read (input) { read(input) {
input.readStructBegin(); input.readStructBegin();
while (true) { while (true) {
const ret = input.readFieldBegin(); const ret = input.readFieldBegin();
@ -42,36 +41,36 @@ const CommonException = module.exports.CommonException = class extends Thrift.TE
} }
switch (fid) { switch (fid) {
case 1: case 1:
if (ftype == Thrift.Type.I32) { if (ftype == Thrift.Type.I32) {
this.code = input.readI32(); this.code = input.readI32();
} else { } else {
input.skip(ftype); input.skip(ftype);
}
break;
case 2:
if (ftype == Thrift.Type.STRING) {
this.message = input.readString();
} else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.MAP) {
this.metadata = {};
const _rtmp31 = input.readMapBegin();
const _size0 = _rtmp31.size || 0;
for (let _i2 = 0; _i2 < _size0; ++_i2) {
let key3 = null;
let val4 = null;
key3 = input.readString();
val4 = input.readString();
this.metadata[key3] = val4;
} }
input.readMapEnd(); break;
} else { case 2:
input.skip(ftype); if (ftype == Thrift.Type.STRING) {
} this.message = input.readString();
break; } else {
input.skip(ftype);
}
break;
case 3:
if (ftype == Thrift.Type.MAP) {
this.metadata = {};
const _rtmp31 = input.readMapBegin();
const _size0 = _rtmp31.size || 0;
for (let _i2 = 0; _i2 < _size0; ++_i2) {
let key3 = null;
let val4 = null;
key3 = input.readString();
val4 = input.readString();
this.metadata[key3] = val4;
}
input.readMapEnd();
} else {
input.skip(ftype);
}
break;
default: default:
input.skip(ftype); input.skip(ftype);
} }
@ -81,7 +80,7 @@ const CommonException = module.exports.CommonException = class extends Thrift.TE
return; return;
} }
write (output) { write(output) {
output.writeStructBegin('CommonException'); output.writeStructBegin('CommonException');
if (this.code !== null && this.code !== undefined) { if (this.code !== null && this.code !== undefined) {
output.writeFieldBegin('code', Thrift.Type.I32, 1); output.writeFieldBegin('code', Thrift.Type.I32, 1);
@ -95,10 +94,14 @@ const CommonException = module.exports.CommonException = class extends Thrift.TE
} }
if (this.metadata !== null && this.metadata !== undefined) { if (this.metadata !== null && this.metadata !== undefined) {
output.writeFieldBegin('metadata', Thrift.Type.MAP, 3); output.writeFieldBegin('metadata', Thrift.Type.MAP, 3);
output.writeMapBegin(Thrift.Type.STRING, Thrift.Type.STRING, Thrift.objectLength(this.metadata)); output.writeMapBegin(
for (let kiter5 in this.metadata) { Thrift.Type.STRING,
Thrift.Type.STRING,
Thrift.objectLength(this.metadata),
);
for (const kiter5 in this.metadata) {
if (this.metadata.hasOwnProperty(kiter5)) { if (this.metadata.hasOwnProperty(kiter5)) {
let viter6 = this.metadata[kiter5]; const viter6 = this.metadata[kiter5];
output.writeString(kiter5); output.writeString(kiter5);
output.writeString(viter6); output.writeString(viter6);
} }
@ -110,5 +113,4 @@ const CommonException = module.exports.CommonException = class extends Thrift.TE
output.writeStructEnd(); output.writeStructEnd();
return; return;
} }
});
};

View file

@ -9,5 +9,3 @@ import Q = thrift.Q;
import Int64 = require('node-int64'); import Int64 = require('node-int64');
import structs_ttypes = require('./structs_types'); import structs_ttypes = require('./structs_types');
import exceptions_ttypes = require('./exceptions_types'); import exceptions_ttypes = require('./exceptions_types');

View file

@ -3,7 +3,7 @@
// //
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING // DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
// //
"use strict"; 'use strict';
const thrift = require('thrift'); const thrift = require('thrift');
const Thrift = thrift.Thrift; const Thrift = thrift.Thrift;
@ -12,5 +12,4 @@ const Int64 = require('node-int64');
const structs_ttypes = require('./structs_types'); const structs_ttypes = require('./structs_types');
const exceptions_ttypes = require('./exceptions_types'); const exceptions_ttypes = require('./exceptions_types');
const ttypes = (module.exports = {});
const ttypes = module.exports = {};

View file

@ -8,7 +8,6 @@ import Thrift = thrift.Thrift;
import Q = thrift.Q; import Q = thrift.Q;
import Int64 = require('node-int64'); import Int64 = require('node-int64');
declare enum RoleType { declare enum RoleType {
UNKNOWN = 0, UNKNOWN = 0,
SYSTEM = 1, SYSTEM = 1,
@ -36,174 +35,201 @@ declare enum WajibPajakOwnership {
} }
declare class Role { declare class Role {
public id: Int64; public id: Int64;
public displayName: string; public displayName: string;
public roleType: RoleType; public roleType: RoleType;
public creator?: User; public creator?: User;
public users?: User[]; public users?: User[];
public wajibPajakList?: WajibPajak[]; public wajibPajakList?: WajibPajak[];
constructor(args?: { id: Int64; displayName: string; roleType: RoleType; creator?: User; users?: User[]; wajibPajakList?: WajibPajak[]; }); constructor(args?: {
} id: Int64;
displayName: string;
roleType: RoleType;
creator?: User;
users?: User[];
wajibPajakList?: WajibPajak[];
});
}
declare class User { declare class User {
public id: Int64; public id: Int64;
public username: string; public username: string;
public password: string; public password: string;
public displayName: string; public displayName: string;
public privateKey: Buffer; public privateKey: Buffer;
public publicKey: Buffer; public publicKey: Buffer;
public roles?: Role[]; public roles?: Role[];
public ownedWajibPajakList?: WajibPajak[]; public ownedWajibPajakList?: WajibPajak[];
public rolesWajibPajakList?: Role[]; public rolesWajibPajakList?: Role[];
constructor(args?: { id: Int64; username: string; password: string; displayName: string; privateKey: Buffer; publicKey: Buffer; roles?: Role[]; ownedWajibPajakList?: WajibPajak[]; rolesWajibPajakList?: Role[]; }); constructor(args?: {
} id: Int64;
username: string;
password: string;
displayName: string;
privateKey: Buffer;
publicKey: Buffer;
roles?: Role[];
ownedWajibPajakList?: WajibPajak[];
rolesWajibPajakList?: Role[];
});
}
declare class WajibPajakProfile { declare class WajibPajakProfile {
public npwp: string; public npwp: string;
public displayName: string; public displayName: string;
public address: string; public address: string;
constructor(args?: { npwp: string; displayName: string; address: string; }); constructor(args?: { npwp: string; displayName: string; address: string });
} }
declare class WajibPajakTaxObligation { declare class WajibPajakTaxObligation {
public id: Int64; public id: Int64;
public obligation: JenisPajak; public obligation: JenisPajak;
public isActive: boolean; public isActive: boolean;
constructor(args?: { id: Int64; obligation: JenisPajak; isActive: boolean; }); constructor(args?: { id: Int64; obligation: JenisPajak; isActive: boolean });
} }
declare class WajibPajak { declare class WajibPajak {
public id: Int64; public id: Int64;
public profile: WajibPajakProfile; public profile: WajibPajakProfile;
public owners: User[]; public owners: User[];
public taxObligations?: WajibPajakTaxObligation[]; public taxObligations?: WajibPajakTaxObligation[];
public roles?: Role[]; public roles?: Role[];
constructor(args?: { id: Int64; profile: WajibPajakProfile; owners: User[]; taxObligations?: WajibPajakTaxObligation[]; roles?: Role[]; }); constructor(args?: {
} id: Int64;
profile: WajibPajakProfile;
owners: User[];
taxObligations?: WajibPajakTaxObligation[];
roles?: Role[];
});
}
declare class Pagination { declare class Pagination {
public page: Int64; public page: Int64;
public rowsPerPage: Int64; public rowsPerPage: Int64;
constructor(args?: { page: Int64; rowsPerPage: Int64; }); constructor(args?: { page: Int64; rowsPerPage: Int64 });
} }
declare class AlertInfo { declare class AlertInfo {
public title: string; public title: string;
public description: string; public description: string;
constructor(args?: { title: string; description: string; }); constructor(args?: { title: string; description: string });
} }
declare class LoginRequest { declare class LoginRequest {
public username: string; public username: string;
public password: string; public password: string;
constructor(args?: { username: string; password: string; }); constructor(args?: { username: string; password: string });
} }
declare class LoginResponse { declare class LoginResponse {
public trkToken: string; public trkToken: string;
public token: string; public token: string;
public profile?: User; public profile?: User;
constructor(args?: { trkToken: string; token: string; profile?: User; }); constructor(args?: { trkToken: string; token: string; profile?: User });
} }
declare class LogoutRequest { declare class LogoutRequest {
public token: string; public token: string;
constructor(args?: { token: string; }); constructor(args?: { token: string });
} }
declare class LogoutResponse { declare class LogoutResponse {}
}
declare class GetProfileRequest { declare class GetProfileRequest {}
}
declare class GetProfileResponse { declare class GetProfileResponse {
public profile: User; public profile: User;
constructor(args?: { profile: User; }); constructor(args?: { profile: User });
} }
declare class GetUserListRequest { declare class GetUserListRequest {
public pagination: Pagination; public pagination: Pagination;
public searchTerm: string; public searchTerm: string;
constructor(args?: { pagination: Pagination; searchTerm: string; }); constructor(args?: { pagination: Pagination; searchTerm: string });
} }
declare class GetUserListResponse { declare class GetUserListResponse {
public pagination: Pagination; public pagination: Pagination;
public totalUsers: Int64; public totalUsers: Int64;
public users: User[]; public users: User[];
constructor(args?: { pagination: Pagination; totalUsers: Int64; users: User[]; }); constructor(args?: { pagination: Pagination; totalUsers: Int64; users: User[] });
} }
declare class CreateUserRequest { declare class CreateUserRequest {
public user: User; public user: User;
constructor(args?: { user: User; }); constructor(args?: { user: User });
} }
declare class CreateUserResponse { declare class CreateUserResponse {}
}
declare class DeleteUsersRequest { declare class DeleteUsersRequest {
public userIds: Int64[]; public userIds: Int64[];
constructor(args?: { userIds: Int64[]; }); constructor(args?: { userIds: Int64[] });
} }
declare class DeleteUsersResponse { declare class DeleteUsersResponse {
public success: Int64[]; public success: Int64[];
public ignored: Int64[]; public ignored: Int64[];
constructor(args?: { success: Int64[]; ignored: Int64[]; }); constructor(args?: { success: Int64[]; ignored: Int64[] });
} }
declare class GetWajibPajakListRequest { declare class GetWajibPajakListRequest {
public pagination: Pagination; public pagination: Pagination;
public ownership: WajibPajakOwnership; public ownership: WajibPajakOwnership;
public searchTerm: string; public searchTerm: string;
constructor(args?: { pagination: Pagination; ownership: WajibPajakOwnership; searchTerm: string; }); constructor(args?: {
} pagination: Pagination;
ownership: WajibPajakOwnership;
searchTerm: string;
});
}
declare class GetWajibPajakListResponse { declare class GetWajibPajakListResponse {
public pagination: Pagination; public pagination: Pagination;
public totalWajibPajak: Int64; public totalWajibPajak: Int64;
public wajibPajakList: WajibPajak[]; public wajibPajakList: WajibPajak[];
constructor(args?: { pagination: Pagination; totalWajibPajak: Int64; wajibPajakList: WajibPajak[]; }); constructor(args?: {
} pagination: Pagination;
totalWajibPajak: Int64;
wajibPajakList: WajibPajak[];
});
}
declare class CreateWajibPajakRequest { declare class CreateWajibPajakRequest {
public wajibPajak: WajibPajak; public wajibPajak: WajibPajak;
constructor(args?: { wajibPajak: WajibPajak; }); constructor(args?: { wajibPajak: WajibPajak });
} }
declare class CreateWajibPajakResponse { declare class CreateWajibPajakResponse {}
}
declare class DeleteWajibpajakListRequest { declare class DeleteWajibpajakListRequest {
public wpIds: Int64[]; public wpIds: Int64[];
constructor(args?: { wpIds: Int64[]; }); constructor(args?: { wpIds: Int64[] });
} }
declare class DeleteWajibpajakListResponse { declare class DeleteWajibpajakListResponse {
public success: Int64[]; public success: Int64[];
public ignored: Int64[]; public ignored: Int64[];
constructor(args?: { success: Int64[]; ignored: Int64[]; }); constructor(args?: { success: Int64[]; ignored: Int64[] });
} }

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,7 @@
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>WPW-CTL</title> <title>Vite + Vue + TS</title>
</head> </head>
<body> <body>
<div id="app"></div> <div id="app"></div>

View file

@ -1,5 +1,5 @@
{ {
"name": "frontend", "name": "frontend2",
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
@ -14,82 +14,50 @@
"@algolia/client-search": "^4.14.2", "@algolia/client-search": "^4.14.2",
"@heroicons/vue": "^2.0.13", "@heroicons/vue": "^2.0.13",
"@vueuse/core": "^9.4.0", "@vueuse/core": "^9.4.0",
"classnames": "^2.3.2",
"flowbite": "1.5.0", "flowbite": "1.5.0",
"flowbite-vue": "^0.0.6", "flowbite-vue": "^0.0.6",
"pinia": "^2.0.23", "node-int64": "^0.4.0",
"node-stdlib-browser": "^1.2.0",
"pinia": "^2.0.27",
"thrift": "^0.16.0", "thrift": "^0.16.0",
"vue": "^3.2.41", "vue": "^3.2.41",
"vue-router": "^4.1.6", "vue3-easy-data-table": "^1.5.20",
"vue3-easy-data-table": "^1.5.12",
"vue3-perfect-scrollbar": "^1.6.1" "vue3-perfect-scrollbar": "^1.6.1"
}, },
"devDependencies": { "devDependencies": {
"node-stdlib-browser": "^1.2.0",
"@ampproject/rollup-plugin-closure-compiler": "^0.27.0",
"@babel/core": "^7.0.0",
"@babel/plugin-syntax-class-properties": "^7.12.13",
"@babel/plugin-transform-classes": "^7.19.0",
"@babel/preset-env": "^7.19.4",
"@esbuild-plugins/node-globals-polyfill": "^0.1.1", "@esbuild-plugins/node-globals-polyfill": "^0.1.1",
"@esbuild-plugins/node-modules-polyfill": "^0.1.4", "@esbuild-plugins/node-modules-polyfill": "^0.1.4",
"@lopatnov/rollup-plugin-uglify": "^2.1.5",
"@originjs/vite-plugin-commonjs": "^1.0.3", "@originjs/vite-plugin-commonjs": "^1.0.3",
"@rollup/plugin-babel": "^6.0.2", "@rollup/plugin-commonjs": "^23.0.3",
"@rollup/plugin-commonjs": "^22.0.2", "@rollup/plugin-node-resolve": "^15.0.1",
"@rollup/plugin-inject": "^4.0.4",
"@rollup/plugin-node-resolve": "^13.3.0",
"@rollup/plugin-terser": "^0.1.0", "@rollup/plugin-terser": "^0.1.0",
"@rushstack/eslint-patch": "^1.2.0", "@rushstack/eslint-patch": "^1.2.0",
"@types/node": "^16.18.3",
"@types/thrift": "^0.10.11", "@types/thrift": "^0.10.11",
"@vitejs/plugin-legacy": "^2.3.0",
"@vitejs/plugin-vue": "^3.2.0", "@vitejs/plugin-vue": "^3.2.0",
"@vitejs/plugin-vue-jsx": "^2.1.0", "@vitejs/plugin-vue-jsx": "^2.1.1",
"@vue/eslint-config-prettier": "^7.0.0", "@vue/eslint-config-prettier": "^7.0.0",
"@vue/eslint-config-typescript": "^11.0.2", "@vue/eslint-config-typescript": "^11.0.2",
"@vue/tsconfig": "^0.1.3", "@vue/tsconfig": "^0.1.3",
"@vuedx/typecheck": "^0.7.6", "@vuedx/typecheck": "^0.7.6",
"@vuedx/typescript-plugin-vue": "^0.7.6", "@vuedx/typescript-plugin-vue": "^0.7.6",
"autoprefixer": "^10.4.13", "autoprefixer": "^10.4.13",
"babel-plugin-minify-dead-code-elimination": "^0.5.2",
"class-names": "^1.0.0",
"esbuild": "*", "esbuild": "*",
"eslint": "^8.5.0", "eslint": "^8.5.0",
"eslint-config-prettier": "^8.5.0", "eslint-config-prettier": "^8.5.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1", "eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-vue": "^9.7.0", "eslint-plugin-vue": "^9.7.0",
"node-int64": "^0.4.0", "postcss": "^8.2.15",
"postcss": "^8.4.18",
"prettier": "^2.7.1", "prettier": "^2.7.1",
"rollup": "^2.79.0", "rollup": "^2.79.0",
"rollup-obfuscator": "^3.0.1", "rollup-obfuscator": "^3.0.1",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-polyfills": "^0.2.1", "rollup-plugin-node-polyfills": "^0.2.1",
"tailwindcss": "^3.2.2", "tailwindcss": "^3",
"terser": "^5.15.1",
"typescript": "^4.6.4", "typescript": "^4.6.4",
"vite": "^3.2.0", "vite": "^3.2.3",
"vite-plugin-chunk-split": "^0.4.3", "vite-plugin-commonjs": "^0.6.0",
"vite-plugin-node-stdlib-browser": "^0.1.1", "vite-plugin-node-stdlib-browser": "^0.1.1",
"vue-router": "^4.1.6",
"vue-tsc": "^1.0.9" "vue-tsc": "^1.0.9"
},
"eslintConfigxxx": {
"root": true,
"env": {
"browser": true,
"node": true,
"es6": true
},
"extendsxx": [
"plugin:vue/essential",
"plugin:prettier/recommended",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -4,8 +4,8 @@
import NavigationBar from './components/NavigationBar.vue'; import NavigationBar from './components/NavigationBar.vue';
import { useHub } from './hub'; import { useHub } from './hub';
import { useTheme } from './stores/theme'; import { useTheme } from './stores/theme';
import /* * as */structs from '@thriftgen/structs_types'; import /* * as */ structs from '@thriftgen/structs_types';
import /* * as */exceptions from '@thriftgen/exceptions_types'; import /* * as */ exceptions from '@thriftgen/exceptions_types';
import { RouteMeta, useRouter } from 'vue-router'; import { RouteMeta, useRouter } from 'vue-router';
import { AlertType, useAlert } from './stores/alert'; import { AlertType, useAlert } from './stores/alert';
import { useAuth } from './stores/auth'; import { useAuth } from './stores/auth';

View file

@ -4,7 +4,7 @@ import { useAlert } from '@/stores/alert';
import { useAuth } from '@/stores/auth'; import { useAuth } from '@/stores/auth';
import { computed, ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import { RouteLocationRaw, RouterLink, useRouter } from 'vue-router'; import { RouteLocationRaw, RouterLink, useRouter } from 'vue-router';
import /* * as */structs from '@thriftgen/structs_types'; import /* * as */ structs from '@thriftgen/structs_types';
import SpinnerIcon from './SpinnerIcon.vue'; import SpinnerIcon from './SpinnerIcon.vue';
import { NavbarLinkMeta } from '@/router'; import { NavbarLinkMeta } from '@/router';
const auth = useAuth(); const auth = useAuth();

View file

@ -1,5 +1,5 @@
import { ThriftClient } from './xhr_client'; import { ThriftClient } from './xhr_client';
import /* * as */Core from '@thriftgen/CoreService'; import /* * as */ Core from '@thriftgen/CoreService';
import { ServiceType } from './service_type'; import { ServiceType } from './service_type';
import { ClientOptions } from '.'; import { ClientOptions } from '.';
import { defaultClientOptions } from './defaults'; import { defaultClientOptions } from './defaults';

View file

@ -8,7 +8,12 @@ import {
} from 'thrift'; } from 'thrift';
import { computed } from 'vue'; import { computed } from 'vue';
import { ClientOptions } from '.'; import { ClientOptions } from '.';
import { CookieKeyAuthToken, CookieKeyTrackToken, HeaderKeyAuthToken, HeaderKeyTrackToken } from './hub'; import {
CookieKeyAuthToken,
CookieKeyTrackToken,
HeaderKeyAuthToken,
HeaderKeyTrackToken,
} from './hub';
export function initXHRClient<TClient>( export function initXHRClient<TClient>(
clientCtor: TClientConstructor<TClient>, clientCtor: TClientConstructor<TClient>,

View file

@ -1,6 +1,6 @@
import { defineStore } from 'pinia'; import { defineStore } from 'pinia';
import /* * as */structs from '@thriftgen/structs_types'; import /* * as */ structs from '@thriftgen/structs_types';
import { deleteCookie, getCookie, setCookie } from '@/utils/cookie'; import { deleteCookie, getCookie, setCookie } from '@/utils/cookie';
import { CookieKeyAuthToken, CookieKeyTrackToken } from '@/hub/hub'; import { CookieKeyAuthToken, CookieKeyTrackToken } from '@/hub/hub';
import { RemovableRef, useLocalStorage } from '@vueuse/core'; import { RemovableRef, useLocalStorage } from '@vueuse/core';

View file

@ -11,7 +11,7 @@ export const useTheme = defineStore({
return state._darkTheme; return state._darkTheme;
}, },
navigationBarVisibility(state): boolean { navigationBarVisibility(state): boolean {
return state._navigationBarVisibility return state._navigationBarVisibility;
}, },
}, },
actions: { actions: {

View file

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import /* * as */structs from '@thriftgen/structs_types'; import /* * as */ structs from '@thriftgen/structs_types';
import /* * as */exceptions from '@thriftgen/exceptions_types'; import /* * as */ exceptions from '@thriftgen/exceptions_types';
import { useHub } from '@/hub'; import { useHub } from '@/hub';
import { computed, ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import type { Header, Item, ServerOptions, SortType } from 'vue3-easy-data-table'; import type { Header, Item, ServerOptions, SortType } from 'vue3-easy-data-table';

View file

@ -11,6 +11,8 @@ const auth = useAuth();
<HeadingPage <HeadingPage
>Welcome<span v-if="auth.profile">, {{ auth.profile?.displayName }}</span></HeadingPage >Welcome<span v-if="auth.profile">, {{ auth.profile?.displayName }}</span></HeadingPage
> >
<a class="text-blue-600" href="https://git.obj.my.id/study-dumps/wpw-final">Source code</a>
</div> </div>
</div> </div>
</template> </template>

View file

@ -3,8 +3,8 @@ import LoginCard from '@/views/core/components/LoginCard.vue';
import NavigationBar from '@/components/NavigationBar.vue'; import NavigationBar from '@/components/NavigationBar.vue';
import { useAuth } from '@/stores/auth'; import { useAuth } from '@/stores/auth';
import { useRoute, useRouter } from 'vue-router'; import { useRoute, useRouter } from 'vue-router';
import /* * as */structs from '@thriftgen/structs_types'; import /* * as */ structs from '@thriftgen/structs_types';
import /* * as */exceptions from '@thriftgen/exceptions_types'; import /* * as */ exceptions from '@thriftgen/exceptions_types';
import { useAlert } from '@/stores/alert'; import { useAlert } from '@/stores/alert';
import { computed, watch } from 'vue'; import { computed, watch } from 'vue';

View file

@ -1,8 +1,8 @@
<script lang="ts" setup> <script lang="ts" setup>
import AlertBox from '@/components/AlertBox.vue'; import AlertBox from '@/components/AlertBox.vue';
import { useHub } from '@/hub'; import { useHub } from '@/hub';
import /* * as */structs from '@thriftgen/structs_types'; import /* * as */ structs from '@thriftgen/structs_types';
import /* * as */exceptions from '@thriftgen/exceptions_types'; import /* * as */ exceptions from '@thriftgen/exceptions_types';
import { computed, ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import { Header, Item, ServerOptions, SortType } from 'vue3-easy-data-table'; import { Header, Item, ServerOptions, SortType } from 'vue3-easy-data-table';
import HeadingPage from './components/HeadingPage.vue'; import HeadingPage from './components/HeadingPage.vue';

View file

@ -1,6 +1,6 @@
<script lang="ts" setup> <script lang="ts" setup>
import { useHub } from '@/hub'; import { useHub } from '@/hub';
import /* * as */structs from '@thriftgen/structs_types'; import /* * as */ structs from '@thriftgen/structs_types';
import { EyeIcon, EyeSlashIcon } from '@heroicons/vue/24/solid'; import { EyeIcon, EyeSlashIcon } from '@heroicons/vue/24/solid';
import { computed, ref, watch } from 'vue'; import { computed, ref, watch } from 'vue';
import AlertBox from '@/components/AlertBox.vue'; import AlertBox from '@/components/AlertBox.vue';

View file

@ -30,7 +30,7 @@ function hide() {
onMounted(() => { onMounted(() => {
const targetEl = refTargetEl.value; const targetEl = refTargetEl.value;
let options: any = { const options: any = {
onHide: () => { onHide: () => {
console.log('modal hide'); console.log('modal hide');
emit('onHide'); emit('onHide');
@ -46,10 +46,10 @@ onMounted(() => {
}; };
if (props.backdropClasses) options.backdropClasses = props.backdropClasses; if (props.backdropClasses) options.backdropClasses = props.backdropClasses;
if (props.placement) options.placement = props.placement; if (props.placement) options.placement = props.placement;
// @ts-ignore // @ts-ignore
modal = new Modal(targetEl, options); modal = new Modal(targetEl, options);
watch( watch(
() => props.show, () => props.show,
(value) => { (value) => {

View file

@ -5,8 +5,6 @@ import HomeView from './HomeView.vue';
import LoginView from './LoginView.vue'; import LoginView from './LoginView.vue';
import UserWajibPajakListViewVue from './UserWajibPajakListView.vue'; import UserWajibPajakListViewVue from './UserWajibPajakListView.vue';
export function routes(): RouteRecordRaw[] { export function routes(): RouteRecordRaw[] {
return [ return [
{ {

View file

@ -3,6 +3,5 @@
declare module '*.vue' { declare module '*.vue' {
import type { DefineComponent } from 'vue'; import type { DefineComponent } from 'vue';
const component: DefineComponent<{}, {}, any>; const component: DefineComponent<{}, {}, any>;
export default component; export default component;
} }

View file

@ -3,13 +3,9 @@
"paths": { "paths": {
"@/*": ["./src/*"], "@/*": ["./src/*"],
"@thriftgen/*": ["./gen/*"], "@thriftgen/*": ["./gen/*"],
// "@flowbite-vue": ["./3rdparty/flowbite-vue/src/*"],
}, },
// "target": "ESNext", "target": "ESNext",
// "module": "ESNext",
"module": "ESNext", "module": "ESNext",
"target": "ES5",
"sourceMap": true,
"useDefineForClassFields": true, "useDefineForClassFields": true,
"moduleResolution": "Node", "moduleResolution": "Node",
"strict": true, "strict": true,
@ -19,17 +15,18 @@
"resolveJsonModule": true, "resolveJsonModule": true,
"isolatedModules": true, "isolatedModules": true,
"esModuleInterop": true, "esModuleInterop": true,
"noImplicitReturns": true, "lib": ["ESNext", "DOM", "DOM.Iterable"],
"lib": ["ESNext", "DOM"],
"plugins": [{ "name": "@vuedx/typescript-plugin-vue" }], "plugins": [{ "name": "@vuedx/typescript-plugin-vue" }],
"skipLibCheck": true, "skipLibCheck": true,
"noEmit": true "noEmit": true,
"types": [
// "webpack-env",
]
}, },
"include": [ "include": [
"env.d.ts", "src/**/*.ts",
"src/**/*.ts", "src/**/*.d.ts",
"src/**/*.d.ts", "src/**/*.tsx",
"src/**/*.tsx",
"src/**/*.vue", "src/**/*.vue",
], ],
"references": [{ "path": "./tsconfig.node.json" }] "references": [{ "path": "./tsconfig.node.json" }]

View file

@ -4,12 +4,12 @@
"module": "ESNext", "module": "ESNext",
"moduleResolution": "Node", "moduleResolution": "Node",
"allowSyntheticDefaultImports": true, "allowSyntheticDefaultImports": true,
"resolveJsonModule": true, "resolveJsonModule": true,
}, },
"include": [ "include": [
"package.json", "package.json",
"vite.config.ts", "vite.config.ts",
"vite-polyfill-aliases.ts", "vite-polyfill-aliases.ts"
] ]
} }

View file

@ -1,4 +1,10 @@
export default { export default {
// This Rollup aliases are extracted from @esbuild-plugins/node-modules-polyfill,
// see https://github.com/remorses/esbuild-plugins/blob/master/node-modules-polyfill/src/polyfills.ts
// process and buffer are excluded because already managed
// by node-globals-polyfill
// https://github.com/vitejs/vite/issues/9511
util: 'rollup-plugin-node-polyfills/polyfills/util', util: 'rollup-plugin-node-polyfills/polyfills/util',
sys: 'util', sys: 'util',
events: 'rollup-plugin-node-polyfills/polyfills/events', events: 'rollup-plugin-node-polyfills/polyfills/events',
@ -27,6 +33,4 @@ export default {
buffer: 'rollup-plugin-node-polyfills/polyfills/buffer-es6', buffer: 'rollup-plugin-node-polyfills/polyfills/buffer-es6',
process: 'rollup-plugin-node-polyfills/polyfills/process-es6', process: 'rollup-plugin-node-polyfills/polyfills/process-es6',
// Buffer: 'buffer/',
// process: 'rollup-plugin-node-globals',
}; };

View file

@ -1,3 +1,5 @@
import { Plugin } from 'rollup';
import { fileURLToPath, URL } from 'node:url'; import { fileURLToPath, URL } from 'node:url';
import { defineConfig, optimizeDeps } from 'vite'; import { defineConfig, optimizeDeps } from 'vite';
import vue from '@vitejs/plugin-vue'; import vue from '@vitejs/plugin-vue';
@ -7,28 +9,66 @@ import { esbuildCommonjs, viteCommonjs } from '@originjs/vite-plugin-commonjs';
import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill'; import { NodeGlobalsPolyfillPlugin } from '@esbuild-plugins/node-globals-polyfill';
import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill'; import { NodeModulesPolyfillPlugin } from '@esbuild-plugins/node-modules-polyfill';
import { Plugin } from 'rollup';
import { splitVendorChunkPlugin } from 'vite';
import rollupNodePolyfills from 'rollup-plugin-node-polyfills'; import rollupNodePolyfills from 'rollup-plugin-node-polyfills';
import viteNodePolyfills from 'vite-plugin-node-stdlib-browser';
import { nodeResolve as rollupNodeResolve } from '@rollup/plugin-node-resolve'; import { nodeResolve as rollupNodeResolve } from '@rollup/plugin-node-resolve';
import rollupCommonjs from '@rollup/plugin-commonjs'; import rollupCommonjs from '@rollup/plugin-commonjs';
import terser from '@rollup/plugin-terser';
import compiler from '@ampproject/rollup-plugin-closure-compiler';
import { babel, getBabelOutputPlugin } from '@rollup/plugin-babel';
import legacy from '@vitejs/plugin-legacy';
import uglify from '@lopatnov/rollup-plugin-uglify';
import { obfuscator } from 'rollup-obfuscator';
import { chunkSplitPlugin } from 'vite-plugin-chunk-split';
import { dependencies } from './package.json';
import polyfillAliases from './vite-polyfill-aliases'; import polyfillAliases from './vite-polyfill-aliases';
import { resolve } from 'node:path'; import { dependencies } from './package.json';
export function injectSecPlugin(mode) { function injectSecPlugin(mode) {
return ['production', 'live'].indexOf(mode) !== -1 ? secPlugins : []; return ['production', 'live', 'prod'].indexOf(mode) !== -1 ? secPlugins : [];
} }
// https://vitejs.dev/config/
export default defineConfig(({ command, mode, ssrBuild }) => {
return {
plugins: [viteCommonjs(), vue(), vueJsx()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@thriftgen': fileURLToPath(new URL('./gen', import.meta.url)),
...polyfillAliases,
},
},
define: {
global: 'globalThis',
},
optimizeDeps: {
esbuildOptions: {
define: { global: 'globalThis' },
plugins: [
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true,
}),
NodeModulesPolyfillPlugin(),
],
},
},
build: {
outDir: '../public',
manifest: true,
minify: false,
rollupOptions: {
plugins: [
rollupNodePolyfills(),
rollupNodeResolve(),
rollupCommonjs({}),
esbuildCommonjs(['thrift']),
...injectSecPlugin(mode),
],
},
},
};
});
import { obfuscator } from 'rollup-obfuscator';
import terser from '@rollup/plugin-terser';
export const secPlugins: Plugin[] = [ export const secPlugins: Plugin[] = [
// NOT WORK. // NOT WORK.
// babel({ // babel({
@ -186,164 +226,4 @@ export const secPlugins: Plugin[] = [
comments: 'some', comments: 'some',
}, },
}), }),
]; ];
// https://vitejs.dev/config/
export default defineConfig(({ command, mode, ssrBuild }) => {
return {
plugins: [viteCommonjs(), vue(), vueJsx()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@thriftgen': fileURLToPath(new URL('./gen', import.meta.url)),
...polyfillAliases,
},
},
define: {
global: 'window',
},
optimizeDeps: {
esbuildOptions: {
define: { global: 'globalThis' },
plugins: [
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true,
}),
NodeModulesPolyfillPlugin(),
],
},
// exclude: ['flowbite', 'flowbite-vue', 'thrift'],
},
build: {
outDir: '../public',
manifest: true,
minify: false,
rollupOptions: {
input: {
main: resolve(__dirname, 'index.html'),
},
output: {
// to be able to use manual chunk - iife
// inlineDynamicImports: true,
manualChunks(id, { getModuleInfo, getModuleIds }) {
// const dynImpIds = getModuleInfo(id).dynamicImporters;
// if (/(gen\/|thrift|Thrift|util|events|inherits|WebSocket|Int64|ws)/.test(id)) return 'ext';
// if (/flowbite/.test(id)) return 'flowbite';
// if (/data-table/.test(id)) return 'edt';
// if (/scrollbar/.test(id)) return 'scrollbar';
// if (/(node_modules)/.test(id)) return 'vendor';
// if (id in dependencies) {
// return 'vendor';
// }
},
},
plugins: [
rollupNodePolyfills(),
rollupNodeResolve(),
rollupCommonjs({}),
esbuildCommonjs(['thrift']),
],
},
},
};
});
export const x = defineConfig(({ command, mode, ssrBuild }) => {
return {
plugins: [viteNodePolyfills(), viteCommonjs(), vue(), vueJsx()],
resolve: {
alias: {
'@': fileURLToPath(new URL('./src', import.meta.url)),
'@thriftgen': fileURLToPath(new URL('./gen', import.meta.url)),
// '@flowbite-vue': fileURLToPath(new URL('./3rdparty/flowbite-vue/src', import.meta.url)),
...polyfillAliases,
},
},
optimizeDeps: {
esbuildOptions: {
define: { global: 'globalThis' },
plugins: [
NodeGlobalsPolyfillPlugin({
process: true,
buffer: true,
}),
NodeModulesPolyfillPlugin(),
],
},
// include: [],
// exclude: [/@thriftgen/],
// exclude: [
// 'flowbite',
// 'flowbite-vue',
// 'thrift',
// 'vue3-easy-data-table',
// 'vue3-perfect-scrollbar',
// ...['structs_types', 'exceptions_types', 'CoreService'].map((x) => '@thriftgen/' + x),
// ],
},
build: {
outDir: '../public',
manifest: true,
// minify: 'terser',
minify: false,
// target: 'esnext',
rollupOptions: {
// input: {
// main: resolve(__dirname, 'index.html'),
// },
// output: {
// // format: 'iife',
// // format: 'cjs',
// globals: {
// // vue: "Vue"
// },
// // to be able to use manual chunk - iife
// // inlineDynamicImports: true,
// // manualChunks(id, { getModuleInfo, getModuleIds }) {
// // // if (/(gen\/|thrift|Thrift|util|inherits|WebSocket|Int64)/.test(id)) return 'ext';
// // // const dynImpIds = getModuleInfo(id).dynamicImporters;
// // if (/data-table/.test(id)) return 'edt';
// // if (/(node_modules)/.test(id)) return 'vendor';
// // // if (id in dependencies) {
// // // return 'vendor';
// // // }
// // },
// },
external: [
// "vue",
],
plugins: [
// chunkSplitPlugin({
// strategy: 'single-vendor',
// customSplitting: {
// 'thrift-vendor': ['thrift'],
// 'flowbite-vendor': ['flowbite'],
// },
// }),
// splitVendorChunkPlugin(),
rollupNodePolyfills(),
rollupNodeResolve(),
rollupCommonjs({}),
esbuildCommonjs(['thrift']),
// NOT WORK.
// ...legacy({
// targets: ['defaults', 'IE 11'],
// }),
...injectSecPlugin(mode),
],
},
},
};
});

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> <link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue + TS</title> <title>Vite + Vue + TS</title>
<script type="module" crossorigin src="/assets/index.241d8ed5.js"></script> <script type="module" crossorigin src="/assets/index.d28a354c.js"></script>
<link rel="stylesheet" href="/assets/index.d6f403e9.css"> <link rel="stylesheet" href="/assets/index.d6f403e9.css">
</head> </head>
<body> <body>

View file

@ -1,6 +1,6 @@
{ {
"index.html": { "index.html": {
"file": "assets/index.241d8ed5.js", "file": "assets/index.d28a354c.js",
"src": "index.html", "src": "index.html",
"isEntry": true, "isEntry": true,
"css": [ "css": [