@anhora/sdk 0.2.0 → 0.3.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.
@@ -49,6 +49,8 @@ export declare class AnhoraConnectorsApi {
49
49
  installationId: string;
50
50
  namespace: string;
51
51
  entityType: ConnectorEntityType;
52
+ /** Synchronous ownership/cancellation guard before each new begin/page/commit request. */
53
+ beforeRequest?: () => void;
52
54
  pages: Iterable<ConnectorSnapshotPageRequest> | AsyncIterable<ConnectorSnapshotPageRequest>;
53
55
  }): Promise<CommitSnapshotResponse>;
54
56
  }
@@ -38,6 +38,7 @@ class AnhoraConnectorsApi {
38
38
  return this.http.request(`/v2/integrations/${installation}/snapshots/${run}/abort`, { method: 'POST', auth: 'ingest' });
39
39
  }
40
40
  async replaceSnapshot(input) {
41
+ input.beforeRequest?.();
41
42
  const run = await this.beginSnapshot(input.installationId, {
42
43
  schemaVersion: 2,
43
44
  namespace: input.namespace,
@@ -46,9 +47,11 @@ class AnhoraConnectorsApi {
46
47
  let page = 0;
47
48
  try {
48
49
  for await (const body of input.pages) {
50
+ input.beforeRequest?.();
49
51
  await this.uploadSnapshotPage(input.installationId, run.runId, page, body);
50
52
  page += 1;
51
53
  }
54
+ input.beforeRequest?.();
52
55
  return await this.commitSnapshot(input.installationId, run.runId, page);
53
56
  }
54
57
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anhora/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Framework-agnostic Anhora API client (connectors, content ingest, deployment runtime)",
5
5
  "license": "MIT",
6
6
  "author": "Anhora",
@@ -37,7 +37,7 @@
37
37
  "access": "public"
38
38
  },
39
39
  "dependencies": {
40
- "@anhora/shared-types": "0.2.0"
40
+ "@anhora/shared-types": "0.3.0"
41
41
  },
42
42
  "devDependencies": {
43
43
  "eslint": "^9.24.0",