@lssm/lib.contracts 0.0.0-canary-20251206181705 → 0.0.0-canary-20251207013726

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.
package/dist/install.d.ts CHANGED
@@ -3,7 +3,7 @@ import { ResourceRefDescriptor } from "./resources.js";
3
3
  import { AnyContractSpec, ContractSpec, EmitDecl } from "./spec.js";
4
4
  import { HandlerCtx } from "./types.js";
5
5
  import { SpecRegistry } from "./registry.js";
6
- import { z } from "zod";
6
+ import { z as z$1 } from "zod";
7
7
  import { AnySchemaModel, ZodSchemaModel } from "@lssm/lib.schema";
8
8
 
9
9
  //#region src/install.d.ts
@@ -28,7 +28,7 @@ type EventParam<S extends ContractSpec<AnySchemaModel, AnySchemaModel | Resource
28
28
  } ? {
29
29
  name: E['name'];
30
30
  version: E['version'];
31
- payload: z.infer<ReturnType<E['payload']['getZod']>>;
31
+ payload: z$1.infer<ReturnType<E['payload']['getZod']>>;
32
32
  } : never : never;
33
33
  /** Build a type union of allowed events for a spec */
34
34
  type AllowedEventUnion<S extends ContractSpec<AnySchemaModel, AnySchemaModel | ResourceRefDescriptor<boolean>>> = S['sideEffects'] extends {
@@ -38,7 +38,7 @@ type AllowedEventUnion<S extends ContractSpec<AnySchemaModel, AnySchemaModel | R
38
38
  } ? {
39
39
  name: S['sideEffects']['emits'][K]['ref']['name'];
40
40
  version: S['sideEffects']['emits'][K]['ref']['version'];
41
- payload: z.infer<ReturnType<P['getZod']>>;
41
+ payload: z$1.infer<ReturnType<P['getZod']>>;
42
42
  } : S['sideEffects']['emits'][K] extends {
43
43
  name: infer N extends string;
44
44
  version: infer V extends number;
@@ -46,7 +46,7 @@ type AllowedEventUnion<S extends ContractSpec<AnySchemaModel, AnySchemaModel | R
46
46
  } ? {
47
47
  name: N;
48
48
  version: V;
49
- payload: z.infer<ReturnType<Q['getZod']>>;
49
+ payload: z$1.infer<ReturnType<Q['getZod']>>;
50
50
  } : never }[number] : never;
51
51
  /** Typed emit for a given spec (validates at runtime through ctx.__emitGuard__). */
