@vertesia/client 1.6.0-dev.20261019.172735Z → 1.6.0-dev.20261120.123957Z

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 (209) hide show
  1. package/lib/AccountApi.d.ts +2 -0
  2. package/lib/AccountApi.d.ts.map +1 -1
  3. package/lib/AccountApi.js +3 -0
  4. package/lib/AccountApi.js.map +1 -1
  5. package/lib/AccountRolesApi.d.ts +11 -0
  6. package/lib/AccountRolesApi.d.ts.map +1 -0
  7. package/lib/AccountRolesApi.js +22 -0
  8. package/lib/AccountRolesApi.js.map +1 -0
  9. package/lib/ApiKeysApi.d.ts +4 -7
  10. package/lib/ApiKeysApi.d.ts.map +1 -1
  11. package/lib/ApiKeysApi.js +5 -4
  12. package/lib/ApiKeysApi.js.map +1 -1
  13. package/lib/AppsApi.d.ts +18 -3
  14. package/lib/AppsApi.d.ts.map +1 -1
  15. package/lib/AppsApi.js +34 -4
  16. package/lib/AppsApi.js.map +1 -1
  17. package/lib/AuditTrailApi.d.ts +6 -1
  18. package/lib/AuditTrailApi.d.ts.map +1 -1
  19. package/lib/AuditTrailApi.js +8 -0
  20. package/lib/AuditTrailApi.js.map +1 -1
  21. package/lib/IamApi.d.ts +1 -1
  22. package/lib/IamApi.js +1 -1
  23. package/lib/InteractionCatalogApi.d.ts +19 -1
  24. package/lib/InteractionCatalogApi.d.ts.map +1 -1
  25. package/lib/InteractionCatalogApi.js +30 -0
  26. package/lib/InteractionCatalogApi.js.map +1 -1
  27. package/lib/InteractionsApi.d.ts +6 -13
  28. package/lib/InteractionsApi.d.ts.map +1 -1
  29. package/lib/InteractionsApi.js +4 -24
  30. package/lib/InteractionsApi.js.map +1 -1
  31. package/lib/OAuthClientsApi.d.ts +3 -1
  32. package/lib/OAuthClientsApi.d.ts.map +1 -1
  33. package/lib/OAuthClientsApi.js +4 -0
  34. package/lib/OAuthClientsApi.js.map +1 -1
  35. package/lib/OAuthProvidersApi.d.ts +6 -2
  36. package/lib/OAuthProvidersApi.d.ts.map +1 -1
  37. package/lib/OAuthProvidersApi.js +6 -2
  38. package/lib/OAuthProvidersApi.js.map +1 -1
  39. package/lib/RunsApi.d.ts +3 -2
  40. package/lib/RunsApi.d.ts.map +1 -1
  41. package/lib/RunsApi.js +3 -2
  42. package/lib/RunsApi.js.map +1 -1
  43. package/lib/StreamSource.d.ts +19 -1
  44. package/lib/StreamSource.d.ts.map +1 -1
  45. package/lib/StreamSource.js +31 -1
  46. package/lib/StreamSource.js.map +1 -1
  47. package/lib/UsersApi.d.ts +7 -1
  48. package/lib/UsersApi.d.ts.map +1 -1
  49. package/lib/UsersApi.js +8 -0
  50. package/lib/UsersApi.js.map +1 -1
  51. package/lib/client.d.ts +14 -2
  52. package/lib/client.d.ts.map +1 -1
  53. package/lib/client.js +55 -8
  54. package/lib/client.js.map +1 -1
  55. package/lib/execute.d.ts +16 -2
  56. package/lib/execute.d.ts.map +1 -1
  57. package/lib/execute.js +16 -3
  58. package/lib/execute.js.map +1 -1
  59. package/lib/idempotency-key.d.ts +19 -0
  60. package/lib/idempotency-key.d.ts.map +1 -0
  61. package/lib/idempotency-key.js +34 -0
  62. package/lib/idempotency-key.js.map +1 -0
  63. package/lib/index.d.ts +1 -0
  64. package/lib/index.d.ts.map +1 -1
  65. package/lib/index.js.map +1 -1
  66. package/lib/nodejs/NodeStreamSource.d.ts +11 -1
  67. package/lib/nodejs/NodeStreamSource.d.ts.map +1 -1
  68. package/lib/nodejs/NodeStreamSource.js +56 -16
  69. package/lib/nodejs/NodeStreamSource.js.map +1 -1
  70. package/lib/store/AgentsApi.d.ts +3 -0
  71. package/lib/store/AgentsApi.d.ts.map +1 -1
  72. package/lib/store/AgentsApi.js +10 -1
  73. package/lib/store/AgentsApi.js.map +1 -1
  74. package/lib/store/ContentSourcesApi.d.ts +52 -0
  75. package/lib/store/ContentSourcesApi.d.ts.map +1 -0
  76. package/lib/store/ContentSourcesApi.js +85 -0
  77. package/lib/store/ContentSourcesApi.js.map +1 -0
  78. package/lib/store/CostApi.d.ts +6 -1
  79. package/lib/store/CostApi.d.ts.map +1 -1
  80. package/lib/store/CostApi.js +7 -0
  81. package/lib/store/CostApi.js.map +1 -1
  82. package/lib/store/DashboardApi.d.ts +61 -19
  83. package/lib/store/DashboardApi.d.ts.map +1 -1
  84. package/lib/store/DashboardApi.js +75 -19
  85. package/lib/store/DashboardApi.js.map +1 -1
  86. package/lib/store/DataApi.d.ts +9 -9
  87. package/lib/store/DataApi.d.ts.map +1 -1
  88. package/lib/store/DataApi.js +14 -10
  89. package/lib/store/DataApi.js.map +1 -1
  90. package/lib/store/FilesApi.d.ts +15 -1
  91. package/lib/store/FilesApi.d.ts.map +1 -1
  92. package/lib/store/FilesApi.js +54 -69
  93. package/lib/store/FilesApi.js.map +1 -1
  94. package/lib/store/IndexingApi.d.ts +0 -6
  95. package/lib/store/IndexingApi.d.ts.map +1 -1
  96. package/lib/store/IndexingApi.js +3 -17
  97. package/lib/store/IndexingApi.js.map +1 -1
  98. package/lib/store/NotificationsApi.d.ts +39 -0
  99. package/lib/store/NotificationsApi.d.ts.map +1 -0
  100. package/lib/store/NotificationsApi.js +68 -0
  101. package/lib/store/NotificationsApi.js.map +1 -0
  102. package/lib/store/ObjectsApi.d.ts +6 -7
  103. package/lib/store/ObjectsApi.d.ts.map +1 -1
  104. package/lib/store/ObjectsApi.js +25 -46
  105. package/lib/store/ObjectsApi.js.map +1 -1
  106. package/lib/store/RenderingApi.d.ts.map +1 -1
  107. package/lib/store/RenderingApi.js +1 -0
  108. package/lib/store/RenderingApi.js.map +1 -1
  109. package/lib/store/WorkflowsApi.d.ts +19 -1
  110. package/lib/store/WorkflowsApi.d.ts.map +1 -1
  111. package/lib/store/WorkflowsApi.js +21 -0
  112. package/lib/store/WorkflowsApi.js.map +1 -1
  113. package/lib/store/chunked-upload.d.ts +71 -0
  114. package/lib/store/chunked-upload.d.ts.map +1 -0
  115. package/lib/store/chunked-upload.js +206 -0
  116. package/lib/store/chunked-upload.js.map +1 -0
  117. package/lib/store/client.d.ts +9 -1
  118. package/lib/store/client.d.ts.map +1 -1
  119. package/lib/store/client.js +15 -1
  120. package/lib/store/client.js.map +1 -1
  121. package/lib/store/index.d.ts +3 -0
  122. package/lib/store/index.d.ts.map +1 -1
  123. package/lib/store/index.js +3 -0
  124. package/lib/store/index.js.map +1 -1
  125. package/lib/store/node-request.browser.d.ts +14 -0
  126. package/lib/store/node-request.browser.d.ts.map +1 -0
  127. package/lib/store/node-request.browser.js +20 -0
  128. package/lib/store/node-request.browser.js.map +1 -0
  129. package/lib/store/node-request.d.ts +20 -0
  130. package/lib/store/node-request.d.ts.map +1 -0
  131. package/lib/store/node-request.js +116 -0
  132. package/lib/store/node-request.js.map +1 -0
  133. package/lib/store/node-sessions.browser.d.ts +3 -0
  134. package/lib/store/node-sessions.browser.d.ts.map +1 -0
  135. package/lib/store/node-sessions.browser.js +15 -0
  136. package/lib/store/node-sessions.browser.js.map +1 -0
  137. package/lib/store/node-sessions.d.ts +14 -0
  138. package/lib/store/node-sessions.d.ts.map +1 -0
  139. package/lib/store/node-sessions.js +88 -0
  140. package/lib/store/node-sessions.js.map +1 -0
  141. package/lib/store/signed-url.d.ts +12 -16
  142. package/lib/store/signed-url.d.ts.map +1 -1
  143. package/lib/store/signed-url.js +111 -71
  144. package/lib/store/signed-url.js.map +1 -1
  145. package/lib/store/stream-bytes.d.ts +16 -0
  146. package/lib/store/stream-bytes.d.ts.map +1 -0
  147. package/lib/store/stream-bytes.js +70 -0
  148. package/lib/store/stream-bytes.js.map +1 -0
  149. package/lib/store/upload-body.d.ts +21 -0
  150. package/lib/store/upload-body.d.ts.map +1 -0
  151. package/lib/store/upload-body.js +32 -0
  152. package/lib/store/upload-body.js.map +1 -0
  153. package/lib/store/upload-content.d.ts +21 -0
  154. package/lib/store/upload-content.d.ts.map +1 -0
  155. package/lib/store/upload-content.js +113 -0
  156. package/lib/store/upload-content.js.map +1 -0
  157. package/lib/store/upload-runtime.d.ts +21 -0
  158. package/lib/store/upload-runtime.d.ts.map +1 -0
  159. package/lib/store/upload-runtime.js +40 -0
  160. package/lib/store/upload-runtime.js.map +1 -0
  161. package/lib/store/zeno-bulk.d.ts +9 -0
  162. package/lib/store/zeno-bulk.d.ts.map +1 -0
  163. package/lib/store/zeno-bulk.js +26 -0
  164. package/lib/store/zeno-bulk.js.map +1 -0
  165. package/lib/vertesia-client.js +10 -9
  166. package/lib/vertesia-client.js.map +1 -1
  167. package/package.json +38 -9
  168. package/src/AccountApi.ts +3 -0
  169. package/src/AccountRolesApi.ts +29 -0
  170. package/src/ApiKeysApi.ts +4 -12
  171. package/src/AppsApi.ts +58 -4
  172. package/src/AuditTrailApi.ts +11 -0
  173. package/src/IamApi.ts +1 -1
  174. package/src/InteractionCatalogApi.ts +44 -1
  175. package/src/InteractionsApi.ts +11 -33
  176. package/src/OAuthClientsApi.ts +6 -0
  177. package/src/OAuthProvidersApi.ts +7 -2
  178. package/src/RunsApi.ts +7 -2
  179. package/src/StreamSource.ts +29 -0
  180. package/src/UsersApi.ts +10 -1
  181. package/src/client.ts +72 -8
  182. package/src/execute.ts +33 -4
  183. package/src/idempotency-key.ts +34 -0
  184. package/src/index.ts +1 -0
  185. package/src/nodejs/NodeStreamSource.ts +63 -24
  186. package/src/store/AgentsApi.ts +13 -1
  187. package/src/store/ContentSourcesApi.ts +126 -0
  188. package/src/store/CostApi.ts +10 -0
  189. package/src/store/DashboardApi.ts +93 -18
  190. package/src/store/DataApi.ts +14 -10
  191. package/src/store/FilesApi.ts +84 -72
  192. package/src/store/IndexingApi.ts +3 -18
  193. package/src/store/NotificationsApi.ts +103 -0
  194. package/src/store/ObjectsApi.ts +32 -51
  195. package/src/store/RenderingApi.ts +1 -0
  196. package/src/store/WorkflowsApi.ts +25 -0
  197. package/src/store/chunked-upload.ts +272 -0
  198. package/src/store/client.ts +21 -1
  199. package/src/store/index.ts +3 -0
  200. package/src/store/node-request.browser.ts +22 -0
  201. package/src/store/node-request.ts +120 -0
  202. package/src/store/node-sessions.browser.ts +16 -0
  203. package/src/store/node-sessions.ts +109 -0
  204. package/src/store/signed-url.ts +126 -72
  205. package/src/store/stream-bytes.ts +79 -0
  206. package/src/store/upload-body.ts +37 -0
  207. package/src/store/upload-content.ts +129 -0
  208. package/src/store/upload-runtime.ts +42 -0
  209. package/src/store/zeno-bulk.ts +30 -0
