@hasna/mementos 0.14.79 → 0.14.81

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.
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA6V9D"}
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/project.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmW9D"}
package/dist/cli/index.js CHANGED
@@ -6460,8 +6460,8 @@ function normalizeProjectUpdateInput(input) {
6460
6460
  }
6461
6461
  return normalized;
6462
6462
  }
6463
- function assertProjectUpdateIdentity(identity) {
6464
- if (identity.authority_id !== PROJECT_UPDATE_AUTHORITY.authority_id || identity.tenant_id !== PROJECT_UPDATE_AUTHORITY.tenant_id || identity.corpus_id !== PROJECT_UPDATE_AUTHORITY.corpus_id) {
6463
+ function assertProjectUpdateIdentity(identity, expectedIdentity = PROJECT_UPDATE_AUTHORITY) {
6464
+ if (identity.authority_id !== expectedIdentity.authority_id || identity.tenant_id !== expectedIdentity.tenant_id || identity.corpus_id !== expectedIdentity.corpus_id) {
6465
6465
  throw new ProjectGuardedUpdateError("PROJECT_UPDATE_AUTHORITY_MISMATCH", "guarded project update does not match this authority, tenant, and corpus");
6466
6466
  }
6467
6467
  }
@@ -6470,8 +6470,8 @@ function assertBoundedIdentifier(value, field) {
6470
6470
  throw new ProjectGuardedUpdateError("PROJECT_UPDATE_INVALID_INPUT", `${field} must be an 8-128 character bounded identifier`);
6471
6471
  }
6472
6472
  }
6473
- function assertProjectUpdateRequest(request) {
6474
- assertProjectUpdateIdentity(request);
6473
+ function assertProjectUpdateRequest(request, expectedIdentity = PROJECT_UPDATE_AUTHORITY) {
6474
+ assertProjectUpdateIdentity(request, expectedIdentity);
6475
6475
  assertBoundedIdentifier(request.operation_id, "operation_id");
6476
6476
  assertBoundedIdentifier(request.step_id, "step_id");
6477
6477
  assertBoundedIdentifier(request.idempotency_key, "idempotency_key");
@@ -6584,7 +6584,7 @@ function makeProjectUpdateReceipt(input) {
6584
6584
  target_id: input.target_id,
6585
6585
  expected_revision: input.request.expected_revision,
6586
6586
  result_revision: input.after_project.updated_at,
6587
- result_digest: digestProjectUpdateValue(input.after_project),
6587
+ result_digest: input.result_digest ?? digestProjectUpdateValue(input.after_project),
6588
6588
  accepted_receipt_id: input.accepted_receipt_id ?? null,
6589
6589
  before_project: input.before_project,
6590
6590
  after_project: input.after_project,
@@ -6648,8 +6648,8 @@ function listProjects(db) {
6648
6648
  const rows = d.query("SELECT * FROM projects ORDER BY updated_at DESC").all();
6649
6649
  return rows.map(parseProjectRow);
6650
6650
  }
6651
- function previewProjectUpdate(id, request, db) {
6652
- assertProjectUpdateRequest(request);
6651
+ function previewProjectUpdate(id, request, db, expectedIdentity = PROJECT_UPDATE_AUTHORITY) {
6652
+ assertProjectUpdateRequest(request, expectedIdentity);
6653
6653
  const normalized = normalizeProjectUpdateInput(request.updates);
6654
6654
  if (!db && isApiMode()) {
6655
6655
  const { data } = apiJson("POST", `/projects/${encodeURIComponent(id)}/guarded-update`, { ...request, updates: normalized, dry_run: true });
@@ -6671,8 +6671,8 @@ function previewProjectUpdate(id, request, db) {
6671
6671
  receipt: null
6672
6672
  };
6673
6673
  }
6674
- function applyProjectUpdate(id, request, db) {
6675
- assertProjectUpdateRequest(request);
6674
+ function applyProjectUpdate(id, request, db, expectedIdentity = PROJECT_UPDATE_AUTHORITY, resultDigestForProject) {
6675
+ assertProjectUpdateRequest(request, expectedIdentity);
6676
6676
  const normalized = normalizeProjectUpdateInput(request.updates);
6677
6677
  if (!db && isApiMode()) {
6678
6678
  const { data } = apiJson("POST", `/projects/${encodeURIComponent(id)}/guarded-update`, { ...request, updates: normalized, dry_run: false });
@@ -6733,14 +6733,15 @@ function applyProjectUpdate(id, request, db) {
6733
6733
  request_digest: requestDigest,
6734
6734
  target_id: id,
6735
6735
  before_project: before,
6736
- after_project: readback
6736
+ after_project: readback,
6737
+ result_digest: resultDigestForProject?.(readback)
6737
6738
  });
6738
6739
  insertProjectUpdateReceipt(d, receipt);
6739
6740
  return { dry_run: false, applied: true, project: readback, receipt };
6740
6741
  });
6741
6742
  }
6742
- function rollbackProjectUpdate(id, request, db) {
6743
- assertProjectUpdateRequest(request);
6743
+ function rollbackProjectUpdate(id, request, db, expectedIdentity = PROJECT_UPDATE_AUTHORITY, resultDigestForProject) {
6744
+ assertProjectUpdateRequest(request, expectedIdentity);
6744
6745
  assertBoundedIdentifier(request.accepted_receipt_id, "accepted_receipt_id");
6745
6746
  if (!db && isApiMode()) {
6746
6747
  const { data } = apiJson("POST", `/projects/${encodeURIComponent(id)}/guarded-rollback`, request);
@@ -6806,14 +6807,15 @@ function rollbackProjectUpdate(id, request, db) {
6806
6807
  target_id: id,
6807
6808
  before_project: current,
6808
6809
  after_project: readback,
6810
+ result_digest: resultDigestForProject?.(readback),
6809
6811
  accepted_receipt_id: accepted.receipt_id
6810
6812
  });
6811
6813
  insertProjectUpdateReceipt(d, receipt);
6812
6814
  return { dry_run: false, applied: true, project: readback, receipt };
6813
6815
  });
6814
6816
  }
6815
- function getProjectUpdateReceipt(id, receiptId, identity = PROJECT_UPDATE_AUTHORITY, db) {
6816
- assertProjectUpdateIdentity(identity);
6817
+ function getProjectUpdateReceipt(id, receiptId, identity = PROJECT_UPDATE_AUTHORITY, db, expectedIdentity = PROJECT_UPDATE_AUTHORITY) {
6818
+ assertProjectUpdateIdentity(identity, expectedIdentity);
6817
6819
  if (!db && isApiMode()) {
6818
6820
  const { data } = apiJson("POST", `/projects/${encodeURIComponent(id)}/update-receipts/lookup`, { ...identity, receipt_id: receiptId });
6819
6821
  return data;
@@ -63996,11 +63998,12 @@ function registerProjectCommands(program2) {
63996
63998
  const allProjects = listProjects();
63997
63999
  const limit = positiveIntOrDefault(opts.limit, DEFAULT_COMPACT_LIMIT);
63998
64000
  const offset = cursorOrOffset(opts.cursor, opts.offset) ?? 0;
63999
- const projects = globalOpts.json ? allProjects : allProjects.slice(offset, offset + limit + 1);
64001
+ const explicitPagination = opts.limit !== undefined || opts.cursor !== undefined || opts.offset !== undefined;
64002
+ const projects = globalOpts.json ? explicitPagination ? allProjects.slice(offset, offset + limit) : allProjects : allProjects.slice(offset, offset + limit + 1);
64000
64003
  const hasMore = !globalOpts.json && projects.length > limit;
64001
64004
  const displayProjects = hasMore ? projects.slice(0, limit) : projects;
64002
64005
  if (globalOpts.json) {
64003
- outputJson(allProjects);
64006
+ outputJson(projects);
64004
64007
  return;
64005
64008
  }
64006
64009
  if (displayProjects.length === 0) {
@@ -14,10 +14,10 @@ export declare class ProjectGuardedUpdateError extends Error {
14
14
  export declare function registerProject(name: string, path: string, description?: string, memoryPrefix?: string, db?: Database): Project;
15
15
  export declare function getProject(idOrPath: string, db?: Database): Project | null;
16
16
  export declare function listProjects(db?: Database): Project[];
17
- export declare function previewProjectUpdate(id: string, request: ProjectGuardedUpdateRequest, db?: Database): ProjectGuardedUpdateResult;
18
- export declare function applyProjectUpdate(id: string, request: ProjectGuardedUpdateRequest, db?: Database): ProjectGuardedUpdateResult;
19
- export declare function rollbackProjectUpdate(id: string, request: ProjectGuardedRollbackRequest, db?: Database): ProjectGuardedUpdateResult;
20
- export declare function getProjectUpdateReceipt(id: string, receiptId: string, identity?: ProjectAuthorityIdentity, db?: Database): ProjectUpdateReceipt;
17
+ export declare function previewProjectUpdate(id: string, request: ProjectGuardedUpdateRequest, db?: Database, expectedIdentity?: ProjectAuthorityIdentity): ProjectGuardedUpdateResult;
18
+ export declare function applyProjectUpdate(id: string, request: ProjectGuardedUpdateRequest, db?: Database, expectedIdentity?: ProjectAuthorityIdentity, resultDigestForProject?: (project: Project) => string): ProjectGuardedUpdateResult;
19
+ export declare function rollbackProjectUpdate(id: string, request: ProjectGuardedRollbackRequest, db?: Database, expectedIdentity?: ProjectAuthorityIdentity, resultDigestForProject?: (project: Project) => string): ProjectGuardedUpdateResult;
20
+ export declare function getProjectUpdateReceipt(id: string, receiptId: string, identity?: ProjectAuthorityIdentity, db?: Database, expectedIdentity?: ProjectAuthorityIdentity): ProjectUpdateReceipt;
21
21
  /**
22
22
  * Package-internal compatibility helper for old tests and migrations.
23
23
  * Public callers use applyProjectUpdate so every mutation is CAS-guarded and
@@ -1 +1 @@
1
- {"version":3,"file":"projects.d.ts","sourceRoot":"","sources":["../../src/db/projects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE1D,OAAO,KAAK,EACV,OAAO,EACP,wBAAwB,EACxB,6BAA6B,EAC7B,2BAA2B,EAC3B,0BAA0B,EAC1B,oBAAoB,EACpB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAkB3B,qBAAa,qBAAsB,SAAQ,KAAK;aAE5B,KAAK,EAAE,MAAM,GAAG,MAAM;aACtB,KAAK,EAAE,MAAM;gBADb,KAAK,EAAE,MAAM,GAAG,MAAM,EACtB,KAAK,EAAE,MAAM;CAKhC;AAED,MAAM,MAAM,6BAA6B,GACrC,8BAA8B,GAC9B,mCAAmC,GACnC,0BAA0B,GAC1B,+BAA+B,GAC/B,0BAA0B,GAC1B,qCAAqC,GACrC,kCAAkC,GAClC,wCAAwC,CAAC;AAE7C,qBAAa,yBAA0B,SAAQ,KAAK;aAEhC,IAAI,EAAE,6BAA6B;aAEnC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAFhC,IAAI,EAAE,6BAA6B,EACnD,OAAO,EAAE,MAAM,EACC,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM;C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B,EACpC,EAAE,CAAC,EAAE,QAAQ,EACb,gBAAgB,GAAE,wBAAmD,EACrE,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,GACpD,0BAA0B,CA4F5B;AAED,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,6BAA6B,EACtC,EAAE,CAAC,EAAE,QAAQ,EACb,gBAAgB,GAAE,wBAAmD,EACrE,sBAAsB,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,GACpD,0BAA0B,CAuG5B;AAED,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,MAAM,EACjB,QAAQ,GAAE,wBAAmD,EAC7D,EAAE,CAAC,EAAE,QAAQ,EACb,gBAAgB,GAAE,wBAAmD,GACpE,oBAAoB,CAmBtB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,kBAAkB,EACzB,EAAE,CAAC,EAAE,QAAQ,GACZ,OAAO,GAAG,IAAI,CAkFhB"}
package/dist/index.js CHANGED
@@ -51683,8 +51683,8 @@ function normalizeProjectUpdateInput(input) {
51683
51683
  }
51684
51684
  return normalized;
51685
51685
  }
51686
- function assertProjectUpdateIdentity(identity) {
51687
- if (identity.authority_id !== PROJECT_UPDATE_AUTHORITY.authority_id || identity.tenant_id !== PROJECT_UPDATE_AUTHORITY.tenant_id || identity.corpus_id !== PROJECT_UPDATE_AUTHORITY.corpus_id) {
51686
+ function assertProjectUpdateIdentity(identity, expectedIdentity = PROJECT_UPDATE_AUTHORITY) {
51687
+ if (identity.authority_id !== expectedIdentity.authority_id || identity.tenant_id !== expectedIdentity.tenant_id || identity.corpus_id !== expectedIdentity.corpus_id) {
51688
51688
  throw new ProjectGuardedUpdateError("PROJECT_UPDATE_AUTHORITY_MISMATCH", "guarded project update does not match this authority, tenant, and corpus");
51689
51689
  }
51690
51690
  }
@@ -51693,8 +51693,8 @@ function assertBoundedIdentifier2(value, field) {
51693
51693
  throw new ProjectGuardedUpdateError("PROJECT_UPDATE_INVALID_INPUT", `${field} must be an 8-128 character bounded identifier`);
51694
51694
  }
51695
51695
  }
51696
- function assertProjectUpdateRequest(request) {
51697
- assertProjectUpdateIdentity(request);
51696
+ function assertProjectUpdateRequest(request, expectedIdentity = PROJECT_UPDATE_AUTHORITY) {
51697
+ assertProjectUpdateIdentity(request, expectedIdentity);
51698
51698
  assertBoundedIdentifier2(request.operation_id, "operation_id");
51699
51699
  assertBoundedIdentifier2(request.step_id, "step_id");
51700
51700
  assertBoundedIdentifier2(request.idempotency_key, "idempotency_key");
@@ -51807,7 +51807,7 @@ function makeProjectUpdateReceipt(input) {
51807
51807
  target_id: input.target_id,
51808
51808
  expected_revision: input.request.expected_revision,
51809
51809
  result_revision: input.after_project.updated_at,
51810
- result_digest: digestProjectUpdateValue(input.after_project),
51810
+ result_digest: input.result_digest ?? digestProjectUpdateValue(input.after_project),
51811
51811
  accepted_receipt_id: input.accepted_receipt_id ?? null,
51812
51812
  before_project: input.before_project,
51813
51813
  after_project: input.after_project,
@@ -51871,8 +51871,8 @@ function listProjects(db) {
51871
51871
  const rows = d.query("SELECT * FROM projects ORDER BY updated_at DESC").all();
51872
51872
  return rows.map(parseProjectRow2);
51873
51873
  }
51874
- function previewProjectUpdate(id, request, db) {
51875
- assertProjectUpdateRequest(request);
51874
+ function previewProjectUpdate(id, request, db, expectedIdentity = PROJECT_UPDATE_AUTHORITY) {
51875
+ assertProjectUpdateRequest(request, expectedIdentity);
51876
51876
  const normalized = normalizeProjectUpdateInput(request.updates);
51877
51877
  if (!db && isApiMode()) {
51878
51878
  const { data } = apiJson("POST", `/projects/${encodeURIComponent(id)}/guarded-update`, { ...request, updates: normalized, dry_run: true });
@@ -51894,8 +51894,8 @@ function previewProjectUpdate(id, request, db) {
51894
51894
  receipt: null
51895
51895
  };
51896
51896
  }
51897
- function applyProjectUpdate(id, request, db) {
51898
- assertProjectUpdateRequest(request);
51897
+ function applyProjectUpdate(id, request, db, expectedIdentity = PROJECT_UPDATE_AUTHORITY, resultDigestForProject) {
51898
+ assertProjectUpdateRequest(request, expectedIdentity);
51899
51899
  const normalized = normalizeProjectUpdateInput(request.updates);
51900
51900
  if (!db && isApiMode()) {
51901
51901
  const { data } = apiJson("POST", `/projects/${encodeURIComponent(id)}/guarded-update`, { ...request, updates: normalized, dry_run: false });
@@ -51956,14 +51956,15 @@ function applyProjectUpdate(id, request, db) {
51956
51956
  request_digest: requestDigest,
51957
51957
  target_id: id,
51958
51958
  before_project: before,
51959
- after_project: readback
51959
+ after_project: readback,
51960
+ result_digest: resultDigestForProject?.(readback)
51960
51961
  });
51961
51962
  insertProjectUpdateReceipt(d, receipt);
51962
51963
  return { dry_run: false, applied: true, project: readback, receipt };
51963
51964
  });
51964
51965
  }
51965
- function rollbackProjectUpdate(id, request, db) {
51966
- assertProjectUpdateRequest(request);
51966
+ function rollbackProjectUpdate(id, request, db, expectedIdentity = PROJECT_UPDATE_AUTHORITY, resultDigestForProject) {
51967
+ assertProjectUpdateRequest(request, expectedIdentity);
51967
51968
  assertBoundedIdentifier2(request.accepted_receipt_id, "accepted_receipt_id");
51968
51969
  if (!db && isApiMode()) {
51969
51970
  const { data } = apiJson("POST", `/projects/${encodeURIComponent(id)}/guarded-rollback`, request);
@@ -52029,14 +52030,15 @@ function rollbackProjectUpdate(id, request, db) {
52029
52030
  target_id: id,
52030
52031
  before_project: current,
52031
52032
  after_project: readback,
52033
+ result_digest: resultDigestForProject?.(readback),
52032
52034
  accepted_receipt_id: accepted.receipt_id
52033
52035
  });
52034
52036
  insertProjectUpdateReceipt(d, receipt);
52035
52037
  return { dry_run: false, applied: true, project: readback, receipt };
52036
52038
  });
52037
52039
  }
52038
- function getProjectUpdateReceipt(id, receiptId, identity = PROJECT_UPDATE_AUTHORITY, db) {
52039
- assertProjectUpdateIdentity(identity);
52040
+ function getProjectUpdateReceipt(id, receiptId, identity = PROJECT_UPDATE_AUTHORITY, db, expectedIdentity = PROJECT_UPDATE_AUTHORITY) {
52041
+ assertProjectUpdateIdentity(identity, expectedIdentity);
52040
52042
  if (!db && isApiMode()) {
52041
52043
  const { data } = apiJson("POST", `/projects/${encodeURIComponent(id)}/update-receipts/lookup`, { ...identity, receipt_id: receiptId });
52042
52044
  return data;
@@ -52178,9 +52180,9 @@ function assertWithinBounds(value, bounds, startedAt) {
52178
52180
  }
52179
52181
  return { response_bytes: bytes, elapsed_ms: elapsed };
52180
52182
  }
52181
- function withResponseControl(receipt, bounds, startedAt) {
52183
+ function withBoundedResponseControl(payload, bounds, startedAt) {
52182
52184
  const result = {
52183
- receipt,
52185
+ ...payload,
52184
52186
  response_control: {
52185
52187
  response_byte_limit: bounds.response_byte_limit,
52186
52188
  time_budget_ms: bounds.time_budget_ms,
@@ -52203,6 +52205,9 @@ function withResponseControl(receipt, bounds, startedAt) {
52203
52205
  result.response_control.elapsed_ms = measured.elapsed_ms;
52204
52206
  return result;
52205
52207
  }
52208
+ function withResponseControl(receipt, bounds, startedAt) {
52209
+ return withBoundedResponseControl({ receipt }, bounds, startedAt);
52210
+ }
52206
52211
  function requireString(value, field, options = {}) {
52207
52212
  const min = options.min ?? 1;
52208
52213
  const max = options.max ?? 512;
@@ -52229,6 +52234,80 @@ function ownedPath(target) {
52229
52234
  }
52230
52235
  return path;
52231
52236
  }
52237
+ function guardedAuthorityIdentity(capability) {
52238
+ return {
52239
+ authority_id: capability.authority_id,
52240
+ tenant_id: capability.tenant_id,
52241
+ corpus_id: capability.corpus_id
52242
+ };
52243
+ }
52244
+ function assertGuardedAuthorityRequest(targetId, request, capability) {
52245
+ assertBounds(request);
52246
+ requireString(targetId, "target_id", { min: 8, max: 128, pattern: OPERATION_PATTERN });
52247
+ if (request.authority !== "mementos" || request.authority_route !== MEMENTOS_PROJECT_GUARDED_UPDATE_ROUTE || request.package_version !== capability.package_version || request.authority_id !== capability.authority_id || request.tenant_id !== capability.tenant_id || request.corpus_id !== capability.corpus_id) {
52248
+ throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_CAPABILITY_MISMATCH", "guarded project request does not match this authority capability identity");
52249
+ }
52250
+ return guardedAuthorityIdentity(capability);
52251
+ }
52252
+ function assertGuardedOperationFields(request) {
52253
+ requireString(request.operation_id, "operation_id", {
52254
+ min: 8,
52255
+ max: 128,
52256
+ pattern: OPERATION_PATTERN
52257
+ });
52258
+ requireString(request.step_id, "step_id", {
52259
+ min: 8,
52260
+ max: 128,
52261
+ pattern: OPERATION_PATTERN
52262
+ });
52263
+ requireString(request.idempotency_key, "idempotency_key", {
52264
+ min: 8,
52265
+ max: 128,
52266
+ pattern: OPERATION_PATTERN
52267
+ });
52268
+ requireString(request.expected_revision, "expected_revision", { max: 128 });
52269
+ }
52270
+ function assertGuardedUpdateRequest(targetId, request, capability) {
52271
+ const identity = assertGuardedAuthorityRequest(targetId, request, capability);
52272
+ assertGuardedOperationFields(request);
52273
+ if (!request.updates || typeof request.updates !== "object") {
52274
+ throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_INVALID_INPUT", "guarded project updates must contain exactly one private path handle");
52275
+ }
52276
+ exactKeys(request.updates, ["path"], "updates");
52277
+ return { identity, path: ownedPath(request.updates.path) };
52278
+ }
52279
+ function publicGuardedUpdateReceipt(receipt, capability) {
52280
+ return {
52281
+ receipt_id: receipt.receipt_id,
52282
+ authority: "mementos",
52283
+ route: MEMENTOS_PROJECT_GUARDED_UPDATE_ROUTE,
52284
+ package_version: capability.package_version,
52285
+ authority_id: capability.authority_id,
52286
+ tenant_id: capability.tenant_id,
52287
+ corpus_id: capability.corpus_id,
52288
+ operation_id: receipt.operation_id,
52289
+ step_id: receipt.step_id,
52290
+ direction: receipt.direction,
52291
+ idempotency_key: receipt.idempotency_key,
52292
+ request_digest: receipt.request_digest,
52293
+ outcome: "accepted",
52294
+ target_id: receipt.target_id,
52295
+ expected_revision: receipt.expected_revision,
52296
+ result_revision: receipt.result_revision,
52297
+ result_digest: receipt.result_digest,
52298
+ accepted_receipt_id: receipt.accepted_receipt_id,
52299
+ created_at: receipt.created_at
52300
+ };
52301
+ }
52302
+ function guardedProjectError(cause) {
52303
+ if (cause instanceof MementosProjectRegistrationError)
52304
+ throw cause;
52305
+ if (cause instanceof ProjectGuardedUpdateError) {
52306
+ const code = cause.code === "PROJECT_UPDATE_INVALID_INPUT" ? "MEMENTOS_PROJECT_REGISTRATION_INVALID_INPUT" : cause.code === "PROJECT_UPDATE_AUTHORITY_MISMATCH" ? "MEMENTOS_PROJECT_REGISTRATION_CAPABILITY_MISMATCH" : cause.code === "PROJECT_UPDATE_NOT_FOUND" ? "MEMENTOS_PROJECT_REGISTRATION_RECORD_NOT_FOUND" : cause.code === "PROJECT_UPDATE_RECEIPT_NOT_FOUND" ? "MEMENTOS_PROJECT_REGISTRATION_RECEIPT_NOT_FOUND" : "MEMENTOS_PROJECT_REGISTRATION_CONFLICT";
52307
+ throw new MementosProjectRegistrationError(code, "guarded project operation was rejected without exposing private project data", { project_update_code: cause.code });
52308
+ }
52309
+ throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_ATOMICITY_UNAVAILABLE", "guarded project operation failed before a bounded public result was available");
52310
+ }
52232
52311
  function normalizedCallDigest(request) {
52233
52312
  return digestMementosProjectRegistrationValue({
52234
52313
  authority_route: request.authority_route,
@@ -52615,6 +52694,7 @@ class PackageOwnedMementosProjectRegistrationAuthority {
52615
52694
  conditional_inverse: true,
52616
52695
  ambiguous_outcome_reconciliation: true,
52617
52696
  guarded_update: true,
52697
+ guarded_update_route: MEMENTOS_PROJECT_GUARDED_UPDATE_ROUTE,
52618
52698
  no_write_dry_run: true,
52619
52699
  expected_revision_compare_and_swap: true,
52620
52700
  caller_idempotency: true,
@@ -52676,6 +52756,90 @@ class PackageOwnedMementosProjectRegistrationAuthority {
52676
52756
  supported_resources: ["project"]
52677
52757
  };
52678
52758
  }
52759
+ boundedGuardedUpdateResult(targetId2, project, receipt, bounds, startedAt) {
52760
+ if (!receipt || project.id !== targetId2 || receipt.target_id !== targetId2) {
52761
+ throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_ATOMICITY_UNAVAILABLE", "guarded project operation did not return its exact immutable receipt");
52762
+ }
52763
+ if (project.updated_at !== receipt.result_revision) {
52764
+ throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_ATOMICITY_UNAVAILABLE", "guarded project result revision did not match its immutable receipt");
52765
+ }
52766
+ const record = {
52767
+ target_id: targetId2,
52768
+ revision: receipt.result_revision,
52769
+ digest: receipt.result_digest
52770
+ };
52771
+ return withBoundedResponseControl({
52772
+ dry_run: false,
52773
+ applied: true,
52774
+ record,
52775
+ receipt: publicGuardedUpdateReceipt(receipt, this.capabilityValue)
52776
+ }, bounds, startedAt);
52777
+ }
52778
+ async guardedUpdateProject(targetId2, request) {
52779
+ const startedAt = Date.now();
52780
+ const { identity, path } = assertGuardedUpdateRequest(targetId2, request, this.capabilityValue);
52781
+ try {
52782
+ const result = applyProjectUpdate(targetId2, {
52783
+ ...identity,
52784
+ operation_id: request.operation_id,
52785
+ step_id: request.step_id,
52786
+ idempotency_key: request.idempotency_key,
52787
+ expected_revision: request.expected_revision,
52788
+ updates: { path }
52789
+ }, this.db, identity, (project) => projectRecord(this.db, project).digest);
52790
+ return this.boundedGuardedUpdateResult(targetId2, result.project, result.receipt, request, startedAt);
52791
+ } catch (cause) {
52792
+ return guardedProjectError(cause);
52793
+ }
52794
+ }
52795
+ async getGuardedProjectUpdateReceipt(targetId2, receiptId2, request) {
52796
+ const startedAt = Date.now();
52797
+ const identity = assertGuardedAuthorityRequest(targetId2, request, this.capabilityValue);
52798
+ requireString(receiptId2, "receipt_id", {
52799
+ min: 8,
52800
+ max: 128,
52801
+ pattern: OPERATION_PATTERN
52802
+ });
52803
+ try {
52804
+ const receipt = getProjectUpdateReceipt(targetId2, receiptId2, identity, this.db, identity);
52805
+ return withBoundedResponseControl({
52806
+ receipt: publicGuardedUpdateReceipt(receipt, this.capabilityValue)
52807
+ }, request, startedAt);
52808
+ } catch (cause) {
52809
+ return guardedProjectError(cause);
52810
+ }
52811
+ }
52812
+ async rollbackGuardedProjectUpdate(targetId2, request) {
52813
+ const startedAt = Date.now();
52814
+ const identity = assertGuardedAuthorityRequest(targetId2, request, this.capabilityValue);
52815
+ assertGuardedOperationFields(request);
52816
+ if (!request.accepted_receipt || typeof request.accepted_receipt !== "object") {
52817
+ throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_INVALID_INPUT", "conditional rollback requires the exact sanitized accepted receipt");
52818
+ }
52819
+ requireString(request.accepted_receipt.receipt_id, "accepted_receipt.receipt_id", {
52820
+ min: 8,
52821
+ max: 128,
52822
+ pattern: OPERATION_PATTERN
52823
+ });
52824
+ try {
52825
+ const internalAccepted = getProjectUpdateReceipt(targetId2, request.accepted_receipt.receipt_id, identity, this.db, identity);
52826
+ const accepted = publicGuardedUpdateReceipt(internalAccepted, this.capabilityValue);
52827
+ if (accepted.direction !== "forward" || accepted.target_id !== targetId2 || request.expected_revision !== accepted.result_revision || canonicalMementosProjectRegistrationJson(request.accepted_receipt) !== canonicalMementosProjectRegistrationJson(accepted)) {
52828
+ throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_INVALID_INPUT", "conditional rollback receipt does not exactly match the accepted forward update");
52829
+ }
52830
+ const result = rollbackProjectUpdate(targetId2, {
52831
+ ...identity,
52832
+ operation_id: request.operation_id,
52833
+ step_id: request.step_id,
52834
+ idempotency_key: request.idempotency_key,
52835
+ expected_revision: request.expected_revision,
52836
+ accepted_receipt_id: accepted.receipt_id
52837
+ }, this.db, identity, (project) => projectRecord(this.db, project).digest);
52838
+ return this.boundedGuardedUpdateResult(targetId2, result.project, result.receipt, request, startedAt);
52839
+ } catch (cause) {
52840
+ return guardedProjectError(cause);
52841
+ }
52842
+ }
52679
52843
  async create(request) {
52680
52844
  const startedAt = Date.now();
52681
52845
  const path = assertForwardRequest2(request, this.capabilityValue);
@@ -52772,9 +52936,9 @@ class PackageOwnedMementosProjectRegistrationAuthority {
52772
52936
  throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_INVALID_INPUT", "resource_kind must be project");
52773
52937
  }
52774
52938
  requireString(request.target_id, "target_id", {
52775
- min: 51,
52776
- max: 51,
52777
- pattern: PROJECT_ID_PATTERN
52939
+ min: 8,
52940
+ max: 128,
52941
+ pattern: OPERATION_PATTERN
52778
52942
  });
52779
52943
  const path = ownedPath(request.target);
52780
52944
  const project = getProjectByExactId3(this.db, request.target_id);
@@ -53033,6 +53197,31 @@ function fromWireReadRequest(body) {
53033
53197
  target: new WirePathHandle(canonicalPath)
53034
53198
  };
53035
53199
  }
53200
+ function fromWireGuardedUpdateRequest(body) {
53201
+ const { target_id: targetId2, updates, ...request } = body;
53202
+ if (typeof targetId2 !== "string") {
53203
+ throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_INVALID_INPUT", "target_id is required on the private guarded-update transport");
53204
+ }
53205
+ if (!updates || typeof updates !== "object" || Array.isArray(updates) || typeof updates["path"] !== "string") {
53206
+ throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_INVALID_INPUT", "updates.path is required on the private guarded-update transport");
53207
+ }
53208
+ return {
53209
+ targetId: targetId2,
53210
+ request: {
53211
+ ...request,
53212
+ updates: {
53213
+ path: new WirePathHandle(String(updates["path"]))
53214
+ }
53215
+ }
53216
+ };
53217
+ }
53218
+ function exactWireIdentifier(body, field) {
53219
+ const value = body[field];
53220
+ if (typeof value !== "string") {
53221
+ throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_INVALID_INPUT", `${field} is required on the guarded-update transport`);
53222
+ }
53223
+ return value;
53224
+ }
53036
53225
  async function handleMementosProjectRegistrationHttpRequest(request, url, authority, basePath = "/v1/project-registration") {
53037
53226
  const path = url.pathname;
53038
53227
  if (path !== basePath && !path.startsWith(`${basePath}/`))
@@ -53067,6 +53256,21 @@ async function handleMementosProjectRegistrationHttpRequest(request, url, author
53067
53256
  if (action === "verify-inverse") {
53068
53257
  return json({ verification: await authority.verifyInverse(fromWireRequest(body)) });
53069
53258
  }
53259
+ if (action === "projects/guarded-update") {
53260
+ const guarded = fromWireGuardedUpdateRequest(body);
53261
+ return json(await authority.guardedUpdateProject(guarded.targetId, guarded.request));
53262
+ }
53263
+ if (action === "projects/update-receipts/lookup") {
53264
+ const targetId2 = exactWireIdentifier(body, "target_id");
53265
+ const receiptId2 = exactWireIdentifier(body, "receipt_id");
53266
+ const { target_id: _targetId, receipt_id: _receiptId, ...lookup } = body;
53267
+ return json(await authority.getGuardedProjectUpdateReceipt(targetId2, receiptId2, lookup));
53268
+ }
53269
+ if (action === "projects/guarded-rollback") {
53270
+ const targetId2 = exactWireIdentifier(body, "target_id");
53271
+ const { target_id: _targetId, ...rollback } = body;
53272
+ return json(await authority.rollbackGuardedProjectUpdate(targetId2, rollback));
53273
+ }
53070
53274
  return json({
53071
53275
  error: "unknown Mementos project-registration route",
53072
53276
  code: "MEMENTOS_PROJECT_REGISTRATION_RECEIPT_NOT_FOUND"
@@ -53099,6 +53303,15 @@ function toWireRequest(request) {
53099
53303
  canonical_path: extractPath(target)
53100
53304
  };
53101
53305
  }
53306
+ function toWireGuardedUpdateRequest(targetId2, request) {
53307
+ return {
53308
+ ...request,
53309
+ target_id: targetId2,
53310
+ updates: {
53311
+ path: extractPath(request.updates.path)
53312
+ }
53313
+ };
53314
+ }
53102
53315
 
53103
53316
  class MementosProjectRegistrationHttpClient {
53104
53317
  authority = "mementos";
@@ -53160,6 +53373,24 @@ class MementosProjectRegistrationHttpClient {
53160
53373
  });
53161
53374
  return body.verification;
53162
53375
  }
53376
+ async guardedUpdateProject(targetId2, request) {
53377
+ return this.request("/projects/guarded-update", {
53378
+ method: "POST",
53379
+ body: JSON.stringify(toWireGuardedUpdateRequest(targetId2, request))
53380
+ });
53381
+ }
53382
+ async getGuardedProjectUpdateReceipt(targetId2, receiptId2, request) {
53383
+ return this.request("/projects/update-receipts/lookup", {
53384
+ method: "POST",
53385
+ body: JSON.stringify({ ...request, target_id: targetId2, receipt_id: receiptId2 })
53386
+ });
53387
+ }
53388
+ async rollbackGuardedProjectUpdate(targetId2, request) {
53389
+ return this.request("/projects/guarded-rollback", {
53390
+ method: "POST",
53391
+ body: JSON.stringify({ ...request, target_id: targetId2 })
53392
+ });
53393
+ }
53163
53394
  }
53164
53395
  function createMementosProjectRegistrationHttpClient(options) {
53165
53396
  return new MementosProjectRegistrationHttpClient(options);
@@ -1,5 +1,5 @@
1
1
  import type { DbAdapter } from "../storage.js";
2
- import { type MementosProjectRegistrationAuthority, type MementosProjectRegistrationAuthorityOptions, type MementosProjectRegistrationCapability, type MementosProjectRegistrationDirection, type MementosProjectRegistrationInverseVerification, type MementosProjectRegistrationLookupRequest, type MementosProjectRegistrationLookupResult, type MementosProjectRegistrationPathHandle, type MementosProjectRegistrationReceipt, type MementosProjectRegistrationRecord, type MementosProjectRegistrationRequest } from "./types.js";
2
+ import { type MementosProjectGuardedRollbackRequest, type MementosProjectGuardedUpdateReceiptLookupRequest, type MementosProjectGuardedUpdateReceiptLookupResult, type MementosProjectGuardedUpdateRequest, type MementosProjectGuardedUpdateResult, type MementosProjectRegistrationAuthority, type MementosProjectRegistrationAuthorityOptions, type MementosProjectRegistrationCapability, type MementosProjectRegistrationDirection, type MementosProjectRegistrationInverseVerification, type MementosProjectRegistrationLookupRequest, type MementosProjectRegistrationLookupResult, type MementosProjectRegistrationPathHandle, type MementosProjectRegistrationReceipt, type MementosProjectRegistrationRecord, type MementosProjectRegistrationRequest } from "./types.js";
3
3
  export declare function canonicalMementosProjectRegistrationJson(value: unknown): string;
4
4
  export declare function digestMementosProjectRegistrationValue(value: unknown): string;
5
5
  export declare function deriveMementosProjectRegistrationIdempotencyKey(input: {
@@ -22,6 +22,10 @@ export declare class PackageOwnedMementosProjectRegistrationAuthority implements
22
22
  private terminal;
23
23
  private duplicateForwardOrTerminal;
24
24
  capability(): Promise<MementosProjectRegistrationCapability>;
25
+ private boundedGuardedUpdateResult;
26
+ guardedUpdateProject(targetId: string, request: MementosProjectGuardedUpdateRequest): Promise<MementosProjectGuardedUpdateResult>;
27
+ getGuardedProjectUpdateReceipt(targetId: string, receiptId: string, request: MementosProjectGuardedUpdateReceiptLookupRequest): Promise<MementosProjectGuardedUpdateReceiptLookupResult>;
28
+ rollbackGuardedProjectUpdate(targetId: string, request: MementosProjectGuardedRollbackRequest): Promise<MementosProjectGuardedUpdateResult>;
25
29
  create(request: MementosProjectRegistrationRequest): Promise<MementosProjectRegistrationReceipt>;
26
30
  readExact(request: {
27
31
  resource_kind: "project";
@@ -1 +1 @@
1
- {"version":3,"file":"authority.d.ts","sourceRoot":"","sources":["../../src/project-registration/authority.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAS/C,OAAO,EAIL,KAAK,oCAAoC,EACzC,KAAK,2CAA2C,EAEhD,KAAK,qCAAqC,EAC1C,KAAK,oCAAoC,EAEzC,KAAK,8CAA8C,EACnD,KAAK,wCAAwC,EAC7C,KAAK,uCAAuC,EAC5C,KAAK,qCAAqC,EAC1C,KAAK,kCAAkC,EACvC,KAAK,iCAAiC,EACtC,KAAK,kCAAkC,EACxC,MAAM,YAAY,CAAC;AA8CpB,wBAAgB,wCAAwC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE/E;AAaD,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAI7E;AAMD,wBAAgB,+CAA+C,CAAC,KAAK,EAAE;IACrE,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,oCAAoC,CAAC;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;CAC7B,GAAG,MAAM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,CAAC,qCAAqC,CAAC;IAOlE,OAAO,CAAC,0BAA0B;IAgC5B,oBAAoB,CACxB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,mCAAmC,GAC3C,OAAO,CAAC,kCAAkC,CAAC;IA4BxC,8BAA8B,CAClC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,gDAAgD,GACxD,OAAO,CAAC,+CAA+C,CAAC;IA4BrD,4BAA4B,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,qCAAqC,GAC7C,OAAO,CAAC,kCAAkC,CAAC;IA+DxC,MAAM,CACV,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,kCAAkC,CAAC;IAkHxC,SAAS,CAAC,OAAO,EAAE;QACvB,aAAa,EAAE,SAAS,CAAC;QACzB,SAAS,EAAE,MAAM,CAAC;QAClB,MAAM,EAAE,qCAAqC,CAAC;QAC9C,mBAAmB,EAAE,MAAM,CAAC;QAC5B,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,iCAAiC,CAAC;IA2BxC,aAAa,CACjB,OAAO,EAAE,wCAAwC,GAChD,OAAO,CAAC,uCAAuC,CAAC;IAa7C,UAAU,CACd,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,kCAAkC,CAAC;IA4LxC,aAAa,CACjB,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,8CAA8C,CAAC;CAgD3D;AAED,wBAAgB,0CAA0C,CACxD,EAAE,EAAE,SAAS,EACb,OAAO,GAAE,2CAAgD,GACxD,oCAAoC,CAEtC;AAED,eAAO,MAAM,+CAA+C,mDAChB,CAAC"}
@@ -1,4 +1,4 @@
1
- import { type MementosProjectRegistrationAuthority, type MementosProjectRegistrationCapability, type MementosProjectRegistrationHttpClientOptions, type MementosProjectRegistrationInverseVerification, type MementosProjectRegistrationLookupRequest, type MementosProjectRegistrationLookupResult, type MementosProjectRegistrationPathHandle, type MementosProjectRegistrationReceipt, type MementosProjectRegistrationRecord, type MementosProjectRegistrationRequest } from "./types.js";
1
+ import { type MementosProjectGuardedRollbackRequest, type MementosProjectGuardedUpdateReceiptLookupRequest, type MementosProjectGuardedUpdateReceiptLookupResult, type MementosProjectGuardedUpdateRequest, type MementosProjectGuardedUpdateResult, type MementosProjectRegistrationAuthority, type MementosProjectRegistrationCapability, type MementosProjectRegistrationHttpClientOptions, type MementosProjectRegistrationInverseVerification, type MementosProjectRegistrationLookupRequest, type MementosProjectRegistrationLookupResult, type MementosProjectRegistrationPathHandle, type MementosProjectRegistrationReceipt, type MementosProjectRegistrationRecord, type MementosProjectRegistrationRequest } from "./types.js";
2
2
  /**
3
3
  * Handle one package-owned registration request. The canonical path is private
4
4
  * request material and is converted back to a structural handle before the
@@ -24,6 +24,9 @@ export declare class MementosProjectRegistrationHttpClient implements MementosPr
24
24
  lookupReceipt(request: MementosProjectRegistrationLookupRequest): Promise<MementosProjectRegistrationLookupResult>;
25
25
  compensate(request: MementosProjectRegistrationRequest): Promise<MementosProjectRegistrationReceipt>;
26
26
  verifyInverse(request: MementosProjectRegistrationRequest): Promise<MementosProjectRegistrationInverseVerification>;
27
+ guardedUpdateProject(targetId: string, request: MementosProjectGuardedUpdateRequest): Promise<MementosProjectGuardedUpdateResult>;
28
+ getGuardedProjectUpdateReceipt(targetId: string, receiptId: string, request: MementosProjectGuardedUpdateReceiptLookupRequest): Promise<MementosProjectGuardedUpdateReceiptLookupResult>;
29
+ rollbackGuardedProjectUpdate(targetId: string, request: MementosProjectGuardedRollbackRequest): Promise<MementosProjectGuardedUpdateResult>;
27
30
  }
28
31
  export declare function createMementosProjectRegistrationHttpClient(options: MementosProjectRegistrationHttpClientOptions): MementosProjectRegistrationAuthority;
29
32
  //# sourceMappingURL=http.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/project-registration/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,oCAAoC,E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,CAAC;QAC5B,cAAc,EAAE,MAAM,CAAC;KACxB,GAAG,OAAO,CAAC,iCAAiC,CAAC;IAYxC,aAAa,CACjB,OAAO,EAAE,wCAAwC,GAChD,OAAO,CAAC,uCAAuC,CAAC;IAO7C,UAAU,CACd,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,kCAAkC,CAAC;IAQxC,aAAa,CACjB,OAAO,EAAE,kCAAkC,GAC1C,OAAO,CAAC,8CAA8C,CAAC;IAUpD,oBAAoB,CACxB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,mCAAmC,GAC3C,OAAO,CAAC,kCAAkC,CAAC;IAUxC,8BAA8B,CAClC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,gDAAgD,GACxD,OAAO,CAAC,+CAA+C,CAAC;IAUrD,4BAA4B,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,qCAAqC,GAC7C,OAAO,CAAC,kCAAkC,CAAC;CAS/C;AAED,wBAAgB,2CAA2C,CACzD,OAAO,EAAE,4CAA4C,GACpD,oCAAoC,CAEtC"}
@@ -4,5 +4,5 @@ export { postgresMementosProjectRegistrationSchemaSql, postgresMementosProjectGu
4
4
  export { MEMENTOS_PROJECT_REFERENCE_SURFACES, hasMementosProjectReferences, mementosProjectReferenceCounts, } from "./project-references.js";
5
5
  export type { MementosProjectReferenceCounts, MementosProjectReferenceKey, } from "./project-references.js";
6
6
  export { MEMENTOS_PROJECT_REGISTRATION_CALLER_ROUTE, MEMENTOS_PROJECT_REGISTRATION_ROUTE, MEMENTOS_PROJECT_REGISTRATION_SCHEMA_VERSION, MEMENTOS_PROJECT_GUARDED_UPDATE_ROUTE, MementosProjectRegistrationError, } from "./types.js";
7
- export type { MementosProjectRegistrationAuthority, MementosProjectRegistrationAuthorityOptions, MementosProjectRegistrationBounds, MementosProjectRegistrationCapability, MementosProjectRegistrationDirection, MementosProjectRegistrationErrorCode, MementosProjectRegistrationFaultPoint, MementosProjectRegistrationHttpClientOptions, MementosProjectRegistrationInverseVerification, MementosProjectRegistrationLookupRequest, MementosProjectRegistrationLookupResult, MementosProjectRegistrationOutcome, MementosProjectRegistrationPathHandle, MementosProjectRegistrationReceipt, MementosProjectRegistrationRecord, MementosProjectRegistrationRequest, MementosProjectRegistrationResourceKind, MementosProjectRegistrationResponseControl, } from "./types.js";
7
+ export type { MementosProjectGuardedRollbackRequest, MementosProjectGuardedUpdateReceipt, MementosProjectGuardedUpdateReceiptLookupRequest, MementosProjectGuardedUpdateReceiptLookupResult, MementosProjectGuardedUpdateRequest, MementosProjectGuardedUpdateResult, MementosProjectRegistrationAuthority, MementosProjectRegistrationAuthorityOptions, MementosProjectRegistrationBounds, MementosProjectRegistrationCapability, MementosProjectRegistrationDirection, MementosProjectRegistrationErrorCode, MementosProjectRegistrationFaultPoint, MementosProjectRegistrationHttpClientOptions, MementosProjectRegistrationInverseVerification, MementosProjectRegistrationLookupRequest, MementosProjectRegistrationLookupResult, MementosProjectRegistrationOutcome, MementosProjectRegistrationPathHandle, MementosProjectRegistrationReceipt, MementosProjectRegistrationRecord, MementosProjectRegistrationRequest, MementosProjectRegistrationResourceKind, MementosProjectRegistrationResponseControl, } from "./types.js";
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/project-registration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gDAAgD,EAChD,wCAAwC,EACxC,+CAA+C,EAC/C,0CAA0C,EAC1C,+CAA+C,EAC/C,sCAAsC,GACvC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,qCAAqC,EACrC,2CAA2C,EAC3C,4CAA4C,GAC7C,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,4CAA4C,EAC5C,6CAA6C,EAC7C,0CAA0C,EAC1C,2CAA2C,GAC5C,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mCAAmC,EACnC,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0CAA0C,EAC1C,mCAAmC,EACnC,4CAA4C,EAC5C,qCAAqC,EACrC,gCAAgC,GACjC,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,oCAAoC,EACpC,2CAA2C,EAC3C,iCAAiC,EACjC,qCAAqC,EACrC,oCAAoC,EACpC,oCAAoC,EACpC,qCAAqC,EACrC,4CAA4C,EAC5C,8CAA8C,EAC9C,wCAAwC,EACxC,uCAAuC,EACvC,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,EAClC,iCAAiC,EACjC,kCAAkC,EAClC,uCAAuC,EACvC,0CAA0C,GAC3C,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/project-registration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gDAAgD,EAChD,wCAAwC,EACxC,+CAA+C,EAC/C,0CAA0C,EAC1C,+CAA+C,EAC/C,sCAAsC,GACvC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,qCAAqC,EACrC,2CAA2C,EAC3C,4CAA4C,GAC7C,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,4CAA4C,EAC5C,6CAA6C,EAC7C,0CAA0C,EAC1C,2CAA2C,GAC5C,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mCAAmC,EACnC,4BAA4B,EAC5B,8BAA8B,GAC/B,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,8BAA8B,EAC9B,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,0CAA0C,EAC1C,mCAAmC,EACnC,4CAA4C,EAC5C,qCAAqC,EACrC,gCAAgC,GACjC,MAAM,YAAY,CAAC;AACpB,YAAY,EACV,qCAAqC,EACrC,mCAAmC,EACnC,gDAAgD,EAChD,+CAA+C,EAC/C,mCAAmC,EACnC,kCAAkC,EAClC,oCAAoC,EACpC,2CAA2C,EAC3C,iCAAiC,EACjC,qCAAqC,EACrC,oCAAoC,EACpC,oCAAoC,EACpC,qCAAqC,EACrC,4CAA4C,EAC5C,8CAA8C,EAC9C,wCAAwC,EACxC,uCAAuC,EACvC,kCAAkC,EAClC,qCAAqC,EACrC,kCAAkC,EAClC,iCAAiC,EACjC,kCAAkC,EAClC,uCAAuC,EACvC,0CAA0C,GAC3C,MAAM,YAAY,CAAC"}