@requence/service 0.7.1 → 0.8.2-edge.1149

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.
Files changed (91) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/README.md +15 -0
  3. package/build/chunk-974rc2jy.js +200 -0
  4. package/build/chunk-974rc2jy.js.map +12 -0
  5. package/build/cli.js +17 -7
  6. package/build/cli.js.map +3 -3
  7. package/build/index.js +1416 -452
  8. package/build/index.js.map +29 -14
  9. package/build/types/helpers/src/index.d.ts +8 -2
  10. package/build/types/helpers/src/index.d.ts.map +1 -1
  11. package/build/types/helpers/src/jsonschema/validate.d.ts +1 -5
  12. package/build/types/helpers/src/jsonschema/validate.d.ts.map +1 -1
  13. package/build/types/helpers/src/jsonschema/zod.d.ts +11 -1
  14. package/build/types/helpers/src/jsonschema/zod.d.ts.map +1 -1
  15. package/build/types/helpers/src/protocol/NodeTree.d.ts +532 -148
  16. package/build/types/helpers/src/protocol/NodeTree.d.ts.map +1 -1
  17. package/build/types/helpers/src/protocol/clientProperties.d.ts +66 -0
  18. package/build/types/helpers/src/protocol/clientProperties.d.ts.map +1 -0
  19. package/build/types/helpers/src/protocol/command.d.ts +372 -142
  20. package/build/types/helpers/src/protocol/command.d.ts.map +1 -1
  21. package/build/types/helpers/src/protocol/configurationScript.d.ts +10 -0
  22. package/build/types/helpers/src/protocol/configurationScript.d.ts.map +1 -0
  23. package/build/types/helpers/src/protocol/helpers.d.ts.map +1 -1
  24. package/build/types/helpers/src/protocol/index.d.ts +5 -0
  25. package/build/types/helpers/src/protocol/index.d.ts.map +1 -1
  26. package/build/types/helpers/src/protocol/logicLanguages.d.ts +19 -0
  27. package/build/types/helpers/src/protocol/logicLanguages.d.ts.map +1 -0
  28. package/build/types/helpers/src/protocol/loopDetection.d.ts +23 -0
  29. package/build/types/helpers/src/protocol/loopDetection.d.ts.map +1 -0
  30. package/build/types/helpers/src/protocol/nodeType.d.ts +81 -27
  31. package/build/types/helpers/src/protocol/nodeType.d.ts.map +1 -1
  32. package/build/types/helpers/src/protocol/taskOptions.d.ts +4 -1
  33. package/build/types/helpers/src/protocol/taskOptions.d.ts.map +1 -1
  34. package/build/types/helpers/src/protocol/templateNodeTypes.d.ts +36 -20
  35. package/build/types/helpers/src/protocol/templateNodeTypes.d.ts.map +1 -1
  36. package/build/types/helpers/src/protocol/treeNodes.d.ts +508 -164
  37. package/build/types/helpers/src/protocol/treeNodes.d.ts.map +1 -1
  38. package/build/types/helpers/src/protocol/update.d.ts +40 -24
  39. package/build/types/helpers/src/protocol/update.d.ts.map +1 -1
  40. package/build/types/helpers/src/protocol/validateTreeStructure.d.ts +22 -0
  41. package/build/types/helpers/src/protocol/validateTreeStructure.d.ts.map +1 -0
  42. package/build/types/helpers/src/utils/amqpHeartbeat.d.ts +3 -0
  43. package/build/types/helpers/src/utils/amqpHeartbeat.d.ts.map +1 -0
  44. package/build/types/helpers/src/utils/amqpPublishRetry.d.ts +45 -0
  45. package/build/types/helpers/src/utils/amqpPublishRetry.d.ts.map +1 -0
  46. package/build/types/helpers/src/utils/claimCheckObject.d.ts +40 -0
  47. package/build/types/helpers/src/utils/claimCheckObject.d.ts.map +1 -0
  48. package/build/types/helpers/src/utils/debounce.d.ts.map +1 -1
  49. package/build/types/helpers/src/{files → utils}/fileObject.d.ts.map +1 -1
  50. package/build/types/helpers/src/{files → utils}/isValidMimeType.d.ts.map +1 -1
  51. package/build/types/helpers/src/utils/mapData.d.ts +1 -1
  52. package/build/types/helpers/src/utils/mapData.d.ts.map +1 -1
  53. package/build/types/helpers/src/{files → utils}/streamObject.d.ts.map +1 -1
  54. package/build/types/helpers/src/utils/variableRef.d.ts +19 -0
  55. package/build/types/helpers/src/utils/variableRef.d.ts.map +1 -0
  56. package/build/types/helpers/src/utils/variableScriptPatterns.d.ts +125 -0
  57. package/build/types/helpers/src/utils/variableScriptPatterns.d.ts.map +1 -0
  58. package/build/types/service/src/boundary.d.ts +87 -0
  59. package/build/types/service/src/boundary.d.ts.map +1 -0
  60. package/build/types/service/src/createAmqpConnection.d.ts +29 -4
  61. package/build/types/service/src/createAmqpConnection.d.ts.map +1 -1
  62. package/build/types/service/src/errors.d.ts +45 -0
  63. package/build/types/service/src/errors.d.ts.map +1 -1
  64. package/build/types/service/src/helpers.d.ts +59 -56
  65. package/build/types/service/src/helpers.d.ts.map +1 -1
  66. package/build/types/service/src/index.d.ts +25 -3
  67. package/build/types/service/src/index.d.ts.map +1 -1
  68. package/build/types/service/src/transformer.d.ts +16 -0
  69. package/build/types/service/src/transformer.d.ts.map +1 -0
  70. package/package.json +7 -3
  71. package/build/chunk-6w7td62p.js +0 -56
  72. package/build/chunk-6w7td62p.js.map +0 -10
  73. package/build/types/helpers/src/files/RequenceFile.d.ts +0 -40
  74. package/build/types/helpers/src/files/RequenceFile.d.ts.map +0 -1
  75. package/build/types/helpers/src/files/RequenceStream.d.ts +0 -32
  76. package/build/types/helpers/src/files/RequenceStream.d.ts.map +0 -1
  77. package/build/types/helpers/src/files/index.d.ts +0 -7
  78. package/build/types/helpers/src/files/index.d.ts.map +0 -1
  79. package/build/types/helpers/src/files/mapOutput.d.ts +0 -10
  80. package/build/types/helpers/src/files/mapOutput.d.ts.map +0 -1
  81. package/build/types/helpers/src/files/types.d.ts +0 -4
  82. package/build/types/helpers/src/files/types.d.ts.map +0 -1
  83. package/build/types/helpers/src/utils/createObjectProxy.d.ts +0 -2
  84. package/build/types/helpers/src/utils/createObjectProxy.d.ts.map +0 -1
  85. package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts +0 -8
  86. package/build/types/helpers/src/utils/resolveRequenceTypes.d.ts.map +0 -1
  87. package/build/types/service/src/mapInput.d.ts +0 -2
  88. package/build/types/service/src/mapInput.d.ts.map +0 -1
  89. /package/build/types/helpers/src/{files → utils}/fileObject.d.ts +0 -0
  90. /package/build/types/helpers/src/{files → utils}/isValidMimeType.d.ts +0 -0
  91. /package/build/types/helpers/src/{files → utils}/streamObject.d.ts +0 -0
