Skip to content

Commit

Permalink
Merge pull request #339 from platformsh/remove-js-proxy
Browse files Browse the repository at this point in the history
Remove JS proxy
  • Loading branch information
shakaman authored Sep 9, 2024
2 parents bdab5e6 + 0962347 commit 000e44d
Show file tree
Hide file tree
Showing 56 changed files with 756 additions and 591 deletions.
16 changes: 8 additions & 8 deletions src/model/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ export default class Account extends Ressource {

super(`${account_url}${url}`, paramDefaults, { id }, account);
this._queryUrl = Ressource.getQueryUrl(url);
this.id = "";
this.created_at = "";
this.updated_at = "";
this.has_key = false;
this.display_name = "";
this.email = "";
this.picture = "";
this.roles = [];
this.id = account.id;
this.created_at = account.created_at;
this.updated_at = account.updated_at;
this.has_key = account.has_key;
this.display_name = account.display_name;
this.email = account.email;
this.picture = account.picture;
this.roles = account.roles ?? [];
}

static async get(params: AccountGetParams, customUrl?: string) {
Expand Down
32 changes: 16 additions & 16 deletions src/model/AccountsProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@ export default class AccountsProfile extends Ressource {
modifiableField
);
this._queryUrl = Ressource.getQueryUrl(url);
this.id = "";
this.display_name = "";
this.email = "";
this.username = "";
this.picture = "";
this.company_type = "";
this.company_role = "";
this.company_name = "";
this.website_url = "";
this.new_ui = true;
this.ui_colorscheme = "";
this.ui_contrast = "";
this.default_catalog = "";
this.marketing = false;
this.billing_contact = "";
this.vat_number = "";
this.id = profile.id;
this.display_name = profile.display_name;
this.email = profile.email;
this.username = profile.username;
this.picture = profile.picture;
this.company_type = profile.company_type;
this.company_role = profile.company_role;
this.company_name = profile.company_name;
this.website_url = profile.website_url;
this.new_ui = profile.new_ui ?? true;
this.ui_colorscheme = profile.ui_colorscheme;
this.ui_contrast = profile.ui_contrast;
this.default_catalog = profile.default_catalog;
this.marketing = profile.marketing;
this.billing_contact = profile.billing_contact;
this.vat_number = profile.vat_number;
}

static async get(params: AccountsProfileGetParams, customUrl?: string) {
Expand Down
38 changes: 19 additions & 19 deletions src/model/Activity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,25 +53,25 @@ export default class Activity extends Ressource {

constructor(activity: APIObject, url: string) {
super(url, paramDefaults, {}, activity, ["name", "ssl"]);
this.id = "";
this.completion_percent = 0;
this.log = "";
this.created_at = "";
this.updated_at = "";
this.cancelled_at = "";
this.environments = [];
this.completed_at = "";
this.parameters = {};
this.project = "";
this.state = "";
this.result = "";
this.started_at = "";
this.type = "";
this.payload = [];
this.description = "";
this.integration = "";
this.timings = {};
this.text = "";
this.id = activity.id;
this.completion_percent = activity.completion_percent ?? 0;
this.log = activity.log;
this.created_at = activity.created_at;
this.updated_at = activity.updated_at;
this.cancelled_at = activity.cancelled_at;
this.environments = activity.environments ?? [];
this.completed_at = activity.completed_at;
this.parameters = activity.parameters ?? {};
this.project = activity.project;
this.state = activity.state;
this.result = activity.result;
this.started_at = activity.started_at;
this.type = activity.type;
this.payload = activity.payload ?? [];
this.description = activity.description;
this.integration = activity.integration;
this.timings = activity.timings ?? {};
this.text = activity.text;
}

static async get(params: ActivityGetParams, customUrl?: string) {
Expand Down
22 changes: 11 additions & 11 deletions src/model/Address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ export default class Address extends Ressource {
_modifiableField
);
this._queryUrl = Address.getQueryUrl(`${account_url}${url}`, id);
this.id = "";
this.country = "";
this.name_line = "";
this.premise = "";
this.sub_premise = "";
this.thoroughfare = "";
this.administrative_area = "";
this.sub_administrative_area = "";
this.locality = "";
this.dependent_locality = "";
this.postal_code = "";
this.id = address.id;
this.country = address.country;
this.name_line = address.name_line;
this.premise = address.premise;
this.sub_premise = address.sub_premise;
this.thoroughfare = address.thoroughfare;
this.administrative_area = address.administrative_area;
this.sub_administrative_area = address.sub_administrative_area;
this.locality = address.locality;
this.dependent_locality = address.dependent_locality;
this.postal_code = address.postal_code;
}

static getQueryUrl(_url: string, id?: string) {
Expand Down
10 changes: 5 additions & 5 deletions src/model/ApiToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ export default class ApiToken extends Ressource {
Ressource.getQueryUrl(`${api_url}${url}`),
params
);
this.id = "";
this.name = "";
this.created_at = "";
this.update_at = "";
this.token = "";
this.id = apiToken.id;
this.name = apiToken.name;
this.created_at = apiToken.created_at;
this.update_at = apiToken.update_at;
this.token = apiToken.token;
}

static async get(params: APITokenGetParams, customUrl: string) {
Expand Down
32 changes: 16 additions & 16 deletions src/model/AuthUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ export default class AuthUser extends Ressource {
modifiableField
);
this._queryUrl = Ressource.getQueryUrl(url);
this.id = "";
this.username = "";
this.first_name = "";
this.last_name = "";
this.email = "";
this.email_verified = false;
this.phone_number_verified = false;
this.picture = "";
this.website = "";
this.country = "";
this.company = "";
this.mfa_enabled = false;
this.sso_enabled = false;
this.deactivated = false;
this.created_at = "";
this.updated_at = "";
this.id = user.id;
this.username = user.username;
this.first_name = user.first_name;
this.last_name = user.last_name;
this.email = user.email;
this.email_verified = user.email_verified;
this.phone_number_verified = user.phone_number_verified;
this.picture = user.picture;
this.website = user.website;
this.country = user.country;
this.company = user.company;
this.mfa_enabled = user.mfa_enabled;
this.sso_enabled = user.sso_enabled;
this.deactivated = user.deactivated;
this.created_at = user.created_at;
this.updated_at = user.updated_at;
}

static async get(params: AuthUserParams, customUrl?: string) {
Expand Down
20 changes: 10 additions & 10 deletions src/model/Certificate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ export default class Certificate extends Ressource {

constructor(certificate: APIObject, url: string) {
super(url, paramDefaults, {}, certificate, ["key", "certificate", "chain"]);
this.key = "";
this.id = "";
this.certificate = "";
this.chain = [];
this.domains = [];
this.expires_at = "";
this.updated_at = "";
this.created_at = "";
this.is_provisioned = true;
this.issuer = [];
this.key = certificate.key;
this.id = certificate.id;
this.certificate = certificate.certificate;
this.chain = certificate.chain ?? [];
this.domains = certificate.domains ?? [];
this.expires_at = certificate.expires_at;
this.updated_at = certificate.updated_at;
this.created_at = certificate.created_at;
this.is_provisioned = certificate.is_provisioned ?? true;
this.issuer = certificate.issuer ?? [];
this._required = ["key", "certificate"];
}

Expand Down
14 changes: 7 additions & 7 deletions src/model/Comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ export default class Comment extends Ressource {

super(`${api_url}${url}`, paramDefaults, {}, comment, createableField, []);

this.ticket_id = "";
this.ticket_id = comment.ticket_id;
this.id = this.ticket_id;
this.comment_id = "";
this.created_at = "";
this.body = "";
this.author_id = "";
this.public = "";
this.attachments = [];
this.comment_id = comment.comment_id;
this.created_at = comment.created_at;
this.body = comment.body;
this.author_id = comment.author_id;
this.public = comment.public;
this.attachments = comment.attachments ?? [];
}

static async query(ticketId: string, queryParams: Record<string, any>) {
Expand Down
8 changes: 4 additions & 4 deletions src/model/ConnectedAccount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export default class ConnectedAccount extends Ressource {
constructor(connectedAccount: APIObject, url: string) {
super(url, {}, {}, connectedAccount, [], []);

this.provider = "";
this.subject = "";
this.created_at = "";
this.updated_at = "";
this.provider = connectedAccount.provider;
this.subject = connectedAccount.subject;
this.created_at = connectedAccount.created_at;
this.updated_at = connectedAccount.updated_at;
}

static async get(userId: string, provider: string) {
Expand Down
20 changes: 10 additions & 10 deletions src/model/Deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,16 +307,16 @@ export default class Deployment extends Ressource {

constructor(deployment: APIObject, url: string) {
super(url, paramDefaults, {}, deployment, [], modifiableField);
this.webapps = {} as Record<string, DeploymentService>;
this.services = {} as Record<string, DeploymentService>;
this.workers = {} as Record<string, DeploymentService>;
this.routes = {};
this.container_profiles = {};
this.variables = [];
this.project_info = {} as DeploymentProjectInfo;
this.environment_info = {} as DeploymentEnvironmentInfo;
this.fingerprint = "";
this.id = "";
this.webapps = deployment.webapps ?? {};
this.services = deployment.services ?? {};
this.workers = deployment.workers ?? {};
this.routes = deployment.routes ?? {};
this.container_profiles = deployment.container_profiles ?? {};
this.variables = deployment.variables ?? [];
this.project_info = deployment.project_info ?? {};
this.environment_info = deployment.environment_info ?? {};
this.fingerprint = deployment.fingerprint;
this.id = deployment.id;
}

static async get(params: DeploymentGetParams, customUrl?: string) {
Expand Down
18 changes: 12 additions & 6 deletions src/model/Domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ export type DomainQueryParams = {
};

export default class Domain extends Ressource {
id = "";
name = "";
is_default = false;
created_at = "";
ssl = [];
updated_at = "";
id: string;
name: string;
is_default: boolean;
created_at: string;
ssl: unknown[];
updated_at: string;

constructor(domain: APIObject, url: string) {
super(
Expand All @@ -35,6 +35,12 @@ export default class Domain extends Ressource {
["name", "ssl", "is_default"],
modifiableField
);
this.id = domain.id;
this.name = domain.name;
this.is_default = domain.is_default;
this.created_at = domain.created_at;
this.ssl = domain.ssl ?? [];
this.updated_at = domain.updated_at;
this._required = ["name"];
}

Expand Down
70 changes: 47 additions & 23 deletions src/model/Environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,32 +65,56 @@ type HttpAccess = {
};

export default class Environment extends Ressource {
id = "";
status: Status = Status.inactive;
head_commit = "";
name = "";
parent: string | null = null;
machine_name = "";
restrict_robots = false;
title = "";
created_at = "";
updated_at = "";
last_active_at = "";
last_backup_at = "";
project = "";
is_dirty = false;
enable_smtp = false;
has_code = false;
deployment_target = "";
deployment_state: DeploymentState | undefined = undefined;
http_access: HttpAccess = {};
is_main = false;
type = "";
edge_hostname = "";
has_deployment = false;
id: string;
status: Status;
head_commit: string;
name: string;
parent: string | null;
machine_name: string;
restrict_robots: boolean;
title: string;
created_at: string;
updated_at: string;
last_active_at: string;
last_backup_at: string;
project: string;
is_dirty: boolean;
enable_smtp: boolean;
has_code: boolean;
deployment_target: string;
deployment_state?: DeploymentState;
http_access: HttpAccess;
is_main: boolean;
type: string;
edge_hostname: string;
has_deployment: boolean;

constructor(environment: APIObject, url: string) {
super(url, paramDefaults, environment, environment, [], modifiableField);

this.id = environment.id;
this.status = environment.status ?? Status.inactive;
this.head_commit = environment.head_commit;
this.name = environment.name;
this.parent = environment.parent ?? null;
this.machine_name = environment.machine_name;
this.restrict_robots = environment.restrict_robots;
this.title = environment.title;
this.created_at = environment.created_at;
this.updated_at = environment.updated_at;
this.last_active_at = environment.last_active_at;
this.last_backup_at = environment.last_backup_at;
this.project = environment.project;
this.is_dirty = environment.is_dirty;
this.enable_smtp = environment.enable_smtp;
this.has_code = environment.has_code;
this.deployment_target = environment.deployment_target;
this.deployment_state = environment.deployment_state;
this.http_access = environment.http_access ?? {};
this.is_main = environment.is_main;
this.type = environment.type;
this.edge_hostname = environment.edge_hostname;
this.has_deployment = environment.has_deployment;
}

static async get(params: EnvironmentGetParams, customUrl?: string) {
Expand Down
Loading

0 comments on commit 000e44d

Please sign in to comment.