Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/app-builder/src/models/cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,6 @@ export interface CaseDetail extends Case {
scenario: {
id: string;
name: string;
description: string;
scenarioIterationId: string;
version: number;
};
Expand Down Expand Up @@ -464,7 +463,6 @@ export async function adaptCaseDetail(
scenario: {
id: decisionDto.scenario.id,
name: decisionDto.scenario.name,
description: decisionDto.scenario.description,
scenarioIterationId: decisionDto.scenario.scenario_iteration_id,
version: decisionDto.scenario.version,
},
Expand Down
2 changes: 0 additions & 2 deletions packages/app-builder/src/models/decision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ export interface Decision {
scenario: {
id: string;
name: string;
description: string;
scenarioIterationId: string;
version: number;
};
Expand Down Expand Up @@ -166,7 +165,6 @@ export function adaptDecision(dto: DecisionDto): Decision {
scenario: {
id: dto.scenario.id,
name: dto.scenario.name,
description: dto.scenario.description,
scenarioIterationId: dto.scenario.scenario_iteration_id,
version: dto.scenario.version,
},
Expand Down
6 changes: 0 additions & 6 deletions packages/app-builder/src/models/pagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,16 @@ export const defaultPaginationSize = 25;

export type Pagination = {
hasNextPage: boolean;
startIndex: number;
endIndex: number;
};

export type PaginatedResponse<T> = {
items: T[];
hasNextPage: boolean;
startIndex: number;
endIndex: number;
};

export function adaptPagination(paginationDto: PaginationDto): Pagination {
return {
hasNextPage: paginationDto.has_next_page,
startIndex: paginationDto.start_index,
endIndex: paginationDto.end_index,
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/marble-api/openapis/marblecore-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ paths:
/credentials:
$ref: ./marblecore-api/authorization.yml#/~1credentials

/decisions/with-ranks: # For ordering, should go down within decisions
$ref: ./marblecore-api/decisions.yml#/~1decisions~1with-ranks
/decisions: # For ordering, should go down within decisions
$ref: ./marblecore-api/decisions.yml#/~1decisions

# ANNOTATIONS

Expand Down
6 changes: 0 additions & 6 deletions packages/marble-api/openapis/marblecore-api/_schemas.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,9 @@ Pagination:
type: object
required:
- has_next_page
- start_index
- end_index
properties:
has_next_page:
type: boolean
start_index:
type: integer
end_index:
type: integer

# ANNOTATIONS

Expand Down
3 changes: 0 additions & 3 deletions packages/marble-api/openapis/marblecore-api/cases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,6 @@ components:
required:
- id
- name
- description
- scenario_iteration_id
- version
properties:
Expand All @@ -981,8 +980,6 @@ components:
format: uuid
name:
type: string
description:
type: string
scenario_iteration_id:
type: string
format: uuid
Expand Down
30 changes: 1 addition & 29 deletions packages/marble-api/openapis/marblecore-api/decisions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/decisions/with-ranks:
/decisions:
get:
tags:
- Decisions
Expand Down Expand Up @@ -114,31 +114,6 @@
$ref: 'components.yml#/responses/401'
'403':
$ref: 'components.yml#/responses/403'
post:
tags:
- Decisions
summary: Create a decision
operationId: createDecision
security:
- bearerAuth: []
requestBody:
description: 'Payload object used to be trigger the decision engine'
content:
application/json:
schema:
$ref: '#/components/schemas/CreateDecisionBody'
required: true
responses:
'200':
description: The decision corresponding to the provided payload
content:
application/json:
schema:
$ref: '#/components/schemas/DecisionDetailDto'
'401':
$ref: 'components.yml#/responses/401'
'403':
$ref: 'components.yml#/responses/403'
/decisions/{decisionId}:
get:
tags:
Expand Down Expand Up @@ -310,8 +285,6 @@ components:
id:
type: string
format: uuid
description:
type: string
name:
type: string
scenario_iteration_id:
Expand All @@ -321,7 +294,6 @@ components:
type: integer
required:
- id
- description
- name
- scenario_iteration_id
- version
Expand Down
100 changes: 36 additions & 64 deletions packages/marble-api/src/generated/marblecore-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ export type OutcomeDto = "approve" | "review" | "decline" | "block_and_review" |
export type ReviewStatusDto = "pending" | "approve" | "decline";
export type Pagination = {
has_next_page: boolean;
start_index: number;
end_index: number;
};
export type CaseStatusDto = "pending" | "investigating" | "closed" | "waiting_for_action" | "snoozed";
export type CaseContributorDto = {
Expand Down Expand Up @@ -85,7 +83,6 @@ export type DecisionDto = {
review_status?: ReviewStatusDto;
scenario: {
id: string;
description: string;
name: string;
scenario_iteration_id: string;
version: number;
Expand All @@ -97,46 +94,6 @@ export type DecisionDto = {
trigger_object_type: string;
scheduled_execution_id?: string;
};
export type CreateDecisionBody = {
scenario_id: string;
trigger_object: object;
object_type: string;
};
export type ConstantDto = ((string | null) | (number | null) | (boolean | null) | (ConstantDto[] | null) | ({
[key: string]: ConstantDto;
} | null)) | null;
export type EvaluationErrorCodeDto = "UNEXPECTED_ERROR" | "UNDEFINED_FUNCTION" | "WRONG_NUMBER_OF_ARGUMENTS" | "MISSING_NAMED_ARGUMENT" | "ARGUMENTS_MUST_BE_INT_OR_FLOAT" | "ARGUMENTS_MUST_BE_INT_FLOAT_OR_TIME" | "ARGUMENT_MUST_BE_INTEGER" | "ARGUMENT_MUST_BE_STRING" | "ARGUMENT_MUST_BE_BOOLEAN" | "ARGUMENT_MUST_BE_LIST" | "ARGUMENT_MUST_BE_CONVERTIBLE_TO_DURATION" | "ARGUMENT_MUST_BE_TIME" | "ARGUMENT_REQUIRED" | "ARGUMENT_INVALID_TYPE" | "LIST_NOT_FOUND" | "DATABASE_ACCESS_NOT_FOUND" | "PAYLOAD_FIELD_NOT_FOUND" | "NULL_FIELD_READ" | "NO_ROWS_READ" | "DIVISION_BY_ZERO" | "PAYLOAD_FIELD_NOT_FOUND" | "RUNTIME_EXPRESSION_ERROR";
export type EvaluationErrorDto = {
error: EvaluationErrorCodeDto;
message: string;
argument_index?: number;
argument_name?: string;
};
export type NodeEvaluationDto = {
return_value: {
value?: ConstantDto;
is_omitted: boolean;
};
errors: EvaluationErrorDto[] | null;
children?: NodeEvaluationDto[];
named_children?: {
[key: string]: NodeEvaluationDto;
};
skipped?: boolean;
};
export type RuleExecutionDto = {
error?: Error;
description: string;
name: string;
outcome: "hit" | "no_hit" | "snoozed" | "error";
result: boolean;
rule_id: string;
score_modifier: number;
rule_evaluation?: NodeEvaluationDto;
};
export type DecisionDetailDto = DecisionDto & {
rules: RuleExecutionDto[];
};
export type ComponentsSchemasTagEntityAnnotationDtoAllOf0 = {
id: string;
case_id: string;
Expand Down Expand Up @@ -193,7 +150,6 @@ export type CaseDecisionDto = {
scenario: {
id: string;
name: string;
description: string;
scenario_iteration_id: string;
version: number;
};
Expand Down Expand Up @@ -510,6 +466,41 @@ export type ScheduledExecutionDto = {
started_at: string;
status: "pending" | "processing" | "success" | "failure" | "partial_failure";
};
export type ConstantDto = ((string | null) | (number | null) | (boolean | null) | (ConstantDto[] | null) | ({
[key: string]: ConstantDto;
} | null)) | null;
export type EvaluationErrorCodeDto = "UNEXPECTED_ERROR" | "UNDEFINED_FUNCTION" | "WRONG_NUMBER_OF_ARGUMENTS" | "MISSING_NAMED_ARGUMENT" | "ARGUMENTS_MUST_BE_INT_OR_FLOAT" | "ARGUMENTS_MUST_BE_INT_FLOAT_OR_TIME" | "ARGUMENT_MUST_BE_INTEGER" | "ARGUMENT_MUST_BE_STRING" | "ARGUMENT_MUST_BE_BOOLEAN" | "ARGUMENT_MUST_BE_LIST" | "ARGUMENT_MUST_BE_CONVERTIBLE_TO_DURATION" | "ARGUMENT_MUST_BE_TIME" | "ARGUMENT_REQUIRED" | "ARGUMENT_INVALID_TYPE" | "LIST_NOT_FOUND" | "DATABASE_ACCESS_NOT_FOUND" | "PAYLOAD_FIELD_NOT_FOUND" | "NULL_FIELD_READ" | "NO_ROWS_READ" | "DIVISION_BY_ZERO" | "PAYLOAD_FIELD_NOT_FOUND" | "RUNTIME_EXPRESSION_ERROR";
export type EvaluationErrorDto = {
error: EvaluationErrorCodeDto;
message: string;
argument_index?: number;
argument_name?: string;
};
export type NodeEvaluationDto = {
return_value: {
value?: ConstantDto;
is_omitted: boolean;
};
errors: EvaluationErrorDto[] | null;
children?: NodeEvaluationDto[];
named_children?: {
[key: string]: NodeEvaluationDto;
};
skipped?: boolean;
};
export type RuleExecutionDto = {
error?: Error;
description: string;
name: string;
outcome: "hit" | "no_hit" | "snoozed" | "error";
result: boolean;
rule_id: string;
score_modifier: number;
rule_evaluation?: NodeEvaluationDto;
};
export type DecisionDetailDto = DecisionDto & {
rules: RuleExecutionDto[];
};
export type RuleSnoozeDto = {
id: string;
pivot_value: string;
Expand Down Expand Up @@ -1421,7 +1412,7 @@ export function listDecisions({ caseId, endDate, hasCase, outcome, pivotValue, s
} | {
status: 403;
data: string;
}>(`/decisions/with-ranks${QS.query(QS.explode({
}>(`/decisions${QS.query(QS.explode({
"case_id[]": caseId,
end_date: endDate,
has_case: hasCase,
Expand All @@ -1441,25 +1432,6 @@ export function listDecisions({ caseId, endDate, hasCase, outcome, pivotValue, s
...opts
}));
}
/**
* Create a decision
*/
export function createDecision(createDecisionBody: CreateDecisionBody, opts?: Oazapfts.RequestOpts) {
return oazapfts.ok(oazapfts.fetchJson<{
status: 200;
data: DecisionDetailDto;
} | {
status: 401;
data: string;
} | {
status: 403;
data: string;
}>("/decisions/with-ranks", oazapfts.json({
...opts,
method: "POST",
body: createDecisionBody
})));
}
/**
* Get an annotation by ID
*/
Expand Down