52
52
  declare function makeEmit<S extends AnyContractSpec>(_spec: S, ctx: HandlerCtx): {
@@ -1,20 +1,20 @@
1
1
  import { ContractSpec } from "../../../spec.js";
2
2
  import { SpecRegistry } from "../../../registry.js";
3
- import * as _lssm_lib_schema466 from "@lssm/lib.schema";
3
+ import * as _lssm_lib_schema513 from "@lssm/lib.schema";
4
4
  import { SchemaModel } from "@lssm/lib.schema";
5
5
 
6
6
  //#region src/integrations/openbanking/contracts/balances.d.ts
7
7
  declare const OpenBankingGetBalances: ContractSpec<SchemaModel<{
8
8
  tenantId: {
9
- type: _lssm_lib_schema466.FieldType<string, string>;
9
+ type: _lssm_lib_schema513.FieldType<string, string>;
10
10
  isOptional: false;
11
11
  };
12
12
  accountId: {
13
- type: _lssm_lib_schema466.FieldType<string, string>;
13
+ type: _lssm_lib_schema513.FieldType<string, string>;
14
14
  isOptional: false;
15
15
  };
16
16
  balanceTypes: {
17
- type: _lssm_lib_schema466.FieldType<string, string>;
17
+ type: _lssm_lib_schema513.FieldType<string, string>;
18
18
  isArray: true;
19
19
  isOptional: true;
20
20
  };
@@ -22,47 +22,47 @@ declare const OpenBankingGetBalances: ContractSpec<SchemaModel<{
22
22
  balances: {
23
23
  type: SchemaModel<{
24
24
  id: {
25
- type: _lssm_lib_schema466.FieldType<string, string>;
25
+ type: _lssm_lib_schema513.FieldType<string, string>;
26
26
  isOptional: false;
27
27
  };
28
28
  accountId: {
29
- type: _lssm_lib_schema466.FieldType<string, string>;
29
+ type: _lssm_lib_schema513.FieldType<string, string>;
30
30
  isOptional: false;
31
31
  };
32
32
  tenantId: {
33
- type: _lssm_lib_schema466.FieldType<string, string>;
33
+ type: _lssm_lib_schema513.FieldType<string, string>;
34
34
  isOptional: false;
35
35
  };
36
36
  connectionId: {
37
- type: _lssm_lib_schema466.FieldType<string, string>;
37
+ type: _lssm_lib_schema513.FieldType<string, string>;
38
38
  isOptional: false;
39
39
  };
40
40
  balanceType: {
41
- type: _lssm_lib_schema466.FieldType<string, string>;
41
+ type: _lssm_lib_schema513.FieldType<string, string>;
42
42
  isOptional: false;
43
43
  };
44
44
  currentBalance: {
45
- type: _lssm_lib_schema466.FieldType<number, number>;
45
+ type: _lssm_lib_schema513.FieldType<number, number>;
46
46
  isOptional: false;
47
47
  };
48
48
  availableBalance: {
49
- type: _lssm_lib_schema466.FieldType<number, number>;
49
+ type: _lssm_lib_schema513.FieldType<number, number>;
50
50
  isOptional: true;
51
51
  };
52
52
  currency: {
53
- type: _lssm_lib_schema466.FieldType<string, string>;
53
+ type: _lssm_lib_schema513.FieldType<string, string>;
54
54
  isOptional: false;
55
55
  };
56
56
  lastUpdatedAt: {
57
- type: _lssm_lib_schema466.FieldType<Date, string>;
57
+ type: _lssm_lib_schema513.FieldType<Date, string>;
58
58
  isOptional: false;
59
59
  };
60
60
  createdAt: {
61
- type: _lssm_lib_schema466.FieldType<Date, string>;
61
+ type: _lssm_lib_schema513.FieldType<Date, string>;
62
62
  isOptional: false;
63
63
  };
64
64
  metadata: {
65
- type: _lssm_lib_schema466.FieldType<Record<string, unknown>, Record<string, unknown>>;
65
+ type: _lssm_lib_schema513.FieldType<Record<string, unknown>, Record<string, unknown>>;
66
66
  isOptional: true;
67
67
  };
68
68
  }>;
@@ -70,77 +70,77 @@ declare const OpenBankingGetBalances: ContractSpec<SchemaModel<{
70
70
  isArray: true;
71
71
  };
72
72
  asOf: {
73
- type: _lssm_lib_schema466.FieldType<Date, string>;
73
+ type: _lssm_lib_schema513.FieldType<Date, string>;
74
74
  isOptional: true;
75
75
  };
76
76
  }>, undefined>;
77
77
  declare const OpenBankingRefreshBalances: ContractSpec<SchemaModel<{
78
78
  tenantId: {
79
- type: _lssm_lib_schema466.FieldType<string, string>;
79
+ type: _lssm_lib_schema513.FieldType<string, string>;
80
80
  isOptional: false;
81
81
  };
82
82
  accountId: {
83
- type: _lssm_lib_schema466.FieldType<string, string>;
83
+ type: _lssm_lib_schema513.FieldType<string, string>;
84
84
  isOptional: false;
85
85
  };
86
86
  connectionId: {
87
- type: _lssm_lib_schema466.FieldType<string, string>;
87
+ type: _lssm_lib_schema513.FieldType<string, string>;
88
88
  isOptional: true;
89
89
  };
90
90
  balanceTypes: {
91
- type: _lssm_lib_schema466.FieldType<string, string>;
91
+ type: _lssm_lib_schema513.FieldType<string, string>;
92
92
  isArray: true;
93
93
  isOptional: true;
94
94
  };
95
95
  forceRefresh: {
96
- type: _lssm_lib_schema466.FieldType<boolean, boolean>;
96
+ type: _lssm_lib_schema513.FieldType<boolean, boolean>;
97
97
  isOptional: true;
98
98
  };
99
99
  }>, SchemaModel<{
100
100
  balances: {
101
101
  type: SchemaModel<{
102
102
  id: {
103
- type: _lssm_lib_schema466.FieldType<string, string>;
103
+ type: _lssm_lib_schema513.FieldType<string, string>;
104
104
  isOptional: false;
105
105
  };
106
106
  accountId: {
107
- type: _lssm_lib_schema466.FieldType<string, string>;
107
+ type: _lssm_lib_schema513.FieldType<string, string>;
108
108
  isOptional: false;
109
109
  };
110
110
  tenantId: {
111
- type: _lssm_lib_schema466.FieldType<string, string>;
111
+ type: _lssm_lib_schema513.FieldType<string, string>;
112
112
  isOptional: false;
113
113
  };
114
114
  connectionId: {
115
- type: _lssm_lib_schema466.FieldType<string, string>;
115
+ type: _lssm_lib_schema513.FieldType<string, string>;
116
116
  isOptional: false;
117
117
  };
118
118
  balanceType: {
119
- type: _lssm_lib_schema466.FieldType<string, string>;
119
+ type: _lssm_lib_schema513.FieldType<string, string>;
120
120
  isOptional: false;
121
121
  };
122
122
  currentBalance: {
123
- type: _lssm_lib_schema466.FieldType<number, number>;
123
+ type: _lssm_lib_schema513.FieldType<number, number>;
124
124
  isOptional: false;
125
125
  };
126
126
  availableBalance: {
127
- type: _lssm_lib_schema466.FieldType<number, number>;
127
+ type: _lssm_lib_schema513.FieldType<number, number>;
128
128
  isOptional: true;
129
129
  };
130
130
  currency: {
131
- type: _lssm_lib_schema466.FieldType<string, string>;
131
+ type: _lssm_lib_schema513.FieldType<string, string>;
132
132
  isOptional: false;
133
133
  };
134
134
  lastUpdatedAt: {
135
- type: _lssm_lib_schema466.FieldType<Date, string>;
135
+ type: _lssm_lib_schema513.FieldType<Date, string>;
136
136
  isOptional: false;
137
137
  };
138
138
  createdAt: {
139
- type: _lssm_lib_schema466.FieldType<Date, string>;
139
+ type: _lssm_lib_schema513.FieldType<Date, string>;
140
140
  isOptional: false;
141
141
  };
142
142
  metadata: {
143
- type: _lssm_lib_schema466.FieldType<Record<string, unknown>, Record<string, unknown>>;
143
+ type: _lssm_lib_schema513.FieldType<Record<string, unknown>, Record<string, unknown>>;
144
144
  isOptional: true;
145
145
  };
146
146
  }>;
@@ -148,11 +148,11 @@ declare const OpenBankingRefreshBalances: ContractSpec<SchemaModel<{
148
148
  isArray: true;
149
149
  };
150
150
  refreshedAt: {
151
- type: _lssm_lib_schema466.FieldType<Date, string>;
151
+ type: _lssm_lib_schema513.FieldType<Date, string>;
152
152
  isOptional: false;
153
153
  };
154
154
  errors: {
155
- type: _lssm_lib_schema466.FieldType<string, string>;
155
+ type: _lssm_lib_schema513.FieldType<string, string>;
156
156
  isArray: true;
157
157
  isOptional: true;
158
158
  };
@@ -1,139 +1,139 @@
1
1
  import { ContractSpec } from "../../../spec.js";
2
2
  import { SpecRegistry } from "../../../registry.js";
3
- import * as _lssm_lib_schema499 from "@lssm/lib.schema";
3
+ import * as _lssm_lib_schema466 from "@lssm/lib.schema";
4
4
  import { SchemaModel } from "@lssm/lib.schema";
5
5
 
6
6
  //#region src/integrations/openbanking/contracts/transactions.d.ts
7
7
  declare const OpenBankingListTransactions: ContractSpec<SchemaModel<{
8
8
  tenantId: {
9
- type: _lssm_lib_schema499.FieldType<string, string>;
9
+ type: _lssm_lib_schema466.FieldType<string, string>;
10
10
  isOptional: false;
11
11
  };
12
12
  accountId: {
13
- type: _lssm_lib_schema499.FieldType<string, string>;
13
+ type: _lssm_lib_schema466.FieldType<string, string>;
14
14
  isOptional: false;
15
15
  };
16
16
  from: {
17
- type: _lssm_lib_schema499.FieldType<Date, string>;
17
+ type: _lssm_lib_schema466.FieldType<Date, string>;
18
18
  isOptional: true;
19
19
  };
20
20
  to: {
21
- type: _lssm_lib_schema499.FieldType<Date, string>;
21
+ type: _lssm_lib_schema466.FieldType<Date, string>;
22
22
  isOptional: true;
23
23
  };
24
24
  cursor: {
25
- type: _lssm_lib_schema499.FieldType<string, string>;
25
+ type: _lssm_lib_schema466.FieldType<string, string>;
26
26
  isOptional: true;
27
27
  };
28
28
  pageSize: {
29
- type: _lssm_lib_schema499.FieldType<number, number>;
29
+ type: _lssm_lib_schema466.FieldType<number, number>;
30
30
  isOptional: true;
31
31
  };
32
32
  direction: {
33
- type: _lssm_lib_schema499.FieldType<string, string>;
33
+ type: _lssm_lib_schema466.FieldType<string, string>;
34
34
  isOptional: true;
35
35
  };
36
36
  minimumAmount: {
37
- type: _lssm_lib_schema499.FieldType<number, number>;
37
+ type: _lssm_lib_schema466.FieldType<number, number>;
38
38
  isOptional: true;
39
39
  };
40
40
  maximumAmount: {
41
- type: _lssm_lib_schema499.FieldType<number, number>;
41
+ type: _lssm_lib_schema466.FieldType<number, number>;
42
42
  isOptional: true;
43
43
  };
44
44
  category: {
45
- type: _lssm_lib_schema499.FieldType<string, string>;
45
+ type: _lssm_lib_schema466.FieldType<string, string>;
46
46
  isOptional: true;
47
47
  };
48
48
  }>, SchemaModel<{
49
49
  transactions: {
50
50
  type: SchemaModel<{
51
51
  id: {
52
- type: _lssm_lib_schema499.FieldType<string, string>;
52
+ type: _lssm_lib_schema466.FieldType<string, string>;
53
53
  isOptional: false;
54
54
  };
55
55
  accountId: {
56
- type: _lssm_lib_schema499.FieldType<string, string>;
56
+ type: _lssm_lib_schema466.FieldType<string, string>;
57
57
  isOptional: false;
58
58
  };
59
59
  tenantId: {
60
- type: _lssm_lib_schema499.FieldType<string, string>;
60
+ type: _lssm_lib_schema466.FieldType<string, string>;
61
61
  isOptional: false;
62
62
  };
63
63
  connectionId: {
64
- type: _lssm_lib_schema499.FieldType<string, string>;
64
+ type: _lssm_lib_schema466.FieldType<string, string>;
65
65
  isOptional: false;
66
66
  };
67
67
  externalId: {
68
- type: _lssm_lib_schema499.FieldType<string, string>;
68
+ type: _lssm_lib_schema466.FieldType<string, string>;
69
69
  isOptional: false;
70
70
  };
71
71
  amount: {
72
- type: _lssm_lib_schema499.FieldType<number, number>;
72
+ type: _lssm_lib_schema466.FieldType<number, number>;
73
73
  isOptional: false;
74
74
  };
75
75
  currency: {
76
- type: _lssm_lib_schema499.FieldType<string, string>;
76
+ type: _lssm_lib_schema466.FieldType<string, string>;
77
77
  isOptional: false;
78
78
  };
79
79
  date: {
80
- type: _lssm_lib_schema499.FieldType<Date, string>;
80
+ type: _lssm_lib_schema466.FieldType<Date, string>;
81
81
  isOptional: false;
82
82
  };
83
83
  bookingDate: {
84
- type: _lssm_lib_schema499.FieldType<Date, string>;
84
+ type: _lssm_lib_schema466.FieldType<Date, string>;
85
85
  isOptional: true;
86
86
  };
87
87
  valueDate: {
88
- type: _lssm_lib_schema499.FieldType<Date, string>;
88
+ type: _lssm_lib_schema466.FieldType<Date, string>;
89
89
  isOptional: true;
90
90
  };
91
91
  description: {
92
- type: _lssm_lib_schema499.FieldType<string, string>;
92
+ type: _lssm_lib_schema466.FieldType<string, string>;
93
93
  isOptional: true;
94
94
  };
95
95
  counterpartyName: {
96
- type: _lssm_lib_schema499.FieldType<string, string>;
96
+ type: _lssm_lib_schema466.FieldType<string, string>;
97
97
  isOptional: true;
98
98
  };
99
99
  counterpartyAccount: {
100
- type: _lssm_lib_schema499.FieldType<string, string>;
100
+ type: _lssm_lib_schema466.FieldType<string, string>;
101
101
  isOptional: true;
102
102
  };
103
103
  merchantCategoryCode: {
104
- type: _lssm_lib_schema499.FieldType<string, string>;
104
+ type: _lssm_lib_schema466.FieldType<string, string>;
105
105
  isOptional: true;
106
106
  };
107
107
  rawCategory: {
108
- type: _lssm_lib_schema499.FieldType<string, string>;
108
+ type: _lssm_lib_schema466.FieldType<string, string>;
109
109
  isOptional: true;
110
110
  };
111
111
  standardizedCategory: {
112
- type: _lssm_lib_schema499.FieldType<string, string>;
112
+ type: _lssm_lib_schema466.FieldType<string, string>;
113
113
  isOptional: true;
114
114
  };
115
115
  transactionType: {
116
- type: _lssm_lib_schema499.FieldType<string, string>;
116
+ type: _lssm_lib_schema466.FieldType<string, string>;
117
117
  isOptional: false;
118
118
  };
119
119
  status: {
120
- type: _lssm_lib_schema499.FieldType<string, string>;
120
+ type: _lssm_lib_schema466.FieldType<string, string>;
121
121
  isOptional: false;
122
122
  };
123
123
  runningBalance: {
124
- type: _lssm_lib_schema499.FieldType<number, number>;
124
+ type: _lssm_lib_schema466.FieldType<number, number>;
125
125
  isOptional: true;
126
126
  };
127
127
  metadata: {
128
- type: _lssm_lib_schema499.FieldType<Record<string, unknown>, Record<string, unknown>>;
128
+ type: _lssm_lib_schema466.FieldType<Record<string, unknown>, Record<string, unknown>>;
129
129
  isOptional: true;
130
130
  };
131
131
  createdAt: {
132
- type: _lssm_lib_schema499.FieldType<Date, string>;
132
+ type: _lssm_lib_schema466.FieldType<Date, string>;
133
133
  isOptional: false;
134
134
  };
135
135
  updatedAt: {
136
- type: _lssm_lib_schema499.FieldType<Date, string>;
136
+ type: _lssm_lib_schema466.FieldType<Date, string>;
137
137
  isOptional: false;
138
138
  };
139
139
  }>;
@@ -141,66 +141,66 @@ declare const OpenBankingListTransactions: ContractSpec<SchemaModel<{
141
141
  isArray: true;
142
142
  };
143
143
  nextCursor: {
144
- type: _lssm_lib_schema499.FieldType<string, string>;
144
+ type: _lssm_lib_schema466.FieldType<string, string>;
145
145
  isOptional: true;
146
146
  };
147
147
  hasMore: {
148
- type: _lssm_lib_schema499.FieldType<boolean, boolean>;
148
+ type: _lssm_lib_schema466.FieldType<boolean, boolean>;
149
149
  isOptional: true;
150
150
  };
151
151
  }>, undefined>;
152
152
  declare const OpenBankingSyncTransactions: ContractSpec<SchemaModel<{
153
153
  tenantId: {
154
- type: _lssm_lib_schema499.FieldType<string, string>;
154
+ type: _lssm_lib_schema466.FieldType<string, string>;
155
155
  isOptional: false;
156
156
  };
157
157
  accountId: {
158
- type: _lssm_lib_schema499.FieldType<string, string>;
158
+ type: _lssm_lib_schema466.FieldType<string, string>;
159
159
  isOptional: false;
160
160
  };
161
161
  from: {
162
- type: _lssm_lib_schema499.FieldType<Date, string>;
162
+ type: _lssm_lib_schema466.FieldType<Date, string>;
163
163
  isOptional: true;
164
164
  };
165
165
  to: {
166
- type: _lssm_lib_schema499.FieldType<Date, string>;
166
+ type: _lssm_lib_schema466.FieldType<Date, string>;
167
167
  isOptional: true;
168
168
  };
169
169
  connectionId: {
170
- type: _lssm_lib_schema499.FieldType<string, string>;
170
+ type: _lssm_lib_schema466.FieldType<string, string>;
171
171
  isOptional: true;
172
172
  };
173
173
  includePending: {
174
- type: _lssm_lib_schema499.FieldType<boolean, boolean>;
174
+ type: _lssm_lib_schema466.FieldType<boolean, boolean>;
175
175
  isOptional: true;
176
176
  };
177
177
  backfillDays: {
178
- type: _lssm_lib_schema499.FieldType<number, number>;
178
+ type: _lssm_lib_schema466.FieldType<number, number>;
179
179
  isOptional: true;
180
180
  };
181
181
  }>, SchemaModel<{
182
182
  synced: {
183
- type: _lssm_lib_schema499.FieldType<number, number>;
183
+ type: _lssm_lib_schema466.FieldType<number, number>;
184
184
  isOptional: false;
185
185
  };
186
186
  failed: {
187
- type: _lssm_lib_schema499.FieldType<number, number>;
187
+ type: _lssm_lib_schema466.FieldType<number, number>;
188
188
  isOptional: false;
189
189
  };
190
190
  earliestSyncedAt: {
191
- type: _lssm_lib_schema499.FieldType<Date, string>;
191
+ type: _lssm_lib_schema466.FieldType<Date, string>;
192
192
  isOptional: true;
193
193
  };
194
194
  latestSyncedAt: {
195
- type: _lssm_lib_schema499.FieldType<Date, string>;
195
+ type: _lssm_lib_schema466.FieldType<Date, string>;
196
196
  isOptional: true;
197
197
  };
198
198
  nextSinceToken: {
199
- type: _lssm_lib_schema499.FieldType<string, string>;
199
+ type: _lssm_lib_schema466.FieldType<string, string>;
200
200
  isOptional: true;
201
201
  };
202
202
  errors: {
203
- type: _lssm_lib_schema499.FieldType<string, string>;
203
+ type: _lssm_lib_schema466.FieldType<string, string>;
204
204
  isArray: true;
205
205
  isOptional: true;
206
206
  };
@@ -0,0 +1,12 @@
1
+ import { Job, JobQueue } from "./queue.js";
2
+ import { ZodSchema } from "zod";
3
+
4
+ //#region src/jobs/define-job.d.ts
5
+ interface DefinedJob<TPayload> {
6
+ type: string;
7
+ schema: ZodSchema<TPayload>;
8
+ handler: (payload: TPayload, job: Job<TPayload>) => Promise<void>;
9
+ }
10
+ declare function registerDefinedJob<TPayload>(queue: JobQueue, def: DefinedJob<TPayload>): void;
11
+ //#endregion
12
+ export { DefinedJob, registerDefinedJob };
@@ -0,0 +1 @@
1
+ function e(e,t){e.register(t.type,async e=>{let n=t.schema.parse(e.payload),r={...e,payload:n};await t.handler(n,r)})}export{e as registerDefinedJob};
@@ -1,3 +1,9 @@
1
+ import { JobQueue } from "../queue.js";
1
2
  import { GmailSyncJobPayload, createGmailSyncHandler } from "./gmail-sync-handler.js";
3
+ import { PING_JOB_TYPE, PingPayload, PingPayloadSchema, pingJob } from "./ping-handler.js";
2
4
  import { StorageDocumentJobPayload, createStorageDocumentHandler } from "./storage-document-handler.js";
3
- export { GmailSyncJobPayload, StorageDocumentJobPayload, createGmailSyncHandler, createStorageDocumentHandler };
5
+
6
+ //#region src/jobs/handlers/index.d.ts
7
+ declare function registerAllJobs(queue: JobQueue): void;
8
+ //#endregion
9
+ export { GmailSyncJobPayload, PING_JOB_TYPE, PingPayload, PingPayloadSchema, StorageDocumentJobPayload, createGmailSyncHandler, createStorageDocumentHandler, pingJob, registerAllJobs };
@@ -1 +1 @@
1
- import{createGmailSyncHandler as e}from"./gmail-sync-handler.js";import{createStorageDocumentHandler as t}from"./storage-document-handler.js";export{e as createGmailSyncHandler,t as createStorageDocumentHandler};
1
+ import{registerDefinedJob as e}from"../define-job.js";import{PING_JOB_TYPE as t,PingPayloadSchema as n,pingJob as r}from"./ping-handler.js";import{createGmailSyncHandler as i}from"./gmail-sync-handler.js";import{createStorageDocumentHandler as a}from"./storage-document-handler.js";function o(t){e(t,r)}export{t as PING_JOB_TYPE,n as PingPayloadSchema,i as createGmailSyncHandler,a as createStorageDocumentHandler,r as pingJob,o as registerAllJobs};
@@ -0,0 +1,10 @@
1
+ import { DefinedJob } from "../define-job.js";
2
+ import { z as z$1 } from "zod";
3
+
4
+ //#region src/jobs/handlers/ping-handler.d.ts
5
+ declare const PING_JOB_TYPE: "core.ping";
6
+ declare const PingPayloadSchema: z$1.ZodObject<{}, z$1.core.$strip>;
7
+ type PingPayload = z$1.infer<typeof PingPayloadSchema>;
8
+ declare const pingJob: DefinedJob<PingPayload>;
9
+ //#endregion
10
+ export { PING_JOB_TYPE, PingPayload, PingPayloadSchema, pingJob };
@@ -0,0 +1 @@
1
+ import{z as e}from"zod";const t=`core.ping`,n=e.object({}),r={type:t,schema:n,handler:async(e,t)=>{console.log(`[ping] job id=%s attempts=%d`,t.id,t.attempts)}};export{t as PING_JOB_TYPE,n as PingPayloadSchema,r as pingJob};
@@ -2,6 +2,9 @@ import { EnqueueOptions, Job, JobHandler, JobQueue, JobStatus } from "./queue.js
2
2
  import { GcpCloudTasksQueue, GcpCloudTasksQueueOptions } from "./gcp-cloud-tasks.js";
3
3
  import { GcpPubSubQueue, GcpPubSubQueueOptions } from "./gcp-pubsub.js";
4
4
  import { GmailSyncJobPayload, createGmailSyncHandler } from "./handlers/gmail-sync-handler.js";
5
+ import { PING_JOB_TYPE, PingPayload, PingPayloadSchema, pingJob } from "./handlers/ping-handler.js";
5
6
  import { StorageDocumentJobPayload, createStorageDocumentHandler } from "./handlers/storage-document-handler.js";
7
+ import { registerAllJobs } from "./handlers/index.js";
6
8
  import { MemoryJobQueue } from "./memory-queue.js";
7
- export { EnqueueOptions, GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, GmailSyncJobPayload, Job, JobHandler, JobQueue, JobStatus, MemoryJobQueue, StorageDocumentJobPayload, createGmailSyncHandler, createStorageDocumentHandler };
9
+ import { ScalewaySqsJobQueue } from "./scaleway-sqs-queue.js";
10
+ export { EnqueueOptions, GcpCloudTasksQueue, GcpCloudTasksQueueOptions, GcpPubSubQueue, GcpPubSubQueueOptions, GmailSyncJobPayload, Job, JobHandler, JobQueue, JobStatus, MemoryJobQueue, PING_JOB_TYPE, PingPayload, PingPayloadSchema, ScalewaySqsJobQueue, StorageDocumentJobPayload, createGmailSyncHandler, createStorageDocumentHandler, pingJob, registerAllJobs };
@@ -1 +1 @@
1
- import{GcpCloudTasksQueue as e}from"./gcp-cloud-tasks.js";import{GcpPubSubQueue as t}from"./gcp-pubsub.js";import{MemoryJobQueue as n}from"./memory-queue.js";import{createGmailSyncHandler as r}from"./handlers/gmail-sync-handler.js";import{createStorageDocumentHandler as i}from"./handlers/storage-document-handler.js";export{e as GcpCloudTasksQueue,t as GcpPubSubQueue,n as MemoryJobQueue,r as createGmailSyncHandler,i as createStorageDocumentHandler};
1
+ import{GcpCloudTasksQueue as e}from"./gcp-cloud-tasks.js";import{GcpPubSubQueue as t}from"./gcp-pubsub.js";import{MemoryJobQueue as n}from"./memory-queue.js";import{ScalewaySqsJobQueue as r}from"./scaleway-sqs-queue.js";import{PING_JOB_TYPE as i,PingPayloadSchema as a,pingJob as o}from"./handlers/ping-handler.js";import{createGmailSyncHandler as s}from"./handlers/gmail-sync-handler.js";import{createStorageDocumentHandler as c}from"./handlers/storage-document-handler.js";import{registerAllJobs as l}from"./handlers/index.js";export{e as GcpCloudTasksQueue,t as GcpPubSubQueue,n as MemoryJobQueue,i as PING_JOB_TYPE,a as PingPayloadSchema,r as ScalewaySqsJobQueue,s as createGmailSyncHandler,c as createStorageDocumentHandler,o as pingJob,l as registerAllJobs};
@@ -0,0 +1,30 @@
1
+ import { EnqueueOptions, Job, JobHandler, JobQueue } from "./queue.js";
2
+
3
+ //#region src/jobs/scaleway-sqs-queue.d.ts
4
+ interface ScalewaySqsQueueConfig {
5
+ queueUrl: string;
6
+ region?: string;
7
+ endpoint?: string;
8
+ waitTimeSeconds?: number;
9
+ maxNumberOfMessages?: number;
10
+ visibilityTimeoutSeconds?: number;
11
+ }
12
+ declare class ScalewaySqsJobQueue implements JobQueue {
13
+ private readonly sqs;
14
+ private readonly queueUrl;
15
+ private readonly waitTimeSeconds;
16
+ private readonly maxNumberOfMessages;
17
+ private readonly visibilityTimeoutSeconds;
18
+ private readonly handlers;
19
+ private running;
20
+ constructor(config: ScalewaySqsQueueConfig);
21
+ enqueue<TPayload>(jobType: string, payload: TPayload, options?: EnqueueOptions): Promise<Job<TPayload>>;
22
+ register<TPayload>(jobType: string, handler: JobHandler<TPayload>): void;
23
+ start(): void;
24
+ stop(): Promise<void>;
25
+ private pollLoop;
26
+ private deleteMessage;
27
+ private sleep;
28
+ }
29
+ //#endregion
30
+ export { ScalewaySqsJobQueue };
@@ -0,0 +1 @@
1
+ import{randomUUID as e}from"crypto";import{DeleteMessageCommand as t,ReceiveMessageCommand as n,SQSClient as r,SendMessageCommand as i}from"@aws-sdk/client-sqs";var a=class{sqs;queueUrl;waitTimeSeconds;maxNumberOfMessages;visibilityTimeoutSeconds;handlers=new Map;running=!1;constructor(e){let t=process.env.SCALEWAY_ACCESS_KEY_QUEUE,n=process.env.SCALEWAY_SECRET_KEY_QUEUE;if(!t||!n)throw Error(`Missing SCALEWAY_ACCESS_KEY / SCALEWAY_SECRET_KEY in env`);this.sqs=new r({region:e.region??process.env.SCALEWAY_REGION??`par`,endpoint:`https://sqs.mnq.fr-par.scaleway.com`,credentials:{accessKeyId:t,secretAccessKey:n}}),this.queueUrl=e.queueUrl,this.waitTimeSeconds=e.waitTimeSeconds??20,this.maxNumberOfMessages=e.maxNumberOfMessages??5,this.visibilityTimeoutSeconds=e.visibilityTimeoutSeconds??60}async enqueue(t,n,r={}){let a=e(),o=new Date,s={id:a,type:t,payload:n};return await this.sqs.send(new i({QueueUrl:this.queueUrl,MessageBody:JSON.stringify(s),DelaySeconds:r.delaySeconds??0})),{id:a,type:t,payload:n,status:`pending`,attempts:0,createdAt:o,updatedAt:o}}register(e,t){if(this.handlers.has(e))throw Error(`Handler already registered for job type "${e}"`);this.handlers.set(e,t)}start(){this.running||(this.running=!0,this.pollLoop().catch(e=>{console.error(`[queue] Fatal error in poll loop`,e),process.exit(1)}))}async stop(){this.running=!1}async pollLoop(){for(console.log(`[queue] SQS worker started for queue:`,this.queueUrl);this.running;)try{let e=(await this.sqs.send(new n({QueueUrl:this.queueUrl,MaxNumberOfMessages:this.maxNumberOfMessages,WaitTimeSeconds:this.waitTimeSeconds,VisibilityTimeout:this.visibilityTimeoutSeconds,MessageSystemAttributeNames:[`ApproximateReceiveCount`]}))).Messages??[];if(e.length===0)continue;for(let t of e){if(!t.Body||!t.ReceiptHandle){console.warn(`[queue] Message missing Body or ReceiptHandle`,t.MessageId);continue}let e;try{e=JSON.parse(t.Body)}catch(e){console.error(`[queue] Failed to parse message body (id=${t.MessageId}), deleting`,e),await this.deleteMessage(t.ReceiptHandle);continue}let n=this.handlers.get(e.type);if(!n){console.error(`[queue] No handler registered for type "${e.type}", deleting message`),await this.deleteMessage(t.ReceiptHandle);continue}let r=new Date,i=parseInt(t.Attributes?.ApproximateReceiveCount??`1`,10),a={id:e.id,type:e.type,payload:e.payload,status:`pending`,attempts:i,createdAt:r,updatedAt:r};a.status=`running`,a.updatedAt=new Date;try{await n(a),a.status=`completed`,a.updatedAt=new Date,await this.deleteMessage(t.ReceiptHandle)}catch(e){a.status=`failed`,a.lastError=e instanceof Error?e.message:`Unknown job error`,a.updatedAt=new Date,console.error(`[queue] Error while handling job type=${a.type} id=${a.id}`,e)}}}catch(e){e&&typeof e==`object`&&`$response`in e?console.error(`[queue] Error while polling SQS`,e,e.$response):console.error(`[queue] Error while polling SQS`,e),await this.sleep(5e3)}console.log(`[queue] SQS worker stopped`)}async deleteMessage(e){try{await this.sqs.send(new t({QueueUrl:this.queueUrl,ReceiptHandle:e}))}catch(e){console.error(`[queue] Failed to delete message`,e)}}async sleep(e){await new Promise(t=>setTimeout(t,e))}};export{a as ScalewaySqsJobQueue};
@@ -1,12 +1,12 @@
1
1
  import { Stability, Tag } from "./ownership.js";
2
2
  import { ContractSpec, OpKind } from "./spec.js";
3
- import z$1 from "zod";
3
+ import z from "zod";
4
4
  import { AnySchemaModel } from "@lssm/lib.schema";
5
5
 
6
6
  //#region src/jsonschema.d.ts
7
7
  declare function jsonSchemaForSpec(spec: ContractSpec<AnySchemaModel, AnySchemaModel>): {
8
- input: z$1.core.JSONSchema.JSONSchema | null;
9
- output: z$1.core.JSONSchema.JSONSchema | null;
8
+ input: z.core.JSONSchema.JSONSchema | null;
9
+ output: z.core.JSONSchema.JSONSchema | null;
10
10
  meta: {
11
11
  name: string;
12
12
  version: number;
@@ -1,5 +1,5 @@
1
1
  import { Stability } from "./ownership.js";
2
- import z$1 from "zod";
2
+ import z from "zod";
3
3
  import { AnySchemaModel } from "@lssm/lib.schema";
4
4
 
5
5
  //#region src/presentations.d.ts
@@ -60,7 +60,7 @@ declare class PresentationRegistry {
60
60
  declare function jsonSchemaForPresentation(p: PresentationSpec): {
61
61
  framework: "react";
62
62
  componentKey: string;
63
- props: z$1.core.JSONSchema.JSONSchema;
63
+ props: z.core.JSONSchema.JSONSchema;
64
64
  meta: {
65
65
  readonly name: string;
66
66
  readonly version: number;
@@ -82,7 +82,7 @@ declare function jsonSchemaForPresentation(p: PresentationSpec): {
82
82
  kind: PresentationKind;
83
83
  } | {
84
84
  mimeType: string;
85
- model: z$1.core.JSONSchema.JSONSchema;
85
+ model: z.core.JSONSchema.JSONSchema;
86
86
  meta: {
87
87
  readonly name: string;
88
88
  readonly version: number;
package/dist/prompt.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { z } from "zod";
1
+ import { z as z$1 } from "zod";
2
2
 
3
3
  //#region src/prompt.d.ts
4
4
  type PromptStability = 'experimental' | 'beta' | 'stable' | 'deprecated';
@@ -7,7 +7,7 @@ interface PromptArg {
7
7
  name: string;
8
8
  description?: string;
9
9
  required?: boolean;
10
- schema: z.ZodType;
10
+ schema: z$1.ZodType;
11
11
  completeWith?: string;
12
12
  }
13
13
  /**
@@ -41,13 +41,13 @@ interface PromptPolicy {
41
41
  };
42
42
  }
43
43
  /** Full prompt specification including args schema and render function. */
44
- interface PromptSpec<I extends z.ZodType> {
44
+ interface PromptSpec<I extends z$1.ZodType> {
45
45
  meta: PromptMeta;
46
46
  args: PromptArg[];
47
47
  input: I;
48
48
  policy?: PromptPolicy;
49
49
  /** Render MCP-friendly content parts. DO NOT perform side effects here. */
50
- render: (args: z.infer<I>, ctx: {
50
+ render: (args: z$1.infer<I>, ctx: {
51
51
  userId?: string | null;
52
52
  orgId?: string | null;
53
53
  locale?: string;
@@ -55,6 +55,6 @@ interface PromptSpec<I extends z.ZodType> {
55
55
  }) => Promise<PromptContentPart[]>;
56
56
  }
57
57
  /** Identity helper that preserves generic inference when declaring prompts. */
58
- declare function definePrompt<I extends z.ZodType>(spec: PromptSpec<I>): PromptSpec<I>;
58
+ declare function definePrompt<I extends z$1.ZodType>(spec: PromptSpec<I>): PromptSpec<I>;
59
59
  //#endregion
60
60
  export { PromptArg, PromptContentPart, PromptMeta, PromptPolicy, PromptSpec, PromptStability, definePrompt };
@@ -1,11 +1,11 @@
1
1
  import { PromptSpec } from "./prompt.js";
2
- import { z } from "zod";
2
+ import { z as z$1 } from "zod";
3
3
 
4
4
  //#region src/promptRegistry.d.ts
5
5
  declare class PromptRegistry {
6
6
  private prompts;
7
7
  /** Register a prompt. Throws on duplicate name+version. */
8
- register<I extends z.ZodType>(p: PromptSpec<I>): this;
8
+ register<I extends z$1.ZodType>(p: PromptSpec<I>): this;
9
9
  /** List all registered prompts. */
10
10
  list(): PromptSpec<any>[];
11
11
  /** Get prompt by name; when version omitted, returns highest version. */
@@ -1,5 +1,5 @@
1
1
  import { Tag } from "./ownership.js";
2
- import { z } from "zod";
2
+ import { z as z$1 } from "zod";
3
3
 
4
4
  //#region src/resources.d.ts
5
5
  interface ResourceMeta {
@@ -14,7 +14,7 @@ interface ResourceMeta {
14
14
  /** Tags for filtering/grouping */
15
15
  tags?: Tag[];
16
16
  }
17
- interface ResourceTemplateSpec<I extends z.ZodType> {
17
+ interface ResourceTemplateSpec<I extends z$1.ZodType> {
18
18
  meta: ResourceMeta;
19
19
  /** Arguments to materialize the URI (zod validates input) */
20
20
  input: I;
@@ -22,7 +22,7 @@ interface ResourceTemplateSpec<I extends z.ZodType> {
22
22
  * Resolve returns the resource body and a resolved URI.
23
23
  * It MUST be read-only (no side effects).
24
24
  */
25
- resolve: (args: z.infer<I>, ctx: {
25
+ resolve: (args: z$1.infer<I>, ctx: {
26
26
  userId?: string | null;
27
27
  orgId?: string | null;
28
28
  locale?: string;
@@ -32,10 +32,10 @@ interface ResourceTemplateSpec<I extends z.ZodType> {
32
32
  data: Uint8Array | string;
33
33
  }>;
34
34
  }
35
- declare function defineResourceTemplate<I extends z.ZodType>(spec: ResourceTemplateSpec<I>): ResourceTemplateSpec<I>;
35
+ declare function defineResourceTemplate<I extends z$1.ZodType>(spec: ResourceTemplateSpec<I>): ResourceTemplateSpec<I>;
36
36
  declare class ResourceRegistry {
37
37
  private templates;
38
- register<I extends z.ZodType>(tmpl: ResourceTemplateSpec<I>): this;
38
+ register<I extends z$1.ZodType>(tmpl: ResourceTemplateSpec<I>): this;
39
39
  listTemplates(): ResourceTemplateSpec<any>[];
40
40
  /** Try to match a concrete URI to a template by naive pattern substitution */
41
41
  match(uri: string): {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lssm/lib.contracts",
3
- "version": "0.0.0-canary-20251206181705",
3
+ "version": "0.0.0-canary-20251207013726",
4
4
  "scripts": {
5
5
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
6
6
  "build": "bun build:bundle && bun build:types",
@@ -22,6 +22,7 @@
22
22
  "typescript": "^5.9.3"
23
23
  },
24
24
  "dependencies": {
25
+ "@aws-sdk/client-sqs": "^3.946.0",
25
26
  "@elevenlabs/elevenlabs-js": "^2.26.0",
26
27
  "@google-cloud/secret-manager": "^6.1.1",
27
28
  "@google-cloud/storage": "^7.18.0",
@@ -147,13 +148,16 @@
147
148
  "./integrations/secrets/provider": "./dist/integrations/secrets/provider.js",
148
149
  "./integrations/spec": "./dist/integrations/spec.js",
149
150
  "./jobs": "./dist/jobs/index.js",
151
+ "./jobs/define-job": "./dist/jobs/define-job.js",
150
152
  "./jobs/gcp-cloud-tasks": "./dist/jobs/gcp-cloud-tasks.js",
151
153
  "./jobs/gcp-pubsub": "./dist/jobs/gcp-pubsub.js",
152
154
  "./jobs/handlers": "./dist/jobs/handlers/index.js",
153
155
  "./jobs/handlers/gmail-sync-handler": "./dist/jobs/handlers/gmail-sync-handler.js",
156
+ "./jobs/handlers/ping-handler": "./dist/jobs/handlers/ping-handler.js",
154
157
  "./jobs/handlers/storage-document-handler": "./dist/jobs/handlers/storage-document-handler.js",
155
158
  "./jobs/memory-queue": "./dist/jobs/memory-queue.js",
156
159
  "./jobs/queue": "./dist/jobs/queue.js",
160
+ "./jobs/scaleway-sqs-queue": "./dist/jobs/scaleway-sqs-queue.js",
157
161
  "./jsonschema": "./dist/jsonschema.js",
158
162
  "./knowledge": "./dist/knowledge/index.js",
159
163
  "./knowledge/binding": "./dist/knowledge/binding.js",