@homespunapps/core 1.5.1 → 1.6.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.
package/dist/client.d.ts CHANGED
@@ -400,6 +400,22 @@ export declare class HomespunClient {
400
400
  * be removed — the relay refuses with a 409 conflict.
401
401
  */
402
402
  removeAppMember(appId: string, humanId: string): Promise<void>;
403
+ /**
404
+ * GET /v1/apps/:id/collections/:name/retention returns the collection's
405
+ * effective retention (the bounds in force), the author default, the raw owner
406
+ * override, and how many live rows those bounds would prune on the next sweep.
407
+ */
408
+ getCollectionRetention(appId: string, collection: string): Promise<CollectionRetentionView>;
409
+ /**
410
+ * PATCH /v1/apps/:id/collections/:name/retention sets or clears the owner
411
+ * retention override, per axis. A number sets that axis's override; `null`
412
+ * clears it (reverts to the author default); omit an axis to leave it
413
+ * unchanged. Returns the new effective retention plus the would-prune count.
414
+ */
415
+ setCollectionRetention(appId: string, collection: string, override: {
416
+ maxRows?: number | null;
417
+ maxAgeDays?: number | null;
418
+ }): Promise<CollectionRetentionView>;
403
419
  /**
404
420
  * GET /v1/apps/:id/ingest-hooks lists the app's inbound catch-hooks with the
405
421
  * full secret URL (decrypted server-side), the current rule metadata
@@ -825,6 +841,23 @@ export interface AppMember {
825
841
  * handshake) are null when the hook's rule has left the manifest (disabledAt
826
842
  * set). `deliveries` are per-status counts of the hook's inbound journal.
827
843
  */
844
+ /** One retention axis pair, either bound null when unset. */
845
+ export interface RetentionAxes {
846
+ maxRows: number | null;
847
+ maxAgeDays: number | null;
848
+ }
849
+ /**
850
+ * A collection's retention picture (issue #956): the EFFECTIVE bounds in force
851
+ * (per-axis `override ?? authorDefault`), the AUTHOR default declared in the
852
+ * manifest, the raw owner OVERRIDE, and `wouldPrune`, how many live rows the
853
+ * effective bounds would prune on the next sweep.
854
+ */
855
+ export interface CollectionRetentionView {
856
+ effective: RetentionAxes;
857
+ authorDefault: RetentionAxes;
858
+ override: RetentionAxes;
859
+ wouldPrune: number;
860
+ }
828
861
  export interface IngestHookInfo {
829
862
  name: string;
830
863
  url: string;
package/dist/client.js CHANGED
@@ -747,6 +747,36 @@ export class HomespunClient {
747
747
  this.fail(r);
748
748
  }
749
749
  // -------------------------------------------------------------------------
750
+ // Collection retention override (issue #956). The author declares default
751
+ // retention in the manifest; this lets the OWNER tighten or loosen it per
752
+ // collection at runtime, without a redeploy. Effective retention is per-axis
753
+ // `override ?? authorDefault`; clearing an axis (null) reverts it to the
754
+ // author default.
755
+ // -------------------------------------------------------------------------
756
+ /**
757
+ * GET /v1/apps/:id/collections/:name/retention returns the collection's
758
+ * effective retention (the bounds in force), the author default, the raw owner
759
+ * override, and how many live rows those bounds would prune on the next sweep.
760
+ */
761
+ async getCollectionRetention(appId, collection) {
762
+ const r = await this.call("GET", `/v1/apps/${encodeURIComponent(appId)}/collections/${encodeURIComponent(collection)}/retention`);
763
+ if (!r.ok)
764
+ this.fail(r);
765
+ return this.asObject(r);
766
+ }
767
+ /**
768
+ * PATCH /v1/apps/:id/collections/:name/retention sets or clears the owner
769
+ * retention override, per axis. A number sets that axis's override; `null`
770
+ * clears it (reverts to the author default); omit an axis to leave it
771
+ * unchanged. Returns the new effective retention plus the would-prune count.
772
+ */
773
+ async setCollectionRetention(appId, collection, override) {
774
+ const r = await this.call("PATCH", `/v1/apps/${encodeURIComponent(appId)}/collections/${encodeURIComponent(collection)}/retention`, override);
775
+ if (!r.ok)
776
+ this.fail(r);
777
+ return this.asObject(r);
778
+ }
779
+ // -------------------------------------------------------------------------
750
780
  // Inbound catch-hooks (inbound-webhooks PR 3). Read + rotate the smallest
751
781
  // surface an agent needs: list an app's declared hooks with their full secret
752
782
  // URL (so the agent can tell its owner the exact URL to paste into an external
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { HomespunClient, HomespunApiError } from "./client.js";
2
- export type { ClientOptions, RelayResponse, AttachmentRef, UploadBlobOptions, PresignBlobOptions, AttachmentTokenMintResponse, ListBlobsOptions, AttachmentTokenAuditEntry, AttachmentTokenListResponse, QueryResponse, AppAsset, DeployAppRequest, DeployAppResponse, RedeployAppRequest, RedeployAppResponse, DeployCheckRequest, DeployCheckResult, KeyMintResult, AppSummary, AppDetail, AppsPage, AppDomain, AppDomainDnsRecord, AppMember, AddAppMemberResult, AppRow, AppRowsPage, ListScalar, ListWhereCondition, ListSortSpec, BatchRowInput, BatchRowResult, BatchResult, BatchWriteOptions, AppFeedEntry, AppFeedPage, CommunitySetupStep, } from "./client.js";
2
+ export type { ClientOptions, RelayResponse, AttachmentRef, UploadBlobOptions, PresignBlobOptions, AttachmentTokenMintResponse, ListBlobsOptions, AttachmentTokenAuditEntry, AttachmentTokenListResponse, QueryResponse, AppAsset, DeployAppRequest, DeployAppResponse, RedeployAppRequest, RedeployAppResponse, DeployCheckRequest, DeployCheckResult, KeyMintResult, AppSummary, AppDetail, AppsPage, AppDomain, AppDomainDnsRecord, AppMember, AddAppMemberResult, AppRow, AppRowsPage, ListScalar, ListWhereCondition, ListSortSpec, BatchRowInput, BatchRowResult, BatchResult, BatchWriteOptions, AppFeedEntry, AppFeedPage, CommunitySetupStep, RetentionAxes, CollectionRetentionView, } from "./client.js";
3
3
  export { openStream } from "./stream.js";
4
4
  export type { OpenStreamOptions, StreamHandlers, StreamHandle, } from "./stream.js";
5
5
  export { openAppStream, appWsUrlFromAppUrl } from "./app-stream.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homespunapps/core",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "description": "Homespun relay client: typed HTTP + WebSocket operations against a Homespun relay. Framework-free.",
5
5
  "license": "MIT",
6
6
  "type": "module",