chore: cli subscription command registration + env and deploy docs
- inkreach-cli: subscription command in bin, built dist - env.development: public origin, plugin service registry, cache provider=redis, cold retention days - skill docs: subscription quick reference, deploy and ops notes
This commit is contained in:
@@ -11,6 +11,7 @@ import { authCommand } from './commands/auth';
|
||||
import { workflowCommand, triggerCommand, actionCommand } from './commands/workflow';
|
||||
import { baseResourceCommands } from './commands/resources';
|
||||
import { secretCommand, runsCommand, fireCommand, sqlCommand } from './commands/extras';
|
||||
import { subscriptionCommand } from './commands/subscription';
|
||||
|
||||
const program = new Command();
|
||||
|
||||
@@ -37,6 +38,7 @@ for (const c of baseResourceCommands()) program.addCommand(c);
|
||||
program.addCommand(workflowCommand());
|
||||
program.addCommand(triggerCommand());
|
||||
program.addCommand(actionCommand());
|
||||
program.addCommand(subscriptionCommand());
|
||||
program.addCommand(secretCommand());
|
||||
program.addCommand(runsCommand());
|
||||
program.addCommand(fireCommand());
|
||||
|
||||
+75
-5
@@ -91,11 +91,7 @@ export class Client {
|
||||
/** PUT convert: the ONLY API path that persists field options (choices,
|
||||
* visibilityFilter dependency config, etc.). Requires the field's current type. */
|
||||
convertField(tableId: string, fieldId: string, body: unknown) {
|
||||
return this.call<unknown>(
|
||||
'PUT',
|
||||
`/api/table/${tableId}/field/${fieldId}/convert`,
|
||||
body
|
||||
);
|
||||
return this.call<unknown>('PUT', `/api/table/${tableId}/field/${fieldId}/convert`, body);
|
||||
}
|
||||
deleteField(tableId: string, fieldId: string) {
|
||||
return this.call<{ id: string }>('DELETE', `/api/table/${tableId}/field/${fieldId}`);
|
||||
@@ -342,6 +338,38 @@ export class Client {
|
||||
removeDeveloper(userId: string) {
|
||||
return this.call<unknown>('DELETE', `/api/plugin-developers/${encodeURIComponent(userId)}`);
|
||||
}
|
||||
|
||||
// ---- subscription center (record subscriptions) ----
|
||||
listSubscriptions(baseId: string, tableId?: string) {
|
||||
const q = tableId ? `?tableId=${encodeURIComponent(tableId)}` : '';
|
||||
return this.call<IRecordSubscriptionVo[]>('GET', `/api/base/${baseId}/subscription${q}`);
|
||||
}
|
||||
getSubscriptionEvents(baseId: string, subscriptionId: string) {
|
||||
return this.call<IRecordSubscriptionEventVo[]>(
|
||||
'GET',
|
||||
`/api/base/${baseId}/subscription/${subscriptionId}/event`
|
||||
);
|
||||
}
|
||||
createSubscription(baseId: string, body: IRecordSubscriptionRo) {
|
||||
return this.call<IRecordSubscriptionVo>('POST', `/api/base/${baseId}/subscription`, body);
|
||||
}
|
||||
updateSubscription(baseId: string, subscriptionId: string, body: Partial<IRecordSubscriptionRo>) {
|
||||
return this.call<IRecordSubscriptionVo>(
|
||||
'PATCH',
|
||||
`/api/base/${baseId}/subscription/${subscriptionId}`,
|
||||
body
|
||||
);
|
||||
}
|
||||
deleteSubscription(baseId: string, subscriptionId: string) {
|
||||
return this.call<{ id: string }>(
|
||||
'DELETE',
|
||||
`/api/base/${baseId}/subscription/${subscriptionId}`
|
||||
);
|
||||
}
|
||||
/** 立即发送(flush pending digest events) */
|
||||
sendSubscriptionNow(baseId: string, subscriptionId: string) {
|
||||
return this.call<unknown>('POST', `/api/base/${baseId}/subscription/${subscriptionId}/send`);
|
||||
}
|
||||
}
|
||||
|
||||
// ---- shared types (mirror backend workflow_node / workflow_edge shapes) ----
|
||||
@@ -398,3 +426,45 @@ export interface IWorkflowVo {
|
||||
}
|
||||
|
||||
export { ApiError };
|
||||
|
||||
// ---- subscription types (mirror backend record_subscription contract) ----
|
||||
export interface IRecordSubscriptionRo {
|
||||
name: string;
|
||||
tableId: string;
|
||||
watchCreated?: boolean;
|
||||
watchUpdated?: boolean;
|
||||
fieldIds?: string[];
|
||||
recordIds?: string[];
|
||||
displayFieldId?: string | null;
|
||||
attachCsv?: boolean;
|
||||
filter?: Record<string, unknown> | null;
|
||||
triggerOnEnter?: boolean;
|
||||
sendMode?: 'digest' | 'instant';
|
||||
recipients?: string[];
|
||||
notifyInApp?: boolean;
|
||||
scheduleType?: 'daily' | 'weekly' | 'hours' | 'minutes';
|
||||
scheduleTime?: string;
|
||||
scheduleWeekday?: number;
|
||||
scheduleInterval?: number;
|
||||
isActive?: boolean;
|
||||
}
|
||||
|
||||
export interface IRecordSubscriptionVo extends IRecordSubscriptionRo {
|
||||
id: string;
|
||||
baseId: string;
|
||||
createdBy: string;
|
||||
createdTime: string;
|
||||
lastModifiedTime?: string | null;
|
||||
lastSentTime?: string | null;
|
||||
pendingCount?: number;
|
||||
}
|
||||
|
||||
export interface IRecordSubscriptionEventVo {
|
||||
id: string;
|
||||
subscriptionId: string;
|
||||
recordId: string;
|
||||
changeType: 'created' | 'updated';
|
||||
changedFieldIds?: string[] | null;
|
||||
createdTime: string;
|
||||
sentTime?: string | null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user