Skip to content

Commit

Permalink
Access level validations
Browse files Browse the repository at this point in the history
  • Loading branch information
eduwercamacaro committed Jan 23, 2024
1 parent 41388d1 commit 9d78fcf
Show file tree
Hide file tree
Showing 24 changed files with 840 additions and 548 deletions.
2 changes: 1 addition & 1 deletion dashboard/apps/web/littlehorse-public-api/acls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ export type Exact<P, I extends P> = P extends Builtin ? P

function toTimestamp(dateStr: string): Timestamp {
const date = new globalThis.Date(dateStr);
const seconds = date.getTime() / 1_000;
const seconds = Math.trunc(date.getTime() / 1_000);
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ export type Exact<P, I extends P> = P extends Builtin ? P

function toTimestamp(dateStr: string): Timestamp {
const date = new globalThis.Date(dateStr);
const seconds = date.getTime() / 1_000;
const seconds = Math.trunc(date.getTime() / 1_000);
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/apps/web/littlehorse-public-api/node_run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ export type Exact<P, I extends P> = P extends Builtin ? P

function toTimestamp(dateStr: string): Timestamp {
const date = new globalThis.Date(dateStr);
const seconds = date.getTime() / 1_000;
const seconds = Math.trunc(date.getTime() / 1_000);
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/apps/web/littlehorse-public-api/object_id.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ export type Exact<P, I extends P> = P extends Builtin ? P

function toTimestamp(dateStr: string): Timestamp {
const date = new globalThis.Date(dateStr);
const seconds = date.getTime() / 1_000;
const seconds = Math.trunc(date.getTime() / 1_000);
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/apps/web/littlehorse-public-api/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8638,7 +8638,7 @@ export type Exact<P, I extends P> = P extends Builtin ? P

function toTimestamp(dateStr: string): Timestamp {
const date = new globalThis.Date(dateStr);
const seconds = date.getTime() / 1_000;
const seconds = Math.trunc(date.getTime() / 1_000);
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/apps/web/littlehorse-public-api/task_def.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export type Exact<P, I extends P> = P extends Builtin ? P

function toTimestamp(dateStr: string): Timestamp {
const date = new globalThis.Date(dateStr);
const seconds = date.getTime() / 1_000;
const seconds = Math.trunc(date.getTime() / 1_000);
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/apps/web/littlehorse-public-api/task_run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ export type Exact<P, I extends P> = P extends Builtin ? P

function toTimestamp(dateStr: string): Timestamp {
const date = new globalThis.Date(dateStr);
const seconds = date.getTime() / 1_000;
const seconds = Math.trunc(date.getTime() / 1_000);
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/apps/web/littlehorse-public-api/user_tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ export type Exact<P, I extends P> = P extends Builtin ? P

function toTimestamp(dateStr: string): Timestamp {
const date = new globalThis.Date(dateStr);
const seconds = date.getTime() / 1_000;
const seconds = Math.trunc(date.getTime() / 1_000);
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/apps/web/littlehorse-public-api/variable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export type Exact<P, I extends P> = P extends Builtin ? P

function toTimestamp(dateStr: string): Timestamp {
const date = new globalThis.Date(dateStr);
const seconds = date.getTime() / 1_000;
const seconds = Math.trunc(date.getTime() / 1_000);
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/apps/web/littlehorse-public-api/wf_run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1470,7 +1470,7 @@ export type Exact<P, I extends P> = P extends Builtin ? P

function toTimestamp(dateStr: string): Timestamp {
const date = new globalThis.Date(dateStr);
const seconds = date.getTime() / 1_000;
const seconds = Math.trunc(date.getTime() / 1_000);
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
Expand Down
29 changes: 26 additions & 3 deletions dashboard/apps/web/littlehorse-public-api/wf_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@ export interface WfSpec_ThreadSpecsEntry {
export interface WfSpec_ParentWfSpecReference {
/** Name of the Parent WfSpec */
wfSpecName: string;
/**
* FOR NOW: no validation of variables on parent. In the future we will pass
* wf_spec_major_version, but we should probably examine the rules for
* evolution in the future.
*/
wfSpecMajorVersion: number;
}

export interface WorkflowRetentionPolicy {
Expand Down Expand Up @@ -660,14 +666,17 @@ export const WfSpec_ThreadSpecsEntry = {
};

function createBaseWfSpec_ParentWfSpecReference(): WfSpec_ParentWfSpecReference {
return { wfSpecName: "" };
return { wfSpecName: "", wfSpecMajorVersion: 0 };
}

export const WfSpec_ParentWfSpecReference = {
encode(message: WfSpec_ParentWfSpecReference, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.wfSpecName !== "") {
writer.uint32(10).string(message.wfSpecName);
}
if (message.wfSpecMajorVersion !== 0) {
writer.uint32(16).int32(message.wfSpecMajorVersion);
}
return writer;
},

Expand All @@ -685,6 +694,13 @@ export const WfSpec_ParentWfSpecReference = {

message.wfSpecName = reader.string();
continue;
case 2:
if (tag !== 16) {
break;
}

message.wfSpecMajorVersion = reader.int32();
continue;
}
if ((tag & 7) === 4 || tag === 0) {
break;
Expand All @@ -695,14 +711,20 @@ export const WfSpec_ParentWfSpecReference = {
},

fromJSON(object: any): WfSpec_ParentWfSpecReference {
return { wfSpecName: isSet(object.wfSpecName) ? globalThis.String(object.wfSpecName) : "" };
return {
wfSpecName: isSet(object.wfSpecName) ? globalThis.String(object.wfSpecName) : "",
wfSpecMajorVersion: isSet(object.wfSpecMajorVersion) ? globalThis.Number(object.wfSpecMajorVersion) : 0,
};
},

toJSON(message: WfSpec_ParentWfSpecReference): unknown {
const obj: any = {};
if (message.wfSpecName !== "") {
obj.wfSpecName = message.wfSpecName;
}
if (message.wfSpecMajorVersion !== 0) {
obj.wfSpecMajorVersion = Math.round(message.wfSpecMajorVersion);
}
return obj;
},

Expand All @@ -712,6 +734,7 @@ export const WfSpec_ParentWfSpecReference = {
fromPartial<I extends Exact<DeepPartial<WfSpec_ParentWfSpecReference>, I>>(object: I): WfSpec_ParentWfSpecReference {
const message = createBaseWfSpec_ParentWfSpecReference();
message.wfSpecName = object.wfSpecName ?? "";
message.wfSpecMajorVersion = object.wfSpecMajorVersion ?? 0;
return message;
},
};
Expand Down Expand Up @@ -3448,7 +3471,7 @@ export type Exact<P, I extends P> = P extends Builtin ? P

function toTimestamp(dateStr: string): Timestamp {
const date = new globalThis.Date(dateStr);
const seconds = date.getTime() / 1_000;
const seconds = Math.trunc(date.getTime() / 1_000);
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
Expand Down
2 changes: 0 additions & 2 deletions schemas/variable.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ package littlehorse;

import "google/protobuf/timestamp.proto";
import "object_id.proto";
import "wf_spec.proto";

option go_package = ".;model";
option java_multiple_files = true;
Expand All @@ -29,5 +28,4 @@ message Variable {
VariableValue value = 2;
google.protobuf.Timestamp created_at = 3;
WfSpecId wf_spec_id = 4;
ThreadVarDef thread_var_def = 5;
}
1 change: 1 addition & 0 deletions schemas/wf_spec.proto
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ message WfSpec {
message ParentWfSpecReference {
// Name of the Parent WfSpec
string wf_spec_name = 1;
int32 wf_spec_major_version = 2;
// FOR NOW: no validation of variables on parent. In the future we will pass
// wf_spec_major_version, but we should probably examine the rules for
// evolution in the future.
Expand Down
Loading

0 comments on commit 9d78fcf

Please sign in to comment.