@@ -0,0 +1,21 @@
1
+ import type { CreateUploadSessionPayload, GetFileUrlResponse } from '@vertesia/common';
2
+ import type { StreamSource } from '../StreamSource.js';
3
+ import type { FilesApi } from './FilesApi.js';
4
+ /** A location without its query string or fragment, which hold a signed URL's credentials. */
5
+ export declare function fileLocationForError(location: string): string;
6
+ /** A copy of an error safe to log: every URL in its message is cut to its location. */
7
+ export declare function sanitizedErrorCause(error: unknown): Error | undefined;
8
+ /**
9
+ * Upload a source to the file `request` names: in one signed PUT, or, for a stream source longer than one part in
10
+ * Node.js, in parts through an upload session (see `chunked-upload.ts`). On failure the source's stream is cancelled.
11
+ *
12
+ * @param signUpload the signed PUT URL to use, when the caller already has one or signs it another way
13
+ * @param fallbackMimeType the content type when neither the source nor the server names one
14
+ */
15
+ export declare function uploadContent(files: FilesApi, source: StreamSource | File, request: CreateUploadSessionPayload, signUpload?: () => Promise<GetFileUrlResponse>, fallbackMimeType?: string): Promise<{
16
+ id: string;
17
+ path: string;
18
+ mime_type?: string;
19
+ etag?: string;
20
+ }>;
21
+ //# sourceMappingURL=upload-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-content.d.ts","sourceRoot":"","sources":["../../src/store/upload-content.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAM9C,8FAA8F;AAC9F,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAO7D;AAED,uFAAuF;AACvF,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,GAAG,SAAS,CAQrE;AAcD;;;;;;GAMG;AACH,wBAAsB,aAAa,CAC/B,KAAK,EAAE,QAAQ,EACf,MAAM,EAAE,YAAY,GAAG,IAAI,EAC3B,OAAO,EAAE,0BAA0B,EACnC,UAAU,GAAE,MAAM,OAAO,CAAC,kBAAkB,CAAqC,EACjF,gBAAgB,CAAC,EAAE,MAAM,GAC1B,OAAO,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAW1E"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * The upload of a source to a file, shared by `FilesApi` and `ObjectsApi`. Internal: not exported from the package.
3
+ */
4
+ import { RequestError } from '@vertesia/api-fetch-client';
5
+ import { partsAsUploadBody, planUpload, uploadInParts } from './chunked-upload.js';
6
+ import { fetchSignedUrl } from './signed-url.js';
7
+ import { unquoteEtag, uploadHeaders } from './upload-body.js';
8
+ import { UploadSessionUnavailableError } from './upload-runtime.js';
9
+ import { resolveUploadMimeType } from './uploadMimeType.js';
10
+ /** A location without its query string or fragment, which hold a signed URL's credentials. */
11
+ export function fileLocationForError(location) {
12
+ try {
13
+ const url = new URL(location);
14
+ return `${url.protocol}//${url.host}${url.pathname}`;
15
+ }
16
+ catch {
17
+ return location.split(/[?#]/, 1)[0] || 'unknown file';
18
+ }
19
+ }
20
+ /** A copy of an error safe to log: every URL in its message is cut to its location. */
21
+ export function sanitizedErrorCause(error) {
22
+ if (!(error instanceof Error)) {
23
+ return undefined;
24
+ }
25
+ const message = error.message.replace(/https?:\/\/[^\s)\]}>"']+/g, (url) => fileLocationForError(url));
26
+ const cause = new Error(message);
27
+ cause.name = error.name;
28
+ return cause;
29
+ }
30
+ /**
31
+ * The statuses of a server without upload sessions (404, or 405 where another route matches the path), or whose
32
+ * storage has none (501).
33
+ */
34
+ const NO_UPLOAD_SESSION_STATUSES = new Set([404, 405, 501]);
35
+ /** The stream of a plan, which a failed upload must cancel to release what it holds (a socket, a file). */
36
+ function planStream(plan) {
37
+ const body = plan.kind === 'parts' ? plan.parts.body : plan.upload.body;
38
+ return body instanceof ReadableStream ? body : undefined;
39
+ }
40
+ /**
41
+ * Upload a source to the file `request` names: in one signed PUT, or, for a stream source longer than one part in
42
+ * Node.js, in parts through an upload session (see `chunked-upload.ts`). On failure the source's stream is cancelled.
43
+ *
44
+ * @param signUpload the signed PUT URL to use, when the caller already has one or signs it another way
45
+ * @param fallbackMimeType the content type when neither the source nor the server names one
46
+ */
47
+ export async function uploadContent(files, source, request, signUpload = () => files.getUploadUrl(request), fallbackMimeType) {
48
+ const plan = await planUpload(source);
49
+ try {
50
+ return await sendPlan(files, source, request, plan, signUpload, fallbackMimeType);
51
+ }
52
+ catch (err) {
53
+ // A stream already being sent is locked, and its sender cancels it; this one was never read whole.
54
+ await planStream(plan)
55
+ ?.cancel(err)
56
+ .catch(() => undefined);
57
+ throw err;
58
+ }
59
+ }
60
+ async function sendPlan(files, source, request, plan, signUpload, fallbackMimeType) {
61
+ let upload;
62
+ if (plan.kind === 'parts') {
63
+ const session = await files.createUploadSession(request).catch((err) => {
64
+ if (err instanceof RequestError && NO_UPLOAD_SESSION_STATUSES.has(err.status))
65
+ return undefined;
66
+ throw err;
67
+ });
68
+ if (!session) {
69
+ console.warn(`Upload sessions are not available; uploading ${request.name} in a single request`);
70
+ upload = partsAsUploadBody(plan.parts);
71
+ }
72
+ else {
73
+ try {
74
+ const etag = await uploadInParts(files, session, plan.parts);
75
+ const mime_type = resolveUploadMimeType(source.type, session.mime_type) || fallbackMimeType;
76
+ return { id: session.id, path: session.path, mime_type, etag };
77
+ }
78
+ catch (err) {
79
+ if (!(err instanceof UploadSessionUnavailableError)) {
80
+ console.error('Failed to upload file', { err: sanitizedErrorCause(err), id: session.id });
81
+ throw err;
82
+ }
83
+ console.warn(`${err.message}; uploading ${session.path} in a single request instead`);
84
+ upload = partsAsUploadBody(plan.parts);
85
+ }
86
+ }
87
+ }
88
+ else {
89
+ upload = plan.upload;
90
+ }
91
+ const { url, id, path, mime_type } = await signUpload();
92
+ const sourceMimeType = resolveUploadMimeType(source.type, mime_type) || fallbackMimeType;
93
+ const res = await fetchSignedUrl(url, {
94
+ method: 'PUT',
95
+ body: upload.body,
96
+ headers: uploadHeaders(upload, sourceMimeType),
97
+ }).catch((err) => {
98
+ console.error('Failed to upload file', { err, location: fileLocationForError(url), id, path });
99
+ throw err;
100
+ });
101
+ if (!res.ok) {
102
+ console.error('Failed to upload file', {
103
+ status: res.status,
104
+ statusText: res.statusText,
105
+ location: fileLocationForError(url),
106
+ id,
107
+ path,
108
+ });
109
+ throw new Error(`Failed to upload file ${source.name}: ${res.statusText}`);
110
+ }
111
+ return { id, path, mime_type: sourceMimeType, etag: unquoteEtag(res.headers.get('etag') ?? undefined) };
112
+ }
113
+ //# sourceMappingURL=upload-content.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-content.js","sourceRoot":"","sources":["../../src/store/upload-content.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAmB,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpG,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAmB,WAAW,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,8FAA8F;AAC9F,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACjD,I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AC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,oBAAoB,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/F,MAAM,GAAG,CAAC;IACd,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACV,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE;YACnC,MAAM,EAAE,GAAG,CAAC,MAAM;YAClB,UAAU,EAAE,GAAG,CAAC,UAAU;YAC1B,QAAQ,EAAE,oBAAoB,CAAC,GAAG,CAAC;YACnC,EAAE;YACF,IAAI;SACP,CAAC,CAAC;QACH,MAAM,IAAI,KAAK,CAAC,yBAAyB,MAAM,CAAC,IAAI,KAAK,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC;IAC/E,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE,IAAI,EAAE,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,SAAS,CAAC,EAAE,CAAC;AAC5G,CAAC"}
@@ -0,0 +1,21 @@
1
+ /** Runtime checks and errors of the upload transports, safe to load in any runtime. */
2
+ /** Whether this runtime has Node's `http` client (Node.js, and runtimes compatible with it such as Bun). */
3
+ export declare function hasNodeHttp(): boolean;
4
+ /** The error for a body whose size differs from its declared `Content-Length`. */
5
+ export declare class ContentLengthMismatchError extends Error {
6
+ readonly declared: number;
7
+ readonly actual: number;
8
+ readonly direction: 'short' | 'long';
9
+ constructor(declared: number, actual: number, direction: 'short' | 'long');
10
+ }
11
+ /** This client cannot use the upload session: an SDK it needs is not installed, or it does not know its protocol. */
12
+ export declare class UploadSessionUnavailableError extends Error {
13
+ /** What is missing, such as `the optional package @azure/storage-blob`. */
14
+ readonly requirement: string;
15
+ constructor(
16
+ /** What is missing, such as `the optional package @azure/storage-blob`. */
17
+ requirement: string, cause?: unknown);
18
+ }
19
+ /** The `Content-Length` in `headers`, in any letter case; undefined when absent or not a whole byte count. */
20
+ export declare function contentLengthHeader(headers: Record<string, string> | undefined): number | undefined;
21
+ //# sourceMappingURL=upload-runtime.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-runtime.d.ts","sourceRoot":"","sources":["../../src/store/upload-runtime.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF,4GAA4G;AAC5G,wBAAgB,WAAW,IAAI,OAAO,CAErC;AAED,kFAAkF;AAClF,qBAAa,0BAA2B,SAAQ,KAAK;IAE7C,QAAQ,CAAC,QAAQ,EAAE,MAAM;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,SAAS,EAAE,OAAO,GAAG,MAAM;IAHxC,YACa,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,OAAO,GAAG,MAAM,EAQvC;CACJ;AAED,qHAAqH;AACrH,qBAAa,6BAA8B,SAAQ,KAAK;IAEhD,2EAA2E;IAC3E,QAAQ,CAAC,WAAW,EAAE,MAAM;IAFhC;IACI,2EAA2E;IAClE,WAAW,EAAE,MAAM,EAC5B,KAAK,CAAC,EAAE,OAAO,EAIlB;CACJ;AAED,8GAA8G;AAC9G,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAKnG"}
@@ -0,0 +1,40 @@
1
+ /** Runtime checks and errors of the upload transports, safe to load in any runtime. */
2
+ /** Whether this runtime has Node's `http` client (Node.js, and runtimes compatible with it such as Bun). */
3
+ export function hasNodeHttp() {
4
+ return typeof process !== 'undefined' && typeof process.versions?.node === 'string';
5
+ }
6
+ /** The error for a body whose size differs from its declared `Content-Length`. */
7
+ export class ContentLengthMismatchError extends Error {
8
+ declared;
9
+ actual;
10
+ direction;
11
+ constructor(declared, actual, direction) {
12
+ super(direction === 'short'
13
+ ? `Upload body ended after ${actual} bytes, short of its declared length of ${declared}`
14
+ : `Upload body ran past its declared length of ${declared} bytes`);
15
+ this.declared = declared;
16
+ this.actual = actual;
17
+ this.direction = direction;
18
+ this.name = 'ContentLengthMismatchError';
19
+ }
20
+ }
21
+ /** This client cannot use the upload session: an SDK it needs is not installed, or it does not know its protocol. */
22
+ export class UploadSessionUnavailableError extends Error {
23
+ requirement;
24
+ constructor(
25
+ /** What is missing, such as `the optional package @azure/storage-blob`. */
26
+ requirement, cause) {
27
+ super(`Uploading in parts needs ${requirement}`, { cause });
28
+ this.requirement = requirement;
29
+ this.name = 'UploadSessionUnavailableError';
30
+ }
31
+ }
32
+ /** The `Content-Length` in `headers`, in any letter case; undefined when absent or not a whole byte count. */
33
+ export function contentLengthHeader(headers) {
34
+ const entry = Object.entries(headers ?? {}).find(([name]) => name.toLowerCase() === 'content-length');
35
+ if (!entry || !/^\d+$/.test(entry[1].trim()))
36
+ return undefined;
37
+ const length = Number(entry[1].trim());
38
+ return Number.isSafeInteger(length) ? length : undefined;
39
+ }
40
+ //# sourceMappingURL=upload-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upload-runtime.js","sourceRoot":"","sources":["../../src/store/upload-runtime.ts"],"names":[],"mappings":"AAAA,uFAAuF;AAEvF,4GAA4G;AAC5G,MAAM,UAAU,WAAW;IACvB,OAAO,OAAO,OAAO,KAAK,WAAW,IAAI,OAAO,OAAO,CAAC,QAAQ,EAAE,IAAI,KAAK,QAAQ,CAAC;AACxF,CAAC;AAED,kFAAkF;AAClF,MAAM,OAAO,0BAA2B,SAAQ,KAAK;IAEpC,QAAQ;IACR,MAAM;IACN,SAAS;IAHtB,YACa,QAAgB,EAChB,MAAc,EACd,SAA2B;QAEpC,KAAK,CACD,SAAS,KAAK,OAAO;YACjB,CAAC,CAAC,2BAA2B,MAAM,2CAA2C,QAAQ,EAAE;YACxF,CAAC,CAAC,+CAA+C,QAAQ,QAAQ,CACxE,CAAC;wBARO,QAAQ;sBACR,MAAM;yBACN,SAAS;QAOlB,IAAI,CAAC,IAAI,GAAG,4BAA4B,CAAC;IAC7C,CAAC;CACJ;AAED,qHAAqH;AACrH,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IAGvC,WAAW;IAFxB;IACI,2EAA2E;IAClE,WAAmB,EAC5B,KAAe;QAEf,KAAK,CAAC,4BAA4B,WAAW,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;2BAHnD,WAAW;QAIpB,IAAI,CAAC,IAAI,GAAG,+BAA+B,CAAC;IAChD,CAAC;CACJ;AAED,8GAA8G;AAC9G,MAAM,UAAU,mBAAmB,CAAC,OAA2C;IAC3E,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,gBAAgB,CAAC,CAAC;IACtG,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAAE,OAAO,SAAS,CAAC;IAC/D,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7D,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The base URL of zeno-bulk, the service behind the bulk export and reindex endpoints, for a store base URL.
3
+ * - ZENO_BULK_URL, when the runtime sets it: a local stack that runs its own zeno-bulk, or none, points it there.
4
+ * - A store on localhost: the dev1 zeno-bulk, which serves the database a default local stack uses.
5
+ * - A dev-branch store, whose host names zeno-server: the matching zeno-bulk host.
6
+ * - Any other store: its own domain, whose load balancer routes the bulk paths to zeno-bulk.
7
+ */
8
+ export declare function zenoBulkBaseUrl(storeBaseUrl: string): string;
9
+ //# sourceMappingURL=zeno-bulk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zeno-bulk.d.ts","sourceRoot":"","sources":["../../src/store/zeno-bulk.ts"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAY5D"}
@@ -0,0 +1,26 @@
1
+ /** The ZENO_BULK_URL environment variable, in a runtime that has one. */
2
+ function getRuntimeZenoBulkUrl() {
3
+ const runtimeProcess = globalThis.process;
4
+ return runtimeProcess?.env?.ZENO_BULK_URL || undefined;
5
+ }
6
+ /**
7
+ * The base URL of zeno-bulk, the service behind the bulk export and reindex endpoints, for a store base URL.
8
+ * - ZENO_BULK_URL, when the runtime sets it: a local stack that runs its own zeno-bulk, or none, points it there.
9
+ * - A store on localhost: the dev1 zeno-bulk, which serves the database a default local stack uses.
10
+ * - A dev-branch store, whose host names zeno-server: the matching zeno-bulk host.
11
+ * - Any other store: its own domain, whose load balancer routes the bulk paths to zeno-bulk.
12
+ */
13
+ export function zenoBulkBaseUrl(storeBaseUrl) {
14
+ const override = getRuntimeZenoBulkUrl();
15
+ if (override) {
16
+ return override.replace(/\/+$/, '');
17
+ }
18
+ if (storeBaseUrl.includes('localhost:') || storeBaseUrl.includes('127.0.0.1:')) {
19
+ return 'https://zeno-bulk-dev-main.api.dev1.vertesia.io';
20
+ }
21
+ if (storeBaseUrl.includes('zeno-server')) {
22
+ return storeBaseUrl.replace(/zeno-server/, 'zeno-bulk');
23
+ }
24
+ return storeBaseUrl;
25
+ }
26
+ //# sourceMappingURL=zeno-bulk.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zeno-bulk.js","sourceRoot":"","sources":["../../src/store/zeno-bulk.ts"],"names":[],"mappings":"AAIA,yEAAyE;AACzE,SAAS,qBAAqB;IAC1B,MAAM,cAAc,GAAI,UAA+D,CAAC,OAAO,CAAC;IAChG,OAAO,cAAc,EAAE,GAAG,EAAE,aAAa,IAAI,SAAS,CAAC;AAC3D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,YAAoB;IAChD,MAAM,QAAQ,GAAG,qBAAqB,EAAE,CAAC;IACzC,IAAI,QAAQ,EAAE,CAAC;QACX,OAAO,QAAQ,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACxC,CAAC;IACD,IAAI,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC7E,OAAO,iDAAiD,CAAC;IAC7D,CAAC;IACD,IAAI,YAAY,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QACvC,OAAO,YAAY,CAAC,OAAO,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,YAAY,CAAC;AACxB,CAAC"}