@superdurable/dex 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.
Files changed (72) hide show
  1. package/LICENSE +7 -0
  2. package/README.md +145 -0
  3. package/dist/src/blob-cache.d.ts +14 -0
  4. package/dist/src/blob-cache.js +22 -0
  5. package/dist/src/blob-cache.js.map +1 -0
  6. package/dist/src/client.d.ts +36 -0
  7. package/dist/src/client.js +441 -0
  8. package/dist/src/client.js.map +1 -0
  9. package/dist/src/codec.d.ts +38 -0
  10. package/dist/src/codec.js +86 -0
  11. package/dist/src/codec.js.map +1 -0
  12. package/dist/src/context.d.ts +23 -0
  13. package/dist/src/context.js +9 -0
  14. package/dist/src/context.js.map +1 -0
  15. package/dist/src/errors.d.ts +44 -0
  16. package/dist/src/errors.js +73 -0
  17. package/dist/src/errors.js.map +1 -0
  18. package/dist/src/flow.d.ts +31 -0
  19. package/dist/src/flow.js +155 -0
  20. package/dist/src/flow.js.map +1 -0
  21. package/dist/src/gen/dex.d.ts +1529 -0
  22. package/dist/src/gen/dex.js +10661 -0
  23. package/dist/src/gen/dex.js.map +1 -0
  24. package/dist/src/gen/google/protobuf/duration.d.ts +103 -0
  25. package/dist/src/gen/google/protobuf/duration.js +64 -0
  26. package/dist/src/gen/google/protobuf/duration.js.map +1 -0
  27. package/dist/src/gen/google/protobuf/empty.d.ts +37 -0
  28. package/dist/src/gen/google/protobuf/empty.js +39 -0
  29. package/dist/src/gen/google/protobuf/empty.js.map +1 -0
  30. package/dist/src/gen/google/protobuf/struct.d.ts +140 -0
  31. package/dist/src/gen/google/protobuf/struct.js +359 -0
  32. package/dist/src/gen/google/protobuf/struct.js.map +1 -0
  33. package/dist/src/gen/google/protobuf/timestamp.d.ts +133 -0
  34. package/dist/src/gen/google/protobuf/timestamp.js +64 -0
  35. package/dist/src/gen/google/protobuf/timestamp.js.map +1 -0
  36. package/dist/src/grpc-status.d.ts +4 -0
  37. package/dist/src/grpc-status.js +105 -0
  38. package/dist/src/grpc-status.js.map +1 -0
  39. package/dist/src/index.d.ts +14 -0
  40. package/dist/src/index.js +20 -0
  41. package/dist/src/index.js.map +1 -0
  42. package/dist/src/invocation-context.d.ts +44 -0
  43. package/dist/src/invocation-context.js +203 -0
  44. package/dist/src/invocation-context.js.map +1 -0
  45. package/dist/src/options.d.ts +106 -0
  46. package/dist/src/options.js +55 -0
  47. package/dist/src/options.js.map +1 -0
  48. package/dist/src/persistence.d.ts +45 -0
  49. package/dist/src/persistence.js +65 -0
  50. package/dist/src/persistence.js.map +1 -0
  51. package/dist/src/rpc.d.ts +39 -0
  52. package/dist/src/rpc.js +50 -0
  53. package/dist/src/rpc.js.map +1 -0
  54. package/dist/src/step.d.ts +92 -0
  55. package/dist/src/step.js +62 -0
  56. package/dist/src/step.js.map +1 -0
  57. package/dist/src/validation.d.ts +3 -0
  58. package/dist/src/validation.js +33 -0
  59. package/dist/src/validation.js.map +1 -0
  60. package/dist/src/value-mapper.d.ts +14 -0
  61. package/dist/src/value-mapper.js +199 -0
  62. package/dist/src/value-mapper.js.map +1 -0
  63. package/dist/src/wait.d.ts +57 -0
  64. package/dist/src/wait.js +124 -0
  65. package/dist/src/wait.js.map +1 -0
  66. package/dist/src/worker-dispatcher.d.ts +14 -0
  67. package/dist/src/worker-dispatcher.js +374 -0
  68. package/dist/src/worker-dispatcher.js.map +1 -0
  69. package/dist/src/worker.d.ts +18 -0
  70. package/dist/src/worker.js +139 -0
  71. package/dist/src/worker.js.map +1 -0
  72. package/package.json +53 -0
@@ -0,0 +1,103 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ export declare const protobufPackage = "google.protobuf";
3
+ /**
4
+ * A Duration represents a signed, fixed-length span of time represented
5
+ * as a count of seconds and fractions of seconds at nanosecond
6
+ * resolution. It is independent of any calendar and concepts like "day"
7
+ * or "month". It is related to Timestamp in that the difference between
8
+ * two Timestamp values is a Duration and it can be added or subtracted
9
+ * from a Timestamp. Range is approximately +-10,000 years.
10
+ *
11
+ * # Examples
12
+ *
13
+ * Example 1: Compute Duration from two Timestamps in pseudo code.
14
+ *
15
+ * Timestamp start = ...;
16
+ * Timestamp end = ...;
17
+ * Duration duration = ...;
18
+ *
19
+ * duration.seconds = end.seconds - start.seconds;
20
+ * duration.nanos = end.nanos - start.nanos;
21
+ *
22
+ * if (duration.seconds < 0 && duration.nanos > 0) {
23
+ * duration.seconds += 1;
24
+ * duration.nanos -= 1000000000;
25
+ * } else if (duration.seconds > 0 && duration.nanos < 0) {
26
+ * duration.seconds -= 1;
27
+ * duration.nanos += 1000000000;
28
+ * }
29
+ *
30
+ * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code.
31
+ *
32
+ * Timestamp start = ...;
33
+ * Duration duration = ...;
34
+ * Timestamp end = ...;
35
+ *
36
+ * end.seconds = start.seconds + duration.seconds;
37
+ * end.nanos = start.nanos + duration.nanos;
38
+ *
39
+ * if (end.nanos < 0) {
40
+ * end.seconds -= 1;
41
+ * end.nanos += 1000000000;
42
+ * } else if (end.nanos >= 1000000000) {
43
+ * end.seconds += 1;
44
+ * end.nanos -= 1000000000;
45
+ * }
46
+ *
47
+ * Example 3: Compute Duration from datetime.timedelta in Python.
48
+ *
49
+ * td = datetime.timedelta(days=3, minutes=10)
50
+ * duration = Duration()
51
+ * duration.FromTimedelta(td)
52
+ *
53
+ * # JSON Mapping
54
+ *
55
+ * In JSON format, the Duration type is encoded as a string rather than an
56
+ * object, where the string ends in the suffix "s" (indicating seconds) and
57
+ * is preceded by the number of seconds, with nanoseconds expressed as
58
+ * fractional seconds. For example, 3 seconds with 0 nanoseconds should be
59
+ * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should
60
+ * be expressed in JSON format as "3.000000001s", and 3 seconds and 1
61
+ * microsecond should be expressed in JSON format as "3.000001s".
62
+ */
63
+ export interface Duration {
64
+ /**
65
+ * Signed seconds of the span of time. Must be from -315,576,000,000
66
+ * to +315,576,000,000 inclusive. Note: these bounds are computed from:
67
+ * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years
68
+ */
69
+ seconds: bigint;
70
+ /**
71
+ * Signed fractions of a second at nanosecond resolution of the span
72
+ * of time. Durations less than one second are represented with a 0
73
+ * `seconds` field and a positive or negative `nanos` field. For durations
74
+ * of one second or more, a non-zero value for the `nanos` field must be
75
+ * of the same sign as the `seconds` field. Must be from -999,999,999
76
+ * to +999,999,999 inclusive.
77
+ */
78
+ nanos: number;
79
+ }
80
+ export declare const Duration: MessageFns<Duration>;
81
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
82
+ export type DeepPartial<T> = T extends bigint ? string | number | bigint : T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
83
+ $case: string;
84
+ value: unknown;
85
+ } ? {
86
+ $case: T["$case"];
87
+ value?: DeepPartial<T["value"]>;
88
+ } : T extends {} ? {
89
+ [K in keyof T]?: DeepPartial<T[K]>;
90
+ } : Partial<T>;
91
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
92
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
93
+ [K in keyof P]: Exact<P[K], I[K]>;
94
+ } & {
95
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
96
+ };
97
+ export interface MessageFns<T> {
98
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
99
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
100
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
101
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
102
+ }
103
+ export {};
@@ -0,0 +1,64 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.0
4
+ // protoc v7.35.1
5
+ // source: google/protobuf/duration.proto
6
+ /* eslint-disable */
7
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
8
+ export const protobufPackage = "google.protobuf";
9
+ function createBaseDuration() {
10
+ return { seconds: 0n, nanos: 0 };
11
+ }
12
+ export const Duration = {
13
+ encode(message, writer = new BinaryWriter()) {
14
+ if (message.seconds !== 0n) {
15
+ if (BigInt.asIntN(64, message.seconds) !== message.seconds) {
16
+ throw new globalThis.Error("value provided for field message.seconds of type int64 too large");
17
+ }
18
+ writer.uint32(8).int64(message.seconds);
19
+ }
20
+ if (message.nanos !== 0) {
21
+ writer.uint32(16).int32(message.nanos);
22
+ }
23
+ return writer;
24
+ },
25
+ decode(input, length) {
26
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
27
+ const end = length === undefined ? reader.len : reader.pos + length;
28
+ const message = createBaseDuration();
29
+ while (reader.pos < end) {
30
+ const tag = reader.uint32();
31
+ switch (tag >>> 3) {
32
+ case 1: {
33
+ if (tag !== 8) {
34
+ break;
35
+ }
36
+ message.seconds = reader.int64();
37
+ continue;
38
+ }
39
+ case 2: {
40
+ if (tag !== 16) {
41
+ break;
42
+ }
43
+ message.nanos = reader.int32();
44
+ continue;
45
+ }
46
+ }
47
+ if ((tag & 7) === 4 || tag === 0) {
48
+ break;
49
+ }
50
+ reader.skip(tag & 7);
51
+ }
52
+ return message;
53
+ },
54
+ create(base) {
55
+ return Duration.fromPartial(base ?? {});
56
+ },
57
+ fromPartial(object) {
58
+ const message = createBaseDuration();
59
+ message.seconds = (object.seconds !== undefined && object.seconds !== null) ? BigInt(object.seconds) : 0n;
60
+ message.nanos = object.nanos ?? 0;
61
+ return message;
62
+ },
63
+ };
64
+ //# sourceMappingURL=duration.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"duration.js","sourceRoot":"","sources":["../../../../../src/gen/google/protobuf/duration.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,iCAAiC;AACjC,iCAAiC;AACjC,yCAAyC;AAEzC,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE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
2
+ export declare const protobufPackage = "google.protobuf";
3
+ /**
4
+ * A generic empty message that you can re-use to avoid defining duplicated
5
+ * empty messages in your APIs. A typical example is to use it as the request
6
+ * or the response type of an API method. For instance:
7
+ *
8
+ * service Foo {
9
+ * rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty);
10
+ * }
11
+ */
12
+ export interface Empty {
13
+ }
14
+ export declare const Empty: MessageFns<Empty>;
15
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
16
+ export type DeepPartial<T> = T extends bigint ? string | number | bigint : T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
17
+ $case: string;
18
+ value: unknown;
19
+ } ? {
20
+ $case: T["$case"];
21
+ value?: DeepPartial<T["value"]>;
22
+ } : T extends {} ? {
23
+ [K in keyof T]?: DeepPartial<T[K]>;
24
+ } : Partial<T>;
25
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
26
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
27
+ [K in keyof P]: Exact<P[K], I[K]>;
28
+ } & {
29
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
30
+ };
31
+ export interface MessageFns<T> {
32
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
33
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
34
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
35
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
36
+ }
37
+ export {};
@@ -0,0 +1,39 @@
1
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
2
+ // versions:
3
+ // protoc-gen-ts_proto v2.12.0
4
+ // protoc v7.35.1
5
+ // source: google/protobuf/empty.proto
6
+ /* eslint-disable */
7
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
8
+ export const protobufPackage = "google.protobuf";
9
+ function createBaseEmpty() {
10
+ return {};
11
+ }
12
+ export const Empty = {
13
+ encode(_, writer = new BinaryWriter()) {
14
+ return writer;
15
+ },
16
+ decode(input, length) {
17
+ const reader = input instanceof BinaryReader ? input : new BinaryReader(input);
18
+ const end = length === undefined ? reader.len : reader.pos + length;
19
+ const message = createBaseEmpty();
20
+ while (reader.pos < end) {
21
+ const tag = reader.uint32();
22
+ switch (tag >>> 3) {
23
+ }
24
+ if ((tag & 7) === 4 || tag === 0) {
25
+ break;
26
+ }
27
+ reader.skip(tag & 7);
28
+ }
29
+ return message;
30
+ },
31
+ create(base) {
32
+ return Empty.fromPartial(base ?? {});
33
+ },
34
+ fromPartial(_) {
35
+ const message = createBaseEmpty();
36
+ return message;
37
+ },
38
+ };
39
+ //# sourceMappingURL=empty.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty.js","sourceRoot":"","sources":["../../../../../src/gen/google/protobuf/empty.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,YAAY;AACZ,iCAAiC;AACjC,iCAAiC;AACjC,sCAAsC;AAEtC,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAErE,MAAM,CAAC,MAAM,eAAe,GAAG,iBAAiB,CAAC;AAcjD,SAAS,eAAe;IACtB,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAsB;IACtC,MAAM,CAAC,CAAQ,EAAE,SAAuB,IAAI,YAAY,EAAE;QACxD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,KAAgC,EAAE,MAAe;QACtD,MAAM,MAAM,GAAG,KAAK,YAAY,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,CAAC;QAC/E,MAAM,GAAG,GAAG,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC;QACpE,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;QAClC,OAAO,MAAM,CAAC,GAAG,GAAG,GAAG,EAAE,CAAC;YACxB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;YAC5B,QAAQ,GAAG,KAAK,CAAC,EAAE,CAAC;YACpB,CAAC;YACD,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC,EAAE,CAAC;gBACjC,MAAM;YACR,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,CAAyC,IAAQ;QACrD,OAAO,KAAK,CAAC,WAAW,CAAC,IAAI,IAAK,EAAU,CAAC,CAAC;IAChD,CAAC;IACD,WAAW,CAAyC,CAAI;QACtD,MAAM,OAAO,GAAG,eAAe,EAAE,CAAC;QAClC,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC"}
@@ -0,0 +1,140 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ export declare const protobufPackage = "google.protobuf";
3
+ /**
4
+ * Represents a JSON `null`.
5
+ *
6
+ * `NullValue` is a sentinel, using an enum with only one value to represent
7
+ * the null value for the `Value` type union.
8
+ *
9
+ * A field of type `NullValue` with any value other than `0` is considered
10
+ * invalid. Most ProtoJSON serializers will emit a Value with a `null_value` set
11
+ * as a JSON `null` regardless of the integer value, and so will round trip to
12
+ * a `0` value.
13
+ */
14
+ export declare enum NullValue {
15
+ /** NULL_VALUE - Null value. */
16
+ NULL_VALUE = 0,
17
+ UNRECOGNIZED = -1
18
+ }
19
+ /**
20
+ * Represents a JSON object.
21
+ *
22
+ * An unordered key-value map, intending to perfectly capture the semantics of a
23
+ * JSON object. This enables parsing any arbitrary JSON payload as a message
24
+ * field in ProtoJSON format.
25
+ *
26
+ * This follows RFC 8259 guidelines for interoperable JSON: notably this type
27
+ * cannot represent large Int64 values or `NaN`/`Infinity` numbers,
28
+ * since the JSON format generally does not support those values in its number
29
+ * type.
30
+ *
31
+ * If you do not intend to parse arbitrary JSON into your message, a custom
32
+ * typed message should be preferred instead of using this type.
33
+ */
34
+ export interface Struct {
35
+ /** Unordered map of dynamically typed values. */
36
+ fields: {
37
+ [key: string]: any | undefined;
38
+ };
39
+ }
40
+ export interface Struct_FieldsEntry {
41
+ key: string;
42
+ value: any | undefined;
43
+ }
44
+ /**
45
+ * Represents a JSON value.
46
+ *
47
+ * `Value` represents a dynamically typed value which can be either
48
+ * null, a number, a string, a boolean, a recursive struct value, or a
49
+ * list of values. A producer of value is expected to set one of these
50
+ * variants. Absence of any variant is an invalid state.
51
+ */
52
+ export interface Value {
53
+ /** The kind of value. */
54
+ kind: //
55
+ /** Represents a JSON `null`. */
56
+ {
57
+ $case: "nullValue";
58
+ value: NullValue;
59
+ } | //
60
+ /**
61
+ * Represents a JSON number. Must not be `NaN`, `Infinity` or
62
+ * `-Infinity`, since those are not supported in JSON. This also cannot
63
+ * represent large Int64 values, since JSON format generally does not
64
+ * support them in its number type.
65
+ */
66
+ {
67
+ $case: "numberValue";
68
+ value: number;
69
+ } | //
70
+ /** Represents a JSON string. */
71
+ {
72
+ $case: "stringValue";
73
+ value: string;
74
+ } | //
75
+ /** Represents a JSON boolean (`true` or `false` literal in JSON). */
76
+ {
77
+ $case: "boolValue";
78
+ value: boolean;
79
+ } | //
80
+ /** Represents a JSON object. */
81
+ {
82
+ $case: "structValue";
83
+ value: {
84
+ [key: string]: any;
85
+ } | undefined;
86
+ } | //
87
+ /** Represents a JSON array. */
88
+ {
89
+ $case: "listValue";
90
+ value: Array<any> | undefined;
91
+ } | undefined;
92
+ }
93
+ /** Represents a JSON array. */
94
+ export interface ListValue {
95
+ /** Repeated field of dynamically typed values. */
96
+ values: any[];
97
+ }
98
+ export declare const Struct: MessageFns<Struct> & StructWrapperFns;
99
+ export declare const Struct_FieldsEntry: MessageFns<Struct_FieldsEntry>;
100
+ export declare const Value: MessageFns<Value> & AnyValueWrapperFns;
101
+ export declare const ListValue: MessageFns<ListValue> & ListValueWrapperFns;
102
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
103
+ export type DeepPartial<T> = T extends bigint ? string | number | bigint : T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {
104
+ $case: string;
105
+ value: unknown;
106
+ } ? {
107
+ $case: T["$case"];
108
+ value?: DeepPartial<T["value"]>;
109
+ } : T extends {} ? {
110
+ [K in keyof T]?: DeepPartial<T[K]>;
111
+ } : Partial<T>;
112
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
113
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
114
+ [K in keyof P]: Exact<P[K], I[K]>;
115
+ } & {
116
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
117
+ };
118
+ export interface MessageFns<T> {
119
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
120
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
121
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
122
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
123
+ }
124
+ export interface StructWrapperFns {
125
+ wrap(object: {
126
+ [key: string]: any;
127
+ } | undefined): Struct;
128
+ unwrap(message: Struct): {
129
+ [key: string]: any;
130
+ };
131
+ }
132
+ export interface AnyValueWrapperFns {
133
+ wrap(value: any): Value;
134
+ unwrap(message: any): string | number | boolean | Object | null | Array<any> | undefined;
135
+ }
136
+ export interface ListValueWrapperFns {
137
+ wrap(array: Array<any> | undefined): ListValue;
138
+ unwrap(message: ListValue): Array<any>;
139
+ }
140
+ export {};