@@ -0,0 +1,87 @@
1
+ import type { CallbackEgressContext, CallbackIngressContext } from '@requence/callbacks';
2
+ import type { WireCodec } from '@requence/helpers/msgpack';
3
+ import { transformer } from './transformer.ts';
4
+ type InboundCtx = Parameters<typeof transformer.inbound>[1];
5
+ export interface OutboundBoundaryOptions {
6
+ uploadUrl?: string;
7
+ streamUrl?: string;
8
+ /** Claim-check offload threshold in bytes, transmitted via task options. */
9
+ maxPayloadSize?: number;
10
+ /** Upload/stream cap in bytes, transmitted via task options. */
11
+ maxFileSize?: number;
12
+ /**
13
+ * The codec this boundary's publishes will use — the codec of the dispatch
14
+ * being replied to, since a reply echoes it.
15
+ *
16
+ * The claim-check offloads on the SERIALIZED size, so the threshold has to be
17
+ * measured with the codec the body actually goes out under. Both are live at
18
+ * once (the choice is baked per service node), so the boundary cannot assume
19
+ * either. Defaults to `json`: the pre-migration status quo, and the right
20
+ * answer for the deferred path, which has no dispatch to echo.
21
+ */
22
+ wireCodec?: WireCodec;
23
+ signal?: AbortSignal;
24
+ fetch?: typeof globalThis.fetch;
25
+ /** Sink for best-effort degradation notices. Defaults to `console.warn`. */
26
+ warn?(message: string, error?: unknown): void;
27
+ }
28
+ export interface OutboundSendOptions {
29
+ /** The emission this value belongs to (embedded in callback references). */
30
+ outputName?: string | null;
31
+ /** Callback registrar for this emission; absent ⇒ functions fail loud. */
32
+ onCallback?: CallbackEgressContext['onCallback'];
33
+ /**
34
+ * Log policy: sanitize the payload first (functions/opaque instances become
35
+ * labels), degrade offload failures to warnings, and never reject — a log
36
+ * line must not fail the task. On a transform error resolves to `undefined`
37
+ * (callers skip publishing).
38
+ */
39
+ bestEffort?: boolean;
40
+ }
41
+ export interface OutboundBoundary {
42
+ /**
43
+ * Serialize a value through the composed transformer inside a
44
+ * `withRequenceStreams` scope. The returned promise resolves with the
45
+ * serialized value as soon as references exist (stream bodies may still be
46
+ * uploading); background completion is tracked in the boundary's ledger and
47
+ * surfaced by `settle()`.
48
+ */
49
+ send(data: unknown, opts?: OutboundSendOptions): Promise<unknown>;
50
+ /** Enroll an external promise (e.g. a publish) in the done-gate. */
51
+ track(promise: Promise<unknown>): void;
52
+ /**
53
+ * The done-gate: wait until the ledger stops growing (sends may enqueue
54
+ * more sends), then throw an `AggregateError` if any fail-hard work failed.
55
+ * Ledger entries are pre-caught at registration time, so nothing ever
56
+ * rejects unhandled while the gate is not yet attached.
57
+ */
58
+ settle(): Promise<void>;
59
+ }
60
+ export declare function createOutboundBoundary(base: OutboundBoundaryOptions): OutboundBoundary;
61
+ export interface InboundBoundaryOptions {
62
+ fetch?: typeof globalThis.fetch;
63
+ /** Cancellation for lazy remote reads of reconstructed values. */
64
+ signal?: AbortSignal;
65
+ /** Per-boundary rehydration timeout; composed with `signal` per call. */
66
+ timeoutMs?: number;
67
+ /** Default invocation dispatch for reconstructed callbacks. */
68
+ onCallbackInvoke?: CallbackIngressContext['onCallbackInvoke'];
69
+ /**
70
+ * Transformer override for this boundary; defaults to the full composed
71
+ * chain. Passthrough consumers substitute the claim-check-only instance
72
+ * (`transformer.ts`) so byte references stay raw wire objects.
73
+ */
74
+ transformer?: {
75
+ inbound(data: unknown, ctx: InboundCtx): Promise<unknown>;
76
+ };
77
+ }
78
+ export interface InboundReceiveOptions {
79
+ onCallbackInvoke?: CallbackIngressContext['onCallbackInvoke'];
80
+ }
81
+ /**
82
+ * The single place the service's ingress cancellation/timeout policy lives:
83
+ * every inbound transform of the runtime goes through one of these.
84
+ */
85
+ export declare function createInboundBoundary(base?: InboundBoundaryOptions): (data: unknown, opts?: InboundReceiveOptions) => Promise<unknown>;
86
+ export {};
87
+ //# sourceMappingURL=boundary.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundary.d.ts","sourceRoot":"","sources":["../../../../src/boundary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM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W,sBAAsB;IACrC,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;IAC/B,kEAAkE;IAClE,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,+DAA+D;IAC/D,gBAAgB,CAAC,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,CAAA;IAC7D;;;;OAIG;IACH,WAAW,CAAC,EAAE;QAAE,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,CAAA;CAC5E;AAED,MAAM,WAAW,qBAAqB;IACpC,gBAAgB,CAAC,EAAE,sBAAsB,CAAC,kBAAkB,CAAC,CAAA;CAC9D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,GAAE,sBAA2B,UAE7D,OAAO,SACP,qBAAqB,KAC1B,OAAO,CAAC,OAAO,CAAC,CAiBpB"}
@@ -14,8 +14,13 @@ interface ServiceContextHelper<V extends keyof RequenceService.Version> extends
14
14
  type ApiOutputName<V> = V extends keyof RequenceService.Version ? OutputName<V> : string | null;
