@delego/runner 0.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connection.js","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AAAA,iDAAiD;AACjD,OAAO,EAAE,SAAS,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AAErC,OAAO,EAAE,WAAW,EAAQ,MAAM,oBAAoB,CAAC;AAMvD,IAAI,OAAO,UAAU,CAAC,SAAS,KAAK,WAAW,EAAE,CAAC;IAChD,UAAU,CAAC,SAAS,GAAG,EAAE,CAAC;AAC5B,CAAC;AAED,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,SAAS,iBAAiB,CAAC,OAAe;IACxC,OAAO,OAAO;SACX,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC;SAC9B,OAAO,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,kBAAkB,CACzB,OAAe,EACf,MAAc,EACd,QAAgB,EAChB,UAAmB;IAEnB,MAAM,KAAK,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACzC,MAAM,WAAW,GAAG,IAAI,eAAe,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC9D,IAAI,UAAU,EAAE,CAAC;QACf,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IAC5C,CAAC;IACD,OAAO,GAAG,KAAK,yBAAyB,WAAW,CAAC,QAAQ,EAAE,EAAE,CAAC;AACnE,CAAC;AA2BD,+EAA+E;AAC/E,iBAAiB;AACjB,+EAA+E;AAE/E,MAAM,aAAa;IACjB,KAAK,CAAC,IAA+B;QACnC,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;QAC1C,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACjC,CA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8BAA8B,CAAC,CAAC;YAChD,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAChC,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,gBAAgB;QAC5B,MAAM,IAAI,CAAC,YAAY,CAAC,gBAAgB,EAAE,CAAC;QAE3C,IAAI,CAAC;YACH,IAAI,CAAC,KAAK,GAAG,YAAY,CAAC;YAC1B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;YAClC,MAAM,IAAI,CAAC,YAAY,EAAE,CAAC;YAC1B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;YAC5C,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,GAAG,cAAc,CAAC;YAC5B,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,CAAC;gBACjC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,sBAAsB,EAAE,KAAK,CAAC,CAAC;gBACjD,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;YAChC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,397 @@
1
+ /**
2
+ * BaseURL is the base URL for calling the Encore application's API.
3
+ */
4
+ export type BaseURL = string;
5
+ export declare const Local: BaseURL;
6
+ /**
7
+ * Environment returns a BaseURL for calling the cloud environment with the given name.
8
+ */
9
+ export declare function Environment(name: string): BaseURL;
10
+ /**
11
+ * PreviewEnv returns a BaseURL for calling the preview environment with the given PR number.
12
+ */
13
+ export declare function PreviewEnv(pr: number | string): BaseURL;
14
+ /**
15
+ * Client is an API client for the delego-backend-trui Encore application.
16
+ */
17
+ export default class Client {
18
+ readonly core: core.ServiceClient;
19
+ private readonly options;
20
+ private readonly target;
21
+ /**
22
+ * Creates a Client for calling the public and authenticated APIs of your Encore application.
23
+ *
24
+ * @param target The target which the client should be configured to use. See Local and Environment for options.
25
+ * @param options Options for the client
26
+ */
27
+ constructor(target: BaseURL, options?: ClientOptions);
28
+ /**
29
+ * Creates a new Encore client with the given client options set.
30
+ *
31
+ * @param options Client options to set. They are merged with existing options.
32
+ **/
33
+ with(options: ClientOptions): Client;
34
+ }
35
+ /**
36
+ * ClientOptions allows you to override any default behaviour within the generated Encore client.
37
+ */
38
+ export interface ClientOptions {
39
+ /**
40
+ * By default the client will use the inbuilt fetch function for making the API requests.
41
+ * however you can override it with your own implementation here if you want to run custom
42
+ * code on each API request made or response received.
43
+ */
44
+ fetcher?: Fetcher;
45
+ /** Default RequestInit to be used for the client */
46
+ requestInit?: Omit<RequestInit, "headers"> & {
47
+ headers?: Record<string, string>;
48
+ };
49
+ /**
50
+ * Allows you to set the authentication data to be used for each
51
+ * request either by passing in a static object or by passing in
52
+ * a function which returns a new object for each request.
53
+ */
54
+ auth?: auth.AuthParams | AuthDataGenerator;
55
+ }
56
+ export declare namespace auth {
57
+ interface AuthParams {
58
+ authorization: string;
59
+ }
60
+ }
61
+ export declare namespace core {
62
+ interface ActionParameter {
63
+ name: string;
64
+ type: "string" | "number" | "boolean";
65
+ description: string;
66
+ required: boolean;
67
+ }
68
+ type JsonValue = string | number | boolean | null | JsonValue[] | {
69
+ [key: string]: JsonValue;
70
+ };
71
+ type ParameterValue = string | number | boolean;
72
+ interface RunnerMessage {
73
+ type: "heartbeat" | "invocation_result";
74
+ invocationId?: string;
75
+ success?: boolean;
76
+ result?: JsonValue;
77
+ error?: string;
78
+ }
79
+ interface ServerMessage {
80
+ type: "heartbeat_ack" | "invoke" | "ready";
81
+ invocationId?: string;
82
+ actionName?: string;
83
+ parameters?: {
84
+ [key: string]: ParameterValue;
85
+ };
86
+ runnerId?: string;
87
+ userContext?: {
88
+ slackUserId: string;
89
+ email?: string;
90
+ groupIds: string[];
91
+ };
92
+ }
93
+ class ServiceClient {
94
+ private baseClient;
95
+ constructor(baseClient: BaseClient);
96
+ getOAuthUrl(): Promise<{
97
+ url: string;
98
+ }>;
99
+ /**
100
+ * Registers or updates actions for a runner.
101
+ * Validates API key from X-API-Key header and upserts actions.
102
+ */
103
+ registerActions(params: actions.RegisterActionsRequest): Promise<actions.RegisterActionsResponse>;
104
+ /**
105
+ * WebSocket streaming endpoint for SDK clients to connect and receive invocations
106
+ */
107
+ runnerConnection(): Promise<StreamInOut<RunnerMessage, ServerMessage>>;
108
+ slackOAuthCallback(method: "GET", body?: RequestInit["body"], options?: CallParameters): Promise<globalThis.Response>;
109
+ slackOAuthInitiate(method: "GET", body?: RequestInit["body"], options?: CallParameters): Promise<globalThis.Response>;
110
+ }
111
+ }
112
+ export declare namespace actions {
113
+ interface RegisterActionsRequest {
114
+ runnerId: string;
115
+ actions: {
116
+ name: string;
117
+ description: string;
118
+ parameters: core.ActionParameter[];
119
+ requiredRoles?: string[];
120
+ }[];
121
+ apiKey: string;
122
+ emailRoles?: {
123
+ [key: string]: string[];
124
+ };
125
+ }
126
+ interface RegisterActionsResponse {
127
+ actionIds: string[];
128
+ }
129
+ }
130
+ declare class WebSocketConnection {
131
+ ws: WebSocket;
132
+ private hasUpdateHandlers;
133
+ constructor(url: string, headers?: Record<string, string>);
134
+ resolveHasUpdateHandlers(): void;
135
+ hasUpdate(): Promise<void>;
136
+ on(type: "error" | "close" | "message" | "open", handler: (event: any) => void): void;
137
+ off(type: "error" | "close" | "message" | "open", handler: (event: any) => void): void;
138
+ close(): void;
139
+ }
140
+ export declare class StreamInOut<Request, Response> {
141
+ socket: WebSocketConnection;
142
+ private buffer;
143
+ constructor(url: string, headers?: Record<string, string>);
144
+ close(): void;
145
+ send(msg: Request): Promise<void>;
146
+ next(): Promise<Response | undefined>;
147
+ [Symbol.asyncIterator](): AsyncGenerator<Response, undefined, void>;
148
+ }
149
+ export declare class StreamIn<Response> {
150
+ socket: WebSocketConnection;
151
+ private buffer;
152
+ constructor(url: string, headers?: Record<string, string>);
153
+ close(): void;
154
+ next(): Promise<Response | undefined>;
155
+ [Symbol.asyncIterator](): AsyncGenerator<Response, undefined, void>;
156
+ }
157
+ export declare class StreamOut<Request, Response> {
158
+ socket: WebSocketConnection;
159
+ private responseValue;
160
+ constructor(url: string, headers?: Record<string, string>);
161
+ response(): Promise<Response>;
162
+ close(): void;
163
+ send(msg: Request): Promise<void>;
164
+ }
165
+ type CallParameters = Omit<RequestInit, "method" | "body" | "headers"> & {
166
+ /** Headers to be sent with the request */
167
+ headers?: Record<string, string>;
168
+ /** Query parameters to be sent with the request */
169
+ query?: Record<string, string | string[]>;
170
+ };
171
+ export type AuthDataGenerator = () => auth.AuthParams | Promise<auth.AuthParams | undefined> | undefined;
172
+ export type Fetcher = typeof fetch;
173
+ declare class BaseClient {
174
+ readonly baseURL: string;
175
+ readonly fetcher: Fetcher;
176
+ readonly headers: Record<string, string>;
177
+ readonly requestInit: Omit<RequestInit, "headers"> & {
178
+ headers?: Record<string, string>;
179
+ };
180
+ readonly authGenerator?: AuthDataGenerator;
181
+ constructor(baseURL: string, options: ClientOptions);
182
+ getAuthData(): Promise<CallParameters | undefined>;
183
+ createStreamInOut<Request, Response>(path: string, params?: CallParameters): Promise<StreamInOut<Request, Response>>;
184
+ createStreamIn<Response>(path: string, params?: CallParameters): Promise<StreamIn<Response>>;
185
+ createStreamOut<Request, Response>(path: string, params?: CallParameters): Promise<StreamOut<Request, Response>>;
186
+ callTypedAPI(method: string, path: string, body?: RequestInit["body"], params?: CallParameters): Promise<Response>;
187
+ callAPI(method: string, path: string, body?: RequestInit["body"], params?: CallParameters): Promise<Response>;
188
+ }
189
+ /**
190
+ * APIErrorDetails represents the response from an Encore API in the case of an error
191
+ */
192
+ interface APIErrorResponse {
193
+ code: ErrCode;
194
+ message: string;
195
+ details?: any;
196
+ }
197
+ /**
198
+ * APIError represents a structured error as returned from an Encore application.
199
+ */
200
+ export declare class APIError extends Error {
201
+ /**
202
+ * The HTTP status code associated with the error.
203
+ */
204
+ readonly status: number;
205
+ /**
206
+ * The Encore error code
207
+ */
208
+ readonly code: ErrCode;
209
+ /**
210
+ * The error details
211
+ */
212
+ readonly details?: any;
213
+ constructor(status: number, response: APIErrorResponse);
214
+ }
215
+ /**
216
+ * Typeguard allowing use of an APIError's fields'
217
+ */
218
+ export declare function isAPIError(err: any): err is APIError;
219
+ export declare enum ErrCode {
220
+ /**
221
+ * OK indicates the operation was successful.
222
+ */
223
+ OK = "ok",
224
+ /**
225
+ * Canceled indicates the operation was canceled (typically by the caller).
226
+ *
227
+ * Encore will generate this error code when cancellation is requested.
228
+ */
229
+ Canceled = "canceled",
230
+ /**
231
+ * Unknown error. An example of where this error may be returned is
232
+ * if a Status value received from another address space belongs to
233
+ * an error-space that is not known in this address space. Also
234
+ * errors raised by APIs that do not return enough error information
235
+ * may be converted to this error.
236
+ *
237
+ * Encore will generate this error code in the above two mentioned cases.
238
+ */
239
+ Unknown = "unknown",
240
+ /**
241
+ * InvalidArgument indicates client specified an invalid argument.
242
+ * Note that this differs from FailedPrecondition. It indicates arguments
243
+ * that are problematic regardless of the state of the system
244
+ * (e.g., a malformed file name).
245
+ *
246
+ * This error code will not be generated by the gRPC framework.
247
+ */
248
+ InvalidArgument = "invalid_argument",
249
+ /**
250
+ * DeadlineExceeded means operation expired before completion.
251
+ * For operations that change the state of the system, this error may be
252
+ * returned even if the operation has completed successfully. For
253
+ * example, a successful response from a server could have been delayed
254
+ * long enough for the deadline to expire.
255
+ *
256
+ * The gRPC framework will generate this error code when the deadline is
257
+ * exceeded.
258
+ */
259
+ DeadlineExceeded = "deadline_exceeded",
260
+ /**
261
+ * NotFound means some requested entity (e.g., file or directory) was
262
+ * not found.
263
+ *
264
+ * This error code will not be generated by the gRPC framework.
265
+ */
266
+ NotFound = "not_found",
267
+ /**
268
+ * AlreadyExists means an attempt to create an entity failed because one
269
+ * already exists.
270
+ *
271
+ * This error code will not be generated by the gRPC framework.
272
+ */
273
+ AlreadyExists = "already_exists",
274
+ /**
275
+ * PermissionDenied indicates the caller does not have permission to
276
+ * execute the specified operation. It must not be used for rejections
277
+ * caused by exhausting some resource (use ResourceExhausted
278
+ * instead for those errors). It must not be
279
+ * used if the caller cannot be identified (use Unauthenticated
280
+ * instead for those errors).
281
+ *
282
+ * This error code will not be generated by the gRPC core framework,
283
+ * but expect authentication middleware to use it.
284
+ */
285
+ PermissionDenied = "permission_denied",
286
+ /**
287
+ * ResourceExhausted indicates some resource has been exhausted, perhaps
288
+ * a per-user quota, or perhaps the entire file system is out of space.
289
+ *
290
+ * This error code will be generated by the gRPC framework in
291
+ * out-of-memory and server overload situations, or when a message is
292
+ * larger than the configured maximum size.
293
+ */
294
+ ResourceExhausted = "resource_exhausted",
295
+ /**
296
+ * FailedPrecondition indicates operation was rejected because the
297
+ * system is not in a state required for the operation's execution.
298
+ * For example, directory to be deleted may be non-empty, an rmdir
299
+ * operation is applied to a non-directory, etc.
300
+ *
301
+ * A litmus test that may help a service implementor in deciding
302
+ * between FailedPrecondition, Aborted, and Unavailable:
303
+ * (a) Use Unavailable if the client can retry just the failing call.
304
+ * (b) Use Aborted if the client should retry at a higher-level
305
+ * (e.g., restarting a read-modify-write sequence).
306
+ * (c) Use FailedPrecondition if the client should not retry until
307
+ * the system state has been explicitly fixed. E.g., if an "rmdir"
308
+ * fails because the directory is non-empty, FailedPrecondition
309
+ * should be returned since the client should not retry unless
310
+ * they have first fixed up the directory by deleting files from it.
311
+ * (d) Use FailedPrecondition if the client performs conditional
312
+ * REST Get/Update/Delete on a resource and the resource on the
313
+ * server does not match the condition. E.g., conflicting
314
+ * read-modify-write on the same resource.
315
+ *
316
+ * This error code will not be generated by the gRPC framework.
317
+ */
318
+ FailedPrecondition = "failed_precondition",
319
+ /**
320
+ * Aborted indicates the operation was aborted, typically due to a
321
+ * concurrency issue like sequencer check failures, transaction aborts,
322
+ * etc.
323
+ *
324
+ * See litmus test above for deciding between FailedPrecondition,
325
+ * Aborted, and Unavailable.
326
+ */
327
+ Aborted = "aborted",
328
+ /**
329
+ * OutOfRange means operation was attempted past the valid range.
330
+ * E.g., seeking or reading past end of file.
331
+ *
332
+ * Unlike InvalidArgument, this error indicates a problem that may
333
+ * be fixed if the system state changes. For example, a 32-bit file
334
+ * system will generate InvalidArgument if asked to read at an
335
+ * offset that is not in the range [0,2^32-1], but it will generate
336
+ * OutOfRange if asked to read from an offset past the current
337
+ * file size.
338
+ *
339
+ * There is a fair bit of overlap between FailedPrecondition and
340
+ * OutOfRange. We recommend using OutOfRange (the more specific
341
+ * error) when it applies so that callers who are iterating through
342
+ * a space can easily look for an OutOfRange error to detect when
343
+ * they are done.
344
+ *
345
+ * This error code will not be generated by the gRPC framework.
346
+ */
347
+ OutOfRange = "out_of_range",
348
+ /**
349
+ * Unimplemented indicates operation is not implemented or not
350
+ * supported/enabled in this service.
351
+ *
352
+ * This error code will be generated by the gRPC framework. Most
353
+ * commonly, you will see this error code when a method implementation
354
+ * is missing on the server. It can also be generated for unknown
355
+ * compression algorithms or a disagreement as to whether an RPC should
356
+ * be streaming.
357
+ */
358
+ Unimplemented = "unimplemented",
359
+ /**
360
+ * Internal errors. Means some invariants expected by underlying
361
+ * system has been broken. If you see one of these errors,
362
+ * something is very broken.
363
+ *
364
+ * This error code will be generated by the gRPC framework in several
365
+ * internal error conditions.
366
+ */
367
+ Internal = "internal",
368
+ /**
369
+ * Unavailable indicates the service is currently unavailable.
370
+ * This is a most likely a transient condition and may be corrected
371
+ * by retrying with a backoff. Note that it is not always safe to retry
372
+ * non-idempotent operations.
373
+ *
374
+ * See litmus test above for deciding between FailedPrecondition,
375
+ * Aborted, and Unavailable.
376
+ *
377
+ * This error code will be generated by the gRPC framework during
378
+ * abrupt shutdown of a server process or network connection.
379
+ */
380
+ Unavailable = "unavailable",
381
+ /**
382
+ * DataLoss indicates unrecoverable data loss or corruption.
383
+ *
384
+ * This error code will not be generated by the gRPC framework.
385
+ */
386
+ DataLoss = "data_loss",
387
+ /**
388
+ * Unauthenticated indicates the request does not have valid
389
+ * authentication credentials for the operation.
390
+ *
391
+ * The gRPC framework will generate this error code when the
392
+ * authentication metadata is invalid or a Credentials callback fails,
393
+ * but also expect authentication middleware to generate it.
394
+ */
395
+ Unauthenticated = "unauthenticated"
396
+ }
397
+ export {};