token增加oldValue字段,处理刷新token时保存下老令牌
This commit is contained in:
parent
543805fb4f
commit
830c41eba1
|
|
@ -1383,7 +1383,7 @@ export async function refreshToken(params, context) {
|
|||
const newValue = await generateNewIdAsync();
|
||||
console.log('####### refreshToken token update start #######\n');
|
||||
console.log('刷新前tokenId:', token?.id);
|
||||
console.log('刷新前tokenValue:', token?.value);
|
||||
console.log('刷新前tokenValue:', tokenValue);
|
||||
console.log('---------------------\n');
|
||||
await context.operate('token', {
|
||||
id: await generateNewIdAsync(),
|
||||
|
|
@ -1391,6 +1391,7 @@ export async function refreshToken(params, context) {
|
|||
data: {
|
||||
value: newValue,
|
||||
refreshedAt: now,
|
||||
oldValue: tokenValue,
|
||||
},
|
||||
filter: {
|
||||
id: token.id,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ declare const _default: <ED2 extends EntityDict & BaseEntityDict, T2 extends key
|
|||
type?: ButtonProps['type'] | AmButtonProps['type'];
|
||||
executeText?: string | undefined;
|
||||
buttonProps?: (ButtonProps & {
|
||||
color?: "default" | "success" | "warning" | "primary" | "danger" | undefined;
|
||||
color?: "primary" | "success" | "warning" | "default" | "danger" | undefined;
|
||||
fill?: "none" | "solid" | "outline" | undefined;
|
||||
size?: "small" | "large" | "middle" | "mini" | undefined;
|
||||
block?: boolean | undefined;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { EntityDict } from '../../../oak-app-domain';
|
||||
declare const _default: (props: import("oak-frontend-base").ReactComponentProps<EntityDict, keyof EntityDict, false, {
|
||||
type: "login" | "bind";
|
||||
type: "bind" | "login";
|
||||
url: string;
|
||||
}>) => React.ReactElement;
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -63,7 +63,17 @@ export class BackendRuntimeContext extends BRC {
|
|||
},
|
||||
},
|
||||
filter: {
|
||||
value: tokenValue,
|
||||
$or: [
|
||||
{
|
||||
value: tokenValue,
|
||||
},
|
||||
{
|
||||
oldValue: tokenValue,
|
||||
refreshedAt: {
|
||||
$gte: Date.now() - 60 * 1000,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}, {
|
||||
dontCollect: true,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export interface Schema extends EntityShape {
|
|||
env: Environment;
|
||||
refreshedAt: Datetime;
|
||||
value: String<64>;
|
||||
oldValue?: String<64>;
|
||||
}
|
||||
export type Action = AbleAction;
|
||||
export declare const AbleActionDef: ActionDef<AbleAction, AbleState>;
|
||||
|
|
|
|||
|
|
@ -14,8 +14,9 @@ export const entityDesc = {
|
|||
env: '环境',
|
||||
ableState: '状态',
|
||||
disablesAt: '禁用时间',
|
||||
refreshedAt: "刷新时间",
|
||||
value: "令牌值"
|
||||
refreshedAt: '刷新时间',
|
||||
value: '令牌值',
|
||||
oldValue: "老令牌", // 只保留1分钟
|
||||
},
|
||||
action: {
|
||||
enable: '激活',
|
||||
|
|
@ -24,7 +25,7 @@ export const entityDesc = {
|
|||
v: {
|
||||
ableState: {
|
||||
enabled: '使用中',
|
||||
disabled: '已禁用'
|
||||
disabled: '已禁用',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -53,7 +54,7 @@ export const entityDesc = {
|
|||
color: {
|
||||
ableState: {
|
||||
enabled: '#008000',
|
||||
disabled: '#A9A9A9'
|
||||
disabled: '#A9A9A9',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ export type OpSchema = EntityShape & {
|
|||
env: Environment;
|
||||
refreshedAt: Datetime;
|
||||
value: String<64>;
|
||||
oldValue?: String<64> | null;
|
||||
ableState?: AbleState | null;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
|
|
@ -35,6 +36,7 @@ export type Schema = EntityShape & {
|
|||
env: Environment;
|
||||
refreshedAt: Datetime;
|
||||
value: String<64>;
|
||||
oldValue?: String<64> | null;
|
||||
ableState?: AbleState | null;
|
||||
application?: Application.Schema | null;
|
||||
user?: User.Schema | null;
|
||||
|
|
@ -63,6 +65,7 @@ type AttrFilter = {
|
|||
env: JsonFilter<Environment>;
|
||||
refreshedAt: Q_DateValue;
|
||||
value: Q_StringValue;
|
||||
oldValue: Q_StringValue;
|
||||
ableState: Q_EnumValue<AbleState>;
|
||||
email: Email.Filter;
|
||||
mobile: Mobile.Filter;
|
||||
|
|
@ -89,6 +92,7 @@ export type Projection = {
|
|||
env?: number | JsonProjection<Environment>;
|
||||
refreshedAt?: number;
|
||||
value?: number;
|
||||
oldValue?: number;
|
||||
ableState?: number;
|
||||
email?: Email.Projection;
|
||||
mobile?: Mobile.Projection;
|
||||
|
|
@ -149,6 +153,8 @@ export type SortAttr = {
|
|||
refreshedAt: number;
|
||||
} | {
|
||||
value: number;
|
||||
} | {
|
||||
oldValue: number;
|
||||
} | {
|
||||
ableState: number;
|
||||
} | {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,12 @@ export const desc = {
|
|||
length: 64
|
||||
}
|
||||
},
|
||||
oldValue: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
ableState: {
|
||||
type: "enum",
|
||||
enumeration: ["enabled", "disabled"]
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ export const style = {
|
|||
color: {
|
||||
ableState: {
|
||||
enabled: '#008000',
|
||||
disabled: '#A9A9A9'
|
||||
disabled: '#A9A9A9',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{ "name": "令牌", "attr": { "application": "应用", "entity": "关联对象", "entityId": "关联对象id", "user": "用户", "player": "扮演者", "env": "环境", "ableState": "状态", "disablesAt": "禁用时间", "refreshedAt": "刷新时间", "value": "令牌值" }, "action": { "enable": "激活", "disable": "禁用" }, "v": { "ableState": { "enabled": "使用中", "disabled": "已禁用" } } }
|
||||
{ "name": "令牌", "attr": { "application": "应用", "entity": "关联对象", "entityId": "关联对象id", "user": "用户", "player": "扮演者", "env": "环境", "ableState": "状态", "disablesAt": "禁用时间", "refreshedAt": "刷新时间", "value": "令牌值", "oldValue": "老令牌" }, "action": { "enable": "激活", "disable": "禁用" }, "v": { "ableState": { "enabled": "使用中", "disabled": "已禁用" } } }
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
declare const _default: (import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "sessionMessage", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMpJump", import("..").BRC<import("../oak-app-domain").EntityDict>>)[];
|
||||
declare const _default: (import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "sessionMessage", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMpJump", import("..").BRC<import("../oak-app-domain").EntityDict>>)[];
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export declare function createToDo<ED extends EntityDict & BaseEntityDict, T ext
|
|||
redirectTo: EntityDict['toDo']['OpSchema']['redirectTo'];
|
||||
entity: any;
|
||||
entityId: string;
|
||||
}, userIds?: string[]): Promise<0 | 1>;
|
||||
}, userIds?: string[]): Promise<1 | 0>;
|
||||
/**
|
||||
* 完成todo例程,当在entity对象上进行action操作时(操作条件是filter),将对应的todo完成
|
||||
* 必须在entity的action的后trigger中调用
|
||||
|
|
|
|||
|
|
@ -1398,7 +1398,7 @@ async function refreshToken(params, context) {
|
|||
const newValue = await (0, uuid_1.generateNewIdAsync)();
|
||||
console.log('####### refreshToken token update start #######\n');
|
||||
console.log('刷新前tokenId:', token?.id);
|
||||
console.log('刷新前tokenValue:', token?.value);
|
||||
console.log('刷新前tokenValue:', tokenValue);
|
||||
console.log('---------------------\n');
|
||||
await context.operate('token', {
|
||||
id: await (0, uuid_1.generateNewIdAsync)(),
|
||||
|
|
@ -1406,6 +1406,7 @@ async function refreshToken(params, context) {
|
|||
data: {
|
||||
value: newValue,
|
||||
refreshedAt: now,
|
||||
oldValue: tokenValue,
|
||||
},
|
||||
filter: {
|
||||
id: token.id,
|
||||
|
|
|
|||
|
|
@ -66,7 +66,17 @@ class BackendRuntimeContext extends oak_frontend_base_1.BackendRuntimeContext {
|
|||
},
|
||||
},
|
||||
filter: {
|
||||
value: tokenValue,
|
||||
$or: [
|
||||
{
|
||||
value: tokenValue,
|
||||
},
|
||||
{
|
||||
oldValue: tokenValue,
|
||||
refreshedAt: {
|
||||
$gte: Date.now() - 60 * 1000,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}, {
|
||||
dontCollect: true,
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ export interface Schema extends EntityShape {
|
|||
env: Environment;
|
||||
refreshedAt: Datetime;
|
||||
value: String<64>;
|
||||
oldValue?: String<64>;
|
||||
}
|
||||
export type Action = AbleAction;
|
||||
export declare const AbleActionDef: ActionDef<AbleAction, AbleState>;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@ exports.entityDesc = {
|
|||
env: '环境',
|
||||
ableState: '状态',
|
||||
disablesAt: '禁用时间',
|
||||
refreshedAt: "刷新时间",
|
||||
value: "令牌值"
|
||||
refreshedAt: '刷新时间',
|
||||
value: '令牌值',
|
||||
oldValue: "老令牌", // 只保留1分钟
|
||||
},
|
||||
action: {
|
||||
enable: '激活',
|
||||
|
|
@ -27,7 +28,7 @@ exports.entityDesc = {
|
|||
v: {
|
||||
ableState: {
|
||||
enabled: '使用中',
|
||||
disabled: '已禁用'
|
||||
disabled: '已禁用',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -56,7 +57,7 @@ exports.entityDesc = {
|
|||
color: {
|
||||
ableState: {
|
||||
enabled: '#008000',
|
||||
disabled: '#A9A9A9'
|
||||
disabled: '#A9A9A9',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ export type OpSchema = EntityShape & {
|
|||
env: Environment;
|
||||
refreshedAt: Datetime;
|
||||
value: String<64>;
|
||||
oldValue?: String<64> | null;
|
||||
ableState?: AbleState | null;
|
||||
};
|
||||
export type OpAttr = keyof OpSchema;
|
||||
|
|
@ -35,6 +36,7 @@ export type Schema = EntityShape & {
|
|||
env: Environment;
|
||||
refreshedAt: Datetime;
|
||||
value: String<64>;
|
||||
oldValue?: String<64> | null;
|
||||
ableState?: AbleState | null;
|
||||
application?: Application.Schema | null;
|
||||
user?: User.Schema | null;
|
||||
|
|
@ -63,6 +65,7 @@ type AttrFilter = {
|
|||
env: JsonFilter<Environment>;
|
||||
refreshedAt: Q_DateValue;
|
||||
value: Q_StringValue;
|
||||
oldValue: Q_StringValue;
|
||||
ableState: Q_EnumValue<AbleState>;
|
||||
email: Email.Filter;
|
||||
mobile: Mobile.Filter;
|
||||
|
|
@ -89,6 +92,7 @@ export type Projection = {
|
|||
env?: number | JsonProjection<Environment>;
|
||||
refreshedAt?: number;
|
||||
value?: number;
|
||||
oldValue?: number;
|
||||
ableState?: number;
|
||||
email?: Email.Projection;
|
||||
mobile?: Mobile.Projection;
|
||||
|
|
@ -149,6 +153,8 @@ export type SortAttr = {
|
|||
refreshedAt: number;
|
||||
} | {
|
||||
value: number;
|
||||
} | {
|
||||
oldValue: number;
|
||||
} | {
|
||||
ableState: number;
|
||||
} | {
|
||||
|
|
|
|||
|
|
@ -49,6 +49,12 @@ exports.desc = {
|
|||
length: 64
|
||||
}
|
||||
},
|
||||
oldValue: {
|
||||
type: "varchar",
|
||||
params: {
|
||||
length: 64
|
||||
}
|
||||
},
|
||||
ableState: {
|
||||
type: "enum",
|
||||
enumeration: ["enabled", "disabled"]
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ exports.style = {
|
|||
color: {
|
||||
ableState: {
|
||||
enabled: '#008000',
|
||||
disabled: '#A9A9A9'
|
||||
disabled: '#A9A9A9',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
{ "name": "令牌", "attr": { "application": "应用", "entity": "关联对象", "entityId": "关联对象id", "user": "用户", "player": "扮演者", "env": "环境", "ableState": "状态", "disablesAt": "禁用时间", "refreshedAt": "刷新时间", "value": "令牌值" }, "action": { "enable": "激活", "disable": "禁用" }, "v": { "ableState": { "enabled": "使用中", "disabled": "已禁用" } } }
|
||||
{ "name": "令牌", "attr": { "application": "应用", "entity": "关联对象", "entityId": "关联对象id", "user": "用户", "player": "扮演者", "env": "环境", "ableState": "状态", "disablesAt": "禁用时间", "refreshedAt": "刷新时间", "value": "令牌值", "oldValue": "老令牌" }, "action": { "enable": "激活", "disable": "禁用" }, "v": { "ableState": { "enabled": "使用中", "disabled": "已禁用" } } }
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
declare const _default: (import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "sessionMessage", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMpJump", import("..").BRC<import("../oak-app-domain").EntityDict>>)[];
|
||||
declare const _default: (import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "message", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "address", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "application", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "article", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "articleMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "extraFile", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "user", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "userEntityGrant", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatQrCode", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "notification", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatLogin", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "parasite", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "sessionMessage", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMenu", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatPublicTag", import("..").BRC<import("../oak-app-domain").EntityDict>> | import("oak-domain/lib/types").Trigger<import("../oak-app-domain").EntityDict, "wechatMpJump", import("..").BRC<import("../oak-app-domain").EntityDict>>)[];
|
||||
export default _default;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export declare function createToDo<ED extends EntityDict & BaseEntityDict, T ext
|
|||
redirectTo: EntityDict['toDo']['OpSchema']['redirectTo'];
|
||||
entity: any;
|
||||
entityId: string;
|
||||
}, userIds?: string[]): Promise<0 | 1>;
|
||||
}, userIds?: string[]): Promise<1 | 0>;
|
||||
/**
|
||||
* 完成todo例程,当在entity对象上进行action操作时(操作条件是filter),将对应的todo完成
|
||||
* 必须在entity的action的后trigger中调用
|
||||
|
|
|
|||
|
|
@ -1893,7 +1893,7 @@ export async function refreshToken<ED extends EntityDict>(
|
|||
const newValue = await generateNewIdAsync();
|
||||
console.log('####### refreshToken token update start #######\n');
|
||||
console.log('刷新前tokenId:', token?.id);
|
||||
console.log('刷新前tokenValue:', token?.value);
|
||||
console.log('刷新前tokenValue:', tokenValue);
|
||||
console.log('---------------------\n');
|
||||
await context.operate(
|
||||
'token',
|
||||
|
|
@ -1903,6 +1903,7 @@ export async function refreshToken<ED extends EntityDict>(
|
|||
data: {
|
||||
value: newValue,
|
||||
refreshedAt: now,
|
||||
oldValue: tokenValue,
|
||||
},
|
||||
filter: {
|
||||
id: token.id,
|
||||
|
|
|
|||
|
|
@ -87,7 +87,17 @@ export abstract class BackendRuntimeContext<ED extends EntityDict & BaseEntityDi
|
|||
},
|
||||
},
|
||||
filter: {
|
||||
value: tokenValue,
|
||||
$or: [
|
||||
{
|
||||
value: tokenValue,
|
||||
},
|
||||
{
|
||||
oldValue: tokenValue,
|
||||
refreshedAt: {
|
||||
$gte: Date.now() - 60 * 1000,
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,15 +17,21 @@ export interface Schema extends EntityShape {
|
|||
env: Environment;
|
||||
refreshedAt: Datetime;
|
||||
value: String<64>;
|
||||
oldValue?: String<64>;
|
||||
};
|
||||
|
||||
export type Action = AbleAction;
|
||||
|
||||
export const AbleActionDef: ActionDef<AbleAction, AbleState> = makeAbleActionDef('enabled');
|
||||
|
||||
export const entityDesc: EntityDesc<Schema, Action, '', {
|
||||
ableState: AbleState,
|
||||
}> = {
|
||||
export const entityDesc: EntityDesc<
|
||||
Schema,
|
||||
Action,
|
||||
'',
|
||||
{
|
||||
ableState: AbleState;
|
||||
}
|
||||
> = {
|
||||
locales: {
|
||||
zh_CN: {
|
||||
name: '令牌',
|
||||
|
|
@ -38,8 +44,9 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
|
|||
env: '环境',
|
||||
ableState: '状态',
|
||||
disablesAt: '禁用时间',
|
||||
refreshedAt: "刷新时间",
|
||||
value: "令牌值"
|
||||
refreshedAt: '刷新时间',
|
||||
value: '令牌值',
|
||||
oldValue: "老令牌", // 只保留1分钟
|
||||
},
|
||||
action: {
|
||||
enable: '激活',
|
||||
|
|
@ -48,7 +55,7 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
|
|||
v: {
|
||||
ableState: {
|
||||
enabled: '使用中',
|
||||
disabled: '已禁用'
|
||||
disabled: '已禁用',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -73,11 +80,11 @@ export const entityDesc: EntityDesc<Schema, Action, '', {
|
|||
icon: {
|
||||
enable: '',
|
||||
disable: '',
|
||||
},
|
||||
},
|
||||
color: {
|
||||
ableState: {
|
||||
enabled: '#008000',
|
||||
disabled: '#A9A9A9'
|
||||
disabled: '#A9A9A9',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue