@agentuity/server 0.1.16 → 0.1.18

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 (93) hide show
  1. package/dist/api/api.d.ts +11 -6
  2. package/dist/api/api.d.ts.map +1 -1
  3. package/dist/api/api.js +19 -12
  4. package/dist/api/api.js.map +1 -1
  5. package/dist/api/index.d.ts +1 -0
  6. package/dist/api/index.d.ts.map +1 -1
  7. package/dist/api/index.js +1 -0
  8. package/dist/api/index.js.map +1 -1
  9. package/dist/api/org/env-delete.d.ts.map +1 -1
  10. package/dist/api/org/env-delete.js.map +1 -1
  11. package/dist/api/org/env-get.d.ts.map +1 -1
  12. package/dist/api/org/env-get.js.map +1 -1
  13. package/dist/api/org/env-update.d.ts.map +1 -1
  14. package/dist/api/org/env-update.js.map +1 -1
  15. package/dist/api/queue/analytics.d.ts +108 -0
  16. package/dist/api/queue/analytics.d.ts.map +1 -0
  17. package/dist/api/queue/analytics.js +245 -0
  18. package/dist/api/queue/analytics.js.map +1 -0
  19. package/dist/api/queue/destinations.d.ts +108 -0
  20. package/dist/api/queue/destinations.d.ts.map +1 -0
  21. package/dist/api/queue/destinations.js +238 -0
  22. package/dist/api/queue/destinations.js.map +1 -0
  23. package/dist/api/queue/dlq.d.ts +100 -0
  24. package/dist/api/queue/dlq.d.ts.map +1 -0
  25. package/dist/api/queue/dlq.js +204 -0
  26. package/dist/api/queue/dlq.js.map +1 -0
  27. package/dist/api/queue/index.d.ts +55 -0
  28. package/dist/api/queue/index.d.ts.map +1 -0
  29. package/dist/api/queue/index.js +86 -0
  30. package/dist/api/queue/index.js.map +1 -0
  31. package/dist/api/queue/messages.d.ts +332 -0
  32. package/dist/api/queue/messages.d.ts.map +1 -0
  33. package/dist/api/queue/messages.js +637 -0
  34. package/dist/api/queue/messages.js.map +1 -0
  35. package/dist/api/queue/queues.d.ts +153 -0
  36. package/dist/api/queue/queues.d.ts.map +1 -0
  37. package/dist/api/queue/queues.js +319 -0
  38. package/dist/api/queue/queues.js.map +1 -0
  39. package/dist/api/queue/sources.d.ts +132 -0
  40. package/dist/api/queue/sources.d.ts.map +1 -0
  41. package/dist/api/queue/sources.js +285 -0
  42. package/dist/api/queue/sources.js.map +1 -0
  43. package/dist/api/queue/types.d.ts +1129 -0
  44. package/dist/api/queue/types.d.ts.map +1 -0
  45. package/dist/api/queue/types.js +949 -0
  46. package/dist/api/queue/types.js.map +1 -0
  47. package/dist/api/queue/util.d.ts +262 -0
  48. package/dist/api/queue/util.d.ts.map +1 -0
  49. package/dist/api/queue/util.js +171 -0
  50. package/dist/api/queue/util.js.map +1 -0
  51. package/dist/api/queue/validation.d.ts +247 -0
  52. package/dist/api/queue/validation.d.ts.map +1 -0
  53. package/dist/api/queue/validation.js +513 -0
  54. package/dist/api/queue/validation.js.map +1 -0
  55. package/dist/api/sandbox/get.d.ts.map +1 -1
  56. package/dist/api/sandbox/get.js +5 -0
  57. package/dist/api/sandbox/get.js.map +1 -1
  58. package/dist/api/sandbox/index.d.ts +3 -3
  59. package/dist/api/sandbox/index.d.ts.map +1 -1
  60. package/dist/api/sandbox/index.js +1 -1
  61. package/dist/api/sandbox/index.js.map +1 -1
  62. package/dist/api/sandbox/run.d.ts.map +1 -1
  63. package/dist/api/sandbox/run.js +5 -2
  64. package/dist/api/sandbox/run.js.map +1 -1
  65. package/dist/api/sandbox/snapshot-build.d.ts +2 -0
  66. package/dist/api/sandbox/snapshot-build.d.ts.map +1 -1
  67. package/dist/api/sandbox/snapshot-build.js +4 -0
  68. package/dist/api/sandbox/snapshot-build.js.map +1 -1
  69. package/dist/api/sandbox/snapshot.d.ts +143 -1
  70. package/dist/api/sandbox/snapshot.d.ts.map +1 -1
  71. package/dist/api/sandbox/snapshot.js +183 -4
  72. package/dist/api/sandbox/snapshot.js.map +1 -1
  73. package/package.json +4 -4
  74. package/src/api/api.ts +62 -13
  75. package/src/api/index.ts +1 -0
  76. package/src/api/org/env-delete.ts +1 -4
  77. package/src/api/org/env-get.ts +1 -4
  78. package/src/api/org/env-update.ts +1 -4
  79. package/src/api/queue/analytics.ts +313 -0
  80. package/src/api/queue/destinations.ts +321 -0
  81. package/src/api/queue/dlq.ts +283 -0
  82. package/src/api/queue/index.ts +261 -0
  83. package/src/api/queue/messages.ts +875 -0
  84. package/src/api/queue/queues.ts +448 -0
  85. package/src/api/queue/sources.ts +384 -0
  86. package/src/api/queue/types.ts +1253 -0
  87. package/src/api/queue/util.ts +204 -0
  88. package/src/api/queue/validation.ts +560 -0
  89. package/src/api/sandbox/get.ts +5 -0
  90. package/src/api/sandbox/index.ts +13 -1
  91. package/src/api/sandbox/run.ts +5 -2
  92. package/src/api/sandbox/snapshot-build.ts +4 -0
  93. package/src/api/sandbox/snapshot.ts +223 -5
