@haathie/pgmb 0.2.9 → 0.2.11
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/README.md +1 -2
- package/lib/abortable-async-iterator.d.ts +14 -0
- package/lib/abortable-async-iterator.js +5 -12
- package/lib/batcher.d.ts +12 -0
- package/lib/batcher.js +1 -5
- package/lib/client.d.ts +77 -0
- package/lib/client.js +34 -41
- package/lib/consts.d.ts +1 -0
- package/lib/consts.js +1 -4
- package/lib/index.d.ts +6 -0
- package/lib/index.js +4 -20
- package/lib/queries.d.ts +498 -0
- package/lib/queries.js +19 -22
- package/lib/query-types.d.ts +17 -0
- package/lib/query-types.js +1 -2
- package/lib/retry-handler.d.ts +11 -0
- package/lib/retry-handler.js +7 -11
- package/lib/sse.d.ts +4 -0
- package/lib/sse.js +16 -52
- package/lib/types.d.ts +234 -0
- package/lib/types.js +1 -2
- package/lib/utils.d.ts +19 -0
- package/lib/utils.js +6 -15
- package/lib/webhook-handler.d.ts +6 -0
- package/lib/webhook-handler.js +7 -13
- package/package.json +3 -9
- package/sql/pgmb-0.2.0-0.2.8.sql +7 -5
- package/sql/pgmb.sql +7 -5
- package/src/abortable-async-iterator.ts +0 -98
- package/src/batcher.ts +0 -90
- package/src/client.ts +0 -704
- package/src/consts.ts +0 -1
- package/src/index.ts +0 -6
- package/src/queries.ts +0 -630
- package/src/query-types.ts +0 -21
- package/src/retry-handler.ts +0 -125
- package/src/sse.ts +0 -148
- package/src/types.ts +0 -267
- package/src/utils.ts +0 -71
- package/src/webhook-handler.ts +0 -91
package/lib/queries.d.ts
ADDED
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
/** Types generated for queries found in "sql/queries.sql" */
|
|
2
|
+
import { PreparedQuery } from '@pgtyped/runtime';
|
|
3
|
+
export type config_type = 'future_intervals_to_create' | 'partition_interval' | 'partition_retention_period' | 'pg_cron_partition_maintenance_cron' | 'pg_cron_poll_for_events_cron' | 'plugin_version' | 'poll_chunk_size' | 'use_pg_cron';
|
|
4
|
+
export type DateOrString = Date | string;
|
|
5
|
+
export type DateOrStringArray = (DateOrString)[];
|
|
6
|
+
export type stringArray = (string)[];
|
|
7
|
+
export type unknownArray = (unknown)[];
|
|
8
|
+
/** 'AssertGroup' parameters type */
|
|
9
|
+
export interface IAssertGroupParams {
|
|
10
|
+
id: string;
|
|
11
|
+
}
|
|
12
|
+
/** 'AssertGroup' return type */
|
|
13
|
+
export type IAssertGroupResult = void;
|
|
14
|
+
/** 'AssertGroup' query type */
|
|
15
|
+
export interface IAssertGroupQuery {
|
|
16
|
+
params: IAssertGroupParams;
|
|
17
|
+
result: IAssertGroupResult;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Query generated from SQL:
|
|
21
|
+
* ```
|
|
22
|
+
* INSERT INTO pgmb.subscription_groups (id)
|
|
23
|
+
* VALUES (:id!)
|
|
24
|
+
* ON CONFLICT DO NOTHING
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare const assertGroup: PreparedQuery<IAssertGroupParams, void>;
|
|
28
|
+
/** 'AssertSubscription' parameters type */
|
|
29
|
+
export interface IAssertSubscriptionParams {
|
|
30
|
+
conditionsSql?: string | null | void;
|
|
31
|
+
expiryInterval?: DateOrString | null | void;
|
|
32
|
+
groupId: string;
|
|
33
|
+
params?: unknown | null | void;
|
|
34
|
+
}
|
|
35
|
+
/** 'AssertSubscription' return type */
|
|
36
|
+
export interface IAssertSubscriptionResult {
|
|
37
|
+
id: string;
|
|
38
|
+
}
|
|
39
|
+
/** 'AssertSubscription' query type */
|
|
40
|
+
export interface IAssertSubscriptionQuery {
|
|
41
|
+
params: IAssertSubscriptionParams;
|
|
42
|
+
result: IAssertSubscriptionResult;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Query generated from SQL:
|
|
46
|
+
* ```
|
|
47
|
+
* INSERT INTO pgmb.subscriptions
|
|
48
|
+
* AS s(group_id, conditions_sql, params, expiry_interval)
|
|
49
|
+
* VALUES (
|
|
50
|
+
* :groupId!,
|
|
51
|
+
* COALESCE(:conditionsSql, 'TRUE'),
|
|
52
|
+
* COALESCE(:params::jsonb, '{}'),
|
|
53
|
+
* :expiryInterval::interval
|
|
54
|
+
* )
|
|
55
|
+
* ON CONFLICT (identity) DO UPDATE
|
|
56
|
+
* SET
|
|
57
|
+
* -- set expiry_interval to the new value only if it's greater than the existing one
|
|
58
|
+
* -- or if the new value is NULL (indicating no expiration)
|
|
59
|
+
* expiry_interval = CASE
|
|
60
|
+
* WHEN EXCLUDED.expiry_interval IS NULL OR s.expiry_interval IS NULL
|
|
61
|
+
* THEN NULL
|
|
62
|
+
* ELSE
|
|
63
|
+
* GREATEST(s.expiry_interval, EXCLUDED.expiry_interval)
|
|
64
|
+
* END,
|
|
65
|
+
* last_active_at = NOW()
|
|
66
|
+
* RETURNING id AS "id!"
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare const assertSubscription: PreparedQuery<IAssertSubscriptionParams, IAssertSubscriptionResult>;
|
|
70
|
+
/** 'DeleteSubscriptions' parameters type */
|
|
71
|
+
export interface IDeleteSubscriptionsParams {
|
|
72
|
+
ids: readonly (string)[];
|
|
73
|
+
}
|
|
74
|
+
/** 'DeleteSubscriptions' return type */
|
|
75
|
+
export type IDeleteSubscriptionsResult = void;
|
|
76
|
+
/** 'DeleteSubscriptions' query type */
|
|
77
|
+
export interface IDeleteSubscriptionsQuery {
|
|
78
|
+
params: IDeleteSubscriptionsParams;
|
|
79
|
+
result: IDeleteSubscriptionsResult;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Query generated from SQL:
|
|
83
|
+
* ```
|
|
84
|
+
* DELETE FROM pgmb.subscriptions
|
|
85
|
+
* WHERE id IN :ids!
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare const deleteSubscriptions: PreparedQuery<IDeleteSubscriptionsParams, void>;
|
|
89
|
+
/** 'MarkSubscriptionsActive' parameters type */
|
|
90
|
+
export interface IMarkSubscriptionsActiveParams {
|
|
91
|
+
ids: stringArray;
|
|
92
|
+
}
|
|
93
|
+
/** 'MarkSubscriptionsActive' return type */
|
|
94
|
+
export type IMarkSubscriptionsActiveResult = void;
|
|
95
|
+
/** 'MarkSubscriptionsActive' query type */
|
|
96
|
+
export interface IMarkSubscriptionsActiveQuery {
|
|
97
|
+
params: IMarkSubscriptionsActiveParams;
|
|
98
|
+
result: IMarkSubscriptionsActiveResult;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Query generated from SQL:
|
|
102
|
+
* ```
|
|
103
|
+
* UPDATE pgmb.subscriptions
|
|
104
|
+
* SET
|
|
105
|
+
* last_active_at = NOW()
|
|
106
|
+
* WHERE id IN (SELECT * FROM unnest(:ids!::pgmb.subscription_id[]))
|
|
107
|
+
* ```
|
|
108
|
+
*/
|
|
109
|
+
export declare const markSubscriptionsActive: PreparedQuery<IMarkSubscriptionsActiveParams, void>;
|
|
110
|
+
/** 'PollForEvents' parameters type */
|
|
111
|
+
export type IPollForEventsParams = void;
|
|
112
|
+
/** 'PollForEvents' return type */
|
|
113
|
+
export interface IPollForEventsResult {
|
|
114
|
+
count: number;
|
|
115
|
+
}
|
|
116
|
+
/** 'PollForEvents' query type */
|
|
117
|
+
export interface IPollForEventsQuery {
|
|
118
|
+
params: IPollForEventsParams;
|
|
119
|
+
result: IPollForEventsResult;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Query generated from SQL:
|
|
123
|
+
* ```
|
|
124
|
+
* SELECT count AS "count!" FROM pgmb.poll_for_events() AS count
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
export declare const pollForEvents: PreparedQuery<void, IPollForEventsResult>;
|
|
128
|
+
/** 'ReadNextEvents' parameters type */
|
|
129
|
+
export interface IReadNextEventsParams {
|
|
130
|
+
chunkSize: number;
|
|
131
|
+
cursor?: string | null | void;
|
|
132
|
+
groupId: string;
|
|
133
|
+
}
|
|
134
|
+
/** 'ReadNextEvents' return type */
|
|
135
|
+
export interface IReadNextEventsResult {
|
|
136
|
+
id: string;
|
|
137
|
+
metadata: unknown;
|
|
138
|
+
nextCursor: string;
|
|
139
|
+
payload: unknown;
|
|
140
|
+
subscriptionIds: stringArray;
|
|
141
|
+
topic: string;
|
|
142
|
+
}
|
|
143
|
+
/** 'ReadNextEvents' query type */
|
|
144
|
+
export interface IReadNextEventsQuery {
|
|
145
|
+
params: IReadNextEventsParams;
|
|
146
|
+
result: IReadNextEventsResult;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Query generated from SQL:
|
|
150
|
+
* ```
|
|
151
|
+
* SELECT
|
|
152
|
+
* id AS "id!",
|
|
153
|
+
* topic AS "topic!",
|
|
154
|
+
* payload AS "payload!",
|
|
155
|
+
* metadata AS "metadata!",
|
|
156
|
+
* subscription_ids::text[] AS "subscriptionIds!",
|
|
157
|
+
* next_cursor AS "nextCursor!"
|
|
158
|
+
* FROM pgmb.read_next_events(:groupId!, :cursor, :chunkSize!)
|
|
159
|
+
* ```
|
|
160
|
+
*/
|
|
161
|
+
export declare const readNextEvents: PreparedQuery<IReadNextEventsParams, IReadNextEventsResult>;
|
|
162
|
+
/** 'ReadNextEventsText' parameters type */
|
|
163
|
+
export interface IReadNextEventsTextParams {
|
|
164
|
+
chunkSize: number;
|
|
165
|
+
cursor?: string | null | void;
|
|
166
|
+
groupId: string;
|
|
167
|
+
}
|
|
168
|
+
/** 'ReadNextEventsText' return type */
|
|
169
|
+
export interface IReadNextEventsTextResult {
|
|
170
|
+
id: string;
|
|
171
|
+
payload: string;
|
|
172
|
+
topic: string;
|
|
173
|
+
}
|
|
174
|
+
/** 'ReadNextEventsText' query type */
|
|
175
|
+
export interface IReadNextEventsTextQuery {
|
|
176
|
+
params: IReadNextEventsTextParams;
|
|
177
|
+
result: IReadNextEventsTextResult;
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Query generated from SQL:
|
|
181
|
+
* ```
|
|
182
|
+
* SELECT
|
|
183
|
+
* id AS "id!",
|
|
184
|
+
* topic AS "topic!",
|
|
185
|
+
* payload::text AS "payload!"
|
|
186
|
+
* FROM pgmb.read_next_events(:groupId!, :cursor, :chunkSize!)
|
|
187
|
+
* ```
|
|
188
|
+
*/
|
|
189
|
+
export declare const readNextEventsText: PreparedQuery<IReadNextEventsTextParams, IReadNextEventsTextResult>;
|
|
190
|
+
/** 'ReplayEvents' parameters type */
|
|
191
|
+
export interface IReplayEventsParams {
|
|
192
|
+
fromEventId: string;
|
|
193
|
+
groupId: string;
|
|
194
|
+
maxEvents: number;
|
|
195
|
+
subscriptionId: string;
|
|
196
|
+
}
|
|
197
|
+
/** 'ReplayEvents' return type */
|
|
198
|
+
export interface IReplayEventsResult {
|
|
199
|
+
id: string;
|
|
200
|
+
metadata: unknown;
|
|
201
|
+
payload: unknown;
|
|
202
|
+
topic: string;
|
|
203
|
+
}
|
|
204
|
+
/** 'ReplayEvents' query type */
|
|
205
|
+
export interface IReplayEventsQuery {
|
|
206
|
+
params: IReplayEventsParams;
|
|
207
|
+
result: IReplayEventsResult;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Query generated from SQL:
|
|
211
|
+
* ```
|
|
212
|
+
* SELECT
|
|
213
|
+
* id AS "id!",
|
|
214
|
+
* topic AS "topic!",
|
|
215
|
+
* payload AS "payload!",
|
|
216
|
+
* metadata AS "metadata!"
|
|
217
|
+
* FROM pgmb.replay_events(
|
|
218
|
+
* :groupId!,
|
|
219
|
+
* :subscriptionId!,
|
|
220
|
+
* :fromEventId!::pgmb.event_id,
|
|
221
|
+
* :maxEvents!
|
|
222
|
+
* )
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
export declare const replayEvents: PreparedQuery<IReplayEventsParams, IReplayEventsResult>;
|
|
226
|
+
/** 'SetGroupCursor' parameters type */
|
|
227
|
+
export interface ISetGroupCursorParams {
|
|
228
|
+
cursor: string;
|
|
229
|
+
groupId: string;
|
|
230
|
+
releaseLock?: boolean | null | void;
|
|
231
|
+
}
|
|
232
|
+
/** 'SetGroupCursor' return type */
|
|
233
|
+
export interface ISetGroupCursorResult {
|
|
234
|
+
success: undefined;
|
|
235
|
+
}
|
|
236
|
+
/** 'SetGroupCursor' query type */
|
|
237
|
+
export interface ISetGroupCursorQuery {
|
|
238
|
+
params: ISetGroupCursorParams;
|
|
239
|
+
result: ISetGroupCursorResult;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Query generated from SQL:
|
|
243
|
+
* ```
|
|
244
|
+
* SELECT pgmb.set_group_cursor(
|
|
245
|
+
* :groupId!,
|
|
246
|
+
* :cursor!::pgmb.event_id,
|
|
247
|
+
* :releaseLock::boolean
|
|
248
|
+
* ) AS "success!"
|
|
249
|
+
* ```
|
|
250
|
+
*/
|
|
251
|
+
export declare const setGroupCursor: PreparedQuery<ISetGroupCursorParams, ISetGroupCursorResult>;
|
|
252
|
+
/** 'ReleaseGroupLock' parameters type */
|
|
253
|
+
export interface IReleaseGroupLockParams {
|
|
254
|
+
groupId: string;
|
|
255
|
+
}
|
|
256
|
+
/** 'ReleaseGroupLock' return type */
|
|
257
|
+
export interface IReleaseGroupLockResult {
|
|
258
|
+
success: undefined;
|
|
259
|
+
}
|
|
260
|
+
/** 'ReleaseGroupLock' query type */
|
|
261
|
+
export interface IReleaseGroupLockQuery {
|
|
262
|
+
params: IReleaseGroupLockParams;
|
|
263
|
+
result: IReleaseGroupLockResult;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
266
|
+
* Query generated from SQL:
|
|
267
|
+
* ```
|
|
268
|
+
* SELECT pgmb.release_group_lock(:groupId!) AS "success!"
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
export declare const releaseGroupLock: PreparedQuery<IReleaseGroupLockParams, IReleaseGroupLockResult>;
|
|
272
|
+
/** 'WriteEvents' parameters type */
|
|
273
|
+
export interface IWriteEventsParams {
|
|
274
|
+
metadatas: unknownArray;
|
|
275
|
+
payloads: unknownArray;
|
|
276
|
+
topics: stringArray;
|
|
277
|
+
}
|
|
278
|
+
/** 'WriteEvents' return type */
|
|
279
|
+
export interface IWriteEventsResult {
|
|
280
|
+
id: string;
|
|
281
|
+
}
|
|
282
|
+
/** 'WriteEvents' query type */
|
|
283
|
+
export interface IWriteEventsQuery {
|
|
284
|
+
params: IWriteEventsParams;
|
|
285
|
+
result: IWriteEventsResult;
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Query generated from SQL:
|
|
289
|
+
* ```
|
|
290
|
+
* INSERT INTO pgmb.events (topic, payload, metadata)
|
|
291
|
+
* SELECT
|
|
292
|
+
* topic,
|
|
293
|
+
* payload,
|
|
294
|
+
* metadata
|
|
295
|
+
* FROM unnest(
|
|
296
|
+
* :topics!::TEXT[],
|
|
297
|
+
* :payloads!::JSONB[],
|
|
298
|
+
* :metadatas!::JSONB[]
|
|
299
|
+
* ) AS t(topic, payload, metadata)
|
|
300
|
+
* RETURNING id AS "id!"
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
export declare const writeEvents: PreparedQuery<IWriteEventsParams, IWriteEventsResult>;
|
|
304
|
+
/** 'WriteScheduledEvents' parameters type */
|
|
305
|
+
export interface IWriteScheduledEventsParams {
|
|
306
|
+
metadatas: unknownArray;
|
|
307
|
+
payloads: unknownArray;
|
|
308
|
+
topics: stringArray;
|
|
309
|
+
ts: DateOrStringArray;
|
|
310
|
+
}
|
|
311
|
+
/** 'WriteScheduledEvents' return type */
|
|
312
|
+
export interface IWriteScheduledEventsResult {
|
|
313
|
+
id: string;
|
|
314
|
+
}
|
|
315
|
+
/** 'WriteScheduledEvents' query type */
|
|
316
|
+
export interface IWriteScheduledEventsQuery {
|
|
317
|
+
params: IWriteScheduledEventsParams;
|
|
318
|
+
result: IWriteScheduledEventsResult;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Query generated from SQL:
|
|
322
|
+
* ```
|
|
323
|
+
* INSERT INTO pgmb.events (id, topic, payload, metadata)
|
|
324
|
+
* SELECT
|
|
325
|
+
* pgmb.create_event_id(COALESCE(ts, clock_timestamp()), pgmb.create_random_bigint()),
|
|
326
|
+
* topic,
|
|
327
|
+
* payload,
|
|
328
|
+
* metadata
|
|
329
|
+
* FROM unnest(
|
|
330
|
+
* :ts!::TIMESTAMPTZ[],
|
|
331
|
+
* :topics!::TEXT[],
|
|
332
|
+
* :payloads!::JSONB[],
|
|
333
|
+
* :metadatas!::JSONB[]
|
|
334
|
+
* ) AS t(ts, topic, payload, metadata)
|
|
335
|
+
* RETURNING id AS "id!"
|
|
336
|
+
* ```
|
|
337
|
+
*/
|
|
338
|
+
export declare const writeScheduledEvents: PreparedQuery<IWriteScheduledEventsParams, IWriteScheduledEventsResult>;
|
|
339
|
+
/** 'ScheduleEventRetry' parameters type */
|
|
340
|
+
export interface IScheduleEventRetryParams {
|
|
341
|
+
delayInterval: DateOrString;
|
|
342
|
+
handlerName: string;
|
|
343
|
+
ids: stringArray;
|
|
344
|
+
retryNumber: number;
|
|
345
|
+
subscriptionId: string;
|
|
346
|
+
}
|
|
347
|
+
/** 'ScheduleEventRetry' return type */
|
|
348
|
+
export interface IScheduleEventRetryResult {
|
|
349
|
+
id: string;
|
|
350
|
+
}
|
|
351
|
+
/** 'ScheduleEventRetry' query type */
|
|
352
|
+
export interface IScheduleEventRetryQuery {
|
|
353
|
+
params: IScheduleEventRetryParams;
|
|
354
|
+
result: IScheduleEventRetryResult;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Query generated from SQL:
|
|
358
|
+
* ```
|
|
359
|
+
* INSERT INTO pgmb.events (id, topic, payload, subscription_id)
|
|
360
|
+
* SELECT
|
|
361
|
+
* pgmb.create_event_id(
|
|
362
|
+
* NOW() + (:delayInterval!::INTERVAL),
|
|
363
|
+
* pgmb.create_random_bigint()
|
|
364
|
+
* ),
|
|
365
|
+
* 'pgmb-retry',
|
|
366
|
+
* jsonb_build_object(
|
|
367
|
+
* 'ids',
|
|
368
|
+
* :ids!::pgmb.event_id[],
|
|
369
|
+
* 'retryNumber',
|
|
370
|
+
* :retryNumber!::int,
|
|
371
|
+
* 'handlerName',
|
|
372
|
+
* :handlerName!::text
|
|
373
|
+
* ),
|
|
374
|
+
* :subscriptionId!::pgmb.subscription_id
|
|
375
|
+
* RETURNING id AS "id!"
|
|
376
|
+
* ```
|
|
377
|
+
*/
|
|
378
|
+
export declare const scheduleEventRetry: PreparedQuery<IScheduleEventRetryParams, IScheduleEventRetryResult>;
|
|
379
|
+
/** 'FindEvents' parameters type */
|
|
380
|
+
export interface IFindEventsParams {
|
|
381
|
+
ids: stringArray;
|
|
382
|
+
}
|
|
383
|
+
/** 'FindEvents' return type */
|
|
384
|
+
export interface IFindEventsResult {
|
|
385
|
+
id: string;
|
|
386
|
+
metadata: unknown;
|
|
387
|
+
payload: unknown;
|
|
388
|
+
topic: string;
|
|
389
|
+
}
|
|
390
|
+
/** 'FindEvents' query type */
|
|
391
|
+
export interface IFindEventsQuery {
|
|
392
|
+
params: IFindEventsParams;
|
|
393
|
+
result: IFindEventsResult;
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Query generated from SQL:
|
|
397
|
+
* ```
|
|
398
|
+
* SELECT
|
|
399
|
+
* id AS "id!",
|
|
400
|
+
* topic AS "topic!",
|
|
401
|
+
* payload AS "payload!",
|
|
402
|
+
* metadata AS "metadata!"
|
|
403
|
+
* FROM pgmb.events
|
|
404
|
+
* WHERE id = ANY(:ids!::pgmb.event_id[])
|
|
405
|
+
* ```
|
|
406
|
+
*/
|
|
407
|
+
export declare const findEvents: PreparedQuery<IFindEventsParams, IFindEventsResult>;
|
|
408
|
+
/** 'RemoveExpiredSubscriptions' parameters type */
|
|
409
|
+
export interface IRemoveExpiredSubscriptionsParams {
|
|
410
|
+
activeIds: stringArray;
|
|
411
|
+
groupId: string;
|
|
412
|
+
}
|
|
413
|
+
/** 'RemoveExpiredSubscriptions' return type */
|
|
414
|
+
export interface IRemoveExpiredSubscriptionsResult {
|
|
415
|
+
deleted: string;
|
|
416
|
+
}
|
|
417
|
+
/** 'RemoveExpiredSubscriptions' query type */
|
|
418
|
+
export interface IRemoveExpiredSubscriptionsQuery {
|
|
419
|
+
params: IRemoveExpiredSubscriptionsParams;
|
|
420
|
+
result: IRemoveExpiredSubscriptionsResult;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Query generated from SQL:
|
|
424
|
+
* ```
|
|
425
|
+
* WITH deleted AS (
|
|
426
|
+
* DELETE FROM pgmb.subscriptions
|
|
427
|
+
* WHERE group_id = :groupId!
|
|
428
|
+
* AND expiry_interval IS NOT NULL
|
|
429
|
+
* AND pgmb.add_interval_imm(last_active_at, expiry_interval) < NOW()
|
|
430
|
+
* AND id NOT IN (select * from unnest(:activeIds!::pgmb.subscription_id[]))
|
|
431
|
+
* RETURNING id
|
|
432
|
+
* )
|
|
433
|
+
* SELECT COUNT(*) AS "deleted!" FROM deleted
|
|
434
|
+
* ```
|
|
435
|
+
*/
|
|
436
|
+
export declare const removeExpiredSubscriptions: PreparedQuery<IRemoveExpiredSubscriptionsParams, IRemoveExpiredSubscriptionsResult>;
|
|
437
|
+
/** 'GetConfigValue' parameters type */
|
|
438
|
+
export interface IGetConfigValueParams {
|
|
439
|
+
key: config_type;
|
|
440
|
+
}
|
|
441
|
+
/** 'GetConfigValue' return type */
|
|
442
|
+
export interface IGetConfigValueResult {
|
|
443
|
+
value: string | null;
|
|
444
|
+
}
|
|
445
|
+
/** 'GetConfigValue' query type */
|
|
446
|
+
export interface IGetConfigValueQuery {
|
|
447
|
+
params: IGetConfigValueParams;
|
|
448
|
+
result: IGetConfigValueResult;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Query generated from SQL:
|
|
452
|
+
* ```
|
|
453
|
+
* SELECT pgmb.get_config_value(:key!::pgmb.config_type) AS "value"
|
|
454
|
+
* ```
|
|
455
|
+
*/
|
|
456
|
+
export declare const getConfigValue: PreparedQuery<IGetConfigValueParams, IGetConfigValueResult>;
|
|
457
|
+
/** 'UpdateConfigValue' parameters type */
|
|
458
|
+
export interface IUpdateConfigValueParams {
|
|
459
|
+
key: config_type;
|
|
460
|
+
value: string;
|
|
461
|
+
}
|
|
462
|
+
/** 'UpdateConfigValue' return type */
|
|
463
|
+
export interface IUpdateConfigValueResult {
|
|
464
|
+
updated: number;
|
|
465
|
+
}
|
|
466
|
+
/** 'UpdateConfigValue' query type */
|
|
467
|
+
export interface IUpdateConfigValueQuery {
|
|
468
|
+
params: IUpdateConfigValueParams;
|
|
469
|
+
result: IUpdateConfigValueResult;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Query generated from SQL:
|
|
473
|
+
* ```
|
|
474
|
+
* UPDATE pgmb.config
|
|
475
|
+
* SET value = :value!::TEXT
|
|
476
|
+
* WHERE id = :key!::pgmb.config_type
|
|
477
|
+
* RETURNING 1 AS "updated!"
|
|
478
|
+
* ```
|
|
479
|
+
*/
|
|
480
|
+
export declare const updateConfigValue: PreparedQuery<IUpdateConfigValueParams, IUpdateConfigValueResult>;
|
|
481
|
+
/** 'MaintainEventsTable' parameters type */
|
|
482
|
+
export type IMaintainEventsTableParams = void;
|
|
483
|
+
/** 'MaintainEventsTable' return type */
|
|
484
|
+
export interface IMaintainEventsTableResult {
|
|
485
|
+
maintainEventsTable: undefined | null;
|
|
486
|
+
}
|
|
487
|
+
/** 'MaintainEventsTable' query type */
|
|
488
|
+
export interface IMaintainEventsTableQuery {
|
|
489
|
+
params: IMaintainEventsTableParams;
|
|
490
|
+
result: IMaintainEventsTableResult;
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Query generated from SQL:
|
|
494
|
+
* ```
|
|
495
|
+
* SELECT pgmb.maintain_events_table()
|
|
496
|
+
* ```
|
|
497
|
+
*/
|
|
498
|
+
export declare const maintainEventsTable: PreparedQuery<void, IMaintainEventsTableResult>;
|
package/lib/queries.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.maintainEventsTable = exports.updateConfigValue = exports.getConfigValue = exports.removeExpiredSubscriptions = exports.findEvents = exports.scheduleEventRetry = exports.writeScheduledEvents = exports.writeEvents = exports.releaseGroupLock = exports.setGroupCursor = exports.replayEvents = exports.readNextEventsText = exports.readNextEvents = exports.pollForEvents = exports.markSubscriptionsActive = exports.deleteSubscriptions = exports.assertSubscription = exports.assertGroup = void 0;
|
|
4
1
|
/** Types generated for queries found in "sql/queries.sql" */
|
|
5
|
-
|
|
2
|
+
import { PreparedQuery } from '@pgtyped/runtime';
|
|
6
3
|
const assertGroupIR = { "usedParamSet": { "id": true }, "params": [{ "name": "id", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 50, "b": 53 }] }], "statement": "INSERT INTO pgmb.subscription_groups (id)\nVALUES (:id!)\nON CONFLICT DO NOTHING" };
|
|
7
4
|
/**
|
|
8
5
|
* Query generated from SQL:
|
|
@@ -12,7 +9,7 @@ const assertGroupIR = { "usedParamSet": { "id": true }, "params": [{ "name": "id
|
|
|
12
9
|
* ON CONFLICT DO NOTHING
|
|
13
10
|
* ```
|
|
14
11
|
*/
|
|
15
|
-
|
|
12
|
+
export const assertGroup = new PreparedQuery(assertGroupIR);
|
|
16
13
|
const assertSubscriptionIR = { "usedParamSet": { "groupId": true, "conditionsSql": true, "params": true, "expiryInterval": true }, "params": [{ "name": "groupId", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 98, "b": 106 }] }, { "name": "conditionsSql", "required": false, "transform": { "type": "scalar" }, "locs": [{ "a": 119, "b": 132 }] }, { "name": "params", "required": false, "transform": { "type": "scalar" }, "locs": [{ "a": 154, "b": 160 }] }, { "name": "expiryInterval", "required": false, "transform": { "type": "scalar" }, "locs": [{ "a": 178, "b": 192 }] }], "statement": "INSERT INTO pgmb.subscriptions\n\tAS s(group_id, conditions_sql, params, expiry_interval)\nVALUES (\n\t:groupId!,\n\tCOALESCE(:conditionsSql, 'TRUE'),\n\tCOALESCE(:params::jsonb, '{}'),\n\t:expiryInterval::interval\n)\nON CONFLICT (identity) DO UPDATE\nSET\n\t-- set expiry_interval to the new value only if it's greater than the existing one\n\t-- or if the new value is NULL (indicating no expiration)\n\texpiry_interval = CASE\n\t\tWHEN EXCLUDED.expiry_interval IS NULL OR s.expiry_interval IS NULL\n\t\t\tTHEN NULL\n\t\tELSE\n\t\t\tGREATEST(s.expiry_interval, EXCLUDED.expiry_interval)\n\tEND,\n\tlast_active_at = NOW()\nRETURNING id AS \"id!\"" };
|
|
17
14
|
/**
|
|
18
15
|
* Query generated from SQL:
|
|
@@ -39,7 +36,7 @@ const assertSubscriptionIR = { "usedParamSet": { "groupId": true, "conditionsSql
|
|
|
39
36
|
* RETURNING id AS "id!"
|
|
40
37
|
* ```
|
|
41
38
|
*/
|
|
42
|
-
|
|
39
|
+
export const assertSubscription = new PreparedQuery(assertSubscriptionIR);
|
|
43
40
|
const deleteSubscriptionsIR = { "usedParamSet": { "ids": true }, "params": [{ "name": "ids", "required": true, "transform": { "type": "array_spread" }, "locs": [{ "a": 43, "b": 47 }] }], "statement": "DELETE FROM pgmb.subscriptions\nWHERE id IN :ids!" };
|
|
44
41
|
/**
|
|
45
42
|
* Query generated from SQL:
|
|
@@ -48,7 +45,7 @@ const deleteSubscriptionsIR = { "usedParamSet": { "ids": true }, "params": [{ "n
|
|
|
48
45
|
* WHERE id IN :ids!
|
|
49
46
|
* ```
|
|
50
47
|
*/
|
|
51
|
-
|
|
48
|
+
export const deleteSubscriptions = new PreparedQuery(deleteSubscriptionsIR);
|
|
52
49
|
const markSubscriptionsActiveIR = { "usedParamSet": { "ids": true }, "params": [{ "name": "ids", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 88, "b": 92 }] }], "statement": "UPDATE pgmb.subscriptions\nSET\n\tlast_active_at = NOW()\nWHERE id IN (SELECT * FROM unnest(:ids!::pgmb.subscription_id[]))" };
|
|
53
50
|
/**
|
|
54
51
|
* Query generated from SQL:
|
|
@@ -59,7 +56,7 @@ const markSubscriptionsActiveIR = { "usedParamSet": { "ids": true }, "params": [
|
|
|
59
56
|
* WHERE id IN (SELECT * FROM unnest(:ids!::pgmb.subscription_id[]))
|
|
60
57
|
* ```
|
|
61
58
|
*/
|
|
62
|
-
|
|
59
|
+
export const markSubscriptionsActive = new PreparedQuery(markSubscriptionsActiveIR);
|
|
63
60
|
const pollForEventsIR = { "usedParamSet": {}, "params": [], "statement": "SELECT count AS \"count!\" FROM pgmb.poll_for_events() AS count" };
|
|
64
61
|
/**
|
|
65
62
|
* Query generated from SQL:
|
|
@@ -67,7 +64,7 @@ const pollForEventsIR = { "usedParamSet": {}, "params": [], "statement": "SELECT
|
|
|
67
64
|
* SELECT count AS "count!" FROM pgmb.poll_for_events() AS count
|
|
68
65
|
* ```
|
|
69
66
|
*/
|
|
70
|
-
|
|
67
|
+
export const pollForEvents = new PreparedQuery(pollForEventsIR);
|
|
71
68
|
const readNextEventsIR = { "usedParamSet": { "groupId": true, "cursor": true, "chunkSize": true }, "params": [{ "name": "groupId", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 197, "b": 205 }] }, { "name": "cursor", "required": false, "transform": { "type": "scalar" }, "locs": [{ "a": 208, "b": 214 }] }, { "name": "chunkSize", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 217, "b": 227 }] }], "statement": "SELECT\n\tid AS \"id!\",\n\ttopic AS \"topic!\",\n\tpayload AS \"payload!\",\n\tmetadata AS \"metadata!\",\n\tsubscription_ids::text[] AS \"subscriptionIds!\",\n\tnext_cursor AS \"nextCursor!\"\nFROM pgmb.read_next_events(:groupId!, :cursor, :chunkSize!)" };
|
|
72
69
|
/**
|
|
73
70
|
* Query generated from SQL:
|
|
@@ -82,7 +79,7 @@ const readNextEventsIR = { "usedParamSet": { "groupId": true, "cursor": true, "c
|
|
|
82
79
|
* FROM pgmb.read_next_events(:groupId!, :cursor, :chunkSize!)
|
|
83
80
|
* ```
|
|
84
81
|
*/
|
|
85
|
-
|
|
82
|
+
export const readNextEvents = new PreparedQuery(readNextEventsIR);
|
|
86
83
|
const readNextEventsTextIR = { "usedParamSet": { "groupId": true, "cursor": true, "chunkSize": true }, "params": [{ "name": "groupId", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 97, "b": 105 }] }, { "name": "cursor", "required": false, "transform": { "type": "scalar" }, "locs": [{ "a": 108, "b": 114 }] }, { "name": "chunkSize", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 117, "b": 127 }] }], "statement": "SELECT\n\tid AS \"id!\",\n\ttopic AS \"topic!\",\n\tpayload::text AS \"payload!\"\nFROM pgmb.read_next_events(:groupId!, :cursor, :chunkSize!)" };
|
|
87
84
|
/**
|
|
88
85
|
* Query generated from SQL:
|
|
@@ -94,7 +91,7 @@ const readNextEventsTextIR = { "usedParamSet": { "groupId": true, "cursor": true
|
|
|
94
91
|
* FROM pgmb.read_next_events(:groupId!, :cursor, :chunkSize!)
|
|
95
92
|
* ```
|
|
96
93
|
*/
|
|
97
|
-
|
|
94
|
+
export const readNextEventsText = new PreparedQuery(readNextEventsTextIR);
|
|
98
95
|
const replayEventsIR = { "usedParamSet": { "groupId": true, "subscriptionId": true, "fromEventId": true, "maxEvents": true }, "params": [{ "name": "groupId", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 116, "b": 124 }] }, { "name": "subscriptionId", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 128, "b": 143 }] }, { "name": "fromEventId", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 147, "b": 159 }] }, { "name": "maxEvents", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 178, "b": 188 }] }], "statement": "SELECT\n\tid AS \"id!\",\n\ttopic AS \"topic!\",\n\tpayload AS \"payload!\",\n\tmetadata AS \"metadata!\"\nFROM pgmb.replay_events(\n\t:groupId!,\n\t:subscriptionId!,\n\t:fromEventId!::pgmb.event_id,\n\t:maxEvents!\n)" };
|
|
99
96
|
/**
|
|
100
97
|
* Query generated from SQL:
|
|
@@ -112,7 +109,7 @@ const replayEventsIR = { "usedParamSet": { "groupId": true, "subscriptionId": tr
|
|
|
112
109
|
* )
|
|
113
110
|
* ```
|
|
114
111
|
*/
|
|
115
|
-
|
|
112
|
+
export const replayEvents = new PreparedQuery(replayEventsIR);
|
|
116
113
|
const setGroupCursorIR = { "usedParamSet": { "groupId": true, "cursor": true, "releaseLock": true }, "params": [{ "name": "groupId", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 31, "b": 39 }] }, { "name": "cursor", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 43, "b": 50 }] }, { "name": "releaseLock", "required": false, "transform": { "type": "scalar" }, "locs": [{ "a": 69, "b": 80 }] }], "statement": "SELECT pgmb.set_group_cursor(\n\t:groupId!,\n\t:cursor!::pgmb.event_id,\n\t:releaseLock::boolean\n) AS \"success!\"" };
|
|
117
114
|
/**
|
|
118
115
|
* Query generated from SQL:
|
|
@@ -124,7 +121,7 @@ const setGroupCursorIR = { "usedParamSet": { "groupId": true, "cursor": true, "r
|
|
|
124
121
|
* ) AS "success!"
|
|
125
122
|
* ```
|
|
126
123
|
*/
|
|
127
|
-
|
|
124
|
+
export const setGroupCursor = new PreparedQuery(setGroupCursorIR);
|
|
128
125
|
const releaseGroupLockIR = { "usedParamSet": { "groupId": true }, "params": [{ "name": "groupId", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 31, "b": 39 }] }], "statement": "SELECT pgmb.release_group_lock(:groupId!) AS \"success!\"" };
|
|
129
126
|
/**
|
|
130
127
|
* Query generated from SQL:
|
|
@@ -132,7 +129,7 @@ const releaseGroupLockIR = { "usedParamSet": { "groupId": true }, "params": [{ "
|
|
|
132
129
|
* SELECT pgmb.release_group_lock(:groupId!) AS "success!"
|
|
133
130
|
* ```
|
|
134
131
|
*/
|
|
135
|
-
|
|
132
|
+
export const releaseGroupLock = new PreparedQuery(releaseGroupLockIR);
|
|
136
133
|
const writeEventsIR = { "usedParamSet": { "topics": true, "payloads": true, "metadatas": true }, "params": [{ "name": "topics", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 100, "b": 107 }] }, { "name": "payloads", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 119, "b": 128 }] }, { "name": "metadatas", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 141, "b": 151 }] }], "statement": "INSERT INTO pgmb.events (topic, payload, metadata)\nSELECT\n\ttopic,\n\tpayload,\n\tmetadata\nFROM unnest(\n\t:topics!::TEXT[],\n\t:payloads!::JSONB[],\n\t:metadatas!::JSONB[]\n) AS t(topic, payload, metadata)\nRETURNING id AS \"id!\"" };
|
|
137
134
|
/**
|
|
138
135
|
* Query generated from SQL:
|
|
@@ -150,7 +147,7 @@ const writeEventsIR = { "usedParamSet": { "topics": true, "payloads": true, "met
|
|
|
150
147
|
* RETURNING id AS "id!"
|
|
151
148
|
* ```
|
|
152
149
|
*/
|
|
153
|
-
|
|
150
|
+
export const writeEvents = new PreparedQuery(writeEventsIR);
|
|
154
151
|
const writeScheduledEventsIR = { "usedParamSet": { "ts": true, "topics": true, "payloads": true, "metadatas": true }, "params": [{ "name": "ts", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 189, "b": 192 }] }, { "name": "topics", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 211, "b": 218 }] }, { "name": "payloads", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 230, "b": 239 }] }, { "name": "metadatas", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 252, "b": 262 }] }], "statement": "INSERT INTO pgmb.events (id, topic, payload, metadata)\nSELECT\n\tpgmb.create_event_id(COALESCE(ts, clock_timestamp()), pgmb.create_random_bigint()),\n\ttopic,\n\tpayload,\n\tmetadata\nFROM unnest(\n\t:ts!::TIMESTAMPTZ[],\n\t:topics!::TEXT[],\n\t:payloads!::JSONB[],\n\t:metadatas!::JSONB[]\n) AS t(ts, topic, payload, metadata)\nRETURNING id AS \"id!\"" };
|
|
155
152
|
/**
|
|
156
153
|
* Query generated from SQL:
|
|
@@ -170,7 +167,7 @@ const writeScheduledEventsIR = { "usedParamSet": { "ts": true, "topics": true, "
|
|
|
170
167
|
* RETURNING id AS "id!"
|
|
171
168
|
* ```
|
|
172
169
|
*/
|
|
173
|
-
|
|
170
|
+
export const writeScheduledEvents = new PreparedQuery(writeScheduledEventsIR);
|
|
174
171
|
const scheduleEventRetryIR = { "usedParamSet": { "delayInterval": true, "ids": true, "retryNumber": true, "handlerName": true, "subscriptionId": true }, "params": [{ "name": "delayInterval", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 103, "b": 117 }] }, { "name": "ids", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 212, "b": 216 }] }, { "name": "retryNumber", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 255, "b": 267 }] }, { "name": "handlerName", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 294, "b": 306 }] }, { "name": "subscriptionId", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 319, "b": 334 }] }], "statement": "INSERT INTO pgmb.events (id, topic, payload, subscription_id)\nSELECT\n\tpgmb.create_event_id(\n\t\tNOW() + (:delayInterval!::INTERVAL),\n\t\tpgmb.create_random_bigint()\n\t),\n\t'pgmb-retry',\n\tjsonb_build_object(\n\t\t'ids',\n\t\t:ids!::pgmb.event_id[],\n\t\t'retryNumber',\n\t\t:retryNumber!::int,\n\t\t'handlerName',\n\t\t:handlerName!::text\n\t),\n\t:subscriptionId!::pgmb.subscription_id\nRETURNING id AS \"id!\"" };
|
|
175
172
|
/**
|
|
176
173
|
* Query generated from SQL:
|
|
@@ -194,7 +191,7 @@ const scheduleEventRetryIR = { "usedParamSet": { "delayInterval": true, "ids": t
|
|
|
194
191
|
* RETURNING id AS "id!"
|
|
195
192
|
* ```
|
|
196
193
|
*/
|
|
197
|
-
|
|
194
|
+
export const scheduleEventRetry = new PreparedQuery(scheduleEventRetryIR);
|
|
198
195
|
const findEventsIR = { "usedParamSet": { "ids": true }, "params": [{ "name": "ids", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 122, "b": 126 }] }], "statement": "SELECT\n\tid AS \"id!\",\n\ttopic AS \"topic!\",\n\tpayload AS \"payload!\",\n\tmetadata AS \"metadata!\"\nFROM pgmb.events\nWHERE id = ANY(:ids!::pgmb.event_id[])" };
|
|
199
196
|
/**
|
|
200
197
|
* Query generated from SQL:
|
|
@@ -208,7 +205,7 @@ const findEventsIR = { "usedParamSet": { "ids": true }, "params": [{ "name": "id
|
|
|
208
205
|
* WHERE id = ANY(:ids!::pgmb.event_id[])
|
|
209
206
|
* ```
|
|
210
207
|
*/
|
|
211
|
-
|
|
208
|
+
export const findEvents = new PreparedQuery(findEventsIR);
|
|
212
209
|
const removeExpiredSubscriptionsIR = { "usedParamSet": { "groupId": true, "activeIds": true }, "params": [{ "name": "groupId", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 68, "b": 76 }] }, { "name": "activeIds", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 219, "b": 229 }] }], "statement": "WITH deleted AS (\n\tDELETE FROM pgmb.subscriptions\n\tWHERE group_id = :groupId!\n\t\tAND expiry_interval IS NOT NULL\n\t\tAND pgmb.add_interval_imm(last_active_at, expiry_interval) < NOW()\n\t\tAND id NOT IN (select * from unnest(:activeIds!::pgmb.subscription_id[]))\n\tRETURNING id\n)\nSELECT COUNT(*) AS \"deleted!\" FROM deleted" };
|
|
213
210
|
/**
|
|
214
211
|
* Query generated from SQL:
|
|
@@ -224,7 +221,7 @@ const removeExpiredSubscriptionsIR = { "usedParamSet": { "groupId": true, "activ
|
|
|
224
221
|
* SELECT COUNT(*) AS "deleted!" FROM deleted
|
|
225
222
|
* ```
|
|
226
223
|
*/
|
|
227
|
-
|
|
224
|
+
export const removeExpiredSubscriptions = new PreparedQuery(removeExpiredSubscriptionsIR);
|
|
228
225
|
const getConfigValueIR = { "usedParamSet": { "key": true }, "params": [{ "name": "key", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 29, "b": 33 }] }], "statement": "SELECT pgmb.get_config_value(:key!::pgmb.config_type) AS \"value\"" };
|
|
229
226
|
/**
|
|
230
227
|
* Query generated from SQL:
|
|
@@ -232,7 +229,7 @@ const getConfigValueIR = { "usedParamSet": { "key": true }, "params": [{ "name":
|
|
|
232
229
|
* SELECT pgmb.get_config_value(:key!::pgmb.config_type) AS "value"
|
|
233
230
|
* ```
|
|
234
231
|
*/
|
|
235
|
-
|
|
232
|
+
export const getConfigValue = new PreparedQuery(getConfigValueIR);
|
|
236
233
|
const updateConfigValueIR = { "usedParamSet": { "value": true, "key": true }, "params": [{ "name": "value", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 31, "b": 37 }] }, { "name": "key", "required": true, "transform": { "type": "scalar" }, "locs": [{ "a": 56, "b": 60 }] }], "statement": "UPDATE pgmb.config\nSET value = :value!::TEXT\nWHERE id = :key!::pgmb.config_type\nRETURNING 1 AS \"updated!\"" };
|
|
237
234
|
/**
|
|
238
235
|
* Query generated from SQL:
|
|
@@ -243,7 +240,7 @@ const updateConfigValueIR = { "usedParamSet": { "value": true, "key": true }, "p
|
|
|
243
240
|
* RETURNING 1 AS "updated!"
|
|
244
241
|
* ```
|
|
245
242
|
*/
|
|
246
|
-
|
|
243
|
+
export const updateConfigValue = new PreparedQuery(updateConfigValueIR);
|
|
247
244
|
const maintainEventsTableIR = { "usedParamSet": {}, "params": [], "statement": "SELECT pgmb.maintain_events_table()" };
|
|
248
245
|
/**
|
|
249
246
|
* Query generated from SQL:
|
|
@@ -251,4 +248,4 @@ const maintainEventsTableIR = { "usedParamSet": {}, "params": [], "statement": "
|
|
|
251
248
|
* SELECT pgmb.maintain_events_table()
|
|
252
249
|
* ```
|
|
253
250
|
*/
|
|
254
|
-
|
|
251
|
+
export const maintainEventsTable = new PreparedQuery(maintainEventsTableIR);
|