@apicircle/core 1.0.8 → 1.1.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 +4 -4
- package/dist/{chunk-L5DQT7V6.js → chunk-T6A4ICRL.js} +5 -5
- package/dist/chunk-T6A4ICRL.js.map +1 -0
- package/dist/index.cjs +995 -87
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +219 -8
- package/dist/index.d.ts +219 -8
- package/dist/index.js +965 -77
- package/dist/index.js.map +1 -1
- package/dist/{patches-ysO3y8pG.d.cts → patches-B3VGNVgf.d.cts} +74 -1
- package/dist/{patches-ysO3y8pG.d.ts → patches-B3VGNVgf.d.ts} +74 -1
- package/dist/workspace/file-backed.cjs +4 -4
- package/dist/workspace/file-backed.cjs.map +1 -1
- package/dist/workspace/file-backed.d.cts +5 -1
- package/dist/workspace/file-backed.d.ts +5 -1
- package/dist/workspace/file-backed.js +1 -1
- package/dist/workspace/registry.cjs +13 -33
- package/dist/workspace/registry.cjs.map +1 -1
- package/dist/workspace/registry.d.cts +13 -26
- package/dist/workspace/registry.d.ts +13 -26
- package/dist/workspace/registry.js +9 -30
- package/dist/workspace/registry.js.map +1 -1
- package/package.json +3 -2
- package/dist/chunk-L5DQT7V6.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BodyType, RequestAuth, Request,
|
|
2
|
-
import { W as WorkspaceState, a as WorkspacePatch, P as ParsedApicircleFolderExport } from './patches-
|
|
3
|
-
export { A as APICIRCLE_FOLDER_EXPORT_FORMAT, b as ApicircleFolderExportDependencies, c as ApicircleFolderExportV1, C as CollectFolderExportArgs, d as CollectFolderExportResult, F as FolderExportCredential, e as FolderExportReport, f as WorkspacePatchKind, g as collectFolderExport, h as collectFolderExportCredentials, i as isApicircleFolderExport, p as parseApicircleFolderExport, j as parseApicircleFolderExportDoc, r as redactFolderExportCredentials, s as serializeFolderExport, k as suggestFolderExportFilename } from './patches-
|
|
1
|
+
import { BodyType, RequestAuth, Request, Folder, RequestRun, RequestBody, HttpMethod, EnvironmentVariable, Assertion, ContextExtraction, WorkspaceSynced, EnvPriorityRef, ReleaseVersion, ReleaseHistory, SecretKeyMeta, LinkedWorkspace, LinkedSnapshot, RequestOverridePatch, RequestOverride, EnvironmentVariableOverride, ExecutionPlan, PlanRun } from '@apicircle/shared';
|
|
2
|
+
import { W as WorkspaceState, a as WorkspacePatch, P as ParsedApicircleFolderExport } from './patches-B3VGNVgf.cjs';
|
|
3
|
+
export { A as APICIRCLE_FOLDER_EXPORT_FORMAT, b as ApicircleFolderExportDependencies, c as ApicircleFolderExportV1, C as CollectFolderExportArgs, d as CollectFolderExportResult, F as FolderExportCredential, e as FolderExportReport, f as WorkspacePatchKind, g as collectFolderExport, h as collectFolderExportCredentials, i as isApicircleFolderExport, p as parseApicircleFolderExport, j as parseApicircleFolderExportDoc, r as redactFolderExportCredentials, s as serializeFolderExport, k as suggestFolderExportFilename } from './patches-B3VGNVgf.cjs';
|
|
4
4
|
|
|
5
5
|
type HeaderEntry$1 = {
|
|
6
6
|
key: string;
|
|
@@ -389,8 +389,18 @@ interface PreSendValidationResult {
|
|
|
389
389
|
interface PreSendValidationInput {
|
|
390
390
|
request: Request;
|
|
391
391
|
scope: ResolutionScope;
|
|
392
|
+
/**
|
|
393
|
+
* Folder map keyed by id. When provided AND the request's `auth.type` is
|
|
394
|
+
* `inherit`, the validator resolves the upward chain via
|
|
395
|
+
* `resolveInheritedAuth` and validates the EFFECTIVE auth's field
|
|
396
|
+
* completeness — so an empty-token folder bearer doesn't slip past the
|
|
397
|
+
* pre-send check. Omit for callers that don't have folder context (legacy
|
|
398
|
+
* tests, ad-hoc plan steps), and the validator falls back to checking the
|
|
399
|
+
* declared auth as-is.
|
|
400
|
+
*/
|
|
401
|
+
folders?: Record<string, Folder>;
|
|
392
402
|
}
|
|
393
|
-
declare function preSendValidation({ request, scope, }: PreSendValidationInput): PreSendValidationResult;
|
|
403
|
+
declare function preSendValidation({ request, scope, folders, }: PreSendValidationInput): PreSendValidationResult;
|
|
394
404
|
|
|
395
405
|
interface ExecutionResult {
|
|
396
406
|
startedAt: string;
|
|
@@ -1140,6 +1150,15 @@ interface ImportedFolder {
|
|
|
1140
1150
|
/** Index path from root (deterministic id assignment is the caller's job). */
|
|
1141
1151
|
pathIds: number[];
|
|
1142
1152
|
parentPathIds: number[] | null;
|
|
1153
|
+
/**
|
|
1154
|
+
* Folder-level auth captured from the source. Postman v2.1 folders can
|
|
1155
|
+
* carry an `auth` field that descendant requests inherit; Insomnia
|
|
1156
|
+
* request_group resources expose the same via `authentication`. When
|
|
1157
|
+
* present, the importer maps it to `Folder.auth` and descendant requests
|
|
1158
|
+
* with no explicit auth resolve via `resolveInheritedAuth` instead of
|
|
1159
|
+
* being wired to a duplicate copy.
|
|
1160
|
+
*/
|
|
1161
|
+
auth?: RequestAuth;
|
|
1143
1162
|
}
|
|
1144
1163
|
interface ParsedPostmanCollection {
|
|
1145
1164
|
collectionName: string;
|
|
@@ -1289,6 +1308,51 @@ interface ContextExtractionResult {
|
|
|
1289
1308
|
}
|
|
1290
1309
|
declare function extractContext(result: ExecutionResult, extractions: ReadonlyArray<ContextExtraction>): ContextExtractionResult;
|
|
1291
1310
|
|
|
1311
|
+
interface ResolveRequestArgs {
|
|
1312
|
+
request: Request;
|
|
1313
|
+
synced: WorkspaceSynced;
|
|
1314
|
+
/** Plaintext local envs: `{ envName: { varKey: value } }`. */
|
|
1315
|
+
localEnvs: Record<string, Record<string, string>>;
|
|
1316
|
+
/**
|
|
1317
|
+
* Plaintext linked envs keyed by linkedWorkspaceId, then envName. Caller
|
|
1318
|
+
* is expected to have already applied any linkedOverrides.environmentVars
|
|
1319
|
+
* (use `applyLinkedEnvironmentOverrides` from this module first).
|
|
1320
|
+
*/
|
|
1321
|
+
linkedEnvs?: Record<string, Record<string, Record<string, string>>>;
|
|
1322
|
+
/** Plaintext secrets keyed by their display label (vault-decrypted). */
|
|
1323
|
+
secrets?: Record<string, string>;
|
|
1324
|
+
/**
|
|
1325
|
+
* `globalContext` (latest-write-wins extractions) + plan variables
|
|
1326
|
+
* (optional) — sit between request.contextVars and the env layer.
|
|
1327
|
+
*/
|
|
1328
|
+
globalContext?: Record<string, string>;
|
|
1329
|
+
planVariables?: ReadonlyArray<{
|
|
1330
|
+
key: string;
|
|
1331
|
+
value: string;
|
|
1332
|
+
}>;
|
|
1333
|
+
/** Plan-level priority overrides take precedence when non-empty. */
|
|
1334
|
+
envPriorityOverride?: readonly EnvPriorityRef[];
|
|
1335
|
+
}
|
|
1336
|
+
interface ResolvedRequestResult {
|
|
1337
|
+
request: Request;
|
|
1338
|
+
scope: ResolutionScope;
|
|
1339
|
+
missing: string[];
|
|
1340
|
+
}
|
|
1341
|
+
declare function resolveRequestForExecution(args: ResolveRequestArgs): ResolvedRequestResult;
|
|
1342
|
+
/**
|
|
1343
|
+
* Layer `synced.linkedOverrides.environmentVars` entries onto a source env
|
|
1344
|
+
* map for one linked workspace. Used by the host to prepare the plaintext
|
|
1345
|
+
* `linkedEnvs` argument before calling `resolveRequestForExecution`.
|
|
1346
|
+
*/
|
|
1347
|
+
declare function applyLinkedEnvironmentOverrides(source: WorkspaceSynced['environments'], linkedWorkspaceId: string, synced: WorkspaceSynced): WorkspaceSynced['environments'];
|
|
1348
|
+
/**
|
|
1349
|
+
* Strip an envs map down to its plaintext key→value pairs, dropping any
|
|
1350
|
+
* variable still marked `encrypted: true` (the host's vault layer should have
|
|
1351
|
+
* decrypted those in advance). Returns the plaintext map the resolver
|
|
1352
|
+
* consumes.
|
|
1353
|
+
*/
|
|
1354
|
+
declare function plaintextEnvMap(source: WorkspaceSynced['environments']): Record<string, Record<string, string>>;
|
|
1355
|
+
|
|
1292
1356
|
interface EncryptedPayload {
|
|
1293
1357
|
iv: string;
|
|
1294
1358
|
ciphertext: string;
|
|
@@ -1335,6 +1399,47 @@ declare function importKey(jwk: JsonWebKey): Promise<CryptoKey>;
|
|
|
1335
1399
|
declare function serializePayload(payload: EncryptedPayload): string;
|
|
1336
1400
|
declare function tryParsePayload(value: string): EncryptedPayload | null;
|
|
1337
1401
|
|
|
1402
|
+
interface SecretCrypto {
|
|
1403
|
+
kdf: 'pbkdf2-sha256-v1';
|
|
1404
|
+
/** Base64-encoded random salt; 16 bytes. */
|
|
1405
|
+
salt: string;
|
|
1406
|
+
/** PBKDF2 iteration count baked at workspace-creation time. */
|
|
1407
|
+
iterations: number;
|
|
1408
|
+
/** Base64-encoded AES-GCM(sentinel, derivedKey, zero-IV). */
|
|
1409
|
+
verifier: string;
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Initialise the workspace's secret crypto state. Called the first time
|
|
1413
|
+
* the user creates a passphrase (new workspace or first secret added in
|
|
1414
|
+
* a workspace that hasn't set one).
|
|
1415
|
+
*
|
|
1416
|
+
* Returns the SecretCrypto blob to persist in workspace.json **and** the
|
|
1417
|
+
* derived key so the caller can immediately use it.
|
|
1418
|
+
*
|
|
1419
|
+
* The `iterations` override exists for tests — production callers should
|
|
1420
|
+
* always use the default `PBKDF2_ITERATIONS` (OWASP floor). Tests pin a
|
|
1421
|
+
* smaller count so the suite stays fast under parallel load; the
|
|
1422
|
+
* algorithm path is identical either way.
|
|
1423
|
+
*/
|
|
1424
|
+
declare function initSecretCrypto(passphrase: string, iterations?: number): Promise<{
|
|
1425
|
+
crypto: SecretCrypto;
|
|
1426
|
+
key: CryptoKey;
|
|
1427
|
+
}>;
|
|
1428
|
+
/**
|
|
1429
|
+
* Unlock the workspace given a passphrase + the stored SecretCrypto blob.
|
|
1430
|
+
*
|
|
1431
|
+
* Returns `{ ok: true, key }` on a successful passphrase match (verifier
|
|
1432
|
+
* matches), `{ ok: false }` on any mismatch — wrong passphrase, corrupt
|
|
1433
|
+
* blob, unsupported KDF. The caller surfaces the right UX for each.
|
|
1434
|
+
*/
|
|
1435
|
+
declare function unlockSecretCrypto(passphrase: string, blob: SecretCrypto): Promise<{
|
|
1436
|
+
ok: true;
|
|
1437
|
+
key: CryptoKey;
|
|
1438
|
+
} | {
|
|
1439
|
+
ok: false;
|
|
1440
|
+
reason: string;
|
|
1441
|
+
}>;
|
|
1442
|
+
|
|
1338
1443
|
/**
|
|
1339
1444
|
* Validate a branch name against GitHub's ref rules. Returns null when the
|
|
1340
1445
|
* name is acceptable, otherwise a short reason. We enforce a stricter
|
|
@@ -1360,6 +1465,43 @@ declare function generateWorkingBranchName(opts: BranchNameOptions): string;
|
|
|
1360
1465
|
*/
|
|
1361
1466
|
declare function serializeWorkspaceForGit(synced: WorkspaceSynced): string;
|
|
1362
1467
|
|
|
1468
|
+
/** The dotfolder under the repo root that owns every API-Circle-managed
|
|
1469
|
+
* file in a Git-backed workspace. */
|
|
1470
|
+
declare const WORKSPACE_DIR = ".apicircle";
|
|
1471
|
+
/** Path to the workspace registry inside a repo / root. */
|
|
1472
|
+
declare const REGISTRY_JSON_PATH = ".apicircle/registry.json";
|
|
1473
|
+
/** On-disk path for the synced workspace document inside a Git repo. */
|
|
1474
|
+
declare function workspaceJsonPath(workspaceId: string): string;
|
|
1475
|
+
/** Directory holding per-attachment blob files (`<slotId>`). */
|
|
1476
|
+
declare function attachmentsDir(workspaceId: string): string;
|
|
1477
|
+
/** Build the on-disk path for a single attachment slot. Caller is
|
|
1478
|
+
* responsible for URL-encoding when this is passed to the GitHub
|
|
1479
|
+
* Contents API. */
|
|
1480
|
+
declare function attachmentPath(workspaceId: string, slotId: string): string;
|
|
1481
|
+
/**
|
|
1482
|
+
* Parse a registry JSON string (fetched from a remote repo's
|
|
1483
|
+
* `.apicircle/registry.json`) and return the active workspace ID.
|
|
1484
|
+
* Falls back to the first entry when `activeWorkspaceId` is null.
|
|
1485
|
+
* Returns `null` if the registry is empty or unparseable.
|
|
1486
|
+
*/
|
|
1487
|
+
declare function parseRegistryActiveId(registryJsonContent: string): string | null;
|
|
1488
|
+
/**
|
|
1489
|
+
* Two-step resolution of a remote workspace.json path. Pass a generic
|
|
1490
|
+
* file-fetcher so this stays decoupled from any particular API client.
|
|
1491
|
+
*
|
|
1492
|
+
* 1. Fetches `registry.json` from the remote `.apicircle/` dir.
|
|
1493
|
+
* 2. Parses it to find the active workspace ID.
|
|
1494
|
+
* 3. Fetches `workspace-<id>/workspace.json`.
|
|
1495
|
+
*
|
|
1496
|
+
* Returns `{ workspaceId, content }` on success, or `{ error }` on failure.
|
|
1497
|
+
*/
|
|
1498
|
+
declare function fetchRemoteWorkspaceJson(fetchFile: (repoPath: string) => Promise<string | null>): Promise<{
|
|
1499
|
+
workspaceId: string;
|
|
1500
|
+
content: string;
|
|
1501
|
+
} | {
|
|
1502
|
+
error: string;
|
|
1503
|
+
}>;
|
|
1504
|
+
|
|
1363
1505
|
/** Error thrown when the input fails any of our checks. `code` lets the UI
|
|
1364
1506
|
* branch on the specific failure (oversized, bad JSON, wrong shape, etc.)
|
|
1365
1507
|
* without parsing the message string. */
|
|
@@ -1453,20 +1595,81 @@ interface PublishReleaseArgs {
|
|
|
1453
1595
|
tagName?: string;
|
|
1454
1596
|
publishedAt?: string;
|
|
1455
1597
|
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Build a fully-formed `ReleaseVersion` entry for `synced` — computing the
|
|
1600
|
+
* SHA-256 `workspaceSnapshot` of the canonical pre-publish workspace.json.
|
|
1601
|
+
*
|
|
1602
|
+
* This is the async half of publishing, split out so the sync mutation path
|
|
1603
|
+
* (`applyMutation` → `appendReleaseEntry`) stays pure: headless writers
|
|
1604
|
+
* (VS Code / MCP / CLI) call `buildReleaseEntry` first, then route the
|
|
1605
|
+
* resulting entry through the `release.publish` patch.
|
|
1606
|
+
*
|
|
1607
|
+
* Throws on invalid semver.
|
|
1608
|
+
*/
|
|
1609
|
+
declare function buildReleaseEntry(synced: WorkspaceSynced, args: PublishReleaseArgs): Promise<ReleaseVersion>;
|
|
1610
|
+
/**
|
|
1611
|
+
* Append a pre-built `ReleaseVersion` to `synced.releases.self.versions` and
|
|
1612
|
+
* bump `currentVersion`. Pure + synchronous — the SHA was already computed by
|
|
1613
|
+
* `buildReleaseEntry`, so this is safe to call from `applyMutation`.
|
|
1614
|
+
*
|
|
1615
|
+
* `now` defaults to the entry's own `publishedAt` so the convenience
|
|
1616
|
+
* `publishRelease` wrapper keeps its original stamping; `applyMutation`
|
|
1617
|
+
* passes its injected timestamp for deterministic batches.
|
|
1618
|
+
*
|
|
1619
|
+
* Throws on invalid semver or a duplicate version.
|
|
1620
|
+
*/
|
|
1621
|
+
declare function appendReleaseEntry(synced: WorkspaceSynced, entry: ReleaseVersion, now?: string): WorkspaceSynced;
|
|
1456
1622
|
/**
|
|
1457
1623
|
* Append a new release to `synced.releases.self.versions` and bump
|
|
1458
|
-
* `currentVersion`.
|
|
1624
|
+
* `currentVersion`. Convenience wrapper = `buildReleaseEntry` +
|
|
1625
|
+
* `appendReleaseEntry`. Pure — does not touch IDB or Git.
|
|
1459
1626
|
*
|
|
1460
1627
|
* Throws on invalid semver, duplicate version, or invalid notes shape.
|
|
1461
1628
|
*/
|
|
1462
1629
|
declare function publishRelease(synced: WorkspaceSynced, args: PublishReleaseArgs): Promise<WorkspaceSynced>;
|
|
1463
1630
|
/** Flip the `deprecated` flag on a version. Soft signal — version is still installable. */
|
|
1464
|
-
declare function deprecateRelease(synced: WorkspaceSynced, version: string): WorkspaceSynced;
|
|
1631
|
+
declare function deprecateRelease(synced: WorkspaceSynced, version: string, now?: string): WorkspaceSynced;
|
|
1465
1632
|
/**
|
|
1466
1633
|
* Flip the `yanked` flag on a version. Hard signal — consumers should
|
|
1467
1634
|
* be told this version is broken / unsafe and offered a different one.
|
|
1468
1635
|
*/
|
|
1469
|
-
declare function yankRelease(synced: WorkspaceSynced, version: string): WorkspaceSynced;
|
|
1636
|
+
declare function yankRelease(synced: WorkspaceSynced, version: string, now?: string): WorkspaceSynced;
|
|
1637
|
+
|
|
1638
|
+
interface LinkedWorkspaceProbe {
|
|
1639
|
+
workspaceId?: string;
|
|
1640
|
+
releases?: {
|
|
1641
|
+
self?: ReleaseHistory | null;
|
|
1642
|
+
};
|
|
1643
|
+
collections?: WorkspaceSynced['collections'];
|
|
1644
|
+
environments?: WorkspaceSynced['environments'];
|
|
1645
|
+
secretKeys?: Record<string, SecretKeyMeta>;
|
|
1646
|
+
globalAssets?: WorkspaceSynced['globalAssets'];
|
|
1647
|
+
}
|
|
1648
|
+
/**
|
|
1649
|
+
* Parse + sanitize a remote workspace.json string into the slices a linked
|
|
1650
|
+
* consumer reads. Throws on oversized input, invalid JSON, or a non-object
|
|
1651
|
+
* root. Prototype-pollution keys are stripped at parse time.
|
|
1652
|
+
*/
|
|
1653
|
+
declare function parseLinkedWorkspaceJson(text: string): LinkedWorkspaceProbe;
|
|
1654
|
+
/** The cached ledger from a probe, defaulting to an empty ledger. */
|
|
1655
|
+
declare function ledgerFromProbe(parsed: LinkedWorkspaceProbe): ReleaseHistory;
|
|
1656
|
+
/**
|
|
1657
|
+
* Build the `LinkedSnapshot` cached in `WorkspaceLocal.linkedCollections` from
|
|
1658
|
+
* a parsed probe + the link record. Returns null when the source has neither
|
|
1659
|
+
* collections nor environments to cache.
|
|
1660
|
+
*/
|
|
1661
|
+
declare function buildLinkedSnapshot(parsed: LinkedWorkspaceProbe, link: LinkedWorkspace): LinkedSnapshot | null;
|
|
1662
|
+
|
|
1663
|
+
/** Layer a consumer's override patch onto a source request. */
|
|
1664
|
+
declare function mergeRequestOverride(base: Request, patch: RequestOverridePatch): Request;
|
|
1665
|
+
/**
|
|
1666
|
+
* Compute the minimal override patch that turns `base` into `effective` —
|
|
1667
|
+
* only the overridable fields that structurally differ. Returns `{}` when the
|
|
1668
|
+
* effective request is identical to the source (caller drops the override).
|
|
1669
|
+
*/
|
|
1670
|
+
declare function computeRequestOverridePatch(base: Request, effective: Request): RequestOverridePatch;
|
|
1671
|
+
/** True when an override patch has no diverging fields (safe to drop). */
|
|
1672
|
+
declare function isEmptyOverridePatch(patch: RequestOverridePatch): boolean;
|
|
1470
1673
|
|
|
1471
1674
|
type MonacoLanguage = 'json' | 'xml' | 'html' | 'graphql' | 'javascript' | 'yaml' | 'plaintext';
|
|
1472
1675
|
declare function normalizeContentType(contentType?: string): string;
|
|
@@ -1582,6 +1785,14 @@ interface LinkedUpdateEntry<TBase = unknown, TTarget = unknown, TOverride = unkn
|
|
|
1582
1785
|
base: TBase | null;
|
|
1583
1786
|
target: TTarget | null;
|
|
1584
1787
|
override: TOverride | null;
|
|
1788
|
+
/**
|
|
1789
|
+
* For `both-changed` entries only: `true` when the consumer's override touches
|
|
1790
|
+
* a DISJOINT set of fields from the ones the source changed — so keeping the
|
|
1791
|
+
* override is a clean field-level merge that needs no user decision. `false`
|
|
1792
|
+
* (or undefined) means override + source touched the same field → a real
|
|
1793
|
+
* conflict the user must resolve. Other statuses leave this undefined.
|
|
1794
|
+
*/
|
|
1795
|
+
autoMergeable?: boolean;
|
|
1585
1796
|
}
|
|
1586
1797
|
interface LinkedUpdatePreview {
|
|
1587
1798
|
fromVersion: string | null;
|
|
@@ -1920,4 +2131,4 @@ interface TransformSavings {
|
|
|
1920
2131
|
declare function computeTransformSavings(body: string, contentType?: string): TransformSavings;
|
|
1921
2132
|
declare const TRANSFORM_FORMAT_LABELS: Record<TransformFormat, string>;
|
|
1922
2133
|
|
|
1923
|
-
export { ANONYMOUS_ACTOR, type ApplyMutationOptions, type ApplyMutationResult, type AssertionResult, type AttachmentResolver, type AttachmentSlotRef, type AuthApplyOptions, type AuthApplyResult, type AuthApplyTarget, type AuthApplyWarning, type AuthCodeExchangeArgs, type AutoHeaderOverrides, type BranchNameOptions, type BuildDigestArgs, type BuildNtlmType3Args, type BuildRequestOptions, type BuiltRequest, type ClientCredentialsArgs, type ConflictResolution, type HeaderEntry$1 as ContentTypeHeaderEntry, type ContextExtractionResult, DESKTOP_APP_ORIGIN, type DeviceAuthorizationArgs, type DeviceAuthorizationResponse, type DiffEntry, type DiffStatus, type DigestChallenge, EMPTY_UNPUSHED_SUMMARY, type EncryptedBindingHint, type EncryptedPayload, type EntityBucket, type ExecuteOptions, type ExecutionResult, type FetchOAuth2TokenArgs, type GraphQLField, type GraphQLSchemaInfo, HTTP_HEADERS_MAP, type HawkSignArgs, type HeaderEntry, type HeaderSuggestionMode, type ImportApicircleFolderResult, type ImportedFolder, type ImportedRequest, type JwtAlgorithm, type JwtSignArgs, type ApplyArgs as LinkedApplyArgs, type ApplyResult as LinkedApplyResult, type PreviewArgs as LinkedPreviewArgs, type LinkedUpdateBucket, type LinkedUpdateEntry, type LinkedUpdatePreview, type LinkedUpdateResolutionMap, type LinkedUpdateStatus, type MonacoLanguage, type NtlmType2Challenge, type OAuth2ErrorResponse, OAuth2TokenError, type OAuth2TokenResponse, type ParsedApicircleEnvironment, ParsedApicircleFolderExport, type ParsedCurl, type ParsedPostmanCollection, type ParsedPostmanEnvironment, type ParsedVersion, type PkceExchangeArgs, type PkceMethod, type PlanRunAuthorizationContext, PlanRunDeniedError, type PlanStepResult, type PollDeviceFlowArgs, type PreSendBlocker, type PreSendValidationInput, type PreSendValidationResult, type PreSendWarning, type PublishReleaseArgs, type RefreshTokenArgs, RemoteWorkspaceParseError, type ResolutionMap, type ResolutionScope, type ResolveInheritedAuthArgs, type ResolvePlanRefResult, type ResolveResult, type RopcArgs, type RunActor, type RunPlanOptions, type RunPlanResult, type SigV4SignArgs, type SigV4SignResult, TRANSFORM_FORMAT_LABELS, type ThreeWayDiff, type TransformCandidate, type TransformFormat, type TransformSavings, type UnpushedChange, type UnpushedSummary, type VariableSource, type VariableSuggestion, WorkspacePatch, WorkspaceState, applyAuth, applyAwsSigV4, applyContentTypeForBodyType, applyLinkedUpdate, applyMerge, applyMutation, applyPathParams, assertNoPlaintextCredentials, buildAuthorizeUrl, buildAutoHeaders, buildDigestAuthHeader, buildHawkAuthHeader, buildNtlmType1Negotiate, buildNtlmType3Authenticate, buildRequest, buildScope, collectAttachmentSlots, collectVariableSuggestions, compareSemver, composeBody, composeCookieHeader, composeHeaders, composeUrl, composeUrlWithQuery, computeCodeChallenge, computeThreeWayDiff, computeTransformSavings, decryptString, deprecateRelease, deriveKeyFromSlotValue, encryptString, exchangeAuthCode, exchangePkce, executeRequest, exportKey, extractContext, fetchOAuth2Token, findPathPlaceholders, generateAesKey, generateCodeVerifier, generateSlotSalt, generateSpanId, generateTraceParent, generateWorkingBranchName, getBodyTypeForContentType, getContentTypeForBodyType, getHeaderEntry, getHeaderValues, getLanguageFromBodyType, getLanguageFromContentType, getVariableAutocomplete, hasUnpushedChanges, importApicircleFolderInto, importKey, isApicircleEnvironment, isDesktop, isInsomniaExport, isPostmanEnvironment, isPostmanV2Collection, isValidSemver, lookup, mergeWithAutoHeaders, normalizeContentType, parseApicircleEnvironment, parseApicircleEnvironmentDoc, parseCurl, parseDigestChallenge, parseGraphqlSchema, parseInsomniaCollection, parseNtlmType2Challenge, parsePostmanCollection, parsePostmanEnvironment, parseSemver, parseUrlQuery, parseWorkspaceJson, pollDeviceFlow, preSendValidation, previewLinkedUpdate, publishRelease, readJsonPath, redactForGit, refreshToken, requestDeviceAuthorization, requestRunToExecutionResult, resolveInheritedAuth, resolvePlanRef, resolveString, resolveStringMap, runAssertions, runClientCredentials, runPlan, runRopc, serializePayload, serializeWorkspaceForGit, signJwt, slugify, sortVersionsDesc, suggestHeaders, summarizeUnpushedChanges, supportedContentTypeLanguageMap, toCsv, toToon, toYaml, tokenizeCurl, tryParsePayload, validateBranchName, yankRelease };
|
|
2134
|
+
export { ANONYMOUS_ACTOR, type ApplyMutationOptions, type ApplyMutationResult, type AssertionResult, type AttachmentResolver, type AttachmentSlotRef, type AuthApplyOptions, type AuthApplyResult, type AuthApplyTarget, type AuthApplyWarning, type AuthCodeExchangeArgs, type AutoHeaderOverrides, type BranchNameOptions, type BuildDigestArgs, type BuildNtlmType3Args, type BuildRequestOptions, type BuiltRequest, type ClientCredentialsArgs, type ConflictResolution, type HeaderEntry$1 as ContentTypeHeaderEntry, type ContextExtractionResult, DESKTOP_APP_ORIGIN, type DeviceAuthorizationArgs, type DeviceAuthorizationResponse, type DiffEntry, type DiffStatus, type DigestChallenge, EMPTY_UNPUSHED_SUMMARY, type EncryptedBindingHint, type EncryptedPayload, type EntityBucket, type ExecuteOptions, type ExecutionResult, type FetchOAuth2TokenArgs, type GraphQLField, type GraphQLSchemaInfo, HTTP_HEADERS_MAP, type HawkSignArgs, type HeaderEntry, type HeaderSuggestionMode, type ImportApicircleFolderResult, type ImportedFolder, type ImportedRequest, type JwtAlgorithm, type JwtSignArgs, type ApplyArgs as LinkedApplyArgs, type ApplyResult as LinkedApplyResult, type PreviewArgs as LinkedPreviewArgs, type LinkedUpdateBucket, type LinkedUpdateEntry, type LinkedUpdatePreview, type LinkedUpdateResolutionMap, type LinkedUpdateStatus, type LinkedWorkspaceProbe, type MonacoLanguage, type NtlmType2Challenge, type OAuth2ErrorResponse, OAuth2TokenError, type OAuth2TokenResponse, type ParsedApicircleEnvironment, ParsedApicircleFolderExport, type ParsedCurl, type ParsedPostmanCollection, type ParsedPostmanEnvironment, type ParsedVersion, type PkceExchangeArgs, type PkceMethod, type PlanRunAuthorizationContext, PlanRunDeniedError, type PlanStepResult, type PollDeviceFlowArgs, type PreSendBlocker, type PreSendValidationInput, type PreSendValidationResult, type PreSendWarning, type PublishReleaseArgs, REGISTRY_JSON_PATH, type RefreshTokenArgs, RemoteWorkspaceParseError, type ResolutionMap, type ResolutionScope, type ResolveInheritedAuthArgs, type ResolvePlanRefResult, type ResolveRequestArgs, type ResolveResult, type ResolvedRequestResult, type RopcArgs, type RunActor, type RunPlanOptions, type RunPlanResult, type SecretCrypto, type SigV4SignArgs, type SigV4SignResult, TRANSFORM_FORMAT_LABELS, type ThreeWayDiff, type TransformCandidate, type TransformFormat, type TransformSavings, type UnpushedChange, type UnpushedSummary, type VariableSource, type VariableSuggestion, WORKSPACE_DIR, WorkspacePatch, WorkspaceState, appendReleaseEntry, applyAuth, applyAwsSigV4, applyContentTypeForBodyType, applyLinkedEnvironmentOverrides, applyLinkedUpdate, applyMerge, applyMutation, applyPathParams, assertNoPlaintextCredentials, attachmentPath, attachmentsDir, buildAuthorizeUrl, buildAutoHeaders, buildDigestAuthHeader, buildHawkAuthHeader, buildLinkedSnapshot, buildNtlmType1Negotiate, buildNtlmType3Authenticate, buildReleaseEntry, buildRequest, buildScope, collectAttachmentSlots, collectVariableSuggestions, compareSemver, composeBody, composeCookieHeader, composeHeaders, composeUrl, composeUrlWithQuery, computeCodeChallenge, computeRequestOverridePatch, computeThreeWayDiff, computeTransformSavings, decryptString, deprecateRelease, deriveKeyFromSlotValue, encryptString, exchangeAuthCode, exchangePkce, executeRequest, exportKey, extractContext, fetchOAuth2Token, fetchRemoteWorkspaceJson, findPathPlaceholders, generateAesKey, generateCodeVerifier, generateSlotSalt, generateSpanId, generateTraceParent, generateWorkingBranchName, getBodyTypeForContentType, getContentTypeForBodyType, getHeaderEntry, getHeaderValues, getLanguageFromBodyType, getLanguageFromContentType, getVariableAutocomplete, hasUnpushedChanges, importApicircleFolderInto, importKey, initSecretCrypto, isApicircleEnvironment, isDesktop, isEmptyOverridePatch, isInsomniaExport, isPostmanEnvironment, isPostmanV2Collection, isValidSemver, ledgerFromProbe, lookup, mergeRequestOverride, mergeWithAutoHeaders, normalizeContentType, parseApicircleEnvironment, parseApicircleEnvironmentDoc, parseCurl, parseDigestChallenge, parseGraphqlSchema, parseInsomniaCollection, parseLinkedWorkspaceJson, parseNtlmType2Challenge, parsePostmanCollection, parsePostmanEnvironment, parseRegistryActiveId, parseSemver, parseUrlQuery, parseWorkspaceJson, plaintextEnvMap, pollDeviceFlow, preSendValidation, previewLinkedUpdate, publishRelease, readJsonPath, redactForGit, refreshToken, requestDeviceAuthorization, requestRunToExecutionResult, resolveInheritedAuth, resolvePlanRef, resolveRequestForExecution, resolveString, resolveStringMap, runAssertions, runClientCredentials, runPlan, runRopc, serializePayload, serializeWorkspaceForGit, signJwt, slugify, sortVersionsDesc, suggestHeaders, summarizeUnpushedChanges, supportedContentTypeLanguageMap, toCsv, toToon, toYaml, tokenizeCurl, tryParsePayload, unlockSecretCrypto, validateBranchName, workspaceJsonPath, yankRelease };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BodyType, RequestAuth, Request,
|
|
2
|
-
import { W as WorkspaceState, a as WorkspacePatch, P as ParsedApicircleFolderExport } from './patches-
|
|
3
|
-
export { A as APICIRCLE_FOLDER_EXPORT_FORMAT, b as ApicircleFolderExportDependencies, c as ApicircleFolderExportV1, C as CollectFolderExportArgs, d as CollectFolderExportResult, F as FolderExportCredential, e as FolderExportReport, f as WorkspacePatchKind, g as collectFolderExport, h as collectFolderExportCredentials, i as isApicircleFolderExport, p as parseApicircleFolderExport, j as parseApicircleFolderExportDoc, r as redactFolderExportCredentials, s as serializeFolderExport, k as suggestFolderExportFilename } from './patches-
|
|
1
|
+
import { BodyType, RequestAuth, Request, Folder, RequestRun, RequestBody, HttpMethod, EnvironmentVariable, Assertion, ContextExtraction, WorkspaceSynced, EnvPriorityRef, ReleaseVersion, ReleaseHistory, SecretKeyMeta, LinkedWorkspace, LinkedSnapshot, RequestOverridePatch, RequestOverride, EnvironmentVariableOverride, ExecutionPlan, PlanRun } from '@apicircle/shared';
|
|
2
|
+
import { W as WorkspaceState, a as WorkspacePatch, P as ParsedApicircleFolderExport } from './patches-B3VGNVgf.js';
|
|
3
|
+
export { A as APICIRCLE_FOLDER_EXPORT_FORMAT, b as ApicircleFolderExportDependencies, c as ApicircleFolderExportV1, C as CollectFolderExportArgs, d as CollectFolderExportResult, F as FolderExportCredential, e as FolderExportReport, f as WorkspacePatchKind, g as collectFolderExport, h as collectFolderExportCredentials, i as isApicircleFolderExport, p as parseApicircleFolderExport, j as parseApicircleFolderExportDoc, r as redactFolderExportCredentials, s as serializeFolderExport, k as suggestFolderExportFilename } from './patches-B3VGNVgf.js';
|
|
4
4
|
|
|
5
5
|
type HeaderEntry$1 = {
|
|
6
6
|
key: string;
|
|
@@ -389,8 +389,18 @@ interface PreSendValidationResult {
|
|
|
389
389
|
interface PreSendValidationInput {
|
|
390
390
|
request: Request;
|
|
391
391
|
scope: ResolutionScope;
|
|
392
|
+
/**
|
|
393
|
+
* Folder map keyed by id. When provided AND the request's `auth.type` is
|
|
394
|
+
* `inherit`, the validator resolves the upward chain via
|
|
395
|
+
* `resolveInheritedAuth` and validates the EFFECTIVE auth's field
|
|
396
|
+
* completeness — so an empty-token folder bearer doesn't slip past the
|
|
397
|
+
* pre-send check. Omit for callers that don't have folder context (legacy
|
|
398
|
+
* tests, ad-hoc plan steps), and the validator falls back to checking the
|
|
399
|
+
* declared auth as-is.
|
|
400
|
+
*/
|
|
401
|
+
folders?: Record<string, Folder>;
|
|
392
402
|
}
|
|
393
|
-
declare function preSendValidation({ request, scope, }: PreSendValidationInput): PreSendValidationResult;
|
|
403
|
+
declare function preSendValidation({ request, scope, folders, }: PreSendValidationInput): PreSendValidationResult;
|
|
394
404
|
|
|
395
405
|
interface ExecutionResult {
|
|
396
406
|
startedAt: string;
|
|
@@ -1140,6 +1150,15 @@ interface ImportedFolder {
|
|
|
1140
1150
|
/** Index path from root (deterministic id assignment is the caller's job). */
|
|
1141
1151
|
pathIds: number[];
|
|
1142
1152
|
parentPathIds: number[] | null;
|
|
1153
|
+
/**
|
|
1154
|
+
* Folder-level auth captured from the source. Postman v2.1 folders can
|
|
1155
|
+
* carry an `auth` field that descendant requests inherit; Insomnia
|
|
1156
|
+
* request_group resources expose the same via `authentication`. When
|
|
1157
|
+
* present, the importer maps it to `Folder.auth` and descendant requests
|
|
1158
|
+
* with no explicit auth resolve via `resolveInheritedAuth` instead of
|
|
1159
|
+
* being wired to a duplicate copy.
|
|
1160
|
+
*/
|
|
1161
|
+
auth?: RequestAuth;
|
|
1143
1162
|
}
|
|
1144
1163
|
interface ParsedPostmanCollection {
|
|
1145
1164
|
collectionName: string;
|
|
@@ -1289,6 +1308,51 @@ interface ContextExtractionResult {
|
|
|
1289
1308
|
}
|
|
1290
1309
|
declare function extractContext(result: ExecutionResult, extractions: ReadonlyArray<ContextExtraction>): ContextExtractionResult;
|
|
1291
1310
|
|
|
1311
|
+
interface ResolveRequestArgs {
|
|
1312
|
+
request: Request;
|
|
1313
|
+
synced: WorkspaceSynced;
|
|
1314
|
+
/** Plaintext local envs: `{ envName: { varKey: value } }`. */
|
|
1315
|
+
localEnvs: Record<string, Record<string, string>>;
|
|
1316
|
+
/**
|
|
1317
|
+
* Plaintext linked envs keyed by linkedWorkspaceId, then envName. Caller
|
|
1318
|
+
* is expected to have already applied any linkedOverrides.environmentVars
|
|
1319
|
+
* (use `applyLinkedEnvironmentOverrides` from this module first).
|
|
1320
|
+
*/
|
|
1321
|
+
linkedEnvs?: Record<string, Record<string, Record<string, string>>>;
|
|
1322
|
+
/** Plaintext secrets keyed by their display label (vault-decrypted). */
|
|
1323
|
+
secrets?: Record<string, string>;
|
|
1324
|
+
/**
|
|
1325
|
+
* `globalContext` (latest-write-wins extractions) + plan variables
|
|
1326
|
+
* (optional) — sit between request.contextVars and the env layer.
|
|
1327
|
+
*/
|
|
1328
|
+
globalContext?: Record<string, string>;
|
|
1329
|
+
planVariables?: ReadonlyArray<{
|
|
1330
|
+
key: string;
|
|
1331
|
+
value: string;
|
|
1332
|
+
}>;
|
|
1333
|
+
/** Plan-level priority overrides take precedence when non-empty. */
|
|
1334
|
+
envPriorityOverride?: readonly EnvPriorityRef[];
|
|
1335
|
+
}
|
|
1336
|
+
interface ResolvedRequestResult {
|
|
1337
|
+
request: Request;
|
|
1338
|
+
scope: ResolutionScope;
|
|
1339
|
+
missing: string[];
|
|
1340
|
+
}
|
|
1341
|
+
declare function resolveRequestForExecution(args: ResolveRequestArgs): ResolvedRequestResult;
|
|
1342
|
+
/**
|
|
1343
|
+
* Layer `synced.linkedOverrides.environmentVars` entries onto a source env
|
|
1344
|
+
* map for one linked workspace. Used by the host to prepare the plaintext
|
|
1345
|
+
* `linkedEnvs` argument before calling `resolveRequestForExecution`.
|
|
1346
|
+
*/
|
|
1347
|
+
declare function applyLinkedEnvironmentOverrides(source: WorkspaceSynced['environments'], linkedWorkspaceId: string, synced: WorkspaceSynced): WorkspaceSynced['environments'];
|
|
1348
|
+
/**
|
|
1349
|
+
* Strip an envs map down to its plaintext key→value pairs, dropping any
|
|
1350
|
+
* variable still marked `encrypted: true` (the host's vault layer should have
|
|
1351
|
+
* decrypted those in advance). Returns the plaintext map the resolver
|
|
1352
|
+
* consumes.
|
|
1353
|
+
*/
|
|
1354
|
+
declare function plaintextEnvMap(source: WorkspaceSynced['environments']): Record<string, Record<string, string>>;
|
|
1355
|
+
|
|
1292
1356
|
interface EncryptedPayload {
|
|
1293
1357
|
iv: string;
|
|
1294
1358
|
ciphertext: string;
|
|
@@ -1335,6 +1399,47 @@ declare function importKey(jwk: JsonWebKey): Promise<CryptoKey>;
|
|
|
1335
1399
|
declare function serializePayload(payload: EncryptedPayload): string;
|
|
1336
1400
|
declare function tryParsePayload(value: string): EncryptedPayload | null;
|
|
1337
1401
|
|
|
1402
|
+
interface SecretCrypto {
|
|
1403
|
+
kdf: 'pbkdf2-sha256-v1';
|
|
1404
|
+
/** Base64-encoded random salt; 16 bytes. */
|
|
1405
|
+
salt: string;
|
|
1406
|
+
/** PBKDF2 iteration count baked at workspace-creation time. */
|
|
1407
|
+
iterations: number;
|
|
1408
|
+
/** Base64-encoded AES-GCM(sentinel, derivedKey, zero-IV). */
|
|
1409
|
+
verifier: string;
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* Initialise the workspace's secret crypto state. Called the first time
|
|
1413
|
+
* the user creates a passphrase (new workspace or first secret added in
|
|
1414
|
+
* a workspace that hasn't set one).
|
|
1415
|
+
*
|
|
1416
|
+
* Returns the SecretCrypto blob to persist in workspace.json **and** the
|
|
1417
|
+
* derived key so the caller can immediately use it.
|
|
1418
|
+
*
|
|
1419
|
+
* The `iterations` override exists for tests — production callers should
|
|
1420
|
+
* always use the default `PBKDF2_ITERATIONS` (OWASP floor). Tests pin a
|
|
1421
|
+
* smaller count so the suite stays fast under parallel load; the
|
|
1422
|
+
* algorithm path is identical either way.
|
|
1423
|
+
*/
|
|
1424
|
+
declare function initSecretCrypto(passphrase: string, iterations?: number): Promise<{
|
|
1425
|
+
crypto: SecretCrypto;
|
|
1426
|
+
key: CryptoKey;
|
|
1427
|
+
}>;
|
|
1428
|
+
/**
|
|
1429
|
+
* Unlock the workspace given a passphrase + the stored SecretCrypto blob.
|
|
1430
|
+
*
|
|
1431
|
+
* Returns `{ ok: true, key }` on a successful passphrase match (verifier
|
|
1432
|
+
* matches), `{ ok: false }` on any mismatch — wrong passphrase, corrupt
|
|
1433
|
+
* blob, unsupported KDF. The caller surfaces the right UX for each.
|
|
1434
|
+
*/
|
|
1435
|
+
declare function unlockSecretCrypto(passphrase: string, blob: SecretCrypto): Promise<{
|
|
1436
|
+
ok: true;
|
|
1437
|
+
key: CryptoKey;
|
|
1438
|
+
} | {
|
|
1439
|
+
ok: false;
|
|
1440
|
+
reason: string;
|
|
1441
|
+
}>;
|
|
1442
|
+
|
|
1338
1443
|
/**
|
|
1339
1444
|
* Validate a branch name against GitHub's ref rules. Returns null when the
|
|
1340
1445
|
* name is acceptable, otherwise a short reason. We enforce a stricter
|
|
@@ -1360,6 +1465,43 @@ declare function generateWorkingBranchName(opts: BranchNameOptions): string;
|
|
|
1360
1465
|
*/
|
|
1361
1466
|
declare function serializeWorkspaceForGit(synced: WorkspaceSynced): string;
|
|
1362
1467
|
|
|
1468
|
+
/** The dotfolder under the repo root that owns every API-Circle-managed
|
|
1469
|
+
* file in a Git-backed workspace. */
|
|
1470
|
+
declare const WORKSPACE_DIR = ".apicircle";
|
|
1471
|
+
/** Path to the workspace registry inside a repo / root. */
|
|
1472
|
+
declare const REGISTRY_JSON_PATH = ".apicircle/registry.json";
|
|
1473
|
+
/** On-disk path for the synced workspace document inside a Git repo. */
|
|
1474
|
+
declare function workspaceJsonPath(workspaceId: string): string;
|
|
1475
|
+
/** Directory holding per-attachment blob files (`<slotId>`). */
|
|
1476
|
+
declare function attachmentsDir(workspaceId: string): string;
|
|
1477
|
+
/** Build the on-disk path for a single attachment slot. Caller is
|
|
1478
|
+
* responsible for URL-encoding when this is passed to the GitHub
|
|
1479
|
+
* Contents API. */
|
|
1480
|
+
declare function attachmentPath(workspaceId: string, slotId: string): string;
|
|
1481
|
+
/**
|
|
1482
|
+
* Parse a registry JSON string (fetched from a remote repo's
|
|
1483
|
+
* `.apicircle/registry.json`) and return the active workspace ID.
|
|
1484
|
+
* Falls back to the first entry when `activeWorkspaceId` is null.
|
|
1485
|
+
* Returns `null` if the registry is empty or unparseable.
|
|
1486
|
+
*/
|
|
1487
|
+
declare function parseRegistryActiveId(registryJsonContent: string): string | null;
|
|
1488
|
+
/**
|
|
1489
|
+
* Two-step resolution of a remote workspace.json path. Pass a generic
|
|
1490
|
+
* file-fetcher so this stays decoupled from any particular API client.
|
|
1491
|
+
*
|
|
1492
|
+
* 1. Fetches `registry.json` from the remote `.apicircle/` dir.
|
|
1493
|
+
* 2. Parses it to find the active workspace ID.
|
|
1494
|
+
* 3. Fetches `workspace-<id>/workspace.json`.
|
|
1495
|
+
*
|
|
1496
|
+
* Returns `{ workspaceId, content }` on success, or `{ error }` on failure.
|
|
1497
|
+
*/
|
|
1498
|
+
declare function fetchRemoteWorkspaceJson(fetchFile: (repoPath: string) => Promise<string | null>): Promise<{
|
|
1499
|
+
workspaceId: string;
|
|
1500
|
+
content: string;
|
|
1501
|
+
} | {
|
|
1502
|
+
error: string;
|
|
1503
|
+
}>;
|
|
1504
|
+
|
|
1363
1505
|
/** Error thrown when the input fails any of our checks. `code` lets the UI
|
|
1364
1506
|
* branch on the specific failure (oversized, bad JSON, wrong shape, etc.)
|
|
1365
1507
|
* without parsing the message string. */
|
|
@@ -1453,20 +1595,81 @@ interface PublishReleaseArgs {
|
|
|
1453
1595
|
tagName?: string;
|
|
1454
1596
|
publishedAt?: string;
|
|
1455
1597
|
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Build a fully-formed `ReleaseVersion` entry for `synced` — computing the
|
|
1600
|
+
* SHA-256 `workspaceSnapshot` of the canonical pre-publish workspace.json.
|
|
1601
|
+
*
|
|
1602
|
+
* This is the async half of publishing, split out so the sync mutation path
|
|
1603
|
+
* (`applyMutation` → `appendReleaseEntry`) stays pure: headless writers
|
|
1604
|
+
* (VS Code / MCP / CLI) call `buildReleaseEntry` first, then route the
|
|
1605
|
+
* resulting entry through the `release.publish` patch.
|
|
1606
|
+
*
|
|
1607
|
+
* Throws on invalid semver.
|
|
1608
|
+
*/
|
|
1609
|
+
declare function buildReleaseEntry(synced: WorkspaceSynced, args: PublishReleaseArgs): Promise<ReleaseVersion>;
|
|
1610
|
+
/**
|
|
1611
|
+
* Append a pre-built `ReleaseVersion` to `synced.releases.self.versions` and
|
|
1612
|
+
* bump `currentVersion`. Pure + synchronous — the SHA was already computed by
|
|
1613
|
+
* `buildReleaseEntry`, so this is safe to call from `applyMutation`.
|
|
1614
|
+
*
|
|
1615
|
+
* `now` defaults to the entry's own `publishedAt` so the convenience
|
|
1616
|
+
* `publishRelease` wrapper keeps its original stamping; `applyMutation`
|
|
1617
|
+
* passes its injected timestamp for deterministic batches.
|
|
1618
|
+
*
|
|
1619
|
+
* Throws on invalid semver or a duplicate version.
|
|
1620
|
+
*/
|
|
1621
|
+
declare function appendReleaseEntry(synced: WorkspaceSynced, entry: ReleaseVersion, now?: string): WorkspaceSynced;
|
|
1456
1622
|
/**
|
|
1457
1623
|
* Append a new release to `synced.releases.self.versions` and bump
|
|
1458
|
-
* `currentVersion`.
|
|
1624
|
+
* `currentVersion`. Convenience wrapper = `buildReleaseEntry` +
|
|
1625
|
+
* `appendReleaseEntry`. Pure — does not touch IDB or Git.
|
|
1459
1626
|
*
|
|
1460
1627
|
* Throws on invalid semver, duplicate version, or invalid notes shape.
|
|
1461
1628
|
*/
|
|
1462
1629
|
declare function publishRelease(synced: WorkspaceSynced, args: PublishReleaseArgs): Promise<WorkspaceSynced>;
|
|
1463
1630
|
/** Flip the `deprecated` flag on a version. Soft signal — version is still installable. */
|
|
1464
|
-
declare function deprecateRelease(synced: WorkspaceSynced, version: string): WorkspaceSynced;
|
|
1631
|
+
declare function deprecateRelease(synced: WorkspaceSynced, version: string, now?: string): WorkspaceSynced;
|
|
1465
1632
|
/**
|
|
1466
1633
|
* Flip the `yanked` flag on a version. Hard signal — consumers should
|
|
1467
1634
|
* be told this version is broken / unsafe and offered a different one.
|
|
1468
1635
|
*/
|
|
1469
|
-
declare function yankRelease(synced: WorkspaceSynced, version: string): WorkspaceSynced;
|
|
1636
|
+
declare function yankRelease(synced: WorkspaceSynced, version: string, now?: string): WorkspaceSynced;
|
|
1637
|
+
|
|
1638
|
+
interface LinkedWorkspaceProbe {
|
|
1639
|
+
workspaceId?: string;
|
|
1640
|
+
releases?: {
|
|
1641
|
+
self?: ReleaseHistory | null;
|
|
1642
|
+
};
|
|
1643
|
+
collections?: WorkspaceSynced['collections'];
|
|
1644
|
+
environments?: WorkspaceSynced['environments'];
|
|
1645
|
+
secretKeys?: Record<string, SecretKeyMeta>;
|
|
1646
|
+
globalAssets?: WorkspaceSynced['globalAssets'];
|
|
1647
|
+
}
|
|
1648
|
+
/**
|
|
1649
|
+
* Parse + sanitize a remote workspace.json string into the slices a linked
|
|
1650
|
+
* consumer reads. Throws on oversized input, invalid JSON, or a non-object
|
|
1651
|
+
* root. Prototype-pollution keys are stripped at parse time.
|
|
1652
|
+
*/
|
|
1653
|
+
declare function parseLinkedWorkspaceJson(text: string): LinkedWorkspaceProbe;
|
|
1654
|
+
/** The cached ledger from a probe, defaulting to an empty ledger. */
|
|
1655
|
+
declare function ledgerFromProbe(parsed: LinkedWorkspaceProbe): ReleaseHistory;
|
|
1656
|
+
/**
|
|
1657
|
+
* Build the `LinkedSnapshot` cached in `WorkspaceLocal.linkedCollections` from
|
|
1658
|
+
* a parsed probe + the link record. Returns null when the source has neither
|
|
1659
|
+
* collections nor environments to cache.
|
|
1660
|
+
*/
|
|
1661
|
+
declare function buildLinkedSnapshot(parsed: LinkedWorkspaceProbe, link: LinkedWorkspace): LinkedSnapshot | null;
|
|
1662
|
+
|
|
1663
|
+
/** Layer a consumer's override patch onto a source request. */
|
|
1664
|
+
declare function mergeRequestOverride(base: Request, patch: RequestOverridePatch): Request;
|
|
1665
|
+
/**
|
|
1666
|
+
* Compute the minimal override patch that turns `base` into `effective` —
|
|
1667
|
+
* only the overridable fields that structurally differ. Returns `{}` when the
|
|
1668
|
+
* effective request is identical to the source (caller drops the override).
|
|
1669
|
+
*/
|
|
1670
|
+
declare function computeRequestOverridePatch(base: Request, effective: Request): RequestOverridePatch;
|
|
1671
|
+
/** True when an override patch has no diverging fields (safe to drop). */
|
|
1672
|
+
declare function isEmptyOverridePatch(patch: RequestOverridePatch): boolean;
|
|
1470
1673
|
|
|
1471
1674
|
type MonacoLanguage = 'json' | 'xml' | 'html' | 'graphql' | 'javascript' | 'yaml' | 'plaintext';
|
|
1472
1675
|
declare function normalizeContentType(contentType?: string): string;
|
|
@@ -1582,6 +1785,14 @@ interface LinkedUpdateEntry<TBase = unknown, TTarget = unknown, TOverride = unkn
|
|
|
1582
1785
|
base: TBase | null;
|
|
1583
1786
|
target: TTarget | null;
|
|
1584
1787
|
override: TOverride | null;
|
|
1788
|
+
/**
|
|
1789
|
+
* For `both-changed` entries only: `true` when the consumer's override touches
|
|
1790
|
+
* a DISJOINT set of fields from the ones the source changed — so keeping the
|
|
1791
|
+
* override is a clean field-level merge that needs no user decision. `false`
|
|
1792
|
+
* (or undefined) means override + source touched the same field → a real
|
|
1793
|
+
* conflict the user must resolve. Other statuses leave this undefined.
|
|
1794
|
+
*/
|
|
1795
|
+
autoMergeable?: boolean;
|
|
1585
1796
|
}
|
|
1586
1797
|
interface LinkedUpdatePreview {
|
|
1587
1798
|
fromVersion: string | null;
|
|
@@ -1920,4 +2131,4 @@ interface TransformSavings {
|
|
|
1920
2131
|
declare function computeTransformSavings(body: string, contentType?: string): TransformSavings;
|
|
1921
2132
|
declare const TRANSFORM_FORMAT_LABELS: Record<TransformFormat, string>;
|
|
1922
2133
|
|
|
1923
|
-
export { ANONYMOUS_ACTOR, type ApplyMutationOptions, type ApplyMutationResult, type AssertionResult, type AttachmentResolver, type AttachmentSlotRef, type AuthApplyOptions, type AuthApplyResult, type AuthApplyTarget, type AuthApplyWarning, type AuthCodeExchangeArgs, type AutoHeaderOverrides, type BranchNameOptions, type BuildDigestArgs, type BuildNtlmType3Args, type BuildRequestOptions, type BuiltRequest, type ClientCredentialsArgs, type ConflictResolution, type HeaderEntry$1 as ContentTypeHeaderEntry, type ContextExtractionResult, DESKTOP_APP_ORIGIN, type DeviceAuthorizationArgs, type DeviceAuthorizationResponse, type DiffEntry, type DiffStatus, type DigestChallenge, EMPTY_UNPUSHED_SUMMARY, type EncryptedBindingHint, type EncryptedPayload, type EntityBucket, type ExecuteOptions, type ExecutionResult, type FetchOAuth2TokenArgs, type GraphQLField, type GraphQLSchemaInfo, HTTP_HEADERS_MAP, type HawkSignArgs, type HeaderEntry, type HeaderSuggestionMode, type ImportApicircleFolderResult, type ImportedFolder, type ImportedRequest, type JwtAlgorithm, type JwtSignArgs, type ApplyArgs as LinkedApplyArgs, type ApplyResult as LinkedApplyResult, type PreviewArgs as LinkedPreviewArgs, type LinkedUpdateBucket, type LinkedUpdateEntry, type LinkedUpdatePreview, type LinkedUpdateResolutionMap, type LinkedUpdateStatus, type MonacoLanguage, type NtlmType2Challenge, type OAuth2ErrorResponse, OAuth2TokenError, type OAuth2TokenResponse, type ParsedApicircleEnvironment, ParsedApicircleFolderExport, type ParsedCurl, type ParsedPostmanCollection, type ParsedPostmanEnvironment, type ParsedVersion, type PkceExchangeArgs, type PkceMethod, type PlanRunAuthorizationContext, PlanRunDeniedError, type PlanStepResult, type PollDeviceFlowArgs, type PreSendBlocker, type PreSendValidationInput, type PreSendValidationResult, type PreSendWarning, type PublishReleaseArgs, type RefreshTokenArgs, RemoteWorkspaceParseError, type ResolutionMap, type ResolutionScope, type ResolveInheritedAuthArgs, type ResolvePlanRefResult, type ResolveResult, type RopcArgs, type RunActor, type RunPlanOptions, type RunPlanResult, type SigV4SignArgs, type SigV4SignResult, TRANSFORM_FORMAT_LABELS, type ThreeWayDiff, type TransformCandidate, type TransformFormat, type TransformSavings, type UnpushedChange, type UnpushedSummary, type VariableSource, type VariableSuggestion, WorkspacePatch, WorkspaceState, applyAuth, applyAwsSigV4, applyContentTypeForBodyType, applyLinkedUpdate, applyMerge, applyMutation, applyPathParams, assertNoPlaintextCredentials, buildAuthorizeUrl, buildAutoHeaders, buildDigestAuthHeader, buildHawkAuthHeader, buildNtlmType1Negotiate, buildNtlmType3Authenticate, buildRequest, buildScope, collectAttachmentSlots, collectVariableSuggestions, compareSemver, composeBody, composeCookieHeader, composeHeaders, composeUrl, composeUrlWithQuery, computeCodeChallenge, computeThreeWayDiff, computeTransformSavings, decryptString, deprecateRelease, deriveKeyFromSlotValue, encryptString, exchangeAuthCode, exchangePkce, executeRequest, exportKey, extractContext, fetchOAuth2Token, findPathPlaceholders, generateAesKey, generateCodeVerifier, generateSlotSalt, generateSpanId, generateTraceParent, generateWorkingBranchName, getBodyTypeForContentType, getContentTypeForBodyType, getHeaderEntry, getHeaderValues, getLanguageFromBodyType, getLanguageFromContentType, getVariableAutocomplete, hasUnpushedChanges, importApicircleFolderInto, importKey, isApicircleEnvironment, isDesktop, isInsomniaExport, isPostmanEnvironment, isPostmanV2Collection, isValidSemver, lookup, mergeWithAutoHeaders, normalizeContentType, parseApicircleEnvironment, parseApicircleEnvironmentDoc, parseCurl, parseDigestChallenge, parseGraphqlSchema, parseInsomniaCollection, parseNtlmType2Challenge, parsePostmanCollection, parsePostmanEnvironment, parseSemver, parseUrlQuery, parseWorkspaceJson, pollDeviceFlow, preSendValidation, previewLinkedUpdate, publishRelease, readJsonPath, redactForGit, refreshToken, requestDeviceAuthorization, requestRunToExecutionResult, resolveInheritedAuth, resolvePlanRef, resolveString, resolveStringMap, runAssertions, runClientCredentials, runPlan, runRopc, serializePayload, serializeWorkspaceForGit, signJwt, slugify, sortVersionsDesc, suggestHeaders, summarizeUnpushedChanges, supportedContentTypeLanguageMap, toCsv, toToon, toYaml, tokenizeCurl, tryParsePayload, validateBranchName, yankRelease };
|
|
2134
|
+
export { ANONYMOUS_ACTOR, type ApplyMutationOptions, type ApplyMutationResult, type AssertionResult, type AttachmentResolver, type AttachmentSlotRef, type AuthApplyOptions, type AuthApplyResult, type AuthApplyTarget, type AuthApplyWarning, type AuthCodeExchangeArgs, type AutoHeaderOverrides, type BranchNameOptions, type BuildDigestArgs, type BuildNtlmType3Args, type BuildRequestOptions, type BuiltRequest, type ClientCredentialsArgs, type ConflictResolution, type HeaderEntry$1 as ContentTypeHeaderEntry, type ContextExtractionResult, DESKTOP_APP_ORIGIN, type DeviceAuthorizationArgs, type DeviceAuthorizationResponse, type DiffEntry, type DiffStatus, type DigestChallenge, EMPTY_UNPUSHED_SUMMARY, type EncryptedBindingHint, type EncryptedPayload, type EntityBucket, type ExecuteOptions, type ExecutionResult, type FetchOAuth2TokenArgs, type GraphQLField, type GraphQLSchemaInfo, HTTP_HEADERS_MAP, type HawkSignArgs, type HeaderEntry, type HeaderSuggestionMode, type ImportApicircleFolderResult, type ImportedFolder, type ImportedRequest, type JwtAlgorithm, type JwtSignArgs, type ApplyArgs as LinkedApplyArgs, type ApplyResult as LinkedApplyResult, type PreviewArgs as LinkedPreviewArgs, type LinkedUpdateBucket, type LinkedUpdateEntry, type LinkedUpdatePreview, type LinkedUpdateResolutionMap, type LinkedUpdateStatus, type LinkedWorkspaceProbe, type MonacoLanguage, type NtlmType2Challenge, type OAuth2ErrorResponse, OAuth2TokenError, type OAuth2TokenResponse, type ParsedApicircleEnvironment, ParsedApicircleFolderExport, type ParsedCurl, type ParsedPostmanCollection, type ParsedPostmanEnvironment, type ParsedVersion, type PkceExchangeArgs, type PkceMethod, type PlanRunAuthorizationContext, PlanRunDeniedError, type PlanStepResult, type PollDeviceFlowArgs, type PreSendBlocker, type PreSendValidationInput, type PreSendValidationResult, type PreSendWarning, type PublishReleaseArgs, REGISTRY_JSON_PATH, type RefreshTokenArgs, RemoteWorkspaceParseError, type ResolutionMap, type ResolutionScope, type ResolveInheritedAuthArgs, type ResolvePlanRefResult, type ResolveRequestArgs, type ResolveResult, type ResolvedRequestResult, type RopcArgs, type RunActor, type RunPlanOptions, type RunPlanResult, type SecretCrypto, type SigV4SignArgs, type SigV4SignResult, TRANSFORM_FORMAT_LABELS, type ThreeWayDiff, type TransformCandidate, type TransformFormat, type TransformSavings, type UnpushedChange, type UnpushedSummary, type VariableSource, type VariableSuggestion, WORKSPACE_DIR, WorkspacePatch, WorkspaceState, appendReleaseEntry, applyAuth, applyAwsSigV4, applyContentTypeForBodyType, applyLinkedEnvironmentOverrides, applyLinkedUpdate, applyMerge, applyMutation, applyPathParams, assertNoPlaintextCredentials, attachmentPath, attachmentsDir, buildAuthorizeUrl, buildAutoHeaders, buildDigestAuthHeader, buildHawkAuthHeader, buildLinkedSnapshot, buildNtlmType1Negotiate, buildNtlmType3Authenticate, buildReleaseEntry, buildRequest, buildScope, collectAttachmentSlots, collectVariableSuggestions, compareSemver, composeBody, composeCookieHeader, composeHeaders, composeUrl, composeUrlWithQuery, computeCodeChallenge, computeRequestOverridePatch, computeThreeWayDiff, computeTransformSavings, decryptString, deprecateRelease, deriveKeyFromSlotValue, encryptString, exchangeAuthCode, exchangePkce, executeRequest, exportKey, extractContext, fetchOAuth2Token, fetchRemoteWorkspaceJson, findPathPlaceholders, generateAesKey, generateCodeVerifier, generateSlotSalt, generateSpanId, generateTraceParent, generateWorkingBranchName, getBodyTypeForContentType, getContentTypeForBodyType, getHeaderEntry, getHeaderValues, getLanguageFromBodyType, getLanguageFromContentType, getVariableAutocomplete, hasUnpushedChanges, importApicircleFolderInto, importKey, initSecretCrypto, isApicircleEnvironment, isDesktop, isEmptyOverridePatch, isInsomniaExport, isPostmanEnvironment, isPostmanV2Collection, isValidSemver, ledgerFromProbe, lookup, mergeRequestOverride, mergeWithAutoHeaders, normalizeContentType, parseApicircleEnvironment, parseApicircleEnvironmentDoc, parseCurl, parseDigestChallenge, parseGraphqlSchema, parseInsomniaCollection, parseLinkedWorkspaceJson, parseNtlmType2Challenge, parsePostmanCollection, parsePostmanEnvironment, parseRegistryActiveId, parseSemver, parseUrlQuery, parseWorkspaceJson, plaintextEnvMap, pollDeviceFlow, preSendValidation, previewLinkedUpdate, publishRelease, readJsonPath, redactForGit, refreshToken, requestDeviceAuthorization, requestRunToExecutionResult, resolveInheritedAuth, resolvePlanRef, resolveRequestForExecution, resolveString, resolveStringMap, runAssertions, runClientCredentials, runPlan, runRopc, serializePayload, serializeWorkspaceForGit, signJwt, slugify, sortVersionsDesc, suggestHeaders, summarizeUnpushedChanges, supportedContentTypeLanguageMap, toCsv, toToon, toYaml, tokenizeCurl, tryParsePayload, unlockSecretCrypto, validateBranchName, workspaceJsonPath, yankRelease };
|