From 3455fd893f8ad92a2307b2094efa38955f97d15c Mon Sep 17 00:00:00 2001 From: "Xc@centOs" Date: Tue, 10 Oct 2023 15:03:38 +0800 Subject: [PATCH] =?UTF-8?q?OakExternalException=E5=A2=9E=E5=8A=A0=E4=BA=86?= =?UTF-8?q?data=E5=9F=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/types/Entity.d.ts | 4 +--- lib/types/Entity.js | 5 ++--- lib/types/Exception.d.ts | 3 ++- lib/types/Exception.js | 7 +++++-- src/types/Entity.ts | 6 ++---- src/types/Exception.ts | 7 +++++-- 6 files changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/types/Entity.d.ts b/lib/types/Entity.d.ts index 762a7dc..1da3e19 100644 --- a/lib/types/Entity.d.ts +++ b/lib/types/Entity.d.ts @@ -1,7 +1,6 @@ import { ReadOnlyAction } from '../actions/action'; import { PrimaryKey, Sequence } from './DataType'; type TriggerDataAttributeType = '$$triggerData$$'; -type TriggerTimestampAttributeType = '$$triggerTimestamp$$'; type TriggerUuidAttributeType = '$$triggerUuid$$'; type PrimaryKeyAttributeType = 'id'; type CreateAtAttributeType = '$$createAt$$'; @@ -9,14 +8,13 @@ type UpdateAtAttributeType = '$$updateAt$$'; type DeleteAtAttributeType = '$$deleteAt$$'; type SeqAttributeType = '$$seq$$'; export declare const TriggerDataAttribute = "$$triggerData$$"; -export declare const TriggerTimestampAttribute = "$$triggerTimestamp$$"; export declare const TriggerUuidAttribute = "$$triggerUuid$$"; export declare const PrimaryKeyAttribute = "id"; export declare const CreateAtAttribute = "$$createAt$$"; export declare const UpdateAtAttribute = "$$updateAt$$"; export declare const DeleteAtAttribute = "$$deleteAt$$"; export declare const SeqAttribute = "$$seq$$"; -export type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType | TriggerUuidAttributeType; +export type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType | DeleteAtAttributeType | TriggerDataAttributeType | SeqAttributeType | TriggerUuidAttributeType; export declare const initinctiveAttributes: string[]; type FilterPart = { filter?: A extends 'create' ? undefined : F; diff --git a/lib/types/Entity.js b/lib/types/Entity.js index 380ddbf..7e5e082 100644 --- a/lib/types/Entity.js +++ b/lib/types/Entity.js @@ -1,15 +1,14 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.initinctiveAttributes = exports.SeqAttribute = exports.DeleteAtAttribute = exports.UpdateAtAttribute = exports.CreateAtAttribute = exports.PrimaryKeyAttribute = exports.TriggerUuidAttribute = exports.TriggerTimestampAttribute = exports.TriggerDataAttribute = void 0; +exports.initinctiveAttributes = exports.SeqAttribute = exports.DeleteAtAttribute = exports.UpdateAtAttribute = exports.CreateAtAttribute = exports.PrimaryKeyAttribute = exports.TriggerUuidAttribute = exports.TriggerDataAttribute = void 0; exports.TriggerDataAttribute = '$$triggerData$$'; -exports.TriggerTimestampAttribute = '$$triggerTimestamp$$'; exports.TriggerUuidAttribute = '$$triggerUuid$$'; exports.PrimaryKeyAttribute = 'id'; exports.CreateAtAttribute = '$$createAt$$'; exports.UpdateAtAttribute = '$$updateAt$$'; exports.DeleteAtAttribute = '$$deleteAt$$'; exports.SeqAttribute = '$$seq$$'; -exports.initinctiveAttributes = [exports.PrimaryKeyAttribute, exports.TriggerDataAttribute, exports.TriggerTimestampAttribute, exports.CreateAtAttribute, exports.UpdateAtAttribute, exports.DeleteAtAttribute, exports.SeqAttribute]; +exports.initinctiveAttributes = [exports.PrimaryKeyAttribute, exports.TriggerDataAttribute, exports.TriggerUuidAttribute, exports.CreateAtAttribute, exports.UpdateAtAttribute, exports.DeleteAtAttribute, exports.SeqAttribute]; ; ; ; diff --git a/lib/types/Exception.d.ts b/lib/types/Exception.d.ts index 6ff57df..9ec4e9f 100644 --- a/lib/types/Exception.d.ts +++ b/lib/types/Exception.d.ts @@ -135,7 +135,8 @@ export declare class OakPreConditionUnsetException extend export declare class OakExternalException extends OakUserException { code?: string; source: string; - constructor(source: string, code?: string, message?: string); + data?: any; + constructor(source: string, code?: string, message?: string, data?: any); toString(): string; } export declare function makeException(data: { diff --git a/lib/types/Exception.js b/lib/types/Exception.js index ed356ee..823b03e 100644 --- a/lib/types/Exception.js +++ b/lib/types/Exception.js @@ -282,16 +282,19 @@ exports.OakPreConditionUnsetException = OakPreConditionUnsetException; class OakExternalException extends OakUserException { code; source; - constructor(source, code, message) { + data; + constructor(source, code, message, data) { super(message); this.code = code; this.source = source; + this.data = data; } toString() { return JSON.stringify({ code: this.code, message: this.message, source: this.source, + data: this.data, }); } } @@ -385,7 +388,7 @@ function makeException(data) { return e; } case 'OakExternalException': { - const e = new OakExternalException(data.source, data.code, data.message); + const e = new OakExternalException(data.source, data.code, data.message, data.data); return e; } case 'OakNetworkException': { diff --git a/src/types/Entity.ts b/src/types/Entity.ts index edba36d..b1e3cec 100644 --- a/src/types/Entity.ts +++ b/src/types/Entity.ts @@ -2,7 +2,6 @@ import { ReadOnlyAction } from '../actions/action'; import { PrimaryKey, Sequence } from './DataType'; type TriggerDataAttributeType = '$$triggerData$$'; -type TriggerTimestampAttributeType = '$$triggerTimestamp$$'; type TriggerUuidAttributeType = '$$triggerUuid$$'; type PrimaryKeyAttributeType = 'id'; type CreateAtAttributeType = '$$createAt$$'; @@ -11,7 +10,6 @@ type DeleteAtAttributeType = '$$deleteAt$$'; type SeqAttributeType = '$$seq$$'; export const TriggerDataAttribute = '$$triggerData$$'; -export const TriggerTimestampAttribute = '$$triggerTimestamp$$'; export const TriggerUuidAttribute = '$$triggerUuid$$'; export const PrimaryKeyAttribute = 'id'; export const CreateAtAttribute = '$$createAt$$'; @@ -19,8 +17,8 @@ export const UpdateAtAttribute = '$$updateAt$$'; export const DeleteAtAttribute = '$$deleteAt$$'; export const SeqAttribute = '$$seq$$'; -export type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType| DeleteAtAttributeType | TriggerDataAttributeType | TriggerTimestampAttributeType | SeqAttributeType | TriggerUuidAttributeType; -export const initinctiveAttributes = [PrimaryKeyAttribute, TriggerDataAttribute, TriggerTimestampAttribute, CreateAtAttribute, UpdateAtAttribute, DeleteAtAttribute, SeqAttribute]; +export type InstinctiveAttributes = PrimaryKeyAttributeType | CreateAtAttributeType | UpdateAtAttributeType| DeleteAtAttributeType | TriggerDataAttributeType | SeqAttributeType | TriggerUuidAttributeType; +export const initinctiveAttributes = [PrimaryKeyAttribute, TriggerDataAttribute, TriggerUuidAttribute, CreateAtAttribute, UpdateAtAttribute, DeleteAtAttribute, SeqAttribute]; type FilterPart = { filter?: A extends 'create' ? undefined : F; diff --git a/src/types/Exception.ts b/src/types/Exception.ts index 6d30e22..259d7de 100644 --- a/src/types/Exception.ts +++ b/src/types/Exception.ts @@ -311,11 +311,13 @@ export class OakPreConditionUnsetException extends OakUse export class OakExternalException extends OakUserException { code?: string; source: string; + data?: any; - constructor(source: string, code?: string, message?: string) { + constructor(source: string, code?: string, message?: string, data?: any) { super(message); this.code = code; this.source = source; + this.data = data; } toString(): string { @@ -323,6 +325,7 @@ export class OakExternalException extends OakUserExceptio code: this.code, message: this.message, source: this.source, + data: this.data, }); } } @@ -425,7 +428,7 @@ export function makeException(data: { return e; } case 'OakExternalException': { - const e = new OakExternalException(data.source, data.code, data.message); + const e = new OakExternalException(data.source, data.code, data.message, data.data); return e; } case 'OakNetworkException': {