@suss/packs 0.35.1 → 0.37.0
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/activejob.d.ts +60 -0
- package/dist/activejob.js +48 -0
- package/dist/activerecord.d.ts +0 -55
- package/dist/apollo-client.js +14 -3
- package/dist/aws-lambda-python.d.ts +1 -0
- package/dist/aws-lambda-python.js +10 -0
- package/dist/aws-lambda-ruby.d.ts +1 -0
- package/dist/aws-lambda-ruby.js +10 -0
- package/dist/aws-lambda.js +4 -427
- package/dist/bullmq.d.ts +1 -0
- package/dist/bullmq.js +138 -0
- package/dist/celery.d.ts +1 -0
- package/dist/celery.js +53 -0
- package/dist/chunk-SH7CMRMX.js +577 -0
- package/dist/graphql-ruby.js +92 -8
- package/dist/node.js +89 -109
- package/dist/prisma.js +50 -0
- package/dist/rails.js +66 -10
- package/dist/sidekiq.d.ts +1 -0
- package/dist/sidekiq.js +37 -0
- package/package.json +39 -10
package/dist/bullmq.js
ADDED
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// ../framework/bullmq/dist/index.js
|
|
2
|
+
import { constructedFrom, messageSends, pack } from "@suss/recognize";
|
|
3
|
+
var BULLMQ = "bullmq";
|
|
4
|
+
var QUEUE = constructedFrom({ from: [BULLMQ], named: ["Queue"] });
|
|
5
|
+
var FLOW_PRODUCER = constructedFrom({
|
|
6
|
+
from: [BULLMQ],
|
|
7
|
+
named: ["FlowProducer"]
|
|
8
|
+
});
|
|
9
|
+
var QUEUE_BUILT_WITH = [
|
|
10
|
+
{ argument: { of: [{ to: "receiver" }], at: 0 } }
|
|
11
|
+
];
|
|
12
|
+
var QUEUE_NAMED_IN_THE_FLOW = [
|
|
13
|
+
{ property: ["queueName"] }
|
|
14
|
+
];
|
|
15
|
+
function sendDeclarations() {
|
|
16
|
+
return [
|
|
17
|
+
messageSends({
|
|
18
|
+
wire: "bullmq",
|
|
19
|
+
client: QUEUE,
|
|
20
|
+
messages: { each: "theInput" },
|
|
21
|
+
channel: QUEUE_BUILT_WITH,
|
|
22
|
+
body: { whole: "message" },
|
|
23
|
+
routingKey: { at: 0 },
|
|
24
|
+
unsettledName: "nothing"
|
|
25
|
+
}).methods({ add: { input: { at: 1 } } }).example('queue.add("welcome", { userId })'),
|
|
26
|
+
messageSends({
|
|
27
|
+
wire: "bullmq",
|
|
28
|
+
client: QUEUE,
|
|
29
|
+
messages: { each: "inTheInput" },
|
|
30
|
+
channel: QUEUE_BUILT_WITH,
|
|
31
|
+
body: "data",
|
|
32
|
+
routingKey: "name",
|
|
33
|
+
unsettledName: "nothing"
|
|
34
|
+
}).methods({ addBulk: { input: { at: 0 } } }).example('queue.addBulk([{ name: "welcome", data: { userId } }])'),
|
|
35
|
+
// A job scheduler adds a job on every tick, from the template it is
|
|
36
|
+
// given here.
|
|
37
|
+
messageSends({
|
|
38
|
+
wire: "bullmq",
|
|
39
|
+
client: QUEUE,
|
|
40
|
+
messages: { each: "theInput" },
|
|
41
|
+
channel: QUEUE_BUILT_WITH,
|
|
42
|
+
body: "data",
|
|
43
|
+
routingKey: "name",
|
|
44
|
+
unsettledName: "nothing"
|
|
45
|
+
}).methods({ upsertJobScheduler: { input: { at: 2 } } }).example(
|
|
46
|
+
'queue.upsertJobScheduler("nightly", { pattern: "0 0 * * *" }, { name: "digest", data: {} })'
|
|
47
|
+
),
|
|
48
|
+
messageSends({
|
|
49
|
+
wire: "bullmq",
|
|
50
|
+
client: FLOW_PRODUCER,
|
|
51
|
+
messages: { each: "theInput" },
|
|
52
|
+
channel: QUEUE_NAMED_IN_THE_FLOW,
|
|
53
|
+
body: "data",
|
|
54
|
+
routingKey: "name",
|
|
55
|
+
unsettledName: "nothing"
|
|
56
|
+
}).methods({ add: { input: { at: 0 } } }).example(
|
|
57
|
+
'flow.add({ name: "render", queueName: "renders", data: { id } })'
|
|
58
|
+
),
|
|
59
|
+
messageSends({
|
|
60
|
+
wire: "bullmq",
|
|
61
|
+
client: FLOW_PRODUCER,
|
|
62
|
+
messages: { each: "inTheInput" },
|
|
63
|
+
channel: QUEUE_NAMED_IN_THE_FLOW,
|
|
64
|
+
body: "data",
|
|
65
|
+
routingKey: "name",
|
|
66
|
+
unsettledName: "nothing"
|
|
67
|
+
}).methods({ addBulk: { input: { at: 0 } } }).example(
|
|
68
|
+
'flow.addBulk([{ name: "render", queueName: "renders", data: { id } }])'
|
|
69
|
+
)
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
function bullmqFramework() {
|
|
73
|
+
const sends = pack("bullmq", sendDeclarations(), {
|
|
74
|
+
languages: ["typescript", "javascript"],
|
|
75
|
+
recognizedAs: "@suss/framework-bullmq"
|
|
76
|
+
});
|
|
77
|
+
return {
|
|
78
|
+
...sends,
|
|
79
|
+
discovery: [
|
|
80
|
+
{
|
|
81
|
+
kind: "consumer",
|
|
82
|
+
match: {
|
|
83
|
+
type: "callbackArgument",
|
|
84
|
+
importModule: BULLMQ,
|
|
85
|
+
importName: "Worker",
|
|
86
|
+
callbackPosition: 1
|
|
87
|
+
},
|
|
88
|
+
binding: {
|
|
89
|
+
semantics: "message-bus",
|
|
90
|
+
messageBus: "bullmq",
|
|
91
|
+
channel: { from: "callArgument", position: 0 }
|
|
92
|
+
},
|
|
93
|
+
requiresImport: [BULLMQ]
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
terminals: [
|
|
97
|
+
// A processor's return value is the job's result, which BullMQ
|
|
98
|
+
// stores and nothing here pairs yet.
|
|
99
|
+
{
|
|
100
|
+
kind: "return",
|
|
101
|
+
match: { type: "returnStatement", excludeCallReturns: false },
|
|
102
|
+
extraction: {}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
kind: "throw",
|
|
106
|
+
match: { type: "throwExpression" },
|
|
107
|
+
extraction: {}
|
|
108
|
+
},
|
|
109
|
+
// Most processors return nothing, and a job completes when its
|
|
110
|
+
// processor runs off the end.
|
|
111
|
+
{
|
|
112
|
+
kind: "return",
|
|
113
|
+
match: { type: "functionFallthrough" },
|
|
114
|
+
extraction: {}
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
// The job is not the message: what the add sent is `job.data`, so
|
|
118
|
+
// the job keeps a role of its own rather than the one a message has.
|
|
119
|
+
inputMapping: {
|
|
120
|
+
type: "positionalParams",
|
|
121
|
+
params: [
|
|
122
|
+
{ position: 0, role: "job" },
|
|
123
|
+
{ position: 1, role: "token" }
|
|
124
|
+
]
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
var declares = {
|
|
129
|
+
kind: "framework",
|
|
130
|
+
package: "@suss/framework-bullmq",
|
|
131
|
+
dependencies: [{ ecosystem: "npm", name: "bullmq" }],
|
|
132
|
+
reads: "BullMQ workers and queues: each worker's processor is a consumer on its queue, and each add to a queue is a message send on it."
|
|
133
|
+
};
|
|
134
|
+
var index_default = bullmqFramework;
|
|
135
|
+
export {
|
|
136
|
+
declares,
|
|
137
|
+
index_default as default
|
|
138
|
+
};
|
package/dist/celery.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { declares, default } from '@suss/framework-celery';
|
package/dist/celery.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// ../framework/celery/dist/index.js
|
|
2
|
+
function celeryJobQueue() {
|
|
3
|
+
return {
|
|
4
|
+
messageBus: "celery",
|
|
5
|
+
module: "celery",
|
|
6
|
+
taskDecorators: ["task", "shared_task"],
|
|
7
|
+
nameKeyword: "name",
|
|
8
|
+
queueKeyword: "queue",
|
|
9
|
+
defaultName: "modulePath",
|
|
10
|
+
enqueueMethods: [
|
|
11
|
+
{ method: "delay", arguments: { type: "spread" } },
|
|
12
|
+
{
|
|
13
|
+
method: "apply_async",
|
|
14
|
+
arguments: {
|
|
15
|
+
type: "packed",
|
|
16
|
+
args: { argument: 0, keyword: "args" },
|
|
17
|
+
kwargs: { argument: 1, keyword: "kwargs" }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
sendByName: [
|
|
22
|
+
{
|
|
23
|
+
method: "send_task",
|
|
24
|
+
name: { argument: 0, keyword: "name" },
|
|
25
|
+
arguments: {
|
|
26
|
+
type: "packed",
|
|
27
|
+
args: { argument: 1, keyword: "args" },
|
|
28
|
+
kwargs: { argument: 2, keyword: "kwargs" }
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
apps: ["Celery", "current_app"]
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function celeryFramework() {
|
|
36
|
+
return {
|
|
37
|
+
name: "celery",
|
|
38
|
+
protocol: "celery",
|
|
39
|
+
discovery: [],
|
|
40
|
+
jobQueues: [celeryJobQueue()]
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
var declares = {
|
|
44
|
+
kind: "framework",
|
|
45
|
+
package: "@suss/framework-celery",
|
|
46
|
+
dependencies: [{ ecosystem: "pypi", name: "celery" }],
|
|
47
|
+
reads: "Celery tasks (Python). A function under `@app.task` or `@shared_task` is the consumer of its task, and `.delay`, `.apply_async` and `send_task` are sends to it, so a route that enqueues a task reaches what the task does."
|
|
48
|
+
};
|
|
49
|
+
var index_default = celeryFramework;
|
|
50
|
+
export {
|
|
51
|
+
declares,
|
|
52
|
+
index_default as default
|
|
53
|
+
};
|