@sprigr/apps-app-sdk 0.12.0 → 0.13.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.
Files changed (2) hide show
  1. package/dist/index.d.ts +76 -1
  2. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -2379,6 +2379,12 @@ interface SprigrDataApi {
2379
2379
  * URL the upstream deletes after a short retention window) so the URL your
2380
2380
  * app hands back keeps resolving.
2381
2381
  *
2382
+ * Per-user storage (sprigr-team#9621): keys under the manifest's
2383
+ * `actor_scoped_storage_prefixes` are stored and resolved per CALLER by the
2384
+ * platform, from the signed actor the wrapper forwards on every call. Keep
2385
+ * using app-relative keys; never add your own owner tag. A call with no actor
2386
+ * may only `list` / `delete` there (maintenance), never read.
2387
+ *
2382
2388
  * This is the in-isolate bridge surface, injected on `env.SPRIGR` for
2383
2389
  * `/__sprigr/*` tool / webhook / event handlers. The standalone
2384
2390
  * `putAppFileStream` / `appFileUrl` helpers in this package call the same
@@ -2418,6 +2424,75 @@ interface SprigrFilesApi {
2418
2424
  expires_at: number;
2419
2425
  key: string;
2420
2426
  }>;
2427
+ /**
2428
+ * Buffered put of base64 bytes (cap 10 MB); prefer `putStream` for anything
2429
+ * large. Optional: absent on wrapper builds before sprigr-team#9621, so
2430
+ * feature-detect. Throws with `err.code` / `err.status` on a refusal.
2431
+ */
2432
+ put?(key: string, base64: string, opts?: {
2433
+ contentType?: string;
2434
+ filename?: string;
2435
+ }): Promise<{
2436
+ ok: boolean;
2437
+ key: string;
2438
+ bytes: number;
2439
+ contentType: string;
2440
+ }>;
2441
+ /** Read a stored object back as base64. Throws `err.code === 'not_found'`
2442
+ * (404) when absent. Optional: see `put`. */
2443
+ get?(key: string): Promise<{
2444
+ ok: boolean;
2445
+ key: string;
2446
+ base64: string;
2447
+ contentType: string;
2448
+ filename?: string;
2449
+ bytes: number;
2450
+ }>;
2451
+ /**
2452
+ * List stored keys under an app-relative prefix, 1000 per page; pass the
2453
+ * returned `cursor` for the next page. On a call with no actor (a schedule,
2454
+ * webhook or event handler), a prefix under `actor_scoped_storage_prefixes`
2455
+ * lists EVERY user's copies, each entry carrying an opaque `owner_ref`
2456
+ * (`owner_scope: 'all_owners'`); with `ownerless: true` it lists the copies
2457
+ * written there before the prefix was declared (`owner_scope: 'ownerless'`).
2458
+ * Optional: see `put`.
2459
+ */
2460
+ list?(prefix?: string, opts?: {
2461
+ cursor?: string;
2462
+ ownerless?: boolean;
2463
+ }): Promise<SprigrFilesListResult>;
2464
+ /**
2465
+ * Delete a stored key. On a call with no actor, a per-user key needs the
2466
+ * `owner_ref` (or `ownerless: true`) a maintenance `list` returned; on a call
2467
+ * made for a user both are ignored and that user's own copy is deleted.
2468
+ * Optional: see `put`.
2469
+ */
2470
+ delete?(key: string, opts?: {
2471
+ owner_ref?: string;
2472
+ ownerless?: boolean;
2473
+ }): Promise<{
2474
+ ok: boolean;
2475
+ key: string;
2476
+ }>;
2477
+ }
2478
+ /** One entry of `env.SPRIGR.files.list`. `owner_ref` / `ownerless` appear only
2479
+ * on a maintenance listing of a per-user prefix (sprigr-team#9621). */
2480
+ interface SprigrFilesListItem {
2481
+ key: string;
2482
+ bytes: number;
2483
+ uploaded?: string;
2484
+ filename?: string;
2485
+ contentType?: string;
2486
+ owner_ref?: string;
2487
+ ownerless?: boolean;
2488
+ }
2489
+ /** Result of `env.SPRIGR.files.list`. */
2490
+ interface SprigrFilesListResult {
2491
+ ok: boolean;
2492
+ files: SprigrFilesListItem[];
2493
+ truncated: boolean;
2494
+ cursor?: string;
2495
+ owner_scope?: 'all_owners' | 'ownerless';
2421
2496
  }
