lonnymq 0.0.15 → 0.0.16
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/index.cjs +5 -6
- package/dist/index.d.ts +0 -1
- package/dist/index.js +6 -7
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var{defineProperty:h,getOwnPropertyNames:W,getOwnPropertyDescriptor:Y}=Object,X=Object.prototype.hasOwnProperty;var U=new WeakMap,J=(e)=>{var t=U.get(e),n;if(t)return t;if(t=h({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")W(e).map((E)=>!X.call(t,E)&&h(t,E,{get:()=>e[E],enumerable:!(n=Y(e,E))||n.enumerable}));return U.set(e,t),t};var K=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0,configurable:!0,set:(E)=>t[n]=()=>E})};var Te={};K(Te,{queueEventDecode:()=>x,Queue:()=>
|
|
1
|
+
var{defineProperty:h,getOwnPropertyNames:W,getOwnPropertyDescriptor:Y}=Object,X=Object.prototype.hasOwnProperty;var U=new WeakMap,J=(e)=>{var t=U.get(e),n;if(t)return t;if(t=h({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")W(e).map((E)=>!X.call(t,E)&&h(t,E,{get:()=>e[E],enumerable:!(n=Y(e,E))||n.enumerable}));return U.set(e,t),t};var K=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0,configurable:!0,set:(E)=>t[n]=()=>E})};var Te={};K(Te,{queueEventDecode:()=>x,Queue:()=>v,MessageHeartbeatCommand:()=>S,MessageDequeueCommand:()=>i,MessageDeleteCommand:()=>u,MessageDeferCommand:()=>o,MessageCreateCommand:()=>c,ChannelPolicySetCommand:()=>l,ChannelPolicyClearCommand:()=>m});module.exports=J(Te);var r=(e)=>({nodeType:"VALUE",value:e}),s=(e)=>({nodeType:"REF",value:e}),j=(e)=>({nodeType:"RAW",value:e}),Z=(e)=>{return`'${e.replace(/'/g,"''")}'`},ee=(e)=>{if(e===null)return"NULL";else if(typeof e==="string")return Z(e);else if(typeof e==="number")return e.toString();else if(typeof e==="boolean")return e?"TRUE":"FALSE";else if(e instanceof Date)return`'${e.toISOString()}'`;else if(typeof e==="bigint")return e.toString();else throw new Error(`Unsupported value type: ${typeof e}`)},te=(e)=>{return`"${e.replace(/"/g,'""')}"`},se=(e)=>{if(e.nodeType==="VALUE")return ee(e.value);else if(e.nodeType==="REF")return te(e.value);else if(e.nodeType==="RAW")return e.value;else throw new Error("Unsupported SQL node type")};var a=(e,...t)=>{let n=[];for(let E=0;E<e.length;E+=1)if(n.push(e[E]),E<t.length)n.push(se(t[E]));return j(n.join(""))};class m{schema;channelName;createdAt;constructor(e){this.schema=e.schema,this.channelName=e.channelName,this.createdAt=new Date}sortKeyGet(){return JSON.stringify([this.channelName,null,this.createdAt.toISOString()])}async execute(e){await e.query(a`
|
|
2
2
|
SELECT 1 FROM ${s(this.schema)}."channel_policy_clear"(
|
|
3
3
|
$1
|
|
4
4
|
)
|
|
5
|
-
`.value,[this.channelName])}}class
|
|
5
|
+
`.value,[this.channelName])}}class l{schema;channelName;maxSize;maxConcurrency;releaseIntervalMs;createdAt;constructor(e){this.schema=e.schema,this.channelName=e.channelName;let t=e.maxConcurrency??null;this.maxConcurrency=t!==null?Math.max(0,t):null;let n=e.maxSize??null;this.maxSize=n!==null?Math.max(0,n):null;let E=e.releaseIntervalMs??null;this.releaseIntervalMs=E!==null?Math.max(0,E):null,this.createdAt=new Date}sortKeyGet(){return JSON.stringify([this.channelName,null,this.createdAt.toISOString()])}async execute(e){await e.query(a`
|
|
6
6
|
SELECT 1 FROM ${s(this.schema)}."channel_policy_set"(
|
|
7
7
|
$1,
|
|
8
8
|
$2::INTEGER,
|
|
@@ -44,7 +44,7 @@ var{defineProperty:h,getOwnPropertyNames:W,getOwnPropertyDescriptor:Y}=Object,X=
|
|
|
44
44
|
)
|
|
45
45
|
`.value,[this.id,this.numAttempts]).then((n)=>n.rows[0]);if(t.result_code===0)return{resultType:"MESSAGE_NOT_FOUND"};else if(t.result_code===1)return{resultType:"MESSAGE_STATE_INVALID"};else if(t.result_code===2)return{resultType:"MESSAGE_HEARTBEATED"};else throw new Error("Unexpected result")}}var F=(e)=>{let t=e.split(`
|
|
46
46
|
`),n=Number.MAX_SAFE_INTEGER;for(let E of t){if(E.trim().length===0)continue;let T=E.search(/\S/);n=Math.min(n,T)}return t.map((E)=>E.slice(n)).join(`
|
|
47
|
-
`).trim()};var g=require("path"),__filename="/home/runner/work/lonnymq/lonnymq/src/core/path.ts",
|
|
47
|
+
`).trim()};var g=require("path"),__filename="/home/runner/work/lonnymq/lonnymq/src/core/path.ts",le=g.dirname(g.dirname(__filename)),ce=new RegExp(`^${le}/`),_=(e)=>{return e.replace(ce,"")};var __filename="/home/runner/work/lonnymq/lonnymq/src/migration/00-table-channel-policy.ts",q={name:_(__filename),sql:(e)=>{return[a`
|
|
48
48
|
CREATE TABLE ${s(e.schema)}."channel_policy" (
|
|
49
49
|
"id" UUID NOT NULL DEFAULT GEN_RANDOM_UUID(),
|
|
50
50
|
"name" TEXT NOT NULL,
|
|
@@ -130,7 +130,6 @@ var{defineProperty:h,getOwnPropertyNames:W,getOwnPropertyDescriptor:Y}=Object,X=
|
|
|
130
130
|
) AS $$
|
|
131
131
|
DECLARE
|
|
132
132
|
v_now TIMESTAMP;
|
|
133
|
-
v_active_next_at TIMESTAMP;
|
|
134
133
|
v_channel_policy RECORD;
|
|
135
134
|
v_channel_state RECORD;
|
|
136
135
|
v_message RECORD;
|
|
@@ -165,7 +164,7 @@ var{defineProperty:h,getOwnPropertyNames:W,getOwnPropertyDescriptor:Y}=Object,X=
|
|
|
165
164
|
v_now,
|
|
166
165
|
v_now
|
|
167
166
|
) ON CONFLICT ("name")
|
|
168
|
-
DO UPDATE SET "
|
|
167
|
+
DO UPDATE SET "name" = EXCLUDED."name"
|
|
169
168
|
RETURNING
|
|
170
169
|
"id",
|
|
171
170
|
"current_size",
|
|
@@ -702,4 +701,4 @@ var{defineProperty:h,getOwnPropertyNames:W,getOwnPropertyDescriptor:Y}=Object,X=
|
|
|
702
701
|
WHERE "name" = p_name;
|
|
703
702
|
END;
|
|
704
703
|
$$ LANGUAGE plpgsql;
|
|
705
|
-
`]}};class A{schema;channelName;registerFn;constructor(e){this.schema=e.schema,this.channelName=e.channelName,this.registerFn=e.registerFn}create(e){let t=new c({schema:this.schema,channelName:this.channelName,name:e.name,content:e.content,lockMs:e.lockMs,delayMs:e.delayMs}),n=new Promise((E)=>{this.registerFn({sortKey:JSON.stringify([t.channelName,t.name,t.createdAt.toISOString()]),execute:(T)=>t.execute(T).then((z)=>E(z))})});return{messageId:t.id,promise:n}}}class D{schema;channelName;registerFn;constructor(e){this.schema=e.schema,this.channelName=e.channelName,this.registerFn=e.registerFn}set(e){let t=new
|
|
704
|
+
`]}};class A{schema;channelName;registerFn;constructor(e){this.schema=e.schema,this.channelName=e.channelName,this.registerFn=e.registerFn}create(e){let t=new c({schema:this.schema,channelName:this.channelName,name:e.name,content:e.content,lockMs:e.lockMs,delayMs:e.delayMs}),n=new Promise((E)=>{this.registerFn({sortKey:JSON.stringify([t.channelName,t.name,t.createdAt.toISOString()]),execute:(T)=>t.execute(T).then((z)=>E(z))})});return{messageId:t.id,promise:n}}}class D{schema;channelName;registerFn;constructor(e){this.schema=e.schema,this.channelName=e.channelName,this.registerFn=e.registerFn}set(e){let t=new l({schema:this.schema,channelName:this.channelName,maxConcurrency:e.maxConcurrency,maxSize:e.maxSize,releaseIntervalMs:e.releaseIntervalMs});this.registerFn({sortKey:JSON.stringify([t.channelName,null,t.createdAt.toISOString()]),execute:async(n)=>{await t.execute(n)}})}clear(){let e=new m({schema:this.schema,channelName:this.channelName});this.registerFn({sortKey:JSON.stringify([e.channelName,null,e.createdAt.toISOString()]),execute:async(t)=>{await e.execute(t)}})}}class p{policy;message;constructor(e){this.message=new A(e),this.policy=new D(e)}}var de=(e,t)=>{return e.sortKey.localeCompare(t.sortKey)};class M{commands;schema;constructor(e){this.commands=[],this.schema=e.schema}channel(e){return new p({schema:this.schema,channelName:e,registerFn:(t)=>{this.commands.push(t)}})}async execute(e){for(let t of this.commands.sort(de))await t.execute(e.databaseClient)}}class y{schema;channelName;constructor(e){this.schema=e.schema,this.channelName=e.channelName}async create(e){return new c({schema:this.schema,channelName:this.channelName,name:e.name,content:e.content,lockMs:e.lockMs,delayMs:e.delayMs}).execute(e.databaseClient)}}class C{schema;channelName;constructor(e){this.schema=e.schema,this.channelName=e.channelName}set(e){return new l({schema:this.schema,channelName:this.channelName,maxConcurrency:e.maxConcurrency,maxSize:e.maxSize,releaseIntervalMs:e.releaseIntervalMs}).execute(e.databaseClient)}clear(e){return new m({schema:this.schema,channelName:this.channelName}).execute(e.databaseClient)}}class I{policy;message;constructor(e){this.message=new y({schema:e.schema,channelName:e.channelName}),this.policy=new C({schema:e.schema,channelName:e.channelName})}}class L{schema;id;isUnlocked;channelName;name;content;state;numAttempts;constructor(e){this.schema=e.schema,this.id=e.id,this.channelName=e.channelName,this.isUnlocked=e.isUnlocked,this.name=e.name,this.content=e.content,this.state=e.state,this.numAttempts=e.numAttempts}async defer(e){return new o({schema:this.schema,id:this.id,numAttempts:this.numAttempts,delayMs:e.delayMs,state:e.state}).execute(e.databaseClient)}async delete(e){return new u({schema:this.schema,numAttempts:this.numAttempts,id:this.id}).execute(e.databaseClient)}async heartbeat(e){return new o({schema:this.schema,id:this.id,numAttempts:this.numAttempts}).execute(e.databaseClient)}}class v{schema;constructor(e){this.schema=e.schema}async dequeue(e){let n=await new i({schema:this.schema}).execute(e.databaseClient);if(n.resultType==="MESSAGE_DEQUEUED")return{resultType:"MESSAGE_DEQUEUED",message:new L({schema:this.schema,id:n.message.id,channelName:n.message.channelName,name:n.message.name,isUnlocked:n.message.isUnlocked,content:n.message.content,state:n.message.state,numAttempts:n.message.numAttempts})};else return n}channel(e){return new I({schema:this.schema,channelName:e})}batch(){return new M({schema:this.schema})}migrations(e={}){return[q,$,b,B,P,Q,w,H,V,k].sort((t,n)=>t.name.localeCompare(n.name)).flatMap((t)=>t.sql({schema:this.schema,eventChannel:e.eventChannel??null})).map((t)=>F(t.value))}}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var r=(e)=>({nodeType:"VALUE",value:e}),s=(e)=>({nodeType:"REF",value:e}),H=(e)=>({nodeType:"RAW",value:e}),k=(e)=>{return`'${e.replace(/'/g,"''")}'`},V=(e)=>{if(e===null)return"NULL";else if(typeof e==="string")return k(e);else if(typeof e==="number")return e.toString();else if(typeof e==="boolean")return e?"TRUE":"FALSE";else if(e instanceof Date)return`'${e.toISOString()}'`;else if(typeof e==="bigint")return e.toString();else throw new Error(`Unsupported value type: ${typeof e}`)},z=(e)=>{return`"${e.replace(/"/g,'""')}"`},W=(e)=>{if(e.nodeType==="VALUE")return V(e.value);else if(e.nodeType==="REF")return z(e.value);else if(e.nodeType==="RAW")return e.value;else throw new Error("Unsupported SQL node type")};var n=(e,...t)=>{let a=[];for(let _=0;_<e.length;_+=1)if(a.push(e[_]),_<t.length)a.push(W(t[_]));return H(a.join(""))};class
|
|
1
|
+
var r=(e)=>({nodeType:"VALUE",value:e}),s=(e)=>({nodeType:"REF",value:e}),H=(e)=>({nodeType:"RAW",value:e}),k=(e)=>{return`'${e.replace(/'/g,"''")}'`},V=(e)=>{if(e===null)return"NULL";else if(typeof e==="string")return k(e);else if(typeof e==="number")return e.toString();else if(typeof e==="boolean")return e?"TRUE":"FALSE";else if(e instanceof Date)return`'${e.toISOString()}'`;else if(typeof e==="bigint")return e.toString();else throw new Error(`Unsupported value type: ${typeof e}`)},z=(e)=>{return`"${e.replace(/"/g,'""')}"`},W=(e)=>{if(e.nodeType==="VALUE")return V(e.value);else if(e.nodeType==="REF")return z(e.value);else if(e.nodeType==="RAW")return e.value;else throw new Error("Unsupported SQL node type")};var n=(e,...t)=>{let a=[];for(let _=0;_<e.length;_+=1)if(a.push(e[_]),_<t.length)a.push(W(t[_]));return H(a.join(""))};class m{schema;channelName;createdAt;constructor(e){this.schema=e.schema,this.channelName=e.channelName,this.createdAt=new Date}sortKeyGet(){return JSON.stringify([this.channelName,null,this.createdAt.toISOString()])}async execute(e){await e.query(n`
|
|
2
2
|
SELECT 1 FROM ${s(this.schema)}."channel_policy_clear"(
|
|
3
3
|
$1
|
|
4
4
|
)
|
|
5
|
-
`.value,[this.channelName])}}class
|
|
5
|
+
`.value,[this.channelName])}}class l{schema;channelName;maxSize;maxConcurrency;releaseIntervalMs;createdAt;constructor(e){this.schema=e.schema,this.channelName=e.channelName;let t=e.maxConcurrency??null;this.maxConcurrency=t!==null?Math.max(0,t):null;let a=e.maxSize??null;this.maxSize=a!==null?Math.max(0,a):null;let _=e.releaseIntervalMs??null;this.releaseIntervalMs=_!==null?Math.max(0,_):null,this.createdAt=new Date}sortKeyGet(){return JSON.stringify([this.channelName,null,this.createdAt.toISOString()])}async execute(e){await e.query(n`
|
|
6
6
|
SELECT 1 FROM ${s(this.schema)}."channel_policy_set"(
|
|
7
7
|
$1,
|
|
8
8
|
$2::INTEGER,
|
|
@@ -37,12 +37,12 @@ var r=(e)=>({nodeType:"VALUE",value:e}),s=(e)=>({nodeType:"REF",value:e}),H=(e)=
|
|
|
37
37
|
$3::BIGINT,
|
|
38
38
|
$4
|
|
39
39
|
)
|
|
40
|
-
`.value,[this.id,this.numAttempts,this.delayMs,this.state]).then((a)=>a.rows[0]);if(t.result_code===0)return{resultType:"MESSAGE_NOT_FOUND"};else if(t.result_code===1)return{resultType:"STATE_INVALID"};else if(t.result_code===2)return{resultType:"MESSAGE_DEFERRED"};else throw new Error("Unexpected result")}}class
|
|
40
|
+
`.value,[this.id,this.numAttempts,this.delayMs,this.state]).then((a)=>a.rows[0]);if(t.result_code===0)return{resultType:"MESSAGE_NOT_FOUND"};else if(t.result_code===1)return{resultType:"STATE_INVALID"};else if(t.result_code===2)return{resultType:"MESSAGE_DEFERRED"};else throw new Error("Unexpected result")}}class L{schema;id;numAttempts;constructor(e){this.schema=e.schema,this.numAttempts=e.numAttempts,this.id=e.id}async execute(e){let t=await e.query(n`
|
|
41
41
|
SELECT * FROM ${s(this.schema)}."message_heartbeat"(
|
|
42
42
|
$1,
|
|
43
43
|
$2::BIGINT
|
|
44
44
|
)
|
|
45
|
-
`.value,[this.id,this.numAttempts]).then((a)=>a.rows[0]);if(t.result_code===0)return{resultType:"MESSAGE_NOT_FOUND"};else if(t.result_code===1)return{resultType:"MESSAGE_STATE_INVALID"};else if(t.result_code===2)return{resultType:"MESSAGE_HEARTBEATED"};else throw new Error("Unexpected result")}}var
|
|
45
|
+
`.value,[this.id,this.numAttempts]).then((a)=>a.rows[0]);if(t.result_code===0)return{resultType:"MESSAGE_NOT_FOUND"};else if(t.result_code===1)return{resultType:"MESSAGE_STATE_INVALID"};else if(t.result_code===2)return{resultType:"MESSAGE_HEARTBEATED"};else throw new Error("Unexpected result")}}var v=(e)=>{let t=e.split(`
|
|
46
46
|
`),a=Number.MAX_SAFE_INTEGER;for(let _ of t){if(_.trim().length===0)continue;let T=_.search(/\S/);a=Math.min(a,T)}return t.map((_)=>_.slice(a)).join(`
|
|
47
47
|
`).trim()};import{dirname as U}from"path";var __filename="/home/runner/work/lonnymq/lonnymq/src/core/path.ts",se=U(U(__filename)),ne=new RegExp(`^${se}/`),E=(e)=>{return e.replace(ne,"")};var __filename="/home/runner/work/lonnymq/lonnymq/src/migration/00-table-channel-policy.ts",O={name:E(__filename),sql:(e)=>{return[n`
|
|
48
48
|
CREATE TABLE ${s(e.schema)}."channel_policy" (
|
|
@@ -130,7 +130,6 @@ var r=(e)=>({nodeType:"VALUE",value:e}),s=(e)=>({nodeType:"REF",value:e}),H=(e)=
|
|
|
130
130
|
) AS $$
|
|
131
131
|
DECLARE
|
|
132
132
|
v_now TIMESTAMP;
|
|
133
|
-
v_active_next_at TIMESTAMP;
|
|
134
133
|
v_channel_policy RECORD;
|
|
135
134
|
v_channel_state RECORD;
|
|
136
135
|
v_message RECORD;
|
|
@@ -165,7 +164,7 @@ var r=(e)=>({nodeType:"VALUE",value:e}),s=(e)=>({nodeType:"REF",value:e}),H=(e)=
|
|
|
165
164
|
v_now,
|
|
166
165
|
v_now
|
|
167
166
|
) ON CONFLICT ("name")
|
|
168
|
-
DO UPDATE SET "
|
|
167
|
+
DO UPDATE SET "name" = EXCLUDED."name"
|
|
169
168
|
RETURNING
|
|
170
169
|
"id",
|
|
171
170
|
"current_size",
|
|
@@ -702,4 +701,4 @@ var r=(e)=>({nodeType:"VALUE",value:e}),s=(e)=>({nodeType:"REF",value:e}),H=(e)=
|
|
|
702
701
|
WHERE "name" = p_name;
|
|
703
702
|
END;
|
|
704
703
|
$$ LANGUAGE plpgsql;
|
|
705
|
-
`]}};class R{schema;channelName;registerFn;constructor(e){this.schema=e.schema,this.channelName=e.channelName,this.registerFn=e.registerFn}create(e){let t=new c({schema:this.schema,channelName:this.channelName,name:e.name,content:e.content,lockMs:e.lockMs,delayMs:e.delayMs}),a=new Promise((_)=>{this.registerFn({sortKey:JSON.stringify([t.channelName,t.name,t.createdAt.toISOString()]),execute:(T)=>t.execute(T).then((w)=>_(w))})});return{messageId:t.id,promise:a}}}class S{schema;channelName;registerFn;constructor(e){this.schema=e.schema,this.channelName=e.channelName,this.registerFn=e.registerFn}set(e){let t=new
|
|
704
|
+
`]}};class R{schema;channelName;registerFn;constructor(e){this.schema=e.schema,this.channelName=e.channelName,this.registerFn=e.registerFn}create(e){let t=new c({schema:this.schema,channelName:this.channelName,name:e.name,content:e.content,lockMs:e.lockMs,delayMs:e.delayMs}),a=new Promise((_)=>{this.registerFn({sortKey:JSON.stringify([t.channelName,t.name,t.createdAt.toISOString()]),execute:(T)=>t.execute(T).then((w)=>_(w))})});return{messageId:t.id,promise:a}}}class S{schema;channelName;registerFn;constructor(e){this.schema=e.schema,this.channelName=e.channelName,this.registerFn=e.registerFn}set(e){let t=new l({schema:this.schema,channelName:this.channelName,maxConcurrency:e.maxConcurrency,maxSize:e.maxSize,releaseIntervalMs:e.releaseIntervalMs});this.registerFn({sortKey:JSON.stringify([t.channelName,null,t.createdAt.toISOString()]),execute:async(a)=>{await t.execute(a)}})}clear(){let e=new m({schema:this.schema,channelName:this.channelName});this.registerFn({sortKey:JSON.stringify([e.channelName,null,e.createdAt.toISOString()]),execute:async(t)=>{await e.execute(t)}})}}class g{policy;message;constructor(e){this.message=new R(e),this.policy=new S(e)}}var _e=(e,t)=>{return e.sortKey.localeCompare(t.sortKey)};class A{commands;schema;constructor(e){this.commands=[],this.schema=e.schema}channel(e){return new g({schema:this.schema,channelName:e,registerFn:(t)=>{this.commands.push(t)}})}async execute(e){for(let t of this.commands.sort(_e))await t.execute(e.databaseClient)}}class D{schema;channelName;constructor(e){this.schema=e.schema,this.channelName=e.channelName}async create(e){return new c({schema:this.schema,channelName:this.channelName,name:e.name,content:e.content,lockMs:e.lockMs,delayMs:e.delayMs}).execute(e.databaseClient)}}class p{schema;channelName;constructor(e){this.schema=e.schema,this.channelName=e.channelName}set(e){return new l({schema:this.schema,channelName:this.channelName,maxConcurrency:e.maxConcurrency,maxSize:e.maxSize,releaseIntervalMs:e.releaseIntervalMs}).execute(e.databaseClient)}clear(e){return new m({schema:this.schema,channelName:this.channelName}).execute(e.databaseClient)}}class M{policy;message;constructor(e){this.message=new D({schema:e.schema,channelName:e.channelName}),this.policy=new p({schema:e.schema,channelName:e.channelName})}}class y{schema;id;isUnlocked;channelName;name;content;state;numAttempts;constructor(e){this.schema=e.schema,this.id=e.id,this.channelName=e.channelName,this.isUnlocked=e.isUnlocked,this.name=e.name,this.content=e.content,this.state=e.state,this.numAttempts=e.numAttempts}async defer(e){return new o({schema:this.schema,id:this.id,numAttempts:this.numAttempts,delayMs:e.delayMs,state:e.state}).execute(e.databaseClient)}async delete(e){return new d({schema:this.schema,numAttempts:this.numAttempts,id:this.id}).execute(e.databaseClient)}async heartbeat(e){return new o({schema:this.schema,id:this.id,numAttempts:this.numAttempts}).execute(e.databaseClient)}}class Q{schema;constructor(e){this.schema=e.schema}async dequeue(e){let a=await new u({schema:this.schema}).execute(e.databaseClient);if(a.resultType==="MESSAGE_DEQUEUED")return{resultType:"MESSAGE_DEQUEUED",message:new y({schema:this.schema,id:a.message.id,channelName:a.message.channelName,name:a.message.name,isUnlocked:a.message.isUnlocked,content:a.message.content,state:a.message.state,numAttempts:a.message.numAttempts})};else return a}channel(e){return new M({schema:this.schema,channelName:e})}batch(){return new A({schema:this.schema})}migrations(e={}){return[O,f,x,G,F,q,$,b,P,B].sort((t,a)=>t.name.localeCompare(a.name)).flatMap((t)=>t.sql({schema:this.schema,eventChannel:e.eventChannel??null})).map((t)=>v(t.value))}}export{X as queueEventDecode,Q as Queue,L as MessageHeartbeatCommand,u as MessageDequeueCommand,d as MessageDeleteCommand,o as MessageDeferCommand,c as MessageCreateCommand,l as ChannelPolicySetCommand,m as ChannelPolicyClearCommand};
|