15
15
  type ApiOutputValue<V, O> = V extends keyof RequenceService.Version ? O extends OutputName<V> ? OutputValue<V, O> : unknown : unknown;
16
16
  interface ActorApi<V> {
17
- sendToOutput<O extends ApiOutputName<V>>(outputName: O, data: ApiOutputValue<V, O>): void;
18
- send(data: ApiOutputValue<V, null>): void;
17
+ sendToOutput<O extends ApiOutputName<V>>(outputName: O, data: ApiOutputValue<V, O>, options?: {
18
+ overwrite?: boolean;
19
+ }): void;
20
+ send(data: ApiOutputValue<V, null>, options?: {
21
+ overwrite?: boolean;
22
+ }): void;
23
+ sendState(state: unknown): void;
19
24
  abort(error: string | Error): void;
20
25
  }
21
26
  export interface ConnectionApi<V> {
@@ -23,22 +28,42 @@ export interface ConnectionApi<V> {
23
28
  open(): Promise<ConnectionApi<V>>;
24
29
  act(messageKey: string, actor: (api: ActorApi<V>) => ApiOutputValue<V, null> | Promise<ApiOutputValue<V, null>> | void | Promise<void> | AsyncGenerator<ApiOutputValue<V, null>> | Generator<ApiOutputValue<V, null>>): Promise<void>;
25
30
  }
31
+ export declare const messageKeySchema: z.ZodPipe<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string[], string>>, z.ZodTuple<[z.ZodUUID, z.ZodUUID], z.ZodString>>, z.ZodTransform<{
32
+ taskId: string;
33
+ messageId: string;
34
+ uploadUrl: string | undefined;
35
+ streamUrl: string | undefined;
36
+ maxPayloadSize: number | undefined;
37
+ maxFileSize: number | undefined;
38
+ }, [string, string, ...string[]]>>;
26
39
  export declare const connectionOptionsSchema: z.ZodObject<{
27
40
  url: z.ZodUnion<readonly [z.ZodPipe<z.ZodString, z.ZodTransform<URL, string>>, z.ZodCustom<URL, URL>]>;
28
41
  version: z.ZodString;
42
+ name: z.ZodOptional<z.ZodString>;
29
43
  devOverlay: z.ZodOptional<z.ZodString>;
30
44
  silent: z.ZodOptional<z.ZodBoolean>;
31
45
  prefetch: z.ZodOptional<z.ZodNumber>;
32
46
  connectionTimeout: z.ZodDefault<z.ZodNumber>;
47
+ heartbeatInterval: z.ZodOptional<z.ZodNumber>;
33
48
  connectionOptions: z.ZodOptional<z.ZodAny>;
49
+ maxMessageSize: z.ZodDefault<z.ZodNumber>;
50
+ passthroughByteReferences: z.ZodOptional<z.ZodBoolean>;
34
51
  }, z.core.$strip>;
35
- export type ConnectionOptions = z.output<typeof connectionOptionsSchema>;
52
+ export type PrivilegedConnectionOptions = z.output<typeof connectionOptionsSchema>;
53
+ export type ConnectionOptions = Omit<PrivilegedConnectionOptions, 'passthroughByteReferences'>;
54
+ export interface ConnectionState {
55
+ connected: boolean;
56
+ err?: Error;
57
+ }
58
+ export type ConnectionStateListener = (state: ConnectionState) => void;
36
59
  type MessageHandlerContext<V> = V extends keyof RequenceService.Version ? ServiceContextHelper<V> : ContextHelper;
37
60
  type MessageHandlerReturnValue<V, O = null> = V extends keyof RequenceService.Version ? O extends OutputName<V> ? OutputValue<V, O> | InternalNamedOutput : void : JSONValue;
38
61
  type MessageHandlerFunction<V> = (context: MessageHandlerContext<V>) => MaybePromise<MessageHandlerReturnValue<V> | void>;
39
62
  type MessageHandlerGenerator<V> = (context: MessageHandlerContext<V>) => Generator<MessageHandlerReturnValue<V>, MessageHandlerReturnValue<V> | void, void>;
40
63
  type MessageHandlerAsyncGenerator<V> = (context: MessageHandlerContext<V>) => AsyncGenerator<MessageHandlerReturnValue<V>, MessageHandlerReturnValue<V> | void, void>;
41
64
  export type MessageHandler<V> = V extends keyof RequenceService.Version ? RequenceService.Version[V]['mode'] extends 'LINEAR' ? MessageHandlerFunction<V> : MessageHandlerAsyncGenerator<V> | MessageHandlerGenerator<V> | MessageHandlerFunction<V> : MessageHandlerAsyncGenerator<V> | MessageHandlerGenerator<V> | MessageHandlerFunction<V>;
42
- export default function createConnection<V>({ url, version, prefetch, silent, connectionTimeout, connectionOptions, devOverlay, }: ConnectionOptions, messageHandler: MessageHandler<V>): ConnectionApi<V>;
65
+ export default function createConnection<V>({ url, version, prefetch, silent, connectionTimeout, heartbeatInterval, connectionOptions, name, devOverlay, maxMessageSize, onConnectionStateChange, ...rest }: ConnectionOptions & {
66
+ onConnectionStateChange?: ConnectionStateListener;
67
+ }, messageHandler: MessageHandler<V>): ConnectionApi<V>;
43
68
  export {};
44
69
  //# sourceMappingURL=createAmqpConnection.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createAmqpConnection.d.ts","sourceRoot":"","sources":["../../../../src/createAmqpConnection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAA0B,MAAM,mBAAmB,CAAA;AAG7E,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAG1B,OAA4B,EAE1B,KAAK,aAAa,EAClB,KAAK,SAAS,EAMf,MAAM,cAAc,CAAA;AAIrB,KAAK,mBAAmB,GAAG,2BAA2B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CAAC,CAAC,GAC/B,uBAAuB,CAAC,CAAC,CAAC,GAC1B,sBAAsB,CAAC,CAAC,CAAC,CAAA;AA4DjC,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,CAAC,EACxC,EACE,GAAG,EACH,OAAO,EACP,QAAY,EACZ,MAAc,EACd,iBAAiB,EAKjB,iBAAkD,EAClD,iBAAiB,EACjB,IAAI,EACJ,UAAe,EACf,cAAc,EACd,uBAAuB,EACvB,GAAG,IAAI,EACR,EAAE,iBAAiB,GAAG;IAAE,uBAAuB,CAAC,EAAE,uBAAuB,CAAA;CAAE,EAC5E,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,oBAukClC"}
@@ -1,3 +1,48 @@
1
1
  export declare class RequenceConnectionError extends Error {
2
2
  }
3
+ /**
4
+ * Signals that the requence system could not be reached — e.g. during a
5
+ * maintenance window or deploy, when the backend is unreachable (connection
6
+ * refused / timeout / DNS failure) or an ingress returns a gateway error
7
+ * (502/503/504). Callers should treat this as transient and retry later.
8
+ */
9
+ export declare class RequenceUnreachableError extends Error {
10
+ readonly status?: number | undefined;
11
+ constructor(status?: number | undefined, options?: {
12
+ cause?: unknown;
13
+ });
14
+ }
15
+ export declare function isUnreachableStatus(status: number): boolean;
16
+ /**
17
+ * Throws a {@link RequenceUnreachableError} when the response carries a gateway
18
+ * status indicating the system is unreachable. Call right after a fetch, before
19
+ * inspecting `response.ok`.
20
+ */
21
+ export declare function assertReachable(response: Response): void;
22
+ /**
23
+ * Wraps `fetch` so a transport-level failure (connection refused, DNS failure,
24
+ * timeout) surfaces as a {@link RequenceUnreachableError} instead of a raw
25
+ * TypeError, and gateway statuses (502/503/504) do the same. The returned
26
+ * response is guaranteed not to be a gateway-error response.
27
+ */
28
+ export declare function reachableFetch(input: Parameters<typeof fetch>[0], init?: Parameters<typeof fetch>[1]): Promise<Response>;
29
+ /**
30
+ * The dispatch declared a capability (`requires` header) this build cannot
31
+ * satisfy, so it was refused before its body was ever decoded.
32
+ *
33
+ * A NAMED error on purpose: the point of the `requires` header is that a
34
+ * mismatch reports the missing capability, instead of whatever incidental
35
+ * exception the undecodable payload would otherwise have produced — a bare
36
+ * `SyntaxError` from `JSON.parse` says nothing about why this box was the wrong
37
+ * one. The message travels to the operator, which surfaces it on the node.
38
+ */
39
+ export declare class UnsupportedCapabilityError extends Error {
40
+ readonly capabilities: string[];
41
+ constructor(unsupported: ReadonlyArray<string>);
42
+ }
43
+ export declare class PayloadTooLargeError extends Error {
44
+ readonly size: number;
45
+ readonly maxSize: number;
46
+ constructor(size: number, maxSize: number);
47
+ }
3
48
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,uBAAwB,SAAQ,KAAK;CAAG"}
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/errors.ts"],"names":[],"mappings":"AAEA,qBAAa,uBAAwB,SAAQ,KAAK;CAAG;AAOrD;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,KAAK;aAE/B,MAAM,CAAC,EAAE,MAAM;IADjC,YACkB,MAAM,CAAC,EAAE,MAAM,YAAA,EAC/B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,EAO9B;CACF;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE3D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAIxD;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,KAAK,EAAE,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,EAClC,IAAI,CAAC,EAAE,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,GACjC,OAAO,CAAC,QAAQ,CAAC,CASnB;AAED;;;;;;;;;GASG;AACH,qBAAa,0BAA2B,SAAQ,KAAK;IACnD,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,CAAA;IAE/B,YAAY,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,EAI7C;CACF;AAED,qBAAa,oBAAqB,SAAQ,KAAK;IAC7C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IAExB,YAAY,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EASxC;CACF"}
@@ -1,5 +1,5 @@
1
1
  import { AsyncLocalStorage } from 'node:async_hooks';
2
- import type { TaskOptions } from '../../helpers/src/protocol/index.js';
2
+ import type { CallbackObject } from '../../helpers/src/index.js';
3
3
  export type JSONValue = string | number | boolean | {
4
4
  [x: string]: JSONValue;
5
5
  } | Array<JSONValue> | null | undefined;
@@ -16,32 +16,37 @@ type OutputValue = {
16
16
  [OUTPUT_VALUE]: string | null;
17
17
  value: any;
18
18
  };
19
- export declare function processData(params: {
20
- data: unknown;
21
- outputName: null | string;
22
- options: Pick<TaskOptions, 'uploadUrl' | 'streamUrl'>;
23
- onCallback: (callback: (...args: any[]) => void) => {
24
- callbackId: string;
25
- sourceId: string;
26
- };
27
- onDone: () => void;
28
- }): Promise<unknown>;
29
- export declare function unwrapResult(params: {
30
- result: unknown;
31
- options: Pick<TaskOptions, 'uploadUrl' | 'streamUrl'>;
32
- onCallback: (callback: (...args: any[]) => void) => {
33
- callbackId: string;
34
- sourceId: string;
35
- };
36
- onDone: () => void;
37
- }): Promise<{
19
+ /**
20
+ * Unwrap the `context.toOutput(...)` symbol wrapper into its raw value and
21
+ * output name. Pure — serialization happens at the component's outbound
22
+ * boundary (`createOutboundBoundary`), not here.
23
+ */
24
+ export declare function unwrapOutputValue(result: unknown): {
38
25
  value: unknown;
39
26
  outputName: string | null;
40
- }>;
27
+ };
28
+ export interface PrivilegedSends {
29
+ send(data: unknown, options?: {
30
+ overwrite?: boolean;
31
+ }): void;
32
+ sendToOutput(name: string, data: unknown, options?: {
33
+ overwrite?: boolean;
34
+ }): void;
35
+ sendState(state: unknown): void;
36
+ invokeCallback(ref: CallbackObject, arg: unknown): void;
37
+ options: {
38
+ uploadUrl?: string;
39
+ streamUrl?: string;
40
+ maxPayloadSize?: number;
41
+ maxFileSize?: number;
42
+ };
43
+ }
41
44
  export default function createContextHelper(options: {
42
45
  taskId: string;
43
46
  input: unknown;
44
47
  configuration: unknown;
48
+ abortController?: AbortController;
49
+ passthroughByteReferences?: boolean;
45
50
  onLog: (method: 'log' | 'warn' | 'info' | 'error', data: any[]) => void;
46
51
  onDefer: (reason?: string) => string;
47
52
  onCallback: (params: {
@@ -51,46 +56,44 @@ export default function createContextHelper(options: {
51
56
  propertyPath: (string | number)[];
52
57
  arg: unknown;
53
58
  }) => void;
54
- }): readonly [{
55
- readonly taskId: string;
56
- readonly input: any;
57
- readonly configuration: any;
58
- readonly toOutput: (name: string | null, value: unknown) => OutputValue;
59
- readonly defer: (reason?: string) => string;
60
- readonly debug: {
61
- readonly log: (...data: any[]) => void;
62
- readonly info: (...data: any[]) => void;
63
- readonly warn: (...data: any[]) => void;
64
- readonly error: (...data: any[]) => void;
59
+ sends: PrivilegedSends;
60
+ }): Promise<readonly [{
61
+ taskId: string;
62
+ input: unknown;
63
+ configuration: unknown;
64
+ toOutput(name: string | null, value: unknown): OutputValue;
65
+ defer: (reason?: string) => string;
66
+ debug: {
67
+ log(...data: any[]): void;
68
+ info(...data: any[]): void;
69
+ warn(...data: any[]): void;
70
+ error(...data: any[]): void;
65
71
  };
66
- readonly retry: (delay?: number) => never;
67
- readonly abort: (reason?: string) => never;
68
- readonly skip: () => never;
69
- readonly terminated: Promise<string> & {
72
+ retry(delay?: number): never;
73
+ abort(reason?: string): never;
74
+ skip(): never;
75
+ terminated: Promise<string> & {
70
76
  signal: AbortSignal;
71
77
  };
72
- }, {
73
- promise: Promise<string>;
74
- resolve: (value?: string | PromiseLike<string> | undefined) => void;
75
- reject: (reason?: any) => void;
76
- }];
77
- export type ContextHelper = ReturnType<typeof createContextHelper>[0];
78
+ }, PromiseWithResolvers<string>]>;
79
+ export type ContextHelper = Awaited<ReturnType<typeof createContextHelper>>[0];
80
+ export type PrivilegedContext = ContextHelper & PrivilegedSends;
78
81
  export declare const handlerStorage: AsyncLocalStorage<{
79
- readonly taskId: string;
80
- readonly input: any;
81
- readonly configuration: any;
82
- readonly toOutput: (name: string | null, value: unknown) => OutputValue;
83
- readonly defer: (reason?: string) => string;
84
- readonly debug: {
85
- readonly log: (...data: any[]) => void;
86
- readonly info: (...data: any[]) => void;
87
- readonly warn: (...data: any[]) => void;
88
- readonly error: (...data: any[]) => void;
82
+ taskId: string;
83
+ input: unknown;
84
+ configuration: unknown;
85
+ toOutput(name: string | null, value: unknown): OutputValue;
86
+ defer: (reason?: string) => string;
87
+ debug: {
88
+ log(...data: any[]): void;
89
+ info(...data: any[]): void;
90
+ warn(...data: any[]): void;
91
+ error(...data: any[]): void;
89
92
  };
90
- readonly retry: (delay?: number) => never;
91
- readonly abort: (reason?: string) => never;
92
- readonly skip: () => never;
93
- readonly terminated: Promise<string> & {
93
+ retry(delay?: number): never;
94
+ abort(reason?: string): never;
95
+ skip(): never;
96
+ terminated: Promise<string> & {
94
97
  signal: AbortSignal;
95
98
  };
96
99
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAIpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAE7D,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,GAC1B,KAAK,CAAC,SAAS,CAAC,GAChB,IAAI,GACJ,SAAS,CAAA;AAEb,qBAAa,UAAW,SAAQ,KAAK;IAChB,KAAK,CAAC,E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,IAAI,UAAU,GAAG,EAAE;QAGnB,KAAK,UAAU,GAAG,EAAE;;kBAIR,MAAM;mBAGL,MAAM;;;;;EAwB2C,CAAA"}
@@ -1,19 +1,41 @@
1
1
  import type { AmqpConnectionManagerOptions } from 'amqp-connection-manager';
2
- import { type ConnectionApi, type MessageHandler } from './createAmqpConnection.ts';
3
- export { RequenceFile, RequenceStream } from '../../helpers/src/files/index.js';
2
+ import { type ConnectionApi, type ConnectionStateListener, type MessageHandler } from './createAmqpConnection.ts';
3
+ export { RequenceFile, RequenceStream } from '@requence/files';
4
4
  export { createCallback, type RequenceCallback, type WrappedRequenceCallback, } from '../../helpers/src/index.js';
5
5
  export * from './errors.ts';
6
6
  export * from './utils.ts';
7
- export { MessageHandler } from './createAmqpConnection.ts';
7
+ export { type ConnectionState, type ConnectionStateListener, MessageHandler, } from './createAmqpConnection.ts';
8
+ export type { PrivilegedContext, PrivilegedSends } from './helpers.ts';
8
9
  export type ServiceApi<V extends keyof RequenceService.Version | (string & {})> = ConnectionApi<V>;
9
10
  interface ServiceOptions<V extends string> {
10
11
  accessToken?: string;
11
12
  devToken?: string;
12
13
  version: V;
14
+ /**
15
+ * Optional, author-chosen label announced in the AMQP client properties and
16
+ * shown in the Requence UI next to the online count — "which of my three
17
+ * deployments is this?".
18
+ *
19
+ * A DEBUGGING LABEL, not an identifier: it is not unique, nothing keys off
20
+ * it, and no behaviour depends on it. Capped at 64 characters (longer labels
21
+ * are truncated, never rejected).
22
+ */
23
+ name?: string;
13
24
  prefetch?: number;
14
25
  connectionTimeout?: number;
26
+ /** heartbeat interval in seconds — defaults to 30 */
27
+ heartbeatInterval?: number;
15
28
  silent?: boolean;
16
29
  connectionOptions?: AmqpConnectionManagerOptions['connectionOptions'];
30
+ /** Max serialized body size in bytes before a PayloadTooLargeError is thrown. */
31
+ maxMessageSize?: number;
32
+ passthroughByteReferences?: boolean;
33
+ /**
34
+ * Notified whenever the underlying AMQP connection is lost or (re)established.
35
+ * amqp-connection-manager auto-reconnects, so this is the only observable
36
+ * signal of a mid-life outage — use it to drive liveness/health reporting.
37
+ */
38
+ onConnectionStateChange?: ConnectionStateListener;
17
39
  }
18
40
  export declare function createService<V extends keyof RequenceService.Version | (string & {})>(version: V, messageHandler: MessageHandler<V>): ServiceApi<V>;
19
41
  export declare function createService<V extends keyof RequenceService.Version | (string & {})>(options: ServiceOptions<V>, messageHandler: MessageHandler<V>): ServiceApi<V>;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,yBAAyB,CAAA;AAE3E,OAA6B,EAC3B,KAAK,aAAa,EAClB,KAAK,cAAc,EAEpB,MAAM,2BAA2B,CAAA;AAElC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AACtE,OAAO,EACL,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,uBAAuB,GAC7B,MAAM,mBAAmB,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,MAAM,MAAM,UAAU,CACpB,CAAC,SAAS,MAAM,eAAe,CAAC,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,IACrD,aAAa,CAAC,CAAC,CAAC,CAAA;AAEpB,UAAU,cAAc,CAAC,CAAC,SAAS,MAAM;IACvC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,CAAC,CAAA;IACV,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,iBAAiB,CAAC,EAAE,4BAA4B,CAAC,mBAAmB,CAAC,CAAA;CACtE;AAUD,wBAAgB,aAAa,C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,MAAM,CAAA;IACjB,OAAO,EAAE,CAAC,CAAA;IACV;;;;;;;;OAQG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,iBAAiB,CAAC,EAAE,4BAA4B,CAAC,mBAAmB,CAAC,CAAA;IACrE,iFAAiF;IACjF,cAAc,CAAC,EAAE,MAAM,CAAA;IAGvB,yBAAyB,CAAC,EAAE,OAAO,CAAA;IACnC;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,uBAAuB,CAAA;CAClD;AAwCD,wBAAgB,aAAa,CAC3B,CAAC,SAAS,MAAM,eAAe,CAAC,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EACvD,OAAO,EAAE,CAAC,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA;AAC/D,wBAAgB,aAAa,CAC3B,CAAC,SAAS,MAAM,eAAe,CAAC,OAAO,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,EACvD,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The service runtime's composed transformer: byte references (file, stream,
3
+ * claim-check) plus callbacks. The instance's `outbound`/`inbound` ctx types
4
+ * accumulate the composed handlers' declared capabilities — the boundary
5
+ * (`boundary.ts`) is the only place that builds those ctx objects.
6
+ */
7
+ export declare const transformer: import("@requence/transformer").Transformer<import("@requence/files").FileEgressContext & import("@requence/files").StreamEgressContext & import("@requence/callbacks").CallbackEgressContext & object & import("@requence/files").ClaimCheckEgressContext, import("@requence/callbacks").CallbackIngressContext & object>;
8
+ /**
9
+ * Inbound chain for passthrough consumers (the logic runtime): claim-checks
10
+ * still resolve — a state seed may arrive as a ClaimCheck reference — but
11
+ * file/stream/callback references stay raw `__REQUENCE_type` wire objects,
12
+ * JSON-safe for forwarding across a process boundary the full instances could
13
+ * not cross. A tag owned by none of these still fails loud.
14
+ */
15
+ export declare const passthroughInboundTransformer: import("@requence/transformer").Transformer<object & import("@requence/files").ClaimCheckEgressContext, object>;
16
+ //# sourceMappingURL=transformer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../../../src/transformer.ts"],"names":[],"mappings":"AAQA;;;;;GAKG;AACH,eAAO,MAAM,WAAW,4TAIiB,CAAA;AAqBzC;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,iHAID,CAAA"}
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@requence/service",
3
3
  "type": "module",
4
- "version": "0.7.1",
4
+ "version": "0.8.2-edge.1149",
5
5
  "bin": {
6
6
  "requence-service": "build/cli.js"
7
7
  },
8
8
  "scripts": {
9
9
  "check-format": "oxfmt --check",
10
10
  "fix-format": "oxfmt --write",
11
- "check-types": "tsc",
11
+ "check-types": "tsgo",
12
12
  "lint": "oxlint --deny-warnings",
13
- "build-declaration": "tsc -p tsconfig.declaration.json && tsc-alias -p tsconfig.declaration.json 2>/dev/null",
13
+ "build-declaration": "tsgo -p tsconfig.declaration.json && tsc-alias -p tsconfig.declaration.json 2>/dev/null",
14
14
  "build": "ADD_ENTRYPOINT=src/cli.ts bun -e \"import('@requence/utils/build-package.mts')\" && bun build-declaration"
15
15
  },
16
16
  "dependencies": {
@@ -20,11 +20,15 @@
20
20
  "chalk": "^5.6.2",
21
21
  "eventsource-client": "^1.2.0",
22
22
  "mime-types": "^3.0.1",
23
+ "msgpackr": "^1.11.5",
23
24
  "yargs": "^17.7.2",
24
25
  "zod": "^4.3.6"
25
26
  },
26
27
  "devDependencies": {
28
+ "@requence/callbacks": "workspace:*",
29
+ "@requence/files": "workspace:*",
27
30
  "@requence/helpers": "workspace:*",
31
+ "@requence/transformer": "workspace:*",
28
32
  "@requence/utils": "workspace:*",
29
33
  "@types/amqplib": "^0.10.7",
30
34
  "@types/bun": "^1.2.23",
@@ -1,56 +0,0 @@
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
@@ -1,10 +0,0 @@
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
- }
@@ -1,40 +0,0 @@
1
- import type { FileObject } from './index.ts';
2
- import type { MainMimeType, SubMimeType, ValidMimeType } from './types.ts';
3
- interface RequenceFilePropertyBag<T> extends Omit<BlobPropertyBag, 'type'> {
4
- type: T;
5
- }
6
- export interface RequenceFileType<A, B> {
7
- size: number;
8
- mimeType: string;
9
- mainMimeType: A;
10
- subMimeType: B;
11
- text(): Promise<string>;
12
- json(): Promise<unknown>;
13
- blob(): Promise<Blob>;
14
- arrayBuffer(): Promise<ArrayBuffer>;
15
- }
16
- export declare class RequenceFile<T extends `${string}/${string}` = '*/*', A = MainMimeType<T>, B = SubMimeType<T>> implements RequenceFileType<A, B> {
17
- #private;
18
- constructor(blobParts: BlobPart[], options?: RequenceFilePropertyBag<ValidMimeType<T>>);
19
- /** @internal */
20
- static fromFileObject<T extends `${string}/${string}`>(file: FileObject): RequenceFile<T>;
21
- /** @internal */
22
- get fileObject(): {
23
- size: number;
24
- mime: string;
25
- url: string;
26
- __REQUENCE_type: "RequenceFile";
27
- } | null;
28
- get size(): number;
29
- get mimeType(): string;
30
- get mainMimeType(): A;
31
- get subMimeType(): B;
32
- text(): Promise<string>;
33
- json(): Promise<any>;
34
- blob(): Promise<Blob>;
35
- arrayBuffer(): Promise<ArrayBuffer>;
36
- toString(): string;
37
- toJSON(): string;
38
- }
39
- export {};
40
- //# sourceMappingURL=RequenceFile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"RequenceFile.d.ts","sourceRoot":"","sources":["../../../../../../helpers/src/files/RequenceFile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1E,UAAU,uBAAuB,CAAC,CAAC,CAAE,SAAQ,IAAI,CAAC,eAAe,EAAE,MAAM,CAAC;IACxE,IAAI,EAAE,CAAC,CAAA;CACR;AAED,MAAM,WAAW,gBAAgB,CAAC,CAAC,EAAE,CAAC;IACpC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,CAAC,CAAA;IACf,WAAW,EAAE,CAAC,CAAA;IACd,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAA;IACvB,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;IACxB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IACrB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC,CAAA;CACpC;AAED,qBAAa,YAAY,CACvB,CAAC,SAAS,GAAG,MAAM,IAAI,MAAM,EAAE,GAAG,KAAK,EACvC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,EACnB,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAClB,YAAW,gBAAgB,C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