@requence/service 0.7.1
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/CHANGELOG.md +10 -0
- package/README.md +330 -0
- package/build/chunk-6w7td62p.js +56 -0
- package/build/chunk-6w7td62p.js.map +10 -0
- package/build/cli.js +166 -0
- package/build/cli.js.map +10 -0
- package/build/index.js +1229 -0
- package/build/index.js.map +24 -0
- package/build/types/helpers/src/files/RequenceFile.d.ts +40 -0
- package/build/types/helpers/src/files/RequenceFile.d.ts.map +1 -0
- package/build/types/helpers/src/files/RequenceStream.d.ts +32 -0
- package/build/types/helpers/src/files/RequenceStream.d.ts.map +1 -0
- package/build/types/helpers/src/files/fileObject.d.ts +16 -0
- package/build/types/helpers/src/files/fileObject.d.ts.map +1 -0
- package/build/types/helpers/src/files/index.d.ts +7 -0
- package/build/types/helpers/src/files/index.d.ts.map +1 -0
- package/build/types/helpers/src/files/isValidMimeType.d.ts +5 -0
- package/build/types/helpers/src/files/isValidMimeType.d.ts.map +1 -0
- package/build/types/helpers/src/files/mapOutput.d.ts +10 -0
- package/build/types/helpers/src/files/mapOutput.d.ts.map +1 -0
- package/build/types/helpers/src/files/streamObject.d.ts +14 -0
- package/build/types/helpers/src/files/streamObject.d.ts.map +1 -0
- package/build/types/helpers/src/files/types.d.ts +4 -0
- package/build/types/helpers/src/files/types.d.ts.map +1 -0
- package/build/types/helpers/src/index.d.ts +13 -0
- package/build/types/helpers/src/index.d.ts.map +1 -0
- package/build/types/helpers/src/jsonschema/mapSchema.d.ts +20 -0
- package/build/types/helpers/src/jsonschema/mapSchema.d.ts.map +1 -0
- package/build/types/helpers/src/jsonschema/types.d.ts +13 -0
- package/build/types/helpers/src/jsonschema/types.d.ts.map +1 -0
- package/build/types/helpers/src/jsonschema/validate.d.ts +32 -0
- package/build/types/helpers/src/jsonschema/validate.d.ts.map +1 -0
- package/build/types/helpers/src/jsonschema/zod.d.ts +17 -0
- package/build/types/helpers/src/jsonschema/zod.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/NodeTree.d.ts +510 -0
- package/build/types/helpers/src/protocol/NodeTree.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/command.d.ts +507 -0
- package/build/types/helpers/src/protocol/command.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/helpers.d.ts +7 -0
- package/build/types/helpers/src/protocol/helpers.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/index.d.ts +8 -0
- package/build/types/helpers/src/protocol/index.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/nodeType.d.ts +187 -0
- package/build/types/helpers/src/protocol/nodeType.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/taskOptions.d.ts +23 -0
- package/build/types/helpers/src/protocol/taskOptions.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/templateNodeTypes.d.ts +267 -0
- package/build/types/helpers/src/protocol/templateNodeTypes.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/treeNodes.d.ts +874 -0
- package/build/types/helpers/src/protocol/treeNodes.d.ts.map +1 -0
- package/build/types/helpers/src/protocol/update.d.ts +406 -0
- package/build/types/helpers/src/protocol/update.d.ts.map +1 -0
- package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts +3 -0
- package/build/types/helpers/src/utils/callbackToAsyncIterator.d.ts.map +1 -0
- package/build/types/helpers/src/utils/clone.d.ts +3 -0
- package/build/types/helpers/src/utils/clone.d.ts.map +1 -0
- package/build/types/helpers/src/utils/createObjectProxy.d.ts +2 -0
- package/build/types/helpers/src/utils/createObjectProxy.d.ts.map +1 -0
- package/build/types/helpers/src/utils/debounce.d.ts +4 -0
- package/build/types/helpers/src/utils/debounce.d.ts.map +1 -0
- package/build/types/helpers/src/utils/guards.d.ts +3 -0
- package/build/types/helpers/src/utils/guards.d.ts.map +1 -0
- package/build/types/helpers/src/utils/mapData.d.ts +18 -0
- package/build/types/helpers/src/utils/mapData.d.ts.map +1 -0
- package/build/types/helpers/src/utils/matchSchema.d.ts +4 -0
- package/build/types/helpers/src/utils/matchSchema.d.ts.map +1 -0
- package/build/types/helpers/src/utils/obfuscate.d.ts +4 -0
- package/build/types/helpers/src/utils/obfuscate.d.ts.map +1 -0
- package/build/types/helpers/src/utils/obj.d.ts +4 -0
- package/build/types/helpers/src/utils/obj.d.ts.map +1 -0
- package/build/types/helpers/src/utils/requenceCallback.d.ts +17 -0
- package/build/types/helpers/src/utils/requenceCallback.d.ts.map +1 -0
- package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts +8 -0
- package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts.map +1 -0
- package/build/types/helpers/src/utils/types.d.ts +7 -0
- package/build/types/helpers/src/utils/types.d.ts.map +1 -0
- package/build/types/service/src/createAmqpConnection.d.ts +44 -0
- package/build/types/service/src/createAmqpConnection.d.ts.map +1 -0
- package/build/types/service/src/errors.d.ts +3 -0
- package/build/types/service/src/errors.d.ts.map +1 -0
- package/build/types/service/src/helpers.d.ts +98 -0
- package/build/types/service/src/helpers.d.ts.map +1 -0
- package/build/types/service/src/index.d.ts +20 -0
- package/build/types/service/src/index.d.ts.map +1 -0
- package/build/types/service/src/macro.d.ts +2 -0
- package/build/types/service/src/macro.d.ts.map +1 -0
- package/build/types/service/src/mapInput.d.ts +2 -0
- package/build/types/service/src/mapInput.d.ts.map +1 -0
- package/build/types/service/src/utils.d.ts +6 -0
- package/build/types/service/src/utils.d.ts.map +1 -0
- package/package.json +38 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# @requence/service
|
|
2
|
+
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 54b16f6: Fix startup race condition where the backchannel queue's QueueBind could fire
|
|
8
|
+
before assertQueue completed, causing a 404 NOT_FOUND error. Moved the
|
|
9
|
+
backchannel setup into the primary channel setup function to ensure sequential
|
|
10
|
+
execution on every (re)connect.
|
package/README.md
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
# @requence/service
|
|
2
|
+
|
|
3
|
+
This package connects a TypeScript / Bun service to the Requence operator. It manages message retrieval, processing, and result delivery.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @requence/service
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Authentication
|
|
12
|
+
|
|
13
|
+
Every service needs an **access token** to connect. Copy it from the **Services** list view in the Requence UI by clicking **Copy credentials**.
|
|
14
|
+
|
|
15
|
+
The token is resolved in this order:
|
|
16
|
+
|
|
17
|
+
1. `accessToken` option passed to `createService()`
|
|
18
|
+
2. `REQUENCE_SERVICE_ACCESS_TOKEN` or `REQUENCE_ACCESS_TOKEN` environment variable
|
|
19
|
+
3. `requence.service.accessToken` or `requence.accessToken` in `package.json`
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
REQUENCE_SERVICE_ACCESS_TOKEN=your-token bun run index.ts
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { createService } from '@requence/service'
|
|
29
|
+
|
|
30
|
+
createService('1.0.0', (ctx) => {
|
|
31
|
+
return { message: `Hello, ${ctx.input.name}!` }
|
|
32
|
+
})
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The second argument to `createService` is the **version** of the service definition you are implementing. When Requence dispatches a message, the handler runs and the return value is sent back as the result.
|
|
36
|
+
|
|
37
|
+
### Options object
|
|
38
|
+
|
|
39
|
+
Instead of a bare version string, you can pass an options object:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import { createService } from '@requence/service'
|
|
43
|
+
|
|
44
|
+
createService(
|
|
45
|
+
{
|
|
46
|
+
version: '1.0.0',
|
|
47
|
+
prefetch: 5, // process up to 5 messages in parallel (default: 1)
|
|
48
|
+
connectionTimeout: 30_000, // ms to wait before throwing (default: 3000)
|
|
49
|
+
silent: false, // suppress lifecycle logs
|
|
50
|
+
},
|
|
51
|
+
async (ctx) => {
|
|
52
|
+
return processData(ctx.input)
|
|
53
|
+
},
|
|
54
|
+
)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Return value
|
|
58
|
+
|
|
59
|
+
`createService` returns a `ServiceApi` object immediately (the connection is established in the background):
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
const service = createService('1.0.0', handler)
|
|
63
|
+
|
|
64
|
+
// wait for the connection to be ready
|
|
65
|
+
await service.open()
|
|
66
|
+
|
|
67
|
+
// gracefully close the connection
|
|
68
|
+
await service.close()
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Context API
|
|
72
|
+
|
|
73
|
+
Every handler receives a `ctx` object.
|
|
74
|
+
|
|
75
|
+
### Data access
|
|
76
|
+
|
|
77
|
+
| Property | Description |
|
|
78
|
+
|---|---|
|
|
79
|
+
| `ctx.input` | The input data routed to this service node from the task template |
|
|
80
|
+
| `ctx.configuration` | The static configuration set on the service node in the UI |
|
|
81
|
+
| `ctx.taskId` | The unique ID of the current task execution |
|
|
82
|
+
|
|
83
|
+
### Logging
|
|
84
|
+
|
|
85
|
+
`ctx.debug` sends log messages to the Requence UI in real time:
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
ctx.debug.log('Processing started')
|
|
89
|
+
ctx.debug.info('Step complete', { step: 1 })
|
|
90
|
+
ctx.debug.warn('Something looks off')
|
|
91
|
+
ctx.debug.error('An error occurred', error)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Flow control
|
|
95
|
+
|
|
96
|
+
#### `ctx.retry(delay?)`
|
|
97
|
+
|
|
98
|
+
Instructs Requence to retry this service after an optional delay in milliseconds (minimum 100 ms). No code executes after this call.
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
createService('1.0.0', async (ctx) => {
|
|
102
|
+
const db = await getDbConnection()
|
|
103
|
+
|
|
104
|
+
if (!db.isConnected) {
|
|
105
|
+
ctx.retry(2_000) // retry in 2 seconds
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return db.query('SELECT ...')
|
|
109
|
+
})
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
> **Note:** It is your responsibility to prevent infinite retry loops.
|
|
113
|
+
|
|
114
|
+
#### `ctx.abort(reason?)`
|
|
115
|
+
|
|
116
|
+
Instructs Requence to abort this service immediately. If the service node's **on fail** output is not connected, the entire task fails.
|
|
117
|
+
|
|
118
|
+
```typescript
|
|
119
|
+
createService('1.0.0', (ctx) => {
|
|
120
|
+
if (!ctx.input.requiredField) {
|
|
121
|
+
ctx.abort('Missing required field')
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
return processData(ctx.input)
|
|
125
|
+
})
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### `ctx.skip()`
|
|
129
|
+
|
|
130
|
+
Puts the message back on the queue without processing it. The next available service instance will receive it instead.
|
|
131
|
+
|
|
132
|
+
#### `ctx.toOutput(name, value)`
|
|
133
|
+
|
|
134
|
+
Routes the result to a specific **named output** on the service node. Use this when your service definition has multiple outputs:
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
createService('1.0.0', (ctx) => {
|
|
138
|
+
if (ctx.input.type === 'pdf') {
|
|
139
|
+
return ctx.toOutput('pdf', { url: '...' })
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return ctx.toOutput('other', { raw: ctx.input })
|
|
143
|
+
})
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
#### `ctx.defer(reason?)`
|
|
147
|
+
|
|
148
|
+
Marks the message as **deferred**. The service acknowledges the message but signals that the result will be delivered later via `service.act()`. Returns a **message key** that you must store and pass to `act()`:
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
createService('1.0.0', (ctx) => {
|
|
152
|
+
const messageKey = ctx.defer('waiting for external process')
|
|
153
|
+
externalQueue.push({ messageKey, payload: ctx.input })
|
|
154
|
+
// handler returns — message is held open until act() is called
|
|
155
|
+
})
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
#### `ctx.terminated`
|
|
159
|
+
|
|
160
|
+
A `Promise` that resolves when the task is stopped (cancelled via the UI or API, or terminated by another node). Use it in continuous/generator services to know when to stop producing values.
|
|
161
|
+
|
|
162
|
+
`ctx.terminated.signal` is a native [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) that fires at the same moment — pass it to any abort-aware API:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
import { setTimeout } from 'node:timers/promises'
|
|
166
|
+
import { createService } from '@requence/service'
|
|
167
|
+
|
|
168
|
+
// Poll every 5 seconds, exit immediately when the task is stopped
|
|
169
|
+
createService('1.0.0', async function* (ctx) {
|
|
170
|
+
while (true) {
|
|
171
|
+
await setTimeout(5_000, null, { signal: ctx.terminated.signal })
|
|
172
|
+
yield await pollForUpdates()
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
Or race against it directly:
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
const result = await Promise.race([
|
|
181
|
+
fetchData(),
|
|
182
|
+
ctx.terminated,
|
|
183
|
+
])
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
> The framework automatically catches the `AbortError` thrown by abort-aware APIs when the task is terminated — no `try/catch` needed inside a generator.
|
|
187
|
+
|
|
188
|
+
## Continuous (Generator) Mode
|
|
189
|
+
|
|
190
|
+
When a service node is configured in **continuous mode**, the handler can be an async generator. Each `yield` sends an incremental result to Requence; the final `return` (or generator completion) signals the end of processing:
|
|
191
|
+
|
|
192
|
+
```typescript
|
|
193
|
+
createService('1.0.0', async function* (ctx) {
|
|
194
|
+
for (const chunk of await fetchChunks(ctx.input)) {
|
|
195
|
+
yield { chunk }
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
The generator is terminated automatically when `ctx.terminated` resolves. Yielded values are still sent before the generator exits.
|
|
201
|
+
|
|
202
|
+
## Deferred Delivery via `service.act()`
|
|
203
|
+
|
|
204
|
+
After deferring a message with `ctx.defer()`, use `service.act()` to deliver the result later — even from a different process run:
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
const service = createService('1.0.0', (ctx) => {
|
|
208
|
+
const messageKey = ctx.defer()
|
|
209
|
+
saveMessageKey(ctx.taskId, messageKey)
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
// ... in a webhook handler or background job:
|
|
213
|
+
await service.act(messageKey, async (api) => {
|
|
214
|
+
api.send({ result: 'done' })
|
|
215
|
+
// or: api.sendToOutput('success', { result: 'done' })
|
|
216
|
+
// or: api.abort('something went wrong')
|
|
217
|
+
})
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
`act()` also supports returning a value or an iterable directly from the actor function, which behaves the same as calling `api.send()` for each value.
|
|
221
|
+
|
|
222
|
+
## Dev Overlay
|
|
223
|
+
|
|
224
|
+
When developing locally alongside a production service, use a **dev token** (your personal access token) to register a dev instance. Requence routes your own tasks to the dev instance instead of the production pool:
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
import { createService } from '@requence/service'
|
|
228
|
+
|
|
229
|
+
createService(
|
|
230
|
+
{
|
|
231
|
+
version: '1.0.0',
|
|
232
|
+
devToken: process.env.REQUENCE_DEV_TOKEN,
|
|
233
|
+
},
|
|
234
|
+
(ctx) => ctx.input,
|
|
235
|
+
)
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
The dev token is resolved in the same order as the access token — option, `REQUENCE_SERVICE_DEV_TOKEN` / `REQUENCE_DEV_TOKEN` env var, or `requence.service.devToken` / `requence.devToken` in `package.json`.
|
|
239
|
+
|
|
240
|
+
## CLI — Generate Types
|
|
241
|
+
|
|
242
|
+
The package ships with a CLI that generates TypeScript types derived from the schemas you defined in the Requence UI (input, configuration, and outputs):
|
|
243
|
+
|
|
244
|
+
```bash
|
|
245
|
+
npx requence-service generate-types
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
This creates a `requence-env.d.ts` file in your project root. TypeScript picks it up automatically — `ctx.input`, `ctx.configuration`, and `ctx.toOutput()` calls become fully typed.
|
|
249
|
+
|
|
250
|
+
### Options
|
|
251
|
+
|
|
252
|
+
| Option | Default | Description |
|
|
253
|
+
|---|---|---|
|
|
254
|
+
| `--access-token` | — | Service access token (falls back to env / config file) |
|
|
255
|
+
| `--dev-token` | — | Personal access token for branch-specific types |
|
|
256
|
+
| `--outfile` | `requence-env.d.ts` | Name of the generated type file |
|
|
257
|
+
| `--outdir` | `.` | Directory to write the type file to |
|
|
258
|
+
| `--watch` | `false` | Watch for schema changes and regenerate automatically |
|
|
259
|
+
| `--clear` / `--no-clear` | `true` | Clear the terminal on watch updates |
|
|
260
|
+
|
|
261
|
+
### Watch mode
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
npx requence-service generate-types --watch
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
The CLI connects via server-sent events and regenerates types whenever a schema changes in the UI.
|
|
268
|
+
|
|
269
|
+
## Utility Helpers
|
|
270
|
+
|
|
271
|
+
### `wrapIterable(iterable)`
|
|
272
|
+
|
|
273
|
+
Wraps any `Iterable` or `AsyncIterable` so that iteration stops automatically when `ctx.terminated` resolves:
|
|
274
|
+
|
|
275
|
+
```typescript
|
|
276
|
+
import { wrapIterable } from '@requence/service'
|
|
277
|
+
|
|
278
|
+
createService('1.0.0', async function* (ctx) {
|
|
279
|
+
for await (const event of wrapIterable(eventStream)) {
|
|
280
|
+
yield processEvent(event)
|
|
281
|
+
}
|
|
282
|
+
})
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### `asyncEventEmitter(initial?)`
|
|
286
|
+
|
|
287
|
+
Creates an async-iterable event emitter that integrates with `ctx.terminated`. Push values from outside (e.g. callbacks or event listeners) and iterate them inside the generator:
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
import { asyncEventEmitter, createService } from '@requence/service'
|
|
291
|
+
|
|
292
|
+
createService('1.0.0', async function* (ctx) {
|
|
293
|
+
const emitter = asyncEventEmitter<string>()
|
|
294
|
+
|
|
295
|
+
externalSource.on('data', (value) => emitter.push(value))
|
|
296
|
+
|
|
297
|
+
for await (const value of emitter) {
|
|
298
|
+
yield { value }
|
|
299
|
+
}
|
|
300
|
+
})
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
The iterator exits automatically when the task is terminated.
|
|
304
|
+
|
|
305
|
+
## Full Example
|
|
306
|
+
|
|
307
|
+
```typescript
|
|
308
|
+
import { createService } from '@requence/service'
|
|
309
|
+
import { db } from './database.js'
|
|
310
|
+
|
|
311
|
+
createService(
|
|
312
|
+
{
|
|
313
|
+
version: '1.2.3',
|
|
314
|
+
prefetch: 2, // process 2 messages in parallel
|
|
315
|
+
},
|
|
316
|
+
async (ctx) => {
|
|
317
|
+
if (!db.isConnected) {
|
|
318
|
+
ctx.retry(2_000) // wait 2s for the DB to recover
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
if (!ctx.input.ocrData) {
|
|
322
|
+
ctx.abort('OCR data is mandatory')
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
const result = await db.getDataBasedOnOcr(ctx.input.ocrData)
|
|
326
|
+
|
|
327
|
+
return result
|
|
328
|
+
},
|
|
329
|
+
)
|
|
330
|
+
```
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// ../helpers/src/utils/obfuscate.ts
|
|
2
|
+
var separator = "";
|
|
3
|
+
var base65Chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$";
|
|
4
|
+
var base65CharToIndex = {};
|
|
5
|
+
for (let i = 0;i < base65Chars.length; i++) {
|
|
6
|
+
base65CharToIndex[base65Chars[i]] = i;
|
|
7
|
+
}
|
|
8
|
+
function obfuscate(...parts) {
|
|
9
|
+
const str = parts.join(separator);
|
|
10
|
+
let binaryString = "";
|
|
11
|
+
for (let i = 0;i < str.length; i++) {
|
|
12
|
+
const charCode = str.charCodeAt(i);
|
|
13
|
+
binaryString += charCode.toString(2).padStart(16, "0");
|
|
14
|
+
}
|
|
15
|
+
let encodedString = "";
|
|
16
|
+
const chunkSize = 6;
|
|
17
|
+
let paddingCount = 0;
|
|
18
|
+
for (let i = 0;i < binaryString.length; i += chunkSize) {
|
|
19
|
+
let chunk = binaryString.substring(i, i + chunkSize);
|
|
20
|
+
if (chunk.length < chunkSize) {
|
|
21
|
+
paddingCount = chunkSize - chunk.length;
|
|
22
|
+
chunk = chunk.padEnd(chunkSize, "0");
|
|
23
|
+
}
|
|
24
|
+
const decimalValue = parseInt(chunk, 2);
|
|
25
|
+
encodedString += base65Chars[decimalValue];
|
|
26
|
+
}
|
|
27
|
+
return encodedString + paddingCount.toString();
|
|
28
|
+
}
|
|
29
|
+
function deobfuscate(str) {
|
|
30
|
+
const paddingCount = parseInt(str.slice(-1), 10);
|
|
31
|
+
str = str.slice(0, -1);
|
|
32
|
+
let binaryString = "";
|
|
33
|
+
for (let i = 0;i < str.length; i++) {
|
|
34
|
+
const decimalValue = base65CharToIndex[str[i]];
|
|
35
|
+
const binaryChunk = decimalValue.toString(2).padStart(6, "0");
|
|
36
|
+
binaryString += binaryChunk;
|
|
37
|
+
}
|
|
38
|
+
if (paddingCount > 0) {
|
|
39
|
+
binaryString = binaryString.slice(0, -paddingCount);
|
|
40
|
+
}
|
|
41
|
+
let decodedString = "";
|
|
42
|
+
const charSize = 16;
|
|
43
|
+
for (let i = 0;i < binaryString.length; i += charSize) {
|
|
44
|
+
const byte = binaryString.substring(i, i + charSize);
|
|
45
|
+
if (byte.length === 16) {
|
|
46
|
+
const charCode = parseInt(byte, 2);
|
|
47
|
+
decodedString += String.fromCharCode(charCode);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return decodedString.split(separator);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export { obfuscate, deobfuscate };
|
|
54
|
+
|
|
55
|
+
//# debugId=E6AE9819DA2983FC64756E2164756E21
|
|
56
|
+
//# sourceMappingURL=chunk-6w7td62p.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../helpers/src/utils/obfuscate.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"const separator = '\\u{f6ee}'\n\nconst base65Chars =\n 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$'\n\nconst base65CharToIndex: Record<string, number> = {}\nfor (let i = 0; i < base65Chars.length; i++) {\n base65CharToIndex[base65Chars[i]] = i\n}\n\nexport function obfuscate(...parts: Array<string>) {\n const str = parts.join(separator)\n let binaryString = ''\n\n for (let i = 0; i < str.length; i++) {\n const charCode = str.charCodeAt(i)\n binaryString += charCode.toString(2).padStart(16, '0')\n }\n\n let encodedString = ''\n const chunkSize = 6\n let paddingCount = 0\n\n for (let i = 0; i < binaryString.length; i += chunkSize) {\n let chunk = binaryString.substring(i, i + chunkSize)\n\n if (chunk.length < chunkSize) {\n paddingCount = chunkSize - chunk.length\n chunk = chunk.padEnd(chunkSize, '0')\n }\n\n const decimalValue = parseInt(chunk, 2)\n encodedString += base65Chars[decimalValue]\n }\n\n return encodedString + paddingCount.toString()\n}\n\nexport function randomString(length: number) {\n const randomValues = new Uint8Array(length)\n crypto.getRandomValues(randomValues)\n\n let randomString = ''\n for (let i = 0; i < length; i++) {\n randomString += base65Chars[randomValues[i] % base65Chars.length]\n }\n\n return randomString\n}\n\nexport function deobfuscate(str: string) {\n const paddingCount = parseInt(str.slice(-1), 10)\n str = str.slice(0, -1)\n\n let binaryString = ''\n\n for (let i = 0; i < str.length; i++) {\n const decimalValue = base65CharToIndex[str[i]]\n const binaryChunk = decimalValue.toString(2).padStart(6, '0')\n binaryString += binaryChunk\n }\n\n if (paddingCount > 0) {\n binaryString = binaryString.slice(0, -paddingCount)\n }\n\n let decodedString = ''\n const charSize = 16\n\n for (let i = 0; i < binaryString.length; i += charSize) {\n const byte = binaryString.substring(i, i + charSize)\n if (byte.length === 16) {\n const charCode = parseInt(byte, 2)\n decodedString += String.fromCharCode(charCode)\n }\n }\n\n return decodedString.split(separator)\n}\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";AAAA,IAAM,YAAY;AAElB,IAAM,cACJ;AAEF,IAAM,oBAA4C,CAAC;AACnD,SAAS,IAAI,EAAG,IAAI,YAAY,QAAQ,KAAK;AAAA,EAC3C,kBAAkB,YAAY,MAAM;AACtC;AAEO,SAAS,SAAS,IAAI,OAAsB;AAAA,EACjD,MAAM,MAAM,MAAM,KAAK,SAAS;AAAA,EAChC,IAAI,eAAe;AAAA,EAEnB,SAAS,IAAI,EAAG,IAAI,IAAI,QAAQ,KAAK;AAAA,IACnC,MAAM,WAAW,IAAI,WAAW,CAAC;AAAA,IACjC,gBAAgB,SAAS,SAAS,CAAC,EAAE,SAAS,IAAI,GAAG;AAAA,EACvD;AAAA,EAEA,IAAI,gBAAgB;AAAA,EACpB,MAAM,YAAY;AAAA,EAClB,IAAI,eAAe;AAAA,EAEnB,SAAS,IAAI,EAAG,IAAI,aAAa,QAAQ,KAAK,WAAW;AAAA,IACvD,IAAI,QAAQ,aAAa,UAAU,GAAG,IAAI,SAAS;AAAA,IAEnD,IAAI,MAAM,SAAS,WAAW;AAAA,MAC5B,eAAe,YAAY,MAAM;AAAA,MACjC,QAAQ,MAAM,OAAO,WAAW,GAAG;AAAA,IACrC;AAAA,IAEA,MAAM,eAAe,SAAS,OAAO,CAAC;AAAA,IACtC,iBAAiB,YAAY;AAAA,EAC/B;AAAA,EAEA,OAAO,gBAAgB,aAAa,SAAS;AAAA;AAexC,SAAS,WAAW,CAAC,KAAa;AAAA,EACvC,MAAM,eAAe,SAAS,IAAI,MAAM,EAAE,GAAG,EAAE;AAAA,EAC/C,MAAM,IAAI,MAAM,GAAG,EAAE;AAAA,EAErB,IAAI,eAAe;AAAA,EAEnB,SAAS,IAAI,EAAG,IAAI,IAAI,QAAQ,KAAK;AAAA,IACnC,MAAM,eAAe,kBAAkB,IAAI;AAAA,IAC3C,MAAM,cAAc,aAAa,SAAS,CAAC,EAAE,SAAS,GAAG,GAAG;AAAA,IAC5D,gBAAgB;AAAA,EAClB;AAAA,EAEA,IAAI,eAAe,GAAG;AAAA,IACpB,eAAe,aAAa,MAAM,IAAI,YAAY;AAAA,EACpD;AAAA,EAEA,IAAI,gBAAgB;AAAA,EACpB,MAAM,WAAW;AAAA,EAEjB,SAAS,IAAI,EAAG,IAAI,aAAa,QAAQ,KAAK,UAAU;AAAA,IACtD,MAAM,OAAO,aAAa,UAAU,GAAG,IAAI,QAAQ;AAAA,IACnD,IAAI,KAAK,WAAW,IAAI;AAAA,MACtB,MAAM,WAAW,SAAS,MAAM,CAAC;AAAA,MACjC,iBAAiB,OAAO,aAAa,QAAQ;AAAA,IAC/C;AAAA,EACF;AAAA,EAEA,OAAO,cAAc,MAAM,SAAS;AAAA;",
|
|
8
|
+
"debugId": "E6AE9819DA2983FC64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
package/build/cli.js
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
deobfuscate
|
|
4
|
+
} from "./chunk-6w7td62p.js";
|
|
5
|
+
|
|
6
|
+
// src/cli.ts
|
|
7
|
+
import fs from "node:fs";
|
|
8
|
+
import path from "node:path";
|
|
9
|
+
import chalk from "chalk";
|
|
10
|
+
import { createEventSource } from "eventsource-client";
|
|
11
|
+
import yargs from "yargs";
|
|
12
|
+
import { hideBin } from "yargs/helpers";
|
|
13
|
+
import { z } from "zod/v4";
|
|
14
|
+
if (typeof process.loadEnvFile === "function") {
|
|
15
|
+
try {
|
|
16
|
+
process.loadEnvFile();
|
|
17
|
+
} catch {}
|
|
18
|
+
}
|
|
19
|
+
var y = yargs(hideBin(process.argv));
|
|
20
|
+
var colors = {
|
|
21
|
+
red: chalk.hex("#ef4444"),
|
|
22
|
+
green: chalk.hex("#22c55e"),
|
|
23
|
+
yellow: chalk.hex("#eab308"),
|
|
24
|
+
orange: chalk.hex("#f97316"),
|
|
25
|
+
zinc: chalk.hex("#71717a")
|
|
26
|
+
};
|
|
27
|
+
function errorExit(title, text) {
|
|
28
|
+
console.error(colors.red.bold(title + `
|
|
29
|
+
`));
|
|
30
|
+
if (text) {
|
|
31
|
+
console.error(colors.red(text) + `
|
|
32
|
+
`);
|
|
33
|
+
}
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
var pkgJson;
|
|
37
|
+
function loadPkgJson() {
|
|
38
|
+
if (!pkgJson) {
|
|
39
|
+
pkgJson = JSON.parse(fs.readFileSync("package.json", "utf-8"));
|
|
40
|
+
}
|
|
41
|
+
return pkgJson;
|
|
42
|
+
}
|
|
43
|
+
async function fetchTypes(url, headers, targetFile, clear = false, showTimestamp = false) {
|
|
44
|
+
const timestamp = () => colors.zinc(new Date().toLocaleTimeString("en-GB", { hour12: false }));
|
|
45
|
+
const response = await fetch(url, {
|
|
46
|
+
method: "GET",
|
|
47
|
+
headers
|
|
48
|
+
});
|
|
49
|
+
const branchName = response.headers.get("x-branch-name");
|
|
50
|
+
const text = await response.text();
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
errorExit(text);
|
|
53
|
+
}
|
|
54
|
+
let header = `// Generated by requence-service CLI — DO NOT EDIT.
|
|
55
|
+
// Changes will be overwritten.
|
|
56
|
+
|
|
57
|
+
`;
|
|
58
|
+
if (branchName) {
|
|
59
|
+
header += `// !!! types for branch "${branchName}" !!!
|
|
60
|
+
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
const data = `${header}/* eslint-disable */
|
|
64
|
+
/* oxlint-disable */
|
|
65
|
+
/* prettier-ignore */
|
|
66
|
+
|
|
67
|
+
${text}`;
|
|
68
|
+
fs.writeFileSync(targetFile, data);
|
|
69
|
+
if (clear) {
|
|
70
|
+
console.clear();
|
|
71
|
+
}
|
|
72
|
+
if (branchName) {
|
|
73
|
+
console.info(...showTimestamp ? [timestamp()] : [], colors.yellow("types for branch", chalk.bold(branchName), "saved to", chalk.bold(path.relative(process.cwd(), targetFile))));
|
|
74
|
+
} else {
|
|
75
|
+
console.info(...showTimestamp ? [timestamp()] : [], colors.green("types saved to", chalk.bold(path.relative(process.cwd(), targetFile))));
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
y.command("generate-types", "generates typescript types", (yargs2) => yargs2.option("access-token", {
|
|
79
|
+
describe: "access token",
|
|
80
|
+
type: "string"
|
|
81
|
+
}).option("dev-token", {
|
|
82
|
+
description: "dev token",
|
|
83
|
+
type: "string"
|
|
84
|
+
}).option("outfile", {
|
|
85
|
+
default: "requence-env.d.ts"
|
|
86
|
+
}).option("outdir", {
|
|
87
|
+
default: ""
|
|
88
|
+
}).option("watch", {
|
|
89
|
+
type: "boolean"
|
|
90
|
+
}).option("clear", {
|
|
91
|
+
description: "clear the terminal on watch updates (use --no-clear to disable)",
|
|
92
|
+
type: "boolean",
|
|
93
|
+
default: true
|
|
94
|
+
}), async (argv) => {
|
|
95
|
+
let token = argv.accessToken ?? process.env.REQUENCE_SERVICE_ACCESS_TOKEN ?? process.env.REQUENCE_ACCESS_TOKEN;
|
|
96
|
+
if (!token) {
|
|
97
|
+
const pkgJson2 = loadPkgJson();
|
|
98
|
+
token = pkgJson2.requence?.service?.accessToken ?? pkgJson2.requence?.accessToken;
|
|
99
|
+
}
|
|
100
|
+
if (argv.clear) {
|
|
101
|
+
console.info();
|
|
102
|
+
}
|
|
103
|
+
if (!token) {
|
|
104
|
+
errorExit("No access token found", `You can provide the access token as argument to ${chalk.bold("requence-service")},
|
|
105
|
+
as environment variable ${chalk.bold("REQUENCE_ACCESS_TOKEN")} / ${chalk.bold("REQUENCE_SERVICE_ACCESS_TOKEN")} or
|
|
106
|
+
in your ${chalk.bold("package.json")} in ${chalk.bold("requence.accessToken")} / ${chalk.bold("requence.service.accessToken")}`);
|
|
107
|
+
}
|
|
108
|
+
const parts = deobfuscate(token);
|
|
109
|
+
if (parts.length !== 3 || parts[0] !== "service") {
|
|
110
|
+
errorExit("Invalid service key");
|
|
111
|
+
}
|
|
112
|
+
const [, connectionString, serverUrl] = parts;
|
|
113
|
+
const headers = {
|
|
114
|
+
Authorization: `Bearer ${connectionString}`
|
|
115
|
+
};
|
|
116
|
+
let devToken = argv.devToken ?? process.env.REQUENCE_SERVICE_DEV_TOKEN ?? process.env.REQUENCE_DEV_TOKEN;
|
|
117
|
+
if (!devToken) {
|
|
118
|
+
const pkgJson2 = loadPkgJson();
|
|
119
|
+
devToken = pkgJson2.requence?.service?.devToken ?? pkgJson2.requence?.devToken;
|
|
120
|
+
}
|
|
121
|
+
if (devToken) {
|
|
122
|
+
const devParts = deobfuscate(devToken);
|
|
123
|
+
if (devParts[0] !== "api") {
|
|
124
|
+
throw new Error("invalid dev token: please provide a personal access token");
|
|
125
|
+
}
|
|
126
|
+
if (devParts[2] !== parts[2]) {
|
|
127
|
+
throw new Error("invalid dev token: access token and dev token belong to different requence instances");
|
|
128
|
+
}
|
|
129
|
+
headers["x-dev-authorization"] = devParts[1];
|
|
130
|
+
}
|
|
131
|
+
await fetchTypes(serverUrl + "/service/types/typescript", headers, path.join(argv.outdir || process.cwd(), argv.outfile));
|
|
132
|
+
if (!argv.watch) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (argv.clear) {
|
|
136
|
+
console.clear();
|
|
137
|
+
}
|
|
138
|
+
console.info(colors.orange.bold("Watching for type changes…"));
|
|
139
|
+
let lastWrite = Date.now();
|
|
140
|
+
const timeSchema = z.coerce.number().int().positive();
|
|
141
|
+
createEventSource({
|
|
142
|
+
method: "GET",
|
|
143
|
+
url: serverUrl + "/service/watch",
|
|
144
|
+
headers,
|
|
145
|
+
async onMessage({ data }) {
|
|
146
|
+
const timeResult = timeSchema.safeParse(data);
|
|
147
|
+
if (!timeResult.success || timeResult.data < lastWrite) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
lastWrite = timeResult.data;
|
|
151
|
+
if (argv.clear) {
|
|
152
|
+
console.clear();
|
|
153
|
+
}
|
|
154
|
+
console.info(colors.zinc.bold(`Regenerating types…${argv.clear ? `
|
|
155
|
+
|
|
156
|
+
` : ""}`));
|
|
157
|
+
await fetchTypes(serverUrl + "/service/types/typescript", headers, path.join(argv.outdir || process.cwd(), argv.outfile), argv.clear, true);
|
|
158
|
+
console.info(colors.orange.bold(`${argv.clear ? `
|
|
159
|
+
|
|
160
|
+
` : ""}Watching for type changes…`));
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}).scriptName("requence-service").help("h").demandCommand(1, 1).strict().parse();
|
|
164
|
+
|
|
165
|
+
//# debugId=F7FC109C50F6F85D64756E2164756E21
|
|
166
|
+
//# sourceMappingURL=cli.js.map
|
package/build/cli.js.map
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/cli.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"#!/usr/bin/env node\n\nimport fs from 'node:fs'\nimport path from 'node:path'\n\nimport { deobfuscate } from '@requence/helpers'\nimport chalk from 'chalk'\nimport { createEventSource } from 'eventsource-client'\nimport yargs from 'yargs'\nimport { hideBin } from 'yargs/helpers'\nimport { z } from 'zod/v4'\n\n// Load .env automatically (Node 20.12+)\nif (typeof process.loadEnvFile === 'function') {\n try {\n process.loadEnvFile()\n } catch {\n // Ignore if .env is missing\n }\n}\n\nconst y = yargs(hideBin(process.argv))\n\nconst colors = {\n red: chalk.hex('#ef4444'),\n green: chalk.hex('#22c55e'),\n yellow: chalk.hex('#eab308'),\n orange: chalk.hex('#f97316'),\n zinc: chalk.hex('#71717a'),\n}\n\nfunction errorExit(title: string, text?: string): never {\n console.error(colors.red.bold(title + '\\n'))\n if (text) {\n console.error(colors.red(text) + '\\n')\n }\n process.exit(1)\n}\n\nlet pkgJson: any | null\nfunction loadPkgJson() {\n if (!pkgJson) {\n pkgJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'))\n }\n return pkgJson\n}\n\nasync function fetchTypes(\n url: string,\n headers: HeadersInit,\n targetFile: string,\n clear = false,\n showTimestamp = false,\n) {\n const timestamp = () =>\n colors.zinc(new Date().toLocaleTimeString('en-GB', { hour12: false }))\n const response = await fetch(url, {\n method: 'GET',\n headers,\n })\n\n const branchName = response.headers.get('x-branch-name')\n const text = await response.text()\n\n if (!response.ok) {\n errorExit(text)\n }\n\n let header =\n '// Generated by requence-service CLI — DO NOT EDIT.\\n// Changes will be overwritten.\\n\\n'\n\n if (branchName) {\n header += `// !!! types for branch \"${branchName}\" !!!\\n\\n`\n }\n const data = `${header}/* eslint-disable */\\n/* oxlint-disable */\\n/* prettier-ignore */\\n\\n${text}`\n\n fs.writeFileSync(targetFile, data)\n\n if (clear) {\n console.clear()\n }\n\n if (branchName) {\n console.info(\n ...(showTimestamp ? [timestamp()] : []),\n colors.yellow(\n 'types for branch',\n chalk.bold(branchName),\n 'saved to',\n chalk.bold(path.relative(process.cwd(), targetFile)),\n ),\n )\n } else {\n console.info(\n ...(showTimestamp ? [timestamp()] : []),\n colors.green(\n 'types saved to',\n chalk.bold(path.relative(process.cwd(), targetFile)),\n ),\n )\n }\n}\n\ny.command(\n 'generate-types',\n 'generates typescript types',\n (yargs) =>\n yargs\n .option('access-token', {\n describe: 'access token',\n type: 'string',\n })\n .option('dev-token', {\n description: 'dev token',\n type: 'string',\n })\n .option('outfile', {\n default: 'requence-env.d.ts',\n })\n .option('outdir', {\n default: '',\n })\n .option('watch', {\n type: 'boolean',\n })\n .option('clear', {\n description:\n 'clear the terminal on watch updates (use --no-clear to disable)',\n type: 'boolean',\n default: true,\n }),\n async (argv) => {\n let token =\n argv.accessToken ??\n process.env.REQUENCE_SERVICE_ACCESS_TOKEN ??\n process.env.REQUENCE_ACCESS_TOKEN\n\n if (!token) {\n const pkgJson = loadPkgJson()\n token =\n pkgJson.requence?.service?.accessToken ?? pkgJson.requence?.accessToken\n }\n\n if (argv.clear) {\n console.info() // newline\n }\n if (!token) {\n errorExit(\n 'No access token found',\n `You can provide the access token as argument to ${chalk.bold('requence-service')},\\nas environment variable ${chalk.bold('REQUENCE_ACCESS_TOKEN')} / ${chalk.bold('REQUENCE_SERVICE_ACCESS_TOKEN')} or\\nin your ${chalk.bold('package.json')} in ${chalk.bold('requence.accessToken')} / ${chalk.bold('requence.service.accessToken')}`,\n )\n }\n\n const parts = deobfuscate(token)\n if (parts.length !== 3 || parts[0] !== 'service') {\n errorExit('Invalid service key')\n }\n\n const [, connectionString, serverUrl] = parts\n const headers: HeadersInit = {\n Authorization: `Bearer ${connectionString}`,\n }\n let devToken =\n argv.devToken ??\n process.env.REQUENCE_SERVICE_DEV_TOKEN ??\n process.env.REQUENCE_DEV_TOKEN\n\n if (!devToken) {\n const pkgJson = loadPkgJson()\n devToken =\n pkgJson.requence?.service?.devToken ?? pkgJson.requence?.devToken\n }\n\n if (devToken) {\n const devParts = deobfuscate(devToken)\n if (devParts[0] !== 'api') {\n throw new Error(\n 'invalid dev token: please provide a personal access token',\n )\n }\n if (devParts[2] !== parts[2]) {\n throw new Error(\n 'invalid dev token: access token and dev token belong to different requence instances',\n )\n }\n\n headers['x-dev-authorization'] = devParts[1]\n }\n\n await fetchTypes(\n serverUrl + '/service/types/typescript',\n headers,\n path.join(argv.outdir || process.cwd(), argv.outfile),\n )\n\n if (!argv.watch) {\n return\n }\n\n if (argv.clear) {\n console.clear()\n }\n console.info(colors.orange.bold('Watching for type changes…'))\n let lastWrite = Date.now()\n const timeSchema = z.coerce.number().int().positive()\n createEventSource({\n method: 'GET',\n url: serverUrl + '/service/watch',\n headers,\n async onMessage({ data }) {\n const timeResult = timeSchema.safeParse(data)\n if (!timeResult.success || timeResult.data < lastWrite) {\n return\n }\n lastWrite = timeResult.data\n if (argv.clear) {\n console.clear()\n }\n console.info(\n colors.zinc.bold(`Regenerating types…${argv.clear ? '\\n\\n' : ''}`),\n )\n\n await fetchTypes(\n serverUrl + '/service/types/typescript',\n headers,\n path.join(argv.outdir || process.cwd(), argv.outfile),\n argv.clear,\n true,\n )\n console.info(\n colors.orange.bold(\n `${argv.clear ? '\\n\\n' : ''}Watching for type changes…`,\n ),\n )\n },\n })\n },\n)\n .scriptName('requence-service')\n .help('h')\n .demandCommand(1, 1)\n .strict()\n .parse()\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;AAEA;AACA;AAGA;AACA;AACA;AACA;AACA;AAGA,IAAI,OAAO,QAAQ,gBAAgB,YAAY;AAAA,EAC7C,IAAI;AAAA,IACF,QAAQ,YAAY;AAAA,IACpB,MAAM;AAGV;AAEA,IAAM,IAAI,MAAM,QAAQ,QAAQ,IAAI,CAAC;AAErC,IAAM,SAAS;AAAA,EACb,KAAK,MAAM,IAAI,SAAS;AAAA,EACxB,OAAO,MAAM,IAAI,SAAS;AAAA,EAC1B,QAAQ,MAAM,IAAI,SAAS;AAAA,EAC3B,QAAQ,MAAM,IAAI,SAAS;AAAA,EAC3B,MAAM,MAAM,IAAI,SAAS;AAC3B;AAEA,SAAS,SAAS,CAAC,OAAe,MAAsB;AAAA,EACtD,QAAQ,MAAM,OAAO,IAAI,KAAK,QAAQ;AAAA,CAAI,CAAC;AAAA,EAC3C,IAAI,MAAM;AAAA,IACR,QAAQ,MAAM,OAAO,IAAI,IAAI,IAAI;AAAA,CAAI;AAAA,EACvC;AAAA,EACA,QAAQ,KAAK,CAAC;AAAA;AAGhB,IAAI;AACJ,SAAS,WAAW,GAAG;AAAA,EACrB,KAAK,SAAS;AAAA,IACZ,UAAU,KAAK,MAAM,GAAG,aAAa,gBAAgB,OAAO,CAAC;AAAA,EAC/D;AAAA,EACA,OAAO;AAAA;AAGT,eAAe,UAAU,CACvB,KACA,SACA,YACA,QAAQ,OACR,gBAAgB,OAChB;AAAA,EACA,MAAM,YAAY,MAChB,OAA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