@@ -0,0 +1,247 @@
1
+ /**
2
+ * @module validation
3
+ * Queue validation utilities with constants matching the Catalyst backend.
4
+ *
5
+ * These validation functions perform client-side validation before API calls,
6
+ * providing immediate feedback and reducing unnecessary network requests.
7
+ */
8
+ /** Maximum allowed length for queue names. */
9
+ export declare const MAX_QUEUE_NAME_LENGTH = 256;
10
+ /** Minimum allowed length for queue names. */
11
+ export declare const MIN_QUEUE_NAME_LENGTH = 1;
12
+ /** Maximum payload size in bytes (1MB). */
13
+ export declare const MAX_PAYLOAD_SIZE = 1048576;
14
+ /** Maximum description length in characters. */
15
+ export declare const MAX_DESCRIPTION_LENGTH = 1024;
16
+ /** Maximum number of messages in a single batch operation. */
17
+ export declare const MAX_BATCH_SIZE = 1000;
18
+ /** Maximum metadata size in bytes (64KB). */
19
+ export declare const MAX_METADATA_SIZE = 65536;
20
+ /** Maximum partition key length in characters. */
21
+ export declare const MAX_PARTITION_KEY_LENGTH = 256;
22
+ /** Maximum idempotency key length in characters. */
23
+ export declare const MAX_IDEMPOTENCY_KEY_LENGTH = 256;
24
+ /** Maximum visibility timeout in seconds (12 hours). */
25
+ export declare const MAX_VISIBILITY_TIMEOUT = 43200;
26
+ /** Maximum number of retry attempts allowed. */
27
+ export declare const MAX_RETRIES = 100;
28
+ /** Maximum number of in-flight messages per client. */
29
+ export declare const MAX_IN_FLIGHT = 1000;
30
+ /** Maximum source name length. */
31
+ export declare const MAX_SOURCE_NAME_LENGTH = 256;
32
+ /**
33
+ * Error thrown when validation fails for queue operations.
34
+ *
35
+ * Includes the field name and optionally the invalid value for debugging.
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * try {
40
+ * validateQueueName('Invalid Name!');
41
+ * } catch (error) {
42
+ * if (error instanceof QueueValidationError) {
43
+ * console.error(`Invalid ${error.field}: ${error.message}`);
44
+ * }
45
+ * }
46
+ * ```
47
+ */
48
+ export declare const QueueValidationError: {
49
+ new (args?: ({
50
+ field: string;
51
+ value?: unknown;
52
+ } & {
53
+ message?: string;
54
+ cause?: unknown;
55
+ }) | undefined): import("@agentuity/core").RichError & {
56
+ readonly _tag: "QueueValidationError";
57
+ } & Readonly<{
58
+ field: string;
59
+ value?: unknown;
60
+ }>;
61
+ readonly defaultMessage?: string;
62
+ };
63
+ /**
64
+ * Validates a queue name against naming rules.
65
+ *
66
+ * Queue names must:
67
+ * - Be 1-256 characters long
68
+ * - Start with a lowercase letter or underscore
69
+ * - Contain only lowercase letters, digits, underscores, and hyphens
70
+ *
71
+ * @param name - The queue name to validate
72
+ * @throws {QueueValidationError} If the name is invalid
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * validateQueueName('my_queue'); // OK
77
+ * validateQueueName('order-queue'); // OK
78
+ * validateQueueName('Invalid Name!'); // Throws
79
+ * ```
80
+ */
81
+ export declare function validateQueueName(name: string): void;
82
+ /**
83
+ * Validates a queue type.
84
+ *
85
+ * @param type - The queue type to validate
86
+ * @throws {QueueValidationError} If the type is not 'worker' or 'pubsub'
87
+ */
88
+ export declare function validateQueueType(type: string): void;
89
+ /**
90
+ * Validates a message payload.
91
+ *
92
+ * Payloads must be non-empty JSON and not exceed 1MB when serialized.
93
+ *
94
+ * @param payload - The payload to validate (must be JSON-serializable)
95
+ * @throws {QueueValidationError} If the payload is empty or too large
96
+ */
97
+ export declare function validatePayload(payload: unknown): void;
98
+ /**
99
+ * Validates a message ID format.
100
+ *
101
+ * Message IDs must start with the `qmsg_` prefix.
102
+ *
103
+ * @param id - The message ID to validate
104
+ * @throws {QueueValidationError} If the ID format is invalid
105
+ */
106
+ export declare function validateMessageId(id: string): void;
107
+ /**
108
+ * Validates a destination ID format.
109
+ *
110
+ * Destination IDs must start with the `qdest_` prefix.
111
+ *
112
+ * @param id - The destination ID to validate
113
+ * @throws {QueueValidationError} If the ID format is invalid
114
+ */
115
+ export declare function validateDestinationId(id: string): void;
116
+ /**
117
+ * Validates a queue or message description.
118
+ *
119
+ * @param description - The description to validate (optional)
120
+ * @throws {QueueValidationError} If the description exceeds the maximum length
121
+ */
122
+ export declare function validateDescription(description?: string): void;
123
+ /**
124
+ * Validates a partition key length.
125
+ *
126
+ * Partition keys are used for message ordering within a queue.
127
+ *
128
+ * @param key - The partition key to validate (optional)
129
+ * @throws {QueueValidationError} If the key exceeds the maximum length
130
+ */
131
+ export declare function validatePartitionKey(key?: string): void;
132
+ /**
133
+ * Validates an idempotency key length.
134
+ *
135
+ * Idempotency keys are used to prevent duplicate message processing.
136
+ *
137
+ * @param key - The idempotency key to validate (optional)
138
+ * @throws {QueueValidationError} If the key exceeds the maximum length
139
+ */
140
+ export declare function validateIdempotencyKey(key?: string): void;
141
+ /**
142
+ * Validates a time-to-live value.
143
+ *
144
+ * TTL specifies how long a message should be kept before expiring.
145
+ *
146
+ * @param ttl - The TTL in seconds to validate (optional)
147
+ * @throws {QueueValidationError} If the TTL is negative
148
+ */
149
+ export declare function validateTTL(ttl?: number): void;
150
+ /**
151
+ * Validates a visibility timeout.
152
+ *
153
+ * Visibility timeout is how long a message is hidden after being received,
154
+ * giving the consumer time to process it before it becomes visible again.
155
+ *
156
+ * @param timeout - The timeout in seconds to validate (optional)
157
+ * @throws {QueueValidationError} If the timeout is out of valid range (1-43200 seconds)
158
+ */
159
+ export declare function validateVisibilityTimeout(timeout?: number): void;
160
+ /**
161
+ * Validates the maximum retry count.
162
+ *
163
+ * @param retries - The max retries value to validate (optional)
164
+ * @throws {QueueValidationError} If retries is negative or exceeds maximum
165
+ */
166
+ export declare function validateMaxRetries(retries?: number): void;
167
+ /**
168
+ * Validates the maximum in-flight messages per client.
169
+ *
170
+ * This controls how many messages a single consumer can process concurrently.
171
+ *
172
+ * @param maxInFlight - The max in-flight value to validate (optional)
173
+ * @throws {QueueValidationError} If the value is out of valid range (1-1000)
174
+ */
175
+ export declare function validateMaxInFlight(maxInFlight?: number): void;
176
+ /**
177
+ * Validates a message offset.
178
+ *
179
+ * Offsets are sequential positions in the queue, starting from 0.
180
+ *
181
+ * @param offset - The offset value to validate
182
+ * @throws {QueueValidationError} If the offset is negative
183
+ */
184
+ export declare function validateOffset(offset: number): void;
185
+ /**
186
+ * Validates a limit for list/consume operations.
187
+ *
188
+ * @param limit - The limit value to validate
189
+ * @throws {QueueValidationError} If the limit is less than 1 or exceeds maximum
190
+ */
191
+ export declare function validateLimit(limit: number): void;
192
+ /**
193
+ * Validates a batch size for batch operations.
194
+ *
195
+ * @param size - The batch size to validate
196
+ * @throws {QueueValidationError} If the size is less than 1 or exceeds maximum
197
+ */
198
+ export declare function validateBatchSize(size: number): void;
199
+ /**
200
+ * Validates a webhook URL for destinations.
201
+ *
202
+ * URLs must use HTTP or HTTPS protocol.
203
+ *
204
+ * @param url - The URL to validate
205
+ * @throws {QueueValidationError} If the URL is missing or not HTTP/HTTPS
206
+ */
207
+ export declare function validateWebhookUrl(url: string): void;
208
+ /**
209
+ * Validates a destination configuration object.
210
+ *
211
+ * Checks that the config contains a valid URL and optional method/timeout settings.
212
+ *
213
+ * @param config - The destination config object to validate
214
+ * @throws {QueueValidationError} If the config is invalid
215
+ */
216
+ export declare function validateDestinationConfig(config: Record<string, unknown>): void;
217
+ /**
218
+ * Validates a source ID format.
219
+ *
220
+ * Source IDs must start with the `qsrc_` prefix.
221
+ *
222
+ * @param id - The source ID to validate
223
+ * @throws {QueueValidationError} If the ID format is invalid
224
+ *
225
+ * @example
226
+ * ```typescript
227
+ * validateSourceId('qsrc_abc123'); // OK
228
+ * validateSourceId('invalid'); // Throws
229
+ * ```
230
+ */
231
+ export declare function validateSourceId(id: string): void;
232
+ /**
233
+ * Validates a source name.
234
+ *
235
+ * Source names must be non-empty and not exceed the maximum length.
236
+ *
237
+ * @param name - The source name to validate
238
+ * @throws {QueueValidationError} If the name is invalid
239
+ *
240
+ * @example
241
+ * ```typescript
242
+ * validateSourceName('my-source'); // OK
243
+ * validateSourceName(''); // Throws
244
+ * ```
245
+ */
246
+ export declare function validateSourceName(name: string): void;
247
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/api/queue/validation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,8CAA8C;AAC9C,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,8CAA8C;AAC9C,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC,2CAA2C;AAC3C,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,gDAAgD;AAChD,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,8DAA8D;AAC9D,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,6CAA6C;AAC7C,eAAO,MAAM,iBAAiB,QAAQ,CAAC;AAEvC,kDAAkD;AAClD,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C,oDAAoD;AACpD,eAAO,MAAM,0BAA0B,MAAM,CAAC;AAE9C,wDAAwD;AACxD,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAE5C,gDAAgD;AAChD,eAAO,MAAM,WAAW,MAAM,CAAC;AAE/B,uDAAuD;AACvD,eAAO,MAAM,aAAa,OAAO,CAAC;AAclC,kCAAkC;AAClC,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAM1C;;;;;;;;;;;;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