2422
2497
  /**
2423
2498
  * Platform document-engine bridge types (`env.SPRIGR.files.edit` / `.create`
@@ -2539,4 +2614,4 @@ interface ExecutionContextLike {
2539
2614
  }
2540
2615
  type HandlerFn<TArgs, TResult> = (args: TArgs, env: Record<string, unknown>, ctx?: ExecutionContextLike) => Promise<TResult>;
2541
2616
 
2542
- export { APPROVAL_GRANTED_KEY, type Actor, type AppApprovalEnvelope, type AppFileListItem, type AppFileUrlArgs, type AppFileUrlResult, type AppFilesEnv, type AppToolEffectsDeclaration, type AppUndoEnvelope, type ApplyPoliciesOptions, type ApprovalGateOptions, type ApprovalSpec, type ArchiveOfferOptions, type ArchiveOfferRefusal, type CaptureJournal, type ConfirmCondition, type ConfirmRule, type ConfirmationPolicy, type D1Like, type D1PreparedStatementLike, DATA_PARTIAL_UPDATE_PATH, DEFAULT_EMIT_TIMEOUT_MS, DEFAULT_LOG_TIMEOUT_MS, DEFAULT_MAX_FILE_BYTES, DEFAULT_MONEY_FIELDS, DEFAULT_WRITE_PREFIXES, type DerivePolicyOptions, type DerivedPolicy, type DispatcherApprovalGate, type DispatcherApprovalOptions, type EmitMarketplaceEventOptions, type EmitResult, type EmitTransport, type EventArgs, type ExecutionContextLike, type FetchFileResult, type FetchWithRetryOptions, type GetAppFileResult, type HandlerFn, type InboxOwner, type InstallBridge, InvalidUndoEnvelopeError, type JournalRowLike, type LogToPlatformOptions, type ManifestDispatchBlock, type ManifestLike, type ManifestToolLike, type MarketplaceEventEmitOpts, type MarketplaceEventSourceIntegration, NotConnectedError, type OAuthBouncerSignals, type OAuthState, type OfferUndoArgs, type PartialUpdateDataOptions, type PlatformHostEnv, type PolicyCheckInput, type PolicySource, type PutAppFileArgs, type PutAppFileResult, type PutAppFileStreamArgs, type RequireApprovalOptions, type ResolveViewerOptions, type RestoreResult, type RestoreSpec, SPRIGR_DATA_MAX_OBJECTS_PER_CALL, SPRIGR_LOG_LEVELS, SPRIGR_LOG_LIMITS, type ScheduleArgs, type SprigrDataAggregationCell, type SprigrDataAggregationResult, type SprigrDataAggregationSpec, type SprigrDataApi, type SprigrDataIndexOpts, type SprigrDataPartialUpdateBody, type SprigrDataPartialUpdateOpts, type SprigrDataPartialUpdateResult, type SprigrDataPatch, type SprigrDataSearchOpts, type SprigrDataSearchResult, SprigrDataValidationError, type SprigrFilesApi, type SprigrFilesApiWithEdit, type SprigrFilesCreateInput, type SprigrFilesCreateResult, type SprigrFilesEditInput, type SprigrFilesEditResult, type SprigrFilesJobResult, type SprigrLogEntry, type SprigrLogFn, type SprigrLogLevel, type SprigrLogResult, SprigrLogValidationError, type ToolArgs, type ToolHandler, type ToolResult, type ToolWrapperOptions, UNIT_SEP, type UndoApplyOptions, type UndoApplyResult, type UndoCaptureSpec, type UndoFidelity, VIEWER_ANONYMOUS, VIEWER_CONTEXT_HEADER, VIEWER_PLATFORM_USER_ID_HEADER, VIEWER_ROLE_HEADER, VIEWER_USER_ID_HEADER, type VerbRule, type ViewerContext, type ViewerContextFailure, type ViewerContextVerification, type ViewerEnv, type WebhookArgs, type WfpBridgeEnv, type WfpEmitReply, actorKey, actorTool, appFileUrl, applyConfirmationPolicies, approvalHash, archiveOfferRefusal, base64ToBytes, buildConfirmationPolicy, buildMarketplaceWebhookUrl, buildPartialUpdateBody, bytesToBase64, canEmit, canLog, canPartialUpdate, checkConfirmationPolicy, commonDestructiveVerbs, constantTimeEqual, createMarketplaceEmitter, createToolWrappers, decodeState, deleteAppFile, deriveConfirmationPolicy, describeMissingBridge, dispatcherApproval, emitMarketplaceEvent, encodeState, fetchFileAsBase64, fetchFileBytes, fetchWithRetry, fullWarning, getAppFile, hmacSha256Hex, installTokenPost, isNotConnectedError, isStagingHost, listAppFiles, logToPlatform, manifestIsFresh, offerUndo, overlaySprigr, ownerFromActorKey, parseActor, partialUpdateData, putAppFile, putAppFileStream, randomHex, recreatedWarning, refuseWithoutForce, requireApproval, resolveInstallBridge, resolveOAuthBouncerBase, resolveOAuthBouncerCallbackUrl, resolvePlatformWebhookBase, resolveViewerContext, resolveViewerUserId, runUndoApply, safeCapture, seq, serializeManifest, set, tool, undoEnvelope, validateLogEntries, validateLogEntry, verifyViewerToken, withSprigrEmitFallback, withSprigrLogFallback };
2617
+ export { APPROVAL_GRANTED_KEY, type Actor, type AppApprovalEnvelope, type AppFileListItem, type AppFileUrlArgs, type AppFileUrlResult, type AppFilesEnv, type AppToolEffectsDeclaration, type AppUndoEnvelope, type ApplyPoliciesOptions, type ApprovalGateOptions, type ApprovalSpec, type ArchiveOfferOptions, type ArchiveOfferRefusal, type CaptureJournal, type ConfirmCondition, type ConfirmRule, type ConfirmationPolicy, type D1Like, type D1PreparedStatementLike, DATA_PARTIAL_UPDATE_PATH, DEFAULT_EMIT_TIMEOUT_MS, DEFAULT_LOG_TIMEOUT_MS, DEFAULT_MAX_FILE_BYTES, DEFAULT_MONEY_FIELDS, DEFAULT_WRITE_PREFIXES, type DerivePolicyOptions, type DerivedPolicy, type DispatcherApprovalGate, type DispatcherApprovalOptions, type EmitMarketplaceEventOptions, type EmitResult, type EmitTransport, type EventArgs, type ExecutionContextLike, type FetchFileResult, type FetchWithRetryOptions, type GetAppFileResult, type HandlerFn, type InboxOwner, type InstallBridge, InvalidUndoEnvelopeError, type JournalRowLike, type LogToPlatformOptions, type ManifestDispatchBlock, type ManifestLike, type ManifestToolLike, type MarketplaceEventEmitOpts, type MarketplaceEventSourceIntegration, NotConnectedError, type OAuthBouncerSignals, type OAuthState, type OfferUndoArgs, type PartialUpdateDataOptions, type PlatformHostEnv, type PolicyCheckInput, type PolicySource, type PutAppFileArgs, type PutAppFileResult, type PutAppFileStreamArgs, type RequireApprovalOptions, type ResolveViewerOptions, type RestoreResult, type RestoreSpec, SPRIGR_DATA_MAX_OBJECTS_PER_CALL, SPRIGR_LOG_LEVELS, SPRIGR_LOG_LIMITS, type ScheduleArgs, type SprigrDataAggregationCell, type SprigrDataAggregationResult, type SprigrDataAggregationSpec, type SprigrDataApi, type SprigrDataIndexOpts, type SprigrDataPartialUpdateBody, type SprigrDataPartialUpdateOpts, type SprigrDataPartialUpdateResult, type SprigrDataPatch, type SprigrDataSearchOpts, type SprigrDataSearchResult, SprigrDataValidationError, type SprigrFilesApi, type SprigrFilesApiWithEdit, type SprigrFilesCreateInput, type SprigrFilesCreateResult, type SprigrFilesEditInput, type SprigrFilesEditResult, type SprigrFilesJobResult, type SprigrFilesListItem, type SprigrFilesListResult, type SprigrLogEntry, type SprigrLogFn, type SprigrLogLevel, type SprigrLogResult, SprigrLogValidationError, type ToolArgs, type ToolHandler, type ToolResult, type ToolWrapperOptions, UNIT_SEP, type UndoApplyOptions, type UndoApplyResult, type UndoCaptureSpec, type UndoFidelity, VIEWER_ANONYMOUS, VIEWER_CONTEXT_HEADER, VIEWER_PLATFORM_USER_ID_HEADER, VIEWER_ROLE_HEADER, VIEWER_USER_ID_HEADER, type VerbRule, type ViewerContext, type ViewerContextFailure, type ViewerContextVerification, type ViewerEnv, type WebhookArgs, type WfpBridgeEnv, type WfpEmitReply, actorKey, actorTool, appFileUrl, applyConfirmationPolicies, approvalHash, archiveOfferRefusal, base64ToBytes, buildConfirmationPolicy, buildMarketplaceWebhookUrl, buildPartialUpdateBody, bytesToBase64, canEmit, canLog, canPartialUpdate, checkConfirmationPolicy, commonDestructiveVerbs, constantTimeEqual, createMarketplaceEmitter, createToolWrappers, decodeState, deleteAppFile, deriveConfirmationPolicy, describeMissingBridge, dispatcherApproval, emitMarketplaceEvent, encodeState, fetchFileAsBase64, fetchFileBytes, fetchWithRetry, fullWarning, getAppFile, hmacSha256Hex, installTokenPost, isNotConnectedError, isStagingHost, listAppFiles, logToPlatform, manifestIsFresh, offerUndo, overlaySprigr, ownerFromActorKey, parseActor, partialUpdateData, putAppFile, putAppFileStream, randomHex, recreatedWarning, refuseWithoutForce, requireApproval, resolveInstallBridge, resolveOAuthBouncerBase, resolveOAuthBouncerCallbackUrl, resolvePlatformWebhookBase, resolveViewerContext, resolveViewerUserId, runUndoApply, safeCapture, seq, serializeManifest, set, tool, undoEnvelope, validateLogEntries, validateLogEntry, verifyViewerToken, withSprigrEmitFallback, withSprigrLogFallback };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprigr/apps-app-sdk",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",