@oddington/sdk 0.1.85 → 0.1.86

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ export declare const routines: import('./routine-reference-types.js').Routines;
7
7
  export { RoutineOperationError } from '../../../shared/routine-operation-error.js';
8
8
  export type { RoutineOperationCode } from '../../../shared/routine-operation-error.js';
9
9
  export type { QueueAskWait, QueueItem, QueueState, QueueSummary, QueryDescription, QueryExecution, QueryExecutionPage, RoutineListOptions, RoutineRunHandle, RoutineQueryReference, QueryExecutionHandle } from './routine-reference-types.js';
10
- export type { QueryDefinition, QueryEntry, QueryRuntime, QueryTrigger, QueryTriggerContext } from './query-definition-types.js';
10
+ export type { QueryDefinition, QueryEntry, QueryRuntime, QueryTrigger, QueryTriggerContext, WebhookEvent, XeroWebhookEvent } from './query-definition-types.js';
11
11
  export type { RoutineReference, RoutineQueueReference } from './routine-reference-types.js';
12
12
  export declare const schema: import('./routine-definition-types.js').RoutineSchemaBuilders;
13
13
  export declare const file: import('./routine-definition-types.js').RoutineFileSchema;
@@ -1,15 +1,8 @@
1
1
  import type { RoutineAccess, RoutineInput, SharedRoutineCapabilities } from './routine-definition-types.js';
2
- import type { RoutineSchedule } from '../../../shared/routine-schedule.js';
2
+ import type { QueryTrigger, QueryTriggerContext } from '../../../shared/routine-query-contract.js';
3
3
  import type { RoutineQueueReference } from './routine-reference-types.js';
4
- export type QueryTrigger = {
5
- readonly schedule: RoutineSchedule;
6
- };
7
- export type QueryTriggerContext = {
8
- readonly type: 'manual';
9
- } | {
10
- readonly type: 'schedule';
11
- readonly scheduledAt: string;
12
- };
4
+ export type { QueryTrigger, QueryTriggerContext } from '../../../shared/routine-query-contract.js';
5
+ export type { WebhookEvent, XeroWebhookEvent } from '../../../shared/routine-webhook-contract.js';
13
6
  export type QueryEntry<Input = unknown> = {
14
7
  readonly idempotencyKey: string;
15
8
  readonly input: RoutineInput<Input>;
@@ -1,12 +1,25 @@
1
1
  import { type RoutineAccess } from './routine-definition-contract.js';
2
2
  import type { RoutineSchedule } from './routine-schedule.js';
3
+ import { type WebhookQueryTrigger, type WebhookEvent } from './routine-webhook-contract.js';
4
+ export type QueryTrigger = {
5
+ readonly schedule: RoutineSchedule;
6
+ } | WebhookQueryTrigger;
7
+ export type QueryTriggerContext = {
8
+ readonly type: 'manual';
9
+ } | {
10
+ readonly type: 'schedule';
11
+ readonly scheduledAt: string;
12
+ } | {
13
+ readonly type: 'webhook';
14
+ readonly event: WebhookEvent;
15
+ };
16
+ export declare function parseQueryTriggers(value: unknown, access: RoutineAccess): QueryTrigger[];
17
+ export declare function parseQueryTriggerContext(value: unknown, query?: RoutineQueryContract): QueryTriggerContext;
3
18
  export type RoutineQueryContract = {
4
19
  id: string;
5
20
  routineId: string;
6
21
  access: RoutineAccess;
7
- triggers: readonly {
8
- schedule: RoutineSchedule;
9
- }[];
22
+ triggers: readonly QueryTrigger[];
10
23
  };
11
24
  export type DeployedRoutineQuery = RoutineQueryContract & {
12
25
  entry: string;
@@ -1,16 +1,11 @@
1
1
  import { type RoutineAccess } from './routine-definition-contract.js';
2
- import type { RoutineSchedule } from './routine-schedule.js';
2
+ import { type QueryTrigger, type QueryTriggerContext } from './routine-query-contract.js';
3
3
  /** Safe retained member results; executable coordinates and authority stay private. */
4
4
  export type QueryExecution = {
5
5
  id: string;
6
6
  queryId: string;
7
7
  deploymentId: string;
8
- trigger: {
9
- type: 'manual';
10
- } | {
11
- type: 'schedule';
12
- scheduledAt: string;
13
- };
8
+ trigger: QueryTriggerContext;
14
9
  status: 'queued' | 'running' | 'succeeded' | 'failed';
15
10
  acceptedAt: string;
16
11
  startedAt?: string;
@@ -27,9 +22,7 @@ export type QueryDescription = {
27
22
  id: string;
28
23
  routineId: string;
29
24
  access: RoutineAccess;
30
- triggers: {
31
- schedule: RoutineSchedule;
32
- }[];
25
+ triggers: QueryTrigger[];
33
26
  latestExecution?: QueryExecution;
34
27
  };
35
28
  export type QueryExecutionPage = {
@@ -0,0 +1,26 @@
1
+ import { type RoutineAccess } from './routine-definition-contract.js';
2
+ import type { JsonValue } from './inbox-contract.js';
3
+ export declare const XERO_WEBHOOK_KINDS: readonly ['invoice.created', 'invoice.updated', 'payment.created', 'payment.updated'];
4
+ export type XeroWebhookKind = typeof XERO_WEBHOOK_KINDS[number];
5
+ export type XeroWebhookEvent = {
6
+ readonly id: string;
7
+ readonly provider: 'xero';
8
+ readonly connection: `xero/${string}`;
9
+ readonly kind: XeroWebhookKind;
10
+ readonly resource: {
11
+ readonly type: 'invoice' | 'payment';
12
+ readonly id: string;
13
+ };
14
+ readonly occurredAt?: string;
15
+ readonly receivedAt: string;
16
+ readonly detail?: JsonValue;
17
+ };
18
+ export type WebhookEvent = XeroWebhookEvent;
19
+ export type WebhookQueryTrigger = {
20
+ readonly webhook: {
21
+ readonly connection: `xero/${string}`;
22
+ readonly events: readonly XeroWebhookKind[];
23
+ };
24
+ };
25
+ export declare function parseWebhookQueryTrigger(value: unknown, access: RoutineAccess): WebhookQueryTrigger;
26
+ export declare function parseWebhookEvent(value: unknown): WebhookEvent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oddington/sdk",
3
- "version": "0.1.85",
3
+ "version": "0.1.86",
4
4
  "description": "OS routine and response-handler SDK",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",