Skip to content

Commit

Permalink
Journal entries (#128)
Browse files Browse the repository at this point in the history
Signed-off-by: Nik Nasr <[email protected]>
  • Loading branch information
nikrooz authored Dec 19, 2024
1 parent 6ea77cb commit 3cd9c5f
Show file tree
Hide file tree
Showing 84 changed files with 4,945 additions and 331 deletions.
4 changes: 3 additions & 1 deletion apps/web-ui/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export default defineConfig(({ mode }) => {
!process.env.VITEST && reactRouter(),
nxViteTsPaths(),
] as Plugin[],

// Uncomment this if you are using workers.
worker: {
plugins: () => [nxViteTsPaths()],
Expand All @@ -48,6 +47,9 @@ export default defineConfig(({ mode }) => {
transformMixedEsModules: true,
},
},
ssr: {
noExternal: ['@uiw/react-json-view'],
},

server: {
headers: SERVER_HEADERS,
Expand Down
26 changes: 26 additions & 0 deletions libs/data-access/admin-api/src/lib/api/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,32 @@ export function useGetInvocation(
};
}

export function useGetInvocationJournal(
invocationId: string,
options?: HookQueryOptions<'/query/invocations/{invocationId}/journal', 'get'>
) {
const baseUrl = useAdminBaseUrl();
const queryOptions = adminApi(
'query',
'/query/invocations/{invocationId}/journal',
'get',
{
baseUrl,
parameters: { path: { invocationId } },
}
);

const results = useQuery({
...queryOptions,
...options,
});

return {
...results,
queryKey: queryOptions.queryKey,
};
}

export function useGetVirtualObjectQueue(
serviceName: string,
key: string,
Expand Down
313 changes: 313 additions & 0 deletions libs/data-access/admin-api/src/lib/api/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,26 @@ export interface paths {
patch?: never;
trace?: never;
};
'/query/invocations/{invocationId}/journal': {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* Get invocation journal
* @description Get invocation journal
*/
get: operations['get_invocation_journal'];
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
'/query/virtualObjects/{name}/keys/{key}/queue': {
parameters: {
query?: never;
Expand Down Expand Up @@ -770,6 +790,227 @@ export interface components {
*/
services: components['schemas']['ServiceMetadata'][];
};
JournalEntry: components['schemas']['JournalBaseEntry'] &
(
| components['schemas']['InputJournalEntryType']
| components['schemas']['GetStateJournalEntryType']
| components['schemas']['SetStateJournalEntryType']
| components['schemas']['GetStateKeysJournalEntryType']
| components['schemas']['ClearStateJournalEntryType']
| components['schemas']['ClearAllStateJournalEntryType']
| components['schemas']['SleepJournalEntryType']
| components['schemas']['GetPromiseJournalEntryType']
| components['schemas']['PeekPromiseJournalEntryType']
| components['schemas']['CompletePromiseJournalEntryType']
| components['schemas']['OneWayCallJournalEntryType']
| components['schemas']['CallJournalEntryType']
| components['schemas']['AwakeableJournalEntryType']
| components['schemas']['CompleteAwakeableJournalEntryType']
| components['schemas']['RunJournalEntryType']
| components['schemas']['CancelInvocationJournalEntryType']
| components['schemas']['GetCallInvocationIdJournalEntryType']
| components['schemas']['AttachInvocationJournalEntryType']
| components['schemas']['GetInvocationOutputJournalEntryType']
| components['schemas']['CustomJournalEntryType']
| components['schemas']['OutputJournalEntryType']
);
JournalRawEntry: {
index: number;
/** Format: binary */
raw?: string;
/** Format: date-time */
sleep_wakeup_at?: string;
completed?: boolean;
promise_name?: string;
invoked_target?: string;
invoked_id?: string;
name?: string;
/** @enum {string} */
entry_type:
| 'Input'
| 'Output'
| 'GetState'
| 'SetState'
| 'GetStateKeys'
| 'ClearState'
| 'ClearAllState'
| 'Sleep'
| 'GetPromise'
| 'PeekPromise'
| 'CompletePromise'
| 'OneWayCall'
| 'Call'
| 'Awakeable'
| 'CompleteAwakeable'
| 'Run'
| 'CancelInvocation'
| 'GetCallInvocationId'
| 'AttachInvocation'
| 'GetInvocationOutput'
| 'Custom';
};
JournalBaseEntry: {
index: number;
};
FailureEntry: {
message?: string;
restate_code?: string;
};
InputJournalEntryType: components['schemas']['JournalBaseEntry'] & {
/** @enum {string} */
entry_type?: 'Input';
body?: string;
headers?: {
key: string;
value: string;
}[];
};
OutputJournalEntryType: components['schemas']['JournalBaseEntry'] & {
/** @enum {string} */
entry_type?: 'Output';
body?: string;
failure?: components['schemas']['FailureEntry'];
};
GetStateJournalEntryType: components['schemas']['JournalBaseEntry'] & {
/** @enum {string} */
entry_type?: 'GetState';
key?: string;
value?: string;
completed?: boolean;
failure?: components['schemas']['FailureEntry'];
};
SetStateJournalEntryType: components['schemas']['JournalBaseEntry'] & {
/** @enum {string} */
entry_type?: 'SetState';
key?: string;
value?: string;
};
GetStateKeysJournalEntryType: components['schemas']['JournalBaseEntry'] & {
/** @enum {string} */
entry_type?: 'GetStateKeys';
completed?: boolean;
keys?: string[];
failure?: components['schemas']['FailureEntry'];
};
ClearStateJournalEntryType: components['schemas']['JournalBaseEntry'] & {
key?: string;
/** @enum {string} */
entry_type?: 'ClearState';
};
ClearAllStateJournalEntryType: components['schemas']['JournalBaseEntry'] & {
/** @enum {string} */
entry_type?: 'ClearAllState';
};
SleepJournalEntryType: components['schemas']['JournalBaseEntry'] & {
completed?: boolean;
failure?: components['schemas']['FailureEntry'];
/** Format: data-time */
sleep_wakeup_at: string;
/** @enum {string} */
entry_type?: 'Sleep';
};
GetPromiseJournalEntryType: components['schemas']['JournalBaseEntry'] & {
completed?: boolean;
/** @enum {string} */
entry_type?: 'GetPromise';
promise_name: string;
value?: string;
failure?: components['schemas']['FailureEntry'];
};
PeekPromiseJournalEntryType: components['schemas']['JournalBaseEntry'] & {
completed?: boolean;
/** @enum {string} */
entry_type?: 'PeekPromise';
promise_name: string;
value?: string;
failure?: components['schemas']['FailureEntry'];
};
CompletePromiseJournalEntryType: components['schemas']['JournalBaseEntry'] & {
completed?: boolean;
promise_name: string;
/** @enum {string} */
entry_type?: 'CompletePromise';
completion?: {
value?: string;
failure?: components['schemas']['FailureEntry'];
};
failure?: components['schemas']['FailureEntry'];
};
OneWayCallJournalEntryType: components['schemas']['JournalBaseEntry'] & {
invoked_id: string;
invoked_target: string;
key?: string;
serviceName?: string;
handlerName?: string;
parameters?: string;
headers?: {
key: string;
value: string;
}[];
/** Format: date-time */
invokeTime?: string;
/** @enum {string} */
entry_type?: 'OneWayCall';
};
CallJournalEntryType: components['schemas']['JournalBaseEntry'] & {
completed?: boolean;
invoked_id: string;
invoked_target: string;
failure?: components['schemas']['FailureEntry'];
key?: string;
serviceName?: string;
handlerName?: string;
parameters?: string;
headers?: {
key: string;
value: string;
}[];
value?: string;
/** @enum {string} */
entry_type?: 'Call';
};
AwakeableJournalEntryType: components['schemas']['JournalBaseEntry'] & {
completed?: boolean;
/** @enum {string} */
entry_type?: 'Awakeable';
failure?: components['schemas']['FailureEntry'];
value?: string;
};
CompleteAwakeableJournalEntryType: components['schemas']['JournalBaseEntry'] & {
/** @enum {string} */
entry_type?: 'CompleteAwakeable';
failure?: components['schemas']['FailureEntry'];
value?: string;
id?: string;
};
CancelInvocationJournalEntryType: components['schemas']['JournalBaseEntry'] & {
/** @enum {string} */
entry_type?: 'CancelInvocation';
};
GetCallInvocationIdJournalEntryType: components['schemas']['JournalBaseEntry'] & {
completed?: boolean;
/** @enum {string} */
entry_type?: 'GetCallInvocationId';
};
AttachInvocationJournalEntryType: components['schemas']['JournalBaseEntry'] & {
/** @enum {string} */
entry_type?: 'AttachInvocation';
};
GetInvocationOutputJournalEntryType: components['schemas']['JournalBaseEntry'] & {
/** @enum {string} */
entry_type?: 'GetInvocationOutput';
};
CustomJournalEntryType: components['schemas']['JournalBaseEntry'] & {
/** @enum {string} */
entry_type?: 'Custom';
};
RunJournalEntryType: components['schemas']['JournalBaseEntry'] & {
name: string;
/** @enum {string} */
entry_type?: 'Run';
failure?: components['schemas']['FailureEntry'];
value?: string;
};
InboxResponse: {
size?: number;
head: string;
Expand Down Expand Up @@ -2218,6 +2459,78 @@ export interface operations {
};
};
};
get_invocation_journal: {
parameters: {
query?: never;
header?: never;
path: {
/** @description Invocation id */
invocationId: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
200: {
headers: {
[name: string]: unknown;
};
content: {
'application/json': {
entries: components['schemas']['JournalEntry'][];
};
};
};
400: {
headers: {
[name: string]: unknown;
};
content: {
'application/json': components['schemas']['ErrorDescriptionResponse'];
};
};
403: {
headers: {
[name: string]: unknown;
};
content: {
'application/json': components['schemas']['ErrorDescriptionResponse'];
};
};
404: {
headers: {
[name: string]: unknown;
};
content: {
'application/json': components['schemas']['ErrorDescriptionResponse'];
};
};
409: {
headers: {
[name: string]: unknown;
};
content: {
'application/json': components['schemas']['ErrorDescriptionResponse'];
};
};
500: {
headers: {
[name: string]: unknown;
};
content: {
'application/json': components['schemas']['ErrorDescriptionResponse'];
};
};
503: {
headers: {
[name: string]: unknown;
};
content: {
'application/json': components['schemas']['ErrorDescriptionResponse'];
};
};
};
};
get_inbox: {
parameters: {
query?: {
Expand Down
Loading

0 comments on commit 3cd9c5f

Please sign in to comment.