@sprigr/apps-app-sdk 0.22.0 → 0.24.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/README.md +2 -0
- package/dist/index.d.ts +42 -1
- package/dist/index.js +33 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -80,6 +80,7 @@ export default {
|
|
|
80
80
|
- `fetchFileBytes` / `fetchFileAsBase64` / `bytesToBase64` / `base64ToBytes` — file byte helpers
|
|
81
81
|
- `readableStoredKey(appKey, downloadUrl)` / `agentFileKeyFromUrl` — turn the install-relative key your app stored a file under into the absolute key the platform's `read_file` tool opens (read off the signed URL `appFileUrl` minted). Return it as a tool's `file_key` so an agent can open the file. `appKeyFromCallerKey` / `callerKeyRefusal` go the other way, for a key an agent hands back to your tool (0.17.0)
|
|
82
82
|
- `readFileRef(env, { file_key } | { file_url }, { maxBytes })` / `resolveFileRef`: accept a file an agent hands your tool. `resolveFileRef` only validates (run it before an approval card): a key in this install's store in any form, or an https link on `files.sprigr.com` (a link into this install is read as its key; a company link must be signed and in this company; workspace keys, other installs and every other host are refused with a `FileRefError` whose message says what to pass instead). `readFileRef` then reads the bytes with a size cap, a 20 s time cap and no redirects; `openFileRef` does the same as a stream, for a large attachment passed on without buffering. `FILE_REF_SOURCES_HELP` is the agent-facing list of accepted sources, for a tool's input description (0.21.0)
|
|
83
|
+
- `getCompanyTimezone(env)`: the company's IANA zone from the platform's `COMPANY_TIMEZONE` binding, or `undefined` when the company has none or the value is not a zone `Intl` accepts. Never throws and never defaults; the app picks its own fallback (0.24.0)
|
|
83
84
|
|
|
84
85
|
Full platform semantics: [`docs/platform-reference.md`](../../docs/platform-reference.md).
|
|
85
86
|
|
|
@@ -95,6 +96,7 @@ Three platform tiers, and they are not substitutes for each other. Full guide: [
|
|
|
95
96
|
|
|
96
97
|
- `requireApproval(handlers, specs, opts)` wraps the named tools so each returns an `_approval` card instead of writing, then on the granted pass captures a before-image through the **pinned** connection and offers `_undo`. It resolves the connection inside itself, before the label lookup, the hash and the capture: a gate that sits outside the app's own pin names the wrong store, hashes the wrong store and captures the wrong store's copy. Register the result after the originals: `Object.assign(registry, requireApproval(registry, SPECS, opts))`.
|
|
97
98
|
- `dispatcherApproval(specs, opts)`: the same gate for a one-tool-many-actions dispatcher. Build it beside the action registry and call `gate.run(action, args, env, () => def.execute(state, parsed))` from the dispatcher; params are read from `opts.inputField` (default `input`), the action name is hashed in, and `pinEnv` may return a per-actor token state rather than the env.
|
|
99
|
+
- A spec with no `hash` binds the grant to its payload: every argument except the `keys` fields, the attestation flags and the gate's `connectionArgs` (e.g. `['store']`) goes into the hash canonically, so a tap on one payload cannot be spent on another (sprigr-apps#2605). See docs/write-protection.md.
|
|
98
100
|
- Every resolver on the gate is a **default, overridable per spec**: `ApprovalSpec.resolveConnection`, `.describeTarget` and `.stampConnection` win over the gate's for that spec alone. Reach for it when one app has two families of write that reach a connection differently (creates that POST under an account, deletes that address a global object id on a path carrying no account). One gate-level rule has to pick one of them, and for the other it prints a false connection on the card a person taps and mixes it into the grant hash. A spec that hits no connection returns `''`.
|
|
99
101
|
- `approvalHash(rawId, connection, ...parts)`, `set(values)`, `seq(values)`: a stable operation identity so a tap survives the model reordering a list or dropping an optional argument on the retry.
|
|
100
102
|
- `undoEnvelope({...})` throws on a blank field. The platform drops the whole envelope on a blank and mints nothing, silently.
|
package/dist/index.d.ts
CHANGED
|
@@ -1890,6 +1890,14 @@ interface ApprovalSpec<P = unknown, E = unknown> {
|
|
|
1890
1890
|
/**
|
|
1891
1891
|
* Extra identity parts beyond `rawId + connection`, e.g. a sorted tag set.
|
|
1892
1892
|
* Use `set()` / `seq()` from `approval-hash`. Never include `confirm`.
|
|
1893
|
+
*
|
|
1894
|
+
* Omitted, the wrapper appends a canonical form of every OTHER argument:
|
|
1895
|
+
* not the `keys` fields, not `confirm` / `_approval_granted`, and not the
|
|
1896
|
+
* gate's `connectionArgs` (sprigr-apps#2605). So a grant approved for one
|
|
1897
|
+
* payload cannot be spent on another; before, a hash-less refund hashed the
|
|
1898
|
+
* same for 10.00 and 250.00. Supply `hash` when that default is too strict
|
|
1899
|
+
* (an order-insensitive set, a free-text field the model rewords) or
|
|
1900
|
+
* `() => []` when the id and connection really are the whole operation.
|
|
1893
1901
|
*/
|
|
1894
1902
|
hash?: (args: ToolArgs) => Array<string | number | undefined | null>;
|
|
1895
1903
|
/**
|
|
@@ -1972,6 +1980,14 @@ interface ApprovalGateOptions<E, P = E> {
|
|
|
1972
1980
|
* `ApprovalSpec.resolveConnection`.
|
|
1973
1981
|
*/
|
|
1974
1982
|
resolveConnection: (env: E, args: ToolArgs) => Promise<string>;
|
|
1983
|
+
/**
|
|
1984
|
+
* Argument names that only CHOOSE the connection (e.g. `['store']`). They
|
|
1985
|
+
* are left out of the default payload hash (see `ApprovalSpec.hash`)
|
|
1986
|
+
* because the connection is already in the hash in its RESOLVED form, and
|
|
1987
|
+
* the model usually omits the raw argument on the retry. Omit for a
|
|
1988
|
+
* single-connection app.
|
|
1989
|
+
*/
|
|
1990
|
+
connectionArgs?: string[];
|
|
1975
1991
|
/**
|
|
1976
1992
|
* Re-pin to a resolved connection so lookups and captures hit it. Omit when
|
|
1977
1993
|
* `P` is `E` and the env needs no pin (a single-connection app).
|
|
@@ -2908,6 +2924,31 @@ declare function purgeIndexByPrefix(env: WfpBridgeEnv, prefixes: readonly IdPref
|
|
|
2908
2924
|
chunk?: number;
|
|
2909
2925
|
}): Promise<PurgeResult>;
|
|
2910
2926
|
|
|
2927
|
+
/**
|
|
2928
|
+
* The install's company, as the platform binds it (sprigr-team#11006).
|
|
2929
|
+
*
|
|
2930
|
+
* `COMPANY_TIMEZONE` is a plain_text binding stamped at upload
|
|
2931
|
+
* (sprigr-team#11038): the company's IANA zone, so an app can compute the
|
|
2932
|
+
* tenant's "today" or a local cut-off without guessing. The platform binds it
|
|
2933
|
+
* only when the company has a valid zone, and never a default, so an install
|
|
2934
|
+
* whose company has none simply has no binding. A value written before a
|
|
2935
|
+
* zone change stays until the install's next build.
|
|
2936
|
+
*/
|
|
2937
|
+
/** The env slice this module reads. Optional: older installs lack it. */
|
|
2938
|
+
interface CompanyTimezoneEnv {
|
|
2939
|
+
COMPANY_TIMEZONE?: string;
|
|
2940
|
+
}
|
|
2941
|
+
/**
|
|
2942
|
+
* The company's IANA zone, or `undefined` when there is none.
|
|
2943
|
+
*
|
|
2944
|
+
* Returns the bound value (trimmed) only when `Intl` accepts it as a time
|
|
2945
|
+
* zone, so the result can be handed straight to `Intl.DateTimeFormat`. Never
|
|
2946
|
+
* throws and never invents a zone: `undefined` means "the platform does not
|
|
2947
|
+
* know", and the app decides its own fallback (a per-user zone, UTC, or
|
|
2948
|
+
* asking).
|
|
2949
|
+
*/
|
|
2950
|
+
declare function getCompanyTimezone(env: CompanyTimezoneEnv | null | undefined): string | undefined;
|
|
2951
|
+
|
|
2911
2952
|
/**
|
|
2912
2953
|
* @sprigr/apps-app-sdk
|
|
2913
2954
|
*
|
|
@@ -3482,4 +3523,4 @@ interface ExecutionContextLike {
|
|
|
3482
3523
|
}
|
|
3483
3524
|
type HandlerFn<TArgs, TResult> = (args: TArgs, env: Record<string, unknown>, ctx?: ExecutionContextLike) => Promise<TResult>;
|
|
3484
3525
|
|
|
3485
|
-
export { ACTOR_RETIRED_HOOK_TOOL, ACTOR_RETIRE_REASONS, APPROVAL_GRANTED_KEY, APPROVAL_PREVIEW_MAX, APP_FILES_ROOT, APP_OWNER_SEGMENT, type Actor, type ActorRetireReason, type ActorRetired, type ActorRetiredHookBody, type ActorRetiredResult, type AppApprovalEnvelope, type AppFileListItem, type AppFileUrlArgs, type AppFileUrlResult, type AppFilesEnv, type AppToolEffectsDeclaration, type AppUndoEnvelope, type ApplyPoliciesOptions, type ApprovalCoverage, type ApprovalGateOptions, type ApprovalSpec, type ArchiveOfferOptions, type ArchiveOfferRefusal, type CallerKeyResolution, type CaptureJournal, type ConfirmCondition, type ConfirmRule, type ConfirmationPolicy, type ConnectCompleteRequest, type ConnectCompleteResult, type D1Like, type D1PreparedStatementLike, DATA_DELETE_MAX_IDS, DATA_PARTIAL_UPDATE_PATH, DEFAULT_EMIT_TIMEOUT_MS, DEFAULT_FILE_READ_TIMEOUT_MS, DEFAULT_LOG_TIMEOUT_MS, DEFAULT_MAX_FILE_BYTES, DEFAULT_MONEY_FIELDS, DEFAULT_WRITE_PREFIXES, type DataClient, type DataIdsOpts, type DataListIdsResult, type DataTransport, type DerivePolicyOptions, type DerivedPolicy, type DispatcherApprovalGate, type DispatcherApprovalOptions, type EmitMarketplaceEventOptions, type EmitResult, type EmitTransport, type EventArgs, type ExecutionContextLike, FILE_REF_SOURCES_HELP, type FetchFileResult, type FetchWithRetryOptions, type FileRef, type FileRefContent, type FileRefEnv, FileRefError, type FileRefErrorCode, type FileRefStream, type FileRefVia, type GetAppFileResult, type HandlerFn, INBOX_SEND_CONTRACT_V1, type IdPrefixSpec, type IdSnapshot, type InboxAddress, type InboxAppendRequest, type InboxAppendResult, type InboxChannelDeclaration, type InboxFoldersRequest, type InboxFoldersResult, type InboxOwner, type InboxSendConnection, type InboxSendHandlerImpl, InboxSendRefusal, type InboxSendSupports, type InboxSendV1Args, type InboxSendV1Result, 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 PurgeResult, type PutAppFileArgs, type PutAppFileResult, type PutAppFileStreamArgs, type ReadFileRefOptions, type RequireApprovalOptions, type ResolveFileRefOptions, type ResolveViewerOptions, type ResolvedFileRef, type RestoreResult, type RestoreSpec, SPRIGR_DATA_MAX_OBJECTS_PER_CALL, SPRIGR_FILE_HOSTS, SPRIGR_LOG_LEVELS, SPRIGR_LOG_LIMITS, type ScheduleArgs, type SprigrDataAggregationCell, type SprigrDataAggregationResult, type SprigrDataAggregationSpec, type SprigrDataApi, type SprigrDataImportOpts, 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 SprigrInboxApi, type SprigrLogEntry, type SprigrLogFn, type SprigrLogLevel, type SprigrLogResult, SprigrLogValidationError, type SyncedAttachment, type SyncedMessage, 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, WORKSPACE_FILE_HOW_TO, type WebhookArgs, type WfpBridgeEnv, type WfpEmitReply, actorKey, actorRetiredHook, actorTool, agentFileKeyFromUrl, appFileUrl, appKeyFromCallerKey, applyConfirmationPolicies, approvalHash, approvalPreview, approvalRecipients, archiveOfferRefusal, attendedFindings, base64ToBytes, buildConfirmationPolicy, buildMarketplaceWebhookUrl, buildPartialUpdateBody, bytesToBase64, callerKeyRefusal, canEmit, canLog, canPartialUpdate, checkConfirmationPolicy, commonDestructiveVerbs, connectComplete, connectDisconnect, constantTimeEqual, createMarketplaceEmitter, createToolWrappers, decodeState, defineInboxSendHandler, deleteAppFile, deleteSnapshotIds, deriveConfirmationPolicy, describeMissingBridge, dispatcherApproval, emitMarketplaceEvent, encodeState, fetchFileAsBase64, fetchFileBytes, fetchWithRetry, fullWarning, getAppFile, hmacSha256Hex, installTokenPost, isNotConnectedError, isStagingHost, listAppFiles, logToPlatform, makeDataClient, manifestIsFresh, offerUndo, openFileRef, overlaySprigr, ownerFromActorKey, parseActor, parseActorRetiredArgs, partialUpdateData, purgeIndexByPrefix, putAppFile, putAppFileStream, randomHex, readFileRef, readableStoredKey, recreatedWarning, refuseWithoutForce, requireApproval, resolveFileRef, resolveInstallBridge, resolveOAuthBouncerBase, resolveOAuthBouncerCallbackUrl, resolvePlatformWebhookBase, resolveViewerContext, resolveViewerUserId, runUndoApply, safeCapture, seq, serializeManifest, set, snapshotIndexIds, tool, undoEnvelope, validateLogEntries, validateLogEntry, verifyViewerToken, withSprigrEmitFallback, withSprigrInboxFallback, withSprigrLogFallback };
|
|
3526
|
+
export { ACTOR_RETIRED_HOOK_TOOL, ACTOR_RETIRE_REASONS, APPROVAL_GRANTED_KEY, APPROVAL_PREVIEW_MAX, APP_FILES_ROOT, APP_OWNER_SEGMENT, type Actor, type ActorRetireReason, type ActorRetired, type ActorRetiredHookBody, type ActorRetiredResult, type AppApprovalEnvelope, type AppFileListItem, type AppFileUrlArgs, type AppFileUrlResult, type AppFilesEnv, type AppToolEffectsDeclaration, type AppUndoEnvelope, type ApplyPoliciesOptions, type ApprovalCoverage, type ApprovalGateOptions, type ApprovalSpec, type ArchiveOfferOptions, type ArchiveOfferRefusal, type CallerKeyResolution, type CaptureJournal, type CompanyTimezoneEnv, type ConfirmCondition, type ConfirmRule, type ConfirmationPolicy, type ConnectCompleteRequest, type ConnectCompleteResult, type D1Like, type D1PreparedStatementLike, DATA_DELETE_MAX_IDS, DATA_PARTIAL_UPDATE_PATH, DEFAULT_EMIT_TIMEOUT_MS, DEFAULT_FILE_READ_TIMEOUT_MS, DEFAULT_LOG_TIMEOUT_MS, DEFAULT_MAX_FILE_BYTES, DEFAULT_MONEY_FIELDS, DEFAULT_WRITE_PREFIXES, type DataClient, type DataIdsOpts, type DataListIdsResult, type DataTransport, type DerivePolicyOptions, type DerivedPolicy, type DispatcherApprovalGate, type DispatcherApprovalOptions, type EmitMarketplaceEventOptions, type EmitResult, type EmitTransport, type EventArgs, type ExecutionContextLike, FILE_REF_SOURCES_HELP, type FetchFileResult, type FetchWithRetryOptions, type FileRef, type FileRefContent, type FileRefEnv, FileRefError, type FileRefErrorCode, type FileRefStream, type FileRefVia, type GetAppFileResult, type HandlerFn, INBOX_SEND_CONTRACT_V1, type IdPrefixSpec, type IdSnapshot, type InboxAddress, type InboxAppendRequest, type InboxAppendResult, type InboxChannelDeclaration, type InboxFoldersRequest, type InboxFoldersResult, type InboxOwner, type InboxSendConnection, type InboxSendHandlerImpl, InboxSendRefusal, type InboxSendSupports, type InboxSendV1Args, type InboxSendV1Result, 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 PurgeResult, type PutAppFileArgs, type PutAppFileResult, type PutAppFileStreamArgs, type ReadFileRefOptions, type RequireApprovalOptions, type ResolveFileRefOptions, type ResolveViewerOptions, type ResolvedFileRef, type RestoreResult, type RestoreSpec, SPRIGR_DATA_MAX_OBJECTS_PER_CALL, SPRIGR_FILE_HOSTS, SPRIGR_LOG_LEVELS, SPRIGR_LOG_LIMITS, type ScheduleArgs, type SprigrDataAggregationCell, type SprigrDataAggregationResult, type SprigrDataAggregationSpec, type SprigrDataApi, type SprigrDataImportOpts, 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 SprigrInboxApi, type SprigrLogEntry, type SprigrLogFn, type SprigrLogLevel, type SprigrLogResult, SprigrLogValidationError, type SyncedAttachment, type SyncedMessage, 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, WORKSPACE_FILE_HOW_TO, type WebhookArgs, type WfpBridgeEnv, type WfpEmitReply, actorKey, actorRetiredHook, actorTool, agentFileKeyFromUrl, appFileUrl, appKeyFromCallerKey, applyConfirmationPolicies, approvalHash, approvalPreview, approvalRecipients, archiveOfferRefusal, attendedFindings, base64ToBytes, buildConfirmationPolicy, buildMarketplaceWebhookUrl, buildPartialUpdateBody, bytesToBase64, callerKeyRefusal, canEmit, canLog, canPartialUpdate, checkConfirmationPolicy, commonDestructiveVerbs, connectComplete, connectDisconnect, constantTimeEqual, createMarketplaceEmitter, createToolWrappers, decodeState, defineInboxSendHandler, deleteAppFile, deleteSnapshotIds, deriveConfirmationPolicy, describeMissingBridge, dispatcherApproval, emitMarketplaceEvent, encodeState, fetchFileAsBase64, fetchFileBytes, fetchWithRetry, fullWarning, getAppFile, getCompanyTimezone, hmacSha256Hex, installTokenPost, isNotConnectedError, isStagingHost, listAppFiles, logToPlatform, makeDataClient, manifestIsFresh, offerUndo, openFileRef, overlaySprigr, ownerFromActorKey, parseActor, parseActorRetiredArgs, partialUpdateData, purgeIndexByPrefix, putAppFile, putAppFileStream, randomHex, readFileRef, readableStoredKey, recreatedWarning, refuseWithoutForce, requireApproval, resolveFileRef, resolveInstallBridge, resolveOAuthBouncerBase, resolveOAuthBouncerCallbackUrl, resolvePlatformWebhookBase, resolveViewerContext, resolveViewerUserId, runUndoApply, safeCapture, seq, serializeManifest, set, snapshotIndexIds, tool, undoEnvelope, validateLogEntries, validateLogEntry, verifyViewerToken, withSprigrEmitFallback, withSprigrInboxFallback, withSprigrLogFallback };
|
package/dist/index.js
CHANGED
|
@@ -1470,6 +1470,23 @@ async function offerUndo(args) {
|
|
|
1470
1470
|
}
|
|
1471
1471
|
|
|
1472
1472
|
// src/write-protection/require-approval.ts
|
|
1473
|
+
var ATTESTATION_KEYS = ["confirm", APPROVAL_GRANTED_KEY];
|
|
1474
|
+
function canonicalJson(value) {
|
|
1475
|
+
if (Array.isArray(value)) return `[${value.map(canonicalJson).join(",")}]`;
|
|
1476
|
+
if (value && typeof value === "object") {
|
|
1477
|
+
const entries = Object.keys(value).filter((k) => value[k] !== void 0).sort().map((k) => `${JSON.stringify(k)}:${canonicalJson(value[k])}`);
|
|
1478
|
+
return `{${entries.join(",")}}`;
|
|
1479
|
+
}
|
|
1480
|
+
return JSON.stringify(value ?? null);
|
|
1481
|
+
}
|
|
1482
|
+
function defaultPayloadParts(params, keys, connectionArgs = []) {
|
|
1483
|
+
const skip = /* @__PURE__ */ new Set([...keys, ...ATTESTATION_KEYS, ...connectionArgs]);
|
|
1484
|
+
const rest = {};
|
|
1485
|
+
for (const [k, v] of Object.entries(params)) {
|
|
1486
|
+
if (!skip.has(k) && v !== void 0) rest[k] = v;
|
|
1487
|
+
}
|
|
1488
|
+
return Object.keys(rest).length ? [canonicalJson(rest)] : [];
|
|
1489
|
+
}
|
|
1473
1490
|
function rawIdOf(args, keys) {
|
|
1474
1491
|
for (const k of keys) {
|
|
1475
1492
|
const v = args[k];
|
|
@@ -1509,7 +1526,7 @@ async function askPass(name, spec, params, env, opts, hashPrefix) {
|
|
|
1509
1526
|
const pinned = await pin(opts, env, connection);
|
|
1510
1527
|
const describeTarget = spec.describeTarget ?? opts.describeTarget;
|
|
1511
1528
|
const target = rawId && describeTarget ? await safeLabel(describeTarget, pinned, rawId, name) : rawId || "(unknown id)";
|
|
1512
|
-
const extra = spec.hash ? spec.hash(params) :
|
|
1529
|
+
const extra = spec.hash ? spec.hash(params) : defaultPayloadParts(params, spec.keys, opts.connectionArgs);
|
|
1513
1530
|
const count = countOf(spec, params, rawId);
|
|
1514
1531
|
return {
|
|
1515
1532
|
ok: false,
|
|
@@ -2177,6 +2194,20 @@ async function deleteSnapshotIds(env, snapshot, opts) {
|
|
|
2177
2194
|
async function purgeIndexByPrefix(env, prefixes, opts) {
|
|
2178
2195
|
return deleteSnapshotIds(env, await snapshotIndexIds(env, prefixes), opts);
|
|
2179
2196
|
}
|
|
2197
|
+
|
|
2198
|
+
// src/company.ts
|
|
2199
|
+
function getCompanyTimezone(env) {
|
|
2200
|
+
const raw = env?.COMPANY_TIMEZONE;
|
|
2201
|
+
if (typeof raw !== "string") return void 0;
|
|
2202
|
+
const zone = raw.trim();
|
|
2203
|
+
if (!zone) return void 0;
|
|
2204
|
+
try {
|
|
2205
|
+
new Intl.DateTimeFormat("en-US", { timeZone: zone });
|
|
2206
|
+
return zone;
|
|
2207
|
+
} catch {
|
|
2208
|
+
return void 0;
|
|
2209
|
+
}
|
|
2210
|
+
}
|
|
2180
2211
|
export {
|
|
2181
2212
|
ACTOR_RETIRED_HOOK_TOOL,
|
|
2182
2213
|
ACTOR_RETIRE_REASONS,
|
|
@@ -2253,6 +2284,7 @@ export {
|
|
|
2253
2284
|
fetchWithRetry,
|
|
2254
2285
|
fullWarning,
|
|
2255
2286
|
getAppFile,
|
|
2287
|
+
getCompanyTimezone,
|
|
2256
2288
|
hmacSha256Hex,
|
|
2257
2289
|
installTokenPost,
|
|
2258
2290
|
isNotConnectedError,
|