@bluestep-systems/b6p-core 1.1.0 → 1.3.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 +199 -55
- package/dist/B6PCore.d.ts +22 -0
- package/dist/B6PCore.js +60 -8
- package/dist/B6PCore.js.map +1 -1
- package/dist/Err.d.ts +40 -0
- package/dist/Err.js +58 -0
- package/dist/Err.js.map +1 -1
- package/dist/cache/GitCredentialHosts.d.ts +46 -0
- package/dist/cache/GitCredentialHosts.js +90 -0
- package/dist/cache/GitCredentialHosts.js.map +1 -0
- package/dist/cache/GitCredentialResets.d.ts +89 -0
- package/dist/cache/GitCredentialResets.js +119 -0
- package/dist/cache/GitCredentialResets.js.map +1 -0
- package/dist/constants/Gateway.d.ts +1 -0
- package/dist/constants/Gateway.js +1 -0
- package/dist/constants/Gateway.js.map +1 -1
- package/dist/constants/GitCredential.d.ts +19 -0
- package/dist/constants/GitCredential.js +24 -0
- package/dist/constants/GitCredential.js.map +1 -0
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +3 -1
- package/dist/constants/index.js.map +1 -1
- package/dist/gateway/GatewayClient.d.ts +32 -0
- package/dist/gateway/GatewayClient.js +21 -2
- package/dist/gateway/GatewayClient.js.map +1 -1
- package/dist/gateway/GatewayKb.d.ts +56 -1
- package/dist/gateway/GatewayKb.js +205 -0
- package/dist/gateway/GatewayKb.js.map +1 -1
- package/dist/gitCredential/GitConfigRunner.d.ts +97 -0
- package/dist/gitCredential/GitConfigRunner.js +244 -0
- package/dist/gitCredential/GitConfigRunner.js.map +1 -0
- package/dist/gitCredential/GitCredentialContext.d.ts +39 -0
- package/dist/gitCredential/GitCredentialContext.js +3 -0
- package/dist/gitCredential/GitCredentialContext.js.map +1 -0
- package/dist/gitCredential/GitCredentialService.d.ts +390 -0
- package/dist/gitCredential/GitCredentialService.js +594 -0
- package/dist/gitCredential/GitCredentialService.js.map +1 -0
- package/dist/gitCredential/configFile.d.ts +71 -0
- package/dist/gitCredential/configFile.js +289 -0
- package/dist/gitCredential/configFile.js.map +1 -0
- package/dist/gitCredential/credentialConfig.d.ts +146 -0
- package/dist/gitCredential/credentialConfig.js +523 -0
- package/dist/gitCredential/credentialConfig.js.map +1 -0
- package/dist/gitCredential/hosts.d.ts +17 -0
- package/dist/gitCredential/hosts.js +44 -0
- package/dist/gitCredential/hosts.js.map +1 -0
- package/dist/index.d.ts +16 -3
- package/dist/index.js +34 -2
- package/dist/index.js.map +1 -1
- package/dist/persistence/PersistenceKeys.d.ts +12 -1
- package/dist/persistence/PersistenceKeys.js +11 -0
- package/dist/persistence/PersistenceKeys.js.map +1 -1
- package/dist/persistence/SharedFilePersistence.d.ts +30 -11
- package/dist/persistence/SharedFilePersistence.js +66 -13
- package/dist/persistence/SharedFilePersistence.js.map +1 -1
- package/dist/persistence/exitCleanup.d.ts +37 -0
- package/dist/persistence/exitCleanup.js +142 -0
- package/dist/persistence/exitCleanup.js.map +1 -0
- package/dist/persistence/fileLock.d.ts +57 -0
- package/dist/persistence/fileLock.js +252 -0
- package/dist/persistence/fileLock.js.map +1 -0
- package/dist/persistence/lockedMutation.d.ts +26 -0
- package/dist/persistence/lockedMutation.js +45 -0
- package/dist/persistence/lockedMutation.js.map +1 -0
- package/dist/providers.d.ts +15 -0
- package/dist/script/ScriptContext.d.ts +7 -0
- package/dist/script/ScriptService.d.ts +6 -0
- package/dist/script/ScriptService.js +14 -0
- package/dist/script/ScriptService.js.map +1 -1
- package/dist/testing/FakeGateway.d.ts +24 -0
- package/dist/testing/FakeGateway.js +176 -0
- package/dist/testing/FakeGateway.js.map +1 -1
- package/dist/types.d.ts +95 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -58,32 +58,36 @@ beside it rather than onto `B6PCore` itself.
|
|
|
58
58
|
`core.script` ([`ScriptService`](src/script/ScriptService.ts)) — everything that moves a script tree
|
|
59
59
|
between the local filesystem and the platform (the draft over git, `declarations/` over WebDAV):
|
|
60
60
|
|
|
61
|
-
| Method
|
|
62
|
-
|
|
|
61
|
+
| Method | Purpose |
|
|
62
|
+
| ---------------------- | ---------------------------------------------------------------------- |
|
|
63
63
|
| `push` / `pushCurrent` | Commit and push the draft folder (optionally publish it as a snapshot) |
|
|
64
|
-
| `pull` / `pullCurrent` | Clone or fast-forward the draft into a workspace
|
|
65
|
-
| `audit` / `auditPull`
|
|
66
|
-
| `deploy`
|
|
67
|
-
| `getSetupUrl`
|
|
68
|
-
| `deriveWorkspacePath`
|
|
69
|
-
| `getFactory`
|
|
64
|
+
| `pull` / `pullCurrent` | Clone or fast-forward the draft into a workspace |
|
|
65
|
+
| `audit` / `auditPull` | Compare local vs. server; optionally pull differences |
|
|
66
|
+
| `deploy` | Multi-target deploy driven by a config file |
|
|
67
|
+
| `getSetupUrl` | Resolve a pulled script's web-UI setup page |
|
|
68
|
+
| `deriveWorkspacePath` | Recover the workspace folder from a path inside a script root |
|
|
69
|
+
| `getFactory` | The `ScriptFactory` for entering the script tree from a bare path |
|
|
70
70
|
|
|
71
71
|
`core.schema` ([`SchemaService`](src/schema/SchemaService.ts)) — declarative schema apply against one org
|
|
72
72
|
(super users only; every method takes any URL on the org):
|
|
73
73
|
|
|
74
|
-
| Method
|
|
75
|
-
|
|
|
76
|
-
| `generate`
|
|
77
|
-
| `recipe`
|
|
78
|
-
| `test`
|
|
79
|
-
| `apply`
|
|
80
|
-
| `testThenApply` | `test`, ask `confirm` with the result, then `apply` with the same manifest and key
|
|
74
|
+
| Method | Purpose |
|
|
75
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------------ |
|
|
76
|
+
| `generate` | The manifest (YAML) describing the named objects as they stand, optionally `closure` / `portable` |
|
|
77
|
+
| `recipe` | Run a recipe (`LINK_VIEW_GRANTS`): its manifest plus the findings it met |
|
|
78
|
+
| `test` | Dry-run a manifest as the caller: the plan, any refusals, and a one-use key when it passes (`verbose` adds same-name warnings) |
|
|
79
|
+
| `apply` | Apply the plan a `test` approved: the same manifest string and its key; never retried |
|
|
80
|
+
| `testThenApply` | `test`, ask `confirm` with the result, then `apply` with the same manifest and key |
|
|
81
81
|
|
|
82
82
|
`core.gateway` ([`GatewayService`](src/gateway/GatewayService.ts)) — web-global's gateway
|
|
83
83
|
(`https://gateway.bluestep.net`), the origin for knowledge bases and marketplace repos. It
|
|
84
84
|
holds the HTTP client, the git layer, `core.gateway.kb` (knowledge bases), `core.gateway.marketplace`
|
|
85
85
|
and `core.gateway.tokens` for managing the caller's own access tokens; see [Gateway](#gateway) below.
|
|
86
86
|
|
|
87
|
+
`core.gitCredential` ([`GitCredentialService`](src/gitCredential/GitCredentialService.ts)) — b6p as git's
|
|
88
|
+
credential helper, so plain `git fetch`, `pull` and `push` use the stored token; see
|
|
89
|
+
[git's credential helper](#gits-credential-helper) below.
|
|
90
|
+
|
|
87
91
|
`core` itself — cross-cutting state that is not specific to any one subsystem:
|
|
88
92
|
|
|
89
93
|
| Method | Purpose |
|
|
@@ -120,7 +124,7 @@ written over WebDAV any more (only `declarations/` and the root `.gitignore` sti
|
|
|
120
124
|
auto-confirm declines and the pull returns `null`) unless `enableGit: true` is passed. After the switch the script's
|
|
121
125
|
draft and snapshot refuse WebDAV writes.
|
|
122
126
|
- **The commit author is never invented.** It is the `author` option of `push`/`pushCurrent`/`deploy`, else `git config
|
|
123
|
-
|
|
127
|
+
user.name`/`user.email` for the draft folder (global config included), else `GIT_AUTHOR_NAME`/`GIT_AUTHOR_EMAIL`
|
|
124
128
|
(then `GIT_COMMITTER_*`) from the environment, else a `GitIdentityError` before the platform is touched.
|
|
125
129
|
- `B6PProviders.gitFs` (default `node:fs`) is the Node-style file system git works on; it must read and write the same
|
|
126
130
|
disk as the `fs` provider.
|
|
@@ -130,26 +134,26 @@ written over WebDAV any more (only `declarations/` and the root `.gitignore` sti
|
|
|
130
134
|
`push` / `pushCurrent` resolve to a [`PushResult`](src/script/push.ts) (or `null` when no target was
|
|
131
135
|
given). Read `pushed` first: `false` means nothing was pushed.
|
|
132
136
|
|
|
133
|
-
| Field
|
|
134
|
-
|
|
|
135
|
-
| `pushed`
|
|
136
|
-
| `commitSha`
|
|
137
|
-
| `route`
|
|
138
|
-
| `snapshotRefused`
|
|
139
|
-
| `build`
|
|
140
|
-
| `buildCommitSha`
|
|
141
|
-
| `buildFastForward`
|
|
142
|
-
| `buildIncomplete`
|
|
143
|
-
| `buildVouched`
|
|
144
|
-
| `buildError` / `buildErrorKind`
|
|
145
|
-
| `publishedSha`
|
|
146
|
-
| `publishError` / `publishRefusal` | Why the platform refused or failed the publish (the draft stays pushed), and the structured `{ reason, withheld }` (`BUILD_STALE`, `BUILD_MANIFEST_MISSING`, `DRAFT_MOVED`, `ENTRYPOINT_MISSING`, …)
|
|
147
|
-
| `switchedToGit`
|
|
148
|
-
| `typeCheckDiagnostics`
|
|
149
|
-
| `typeCheckErrors`
|
|
150
|
-
| `liveVerified`
|
|
151
|
-
| `liveMismatches`
|
|
152
|
-
| `keptPlatformOnly`
|
|
137
|
+
| Field | Meaning |
|
|
138
|
+
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
139
|
+
| `pushed` | The draft is on the platform. `false` when the draft folder is missing or empty |
|
|
140
|
+
| `commitSha` | The draft commit this push made, or the one already there; `null` when `pushed` is `false` |
|
|
141
|
+
| `route` | Which route ran: `{ mode: "server-build" \| "push-only", reason, serverVersion, required }`, `reason` one of `dev`, `at-or-above-floor`, `below-floor`, `unknown`, `floor-unset`. `null` when the push stopped before asking |
|
|
142
|
+
| `snapshotRefused` | Set when a snapshot was asked for on a server that does not build git drafts: `{ reason: "too-old" \| "unknown" \| "floor-unset", serverVersion, required }`. The draft was pushed; nothing was built or published |
|
|
143
|
+
| `build` | The platform's compile of the pushed draft (`compileDraft`): `status` (`COMPILED`, `GATE_TRIPPED`, `EMIT_WITHHELD`, `NOTHING_TO_COMPILE`, `SKIPPED_EXTERNALLY_BUILT`, …, or `UNKNOWN` with `rawStatus`), `errors` / `warnings`, `diagnostics` (+ `diagnosticsOmitted`), `gate`. `null` when no build ran or the request failed |
|
|
144
|
+
| `buildCommitSha` | The platform's build commit (output, and the manifest when it vouched); the folder was moved to it unless `buildFastForward` says otherwise. `null` when it made none (already built, nothing to build) |
|
|
145
|
+
| `buildFastForward` | How the folder was moved to the build: `{ state, blockedPaths, error }`, `state` `fast-forwarded`, `unchanged`, `blocked` (local files the build changes match neither side, listed; nothing was changed, nothing published) or `failed`. `null` when no build answer came |
|
|
146
|
+
| `buildIncomplete` | The build ended in a status after which the draft does not publish (`BUSY` / `INPUT_INCOMPLETE` once retries ran out, `COMPILER_UNAVAILABLE`, `NOT_PERMITTED`, `WRITE_FAILED`, `OUTPUT_UPLOAD`, `SKIPPED_GIT_MANAGED`, `GATE_TRIPPED`, `EMIT_WITHHELD`, `UNKNOWN`): `{ status, rawStatus, description }`. `null` otherwise |
|
|
147
|
+
| `buildVouched` | `true`: the build is clean and its manifest committed, or the draft needs none (externally built, nothing to build). `false`: unclean, output committed without a manifest, so a publish is refused until it builds cleanly. `null`: no build ran |
|
|
148
|
+
| `buildError` / `buildErrorKind` | Why no build answer came after a successful push, and whether a build was `not-requested` (the platform's draft was no longer the pushed commit) or the `request-failed` (it may have run); otherwise `null` |
|
|
149
|
+
| `publishedSha` | The commit the platform published on a snapshot push (the build commit); `null` on a plain push, when nothing was published, or on a failed publish. A caller that asked for a snapshot treats `null` as a failure |
|
|
150
|
+
| `publishError` / `publishRefusal` | Why the platform refused or failed the publish (the draft stays pushed), and the structured `{ reason, withheld }` (`BUILD_STALE`, `BUILD_MANIFEST_MISSING`, `DRAFT_MOVED`, `ENTRYPOINT_MISSING`, …) |
|
|
151
|
+
| `switchedToGit` | This push switched a WebDAV script to git, which cannot be undone |
|
|
152
|
+
| `typeCheckDiagnostics` | The platform build's whole count of `ERROR` and `WARNING` diagnostics; `null` when no build ran |
|
|
153
|
+
| `typeCheckErrors` | Those in the script's own sources (never a `.d.ts`), as listed by the platform, which lists at most 20: `{ file, line, column, code, message, severity }`, a type-checker finding being a `WARNING`. Empty when none or no build ran |
|
|
154
|
+
| `liveVerified` | `true`: the platform's `master` is at `publishedSha`. `false`: it is at another commit. `null`: not proven either way |
|
|
155
|
+
| `liveMismatches` | Draft-relative paths that differ between `publishedSha` and `master` when `liveVerified` is `false` |
|
|
156
|
+
| `keptPlatformOnly` | Platform-only files kept because deleting them was not confirmed (they are part of the pushed commit) |
|
|
153
157
|
|
|
154
158
|
### How a push builds (since 1.0.0)
|
|
155
159
|
|
|
@@ -223,25 +227,27 @@ const headers = await core.gateway.client.authHeadersFor(gitUrl); // for a git c
|
|
|
223
227
|
|
|
224
228
|
Failures are typed, all extending `Err.GatewayError` (`status`, `code`):
|
|
225
229
|
|
|
226
|
-
| Error
|
|
227
|
-
|
|
|
228
|
-
| `GatewayAuthError` (`reason`)
|
|
229
|
-
| `GatewayScopeError` (`scope`)
|
|
230
|
-
| `GatewayNotPermittedError`
|
|
231
|
-
| `GatewayNotFoundError`
|
|
232
|
-
| `GatewayScopeEscalationError`
|
|
233
|
-
| `GatewayConflictError`
|
|
234
|
-
| `GatewayAliasTakenError`
|
|
235
|
-
| `GatewayTooLargeError`
|
|
236
|
-
| `GatewayUnavailableError`
|
|
237
|
-
| `GatewayUnexpectedResponseError`
|
|
238
|
-
| `GatewayConfigError`
|
|
239
|
-
| `GatewayDirtyWorkingTreeError` (`paths`)
|
|
240
|
-
| `GatewayCloneMismatchError` (`reason`, `dir`, `repo`)
|
|
241
|
-
| `GatewayKnowledgeBaseError` (`reason`, `ref`, `candidates`)
|
|
242
|
-
| `
|
|
243
|
-
| `
|
|
244
|
-
| `
|
|
230
|
+
| Error | When |
|
|
231
|
+
| --------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
232
|
+
| `GatewayAuthError` (`reason`) | `token-missing` (none stored; thrown before sending), `token-invalid` (401), `token-malformed` (not a `b6pt_` token; nothing sent) |
|
|
233
|
+
| `GatewayScopeError` (`scope`) | `403 scope-missing` |
|
|
234
|
+
| `GatewayNotPermittedError` | `403 not-permitted` |
|
|
235
|
+
| `GatewayNotFoundError` | `404` (also for something that exists but is not visible) |
|
|
236
|
+
| `GatewayScopeEscalationError` | `403 scope-escalation` (a new token asked for a scope the presenting one lacks) |
|
|
237
|
+
| `GatewayConflictError` | `409 non-fast-forward` |
|
|
238
|
+
| `GatewayAliasTakenError` | `409 alias-taken` |
|
|
239
|
+
| `GatewayTooLargeError` | `413 too-large` |
|
|
240
|
+
| `GatewayUnavailableError` | `502`/`503`/`504`, a network failure or a timeout |
|
|
241
|
+
| `GatewayUnexpectedResponseError` | any other status, a redirect (`code: "redirect-refused"`, not followed), or a 2xx body that is not JSON |
|
|
242
|
+
| `GatewayConfigError` | an unusable `gatewayUrl`, or a URL or request path that resolves off the gateway's origin |
|
|
243
|
+
| `GatewayDirtyWorkingTreeError` (`paths`) | a pull would overwrite local changes (git layer) |
|
|
244
|
+
| `GatewayCloneMismatchError` (`reason`, `dir`, `repo`) | a marketplace pull found a clone it must not update: `different-repo`, `different-ref`, `tag-moved` (the tag now names another commit) or `tag-gone` (the gateway no longer has it) |
|
|
245
|
+
| `GatewayKnowledgeBaseError` (`reason`, `ref`, `candidates`) | a knowledge base address is `bad-ref`, `not-found`, `ambiguous`, `unsafe-name`, `wrong-branch` (a pull or push from a clone that is detached, off the live branch, or not tracking it; fields `branch`, `liveBranch`, `upstream`), or a clone is `not-a-kb` |
|
|
246
|
+
| `GatewayPreconditionFailedError` / `GatewayPreconditionRequiredError` | a knowledge-base change whose `If-Match` is stale (`412`) or missing (`428`) |
|
|
247
|
+
| `GatewayAccessRefusedError` | `400` on a create or change that named `access` (a `GatewayInvalidRequestError`) |
|
|
248
|
+
| `GatewayKnowledgeBasePushNotPermittedError` (`ref`) | a push to a KB whose listing says `canPush: false` (a `GatewayNotPermittedError`) |
|
|
249
|
+
| `GatewayInvalidArgumentError` | refused before sending: an empty alias or scope list, an expiry that is not a date, a pasted `b6pt_` secret where an id or alias belongs (token operations), or a relative path with no absolute `cwd` to resolve it against (core never reads `process.cwd()`) |
|
|
250
|
+
| `GatewayWorkingCopyError` (`reason`) | the local folder cannot be used: `not-empty`, `not-a-clone`, `detached`, `no-upstream`, `diverged`, `ref-not-found`, `unsafe-target` (git layer), `wrong-repository` (knowledge-base pull) |
|
|
245
251
|
|
|
246
252
|
`core.gateway.client.sequence((seq) => …)` runs a unit as one queue entry: nothing else on the
|
|
247
253
|
client runs until it settles. `seq.token()` reads the token once, and `seq.request` presents that
|
|
@@ -397,12 +403,150 @@ const pushed = await core.gateway.kb.push(pulled.dir); // { pushed, commit, ref
|
|
|
397
403
|
`canPush: false` before sending anything, with `GatewayKnowledgeBasePushNotPermittedError` (`ref`).
|
|
398
404
|
A clone not on the KB's live branch, not tracking it, or detached is refused the same way with `GatewayKnowledgeBaseError` (`wrong-branch`, `branch`, `liveBranch`). A gateway branch that moved on is `GatewayConflictError`.
|
|
399
405
|
|
|
406
|
+
**Managing global knowledge bases** (scopes: `create` and `update` need `kb:manage`; `detail` and `read` need `kb:read`, as the gateway's content read does for a private knowledge base). Nothing here prompts:
|
|
407
|
+
the consumer confirms, and words the confirmation from the `kb` that `read` returns (its `name`, `access`).
|
|
408
|
+
|
|
409
|
+
```typescript
|
|
410
|
+
const made = await core.gateway.kb.create({ name: "docs", title: "Docs", access: { kind: "public" } }); // access, title, liveBranch optional
|
|
411
|
+
const { kb, etag } = await core.gateway.kb.read("docs"); // name -> id, then GET /{id}; kb.id, kb.name, kb.access
|
|
412
|
+
const changed = await core.gateway.kb.update(kb.id, etag, { title: "Docs", access: { kind: "private" } }); // ONE PATCH with If-Match
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
- `create` (`POST`) sends only the fields given, so the gateway's defaults apply (title = name, live branch
|
|
416
|
+
`main`, private). `detail(id)` (`GET /{id}`) returns `{ kb, etag }`; `update(id, etag, changes)` (`PATCH`)
|
|
417
|
+
sends every given field in one request with `If-Match: etag`, and `access` only when given.
|
|
418
|
+
- `access` is `{ kind: "public" } | { kind: "private" } | { kind: "unknown", rawKind, raw }`, matched exactly
|
|
419
|
+
(`"Public"` is unknown). An `unknown` access (a kind newer than this core) must be treated as private; it is
|
|
420
|
+
never sent back: `create`/`update` refuse it, and any access with a key beyond `kind` (a permission object, say), with `GatewayInvalidArgumentError` before sending. `detail`, `update` and `read` also refuse an id or ref that contains `b6pt_` (taken for a pasted token) before any request or message. `access` is
|
|
421
|
+
absent from a detail or listing entry when the gateway did not report one. Making a knowledge base public
|
|
422
|
+
makes every commit reachable from its live branch, files since deleted included, readable by anyone.
|
|
423
|
+
- Errors: `412` is `GatewayPreconditionFailedError` (changed since read; read again), `428`
|
|
424
|
+
`GatewayPreconditionRequiredError`, a missing scope is `GatewayScopeError` (`scope`: `kb:manage` for a write, `kb:read` for a read), a `400` on a request
|
|
425
|
+
that named `access` is `GatewayAccessRefusedError` (an older gateway; a `GatewayInvalidRequestError`), a taken
|
|
426
|
+
name is `GatewayConflictError` (`code` `name-taken`).
|
|
427
|
+
- `client.requestDetailed(method, path, options)` is `request` plus the status and the `ETag` header.
|
|
428
|
+
|
|
400
429
|
For specs, [`FakeGateway`](src/testing/FakeGateway.ts) is an in-process gateway on `127.0.0.1` that
|
|
401
430
|
answers the contract's REST routes (the token routes included) and error codes, with `grantToken`
|
|
402
431
|
(scopes, plus optional id, alias, owner and expiry; an expired token is `401 token-invalid`),
|
|
403
432
|
`issuedTokens`, `issuedSecrets` (every secret ever accepted, revoked ones included, for leak
|
|
404
433
|
checks), `failNext` and `route` (for mounting git smart-HTTP handlers).
|
|
405
434
|
|
|
435
|
+
### git's credential helper
|
|
436
|
+
|
|
437
|
+
`core.gitCredential` ([`GitCredentialService`](src/gitCredential/GitCredentialService.ts)) lets plain `git` in a
|
|
438
|
+
knowledge-base clone (the gateway) or a script's `draft/` folder (a tenant's git proxy) use the stored `b6pt_`
|
|
439
|
+
token without asking, the way `gh auth setup-git` does for github.com. Both git proxies take the token as the Basic
|
|
440
|
+
password, so git needs nothing else: no CSRF token and no session.
|
|
441
|
+
|
|
442
|
+
Plain `git pull` and `git push` then work in knowledge bases and in script drafts. A plain push in a draft lands the
|
|
443
|
+
commit on the platform's draft branch but does not build or publish it: the platform's build and a snapshot publish
|
|
444
|
+
still take `core.script.push` (the CLI's `b6p script push` or publish), which is unchanged.
|
|
445
|
+
|
|
446
|
+
```ts
|
|
447
|
+
// git runs `<helper> get|store|erase` with the request on stdin; the consumer passes it through:
|
|
448
|
+
process.stdout.write(await core.gitCredential.answer(action, stdinText)); // then exit 0
|
|
449
|
+
|
|
450
|
+
await core.gitCredential.allowedHosts(); // [{ host: "gateway.bluestep.net", source: "gateway" }, { host, source: "script-pull" }]
|
|
451
|
+
await core.gitCredential.setupStatus({ cwd }); // { hosts: [{ host, source, configured, alsoAsked, others }], configured, otherHelpers, scope }
|
|
452
|
+
await core.gitCredential.cloneStatus(cloneDir); // that clone's remote host, read with the clone's own config; null off the list
|
|
453
|
+
await core.gitCredential.setupGit(); // per allowed host: credential.https://<host>.helper = "" then = !b6p auth git-credential; also keptResets
|
|
454
|
+
await core.gitCredential.removeGit(); // { removed, keptResets: [{ url, file, reason }] }: takes those entries out again
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
- **What it answers for.** `get` answers `username=b6p` and `password=<token>` only for `protocol=https` and a host
|
|
458
|
+
exactly on the allowlist (`host[:port]`, the port only when not 443): the configured gateway's host when it is https,
|
|
459
|
+
and every tenant host a `core.script.pull` reached through its git proxy with the token
|
|
460
|
+
([`GitCredentialHosts`](src/cache/GitCredentialHosts.ts), recorded after the git half of the pull succeeds). No host
|
|
461
|
+
rule such as `*.bluestep.net` is assumed. A lookalike host, another port, http, a request naming another username
|
|
462
|
+
or carrying a `url=` (git never sends one to a helper) gets an empty answer, so git asks its other helpers.
|
|
463
|
+
- **`store` and `erase` do nothing.** The token enters only through the consumer's sign-in. git sends `erase` after
|
|
464
|
+
any 401, and one tenant refusing the token (or an outage answered with a 401) must not sign b6p out everywhere.
|
|
465
|
+
- **git 2.27 or later; 2.42 or later for setup.** Status, `cloneStatus` and removal refuse an older git
|
|
466
|
+
(`git --version`), because the partial-URL fallback their matching follows arrived in git 2.27.0 (git 2.26 ignores
|
|
467
|
+
a pattern such as `https://`, so the same config means something else there). Setup also needs
|
|
468
|
+
`git var GIT_CONFIG_GLOBAL` (git 2.42.0). Both fail as `Err.GitCredentialSetupError`.
|
|
469
|
+
- **Setup resets, like gh.** For each allowed host it appends a new `[credential "https://<host>"]` section holding
|
|
470
|
+
an empty `helper =` (git's reset, so no earlier helper such as `store` or `cache` answers that host or is told to
|
|
471
|
+
keep the token) and then `helper =` b6p's command, to the file git itself reports `git config --global` writes
|
|
472
|
+
(`git var GIT_CONFIG_GLOBAL`, chosen by git's own rule; never worked out from `HOME` or `USERPROFILE`, which Git
|
|
473
|
+
for Windows does not always use; a relative `GIT_CONFIG_GLOBAL` is resolved against the process's directory, once,
|
|
474
|
+
for every read, edit and record). The pair is written in one edit under git's own lock on that file
|
|
475
|
+
(`<file>.lock`, created exclusively and owner-only, set to the file's mode as read under the lock, and renamed over
|
|
476
|
+
the file, as every git writer does; a
|
|
477
|
+
symlink is followed to its target, even a missing one, as git's `resolve_symlink` does, so it stays a link). The
|
|
478
|
+
file never holds one line without the other, and no other git writer's change lands in between. The file is edited
|
|
479
|
+
as bytes, so a value that is not UTF-8 is kept exactly; a last value continued with a trailing `\` is ended with an
|
|
480
|
+
empty line first; and setup refuses an edit that would change any entry git already reads there. A host already
|
|
481
|
+
set up in the system and global config is left alone, so a second run changes nothing; otherwise b6p's own entries
|
|
482
|
+
and pair for it are taken out first, so neither line is ever doubled. A tenant recorded later needs another run.
|
|
483
|
+
- **Status follows git's credential contexts exactly.** `setupStatus()` works out, per host, every entry git 2.53
|
|
484
|
+
applies to it (`credentialContextMatch`, from git's `credential.c` and `urlmatch.c`): every matching entry in config
|
|
485
|
+
order, resets included, not only the most specific. A pattern git can normalize matches by scheme and host
|
|
486
|
+
case-insensitively, a whole `*` label matching any one label, by port with leading zeros dropped and `:443` the same
|
|
487
|
+
as none, by the user when it names one, and by path prefix (escapes normalized, dot segments resolved). Any other
|
|
488
|
+
pattern (no scheme, a `%` in the host, port 0, `https://` with no host at all, or an empty subsection,
|
|
489
|
+
`[credential ""]`) is matched as git's partial-URL fallback does: only the parts it names, percent-decoded, compared
|
|
490
|
+
exactly, so `https://` and `""` apply to every https request. A pattern naming any user (`https://alice@<host>`)
|
|
491
|
+
is `maybe` for its host: a remote URL naming that user brings its helper in, and one that answers `username=b6p`
|
|
492
|
+
makes git ask b6p next, which answers, and git then hands the token to that helper on `store`. Each entry is
|
|
493
|
+
`yes` (every request b6p answers for the host), `no` or `maybe` (only some: a path, the `b6p` user, a partial
|
|
494
|
+
pattern's host spelling). In doubt, another helper counts as asked, and a reset or b6p's own entry as not applying
|
|
495
|
+
when it would hide one, so `configured` is true only when git certainly asks b6p alone; setup repairs any host
|
|
496
|
+
that is not. `alsoAsked` lists the other helpers and `others` the config entries responsible (key, value, file,
|
|
497
|
+
`null` for the command line). Setup never moves or deletes the user's entries, so the consumer tells the user to
|
|
498
|
+
move such an entry before b6p's section or remove it. `otherHelpers` lists the generic helpers.
|
|
499
|
+
- **Which config status reads.** The config in effect where it runs (`{ cwd }`, default the process's directory):
|
|
500
|
+
system, `~/.gitconfig`, `$XDG_CONFIG_HOME/git/config`, the command line and `GIT_CONFIG_COUNT`, and inside a
|
|
501
|
+
repository its local and worktree config, with every file they `[include]` (`git config --includes --show-scope
|
|
502
|
+
--show-origin`). `scope` says which: `"global"` outside any repository, `"global+here"` inside one. **No status
|
|
503
|
+
covers another repository's own config**: a helper set in some other clone's `.git/config`, or in a file an
|
|
504
|
+
`includeIf` reads only there, is seen only from that clone. So an `includeIf` after b6p's pair counts as a helper
|
|
505
|
+
that may be asked (`configured: false`, the entry in `others`), and setup repairs it by appending the pair after it.
|
|
506
|
+
`cloneStatus(dir, { remote })` answers for one clone: the host of its remote (`origin` by default), read with that
|
|
507
|
+
clone's config, or `null` when the remote's host is not an allowed one; the remote's URL is never in the result.
|
|
508
|
+
A consumer calls it after a knowledge-base or script pull to warn that git there would ask another helper too.
|
|
509
|
+
Setup and removal change only the global files.
|
|
510
|
+
- **b6p removes only pairs that are certainly its own.** Each pair setup writes is recorded in public state
|
|
511
|
+
`b6p:git_credential_resets` as `{ "<file>": { "<exact key>": { state, helper, pairsBefore? } } }`, `adding` (with how
|
|
512
|
+
many reset-then-helper pairs the key had in the file, counted as git sees them) before the edit and `installed`
|
|
513
|
+
after; a run that stopped in between is settled from the file: the count it had means not written, one more means
|
|
514
|
+
written, anything else `unconfirmed`. A pair stays b6p's only while its helper directly follows an empty value of
|
|
515
|
+
that key in that file; if the user took b6p's helper out, b6p drops its claim and deletes nothing. Removal re-reads
|
|
516
|
+
the file under git's lock and removes b6p's pair, both lines in that one edit (and the section header when nothing
|
|
517
|
+
else is left under it), only when the file holds exactly one such pair, each on its own line: a reset anyone else
|
|
518
|
+
wrote (one a moment ago included) is never touched. With several pairs under the key, only b6p's helper lines go,
|
|
519
|
+
the resets stay inert, and the key is reported in `keptResets` (`reason: "shared-key"`); one pair sharing a line
|
|
520
|
+
with other text, and an `unconfirmed` claim, are reported as `unconfirmed`, each once. Then every other entry whose
|
|
521
|
+
value is b6p's command, in any spelling of the URL, is removed from the global file it came from. So an
|
|
522
|
+
interruption at any point leaves either b6p's whole pair or an inert reset, never b6p's helper on its own. File
|
|
523
|
+
paths are compared as git reports them (on Windows, either slash and any case). The record survives
|
|
524
|
+
`clearSettings()` and `clearAll()`, which keep it in the same write that clears the rest of public state
|
|
525
|
+
(`Persistence.clearPublicExcept`), because the entries it describes stay in the git config until a removal takes
|
|
526
|
+
them out; every read of the record takes its lock.
|
|
527
|
+
- **Locks.** One lock guards the whole of `SharedFilePersistence`'s state file (`state.json.lock`): every write
|
|
528
|
+
re-reads the file under it and changes only its own key, so no process's setting, cache entry or record is lost to
|
|
529
|
+
another's. Each record or forget of a tenant host, and each reset record, is also one read-modify-write under
|
|
530
|
+
`Persistence.withLock`, and each setup or removal holds one git config lock (`b6p:git_credential_config`) from
|
|
531
|
+
reading the config to settling the last record, so two never interleave, in one process or several. A lockfile
|
|
532
|
+
(`withFileLock`) works as git's `<file>.lock` does: created exclusively, its stamp (process id, host name, a
|
|
533
|
+
token) written and the file registered for cleanup in one synchronous step, held for as long as the work runs, and **never removed by another
|
|
534
|
+
process**, whatever its age or holder. Release removes it only while it holds this acquisition's token, retrying a
|
|
535
|
+
transient `EPERM`/`EBUSY`/`EACCES`; a release still refused stays pending, and this process (only this one) removes
|
|
536
|
+
that lock on its next acquisition of it and on exit. As git's tempfile.c does, b6p removes the locks it holds, and
|
|
537
|
+
git's `<config>.lock` while it is editing a config file (only while it is still the file it created: the same
|
|
538
|
+
device and inode, and for b6p's lock its own stamp), when the process exits, gets SIGINT, SIGTERM or SIGHUP while
|
|
539
|
+
no handler of the host's is listening (then stopping with that signal; a host handler decides instead, and if it
|
|
540
|
+
exits the locks go with the exit; a host `once` handler taking the signal is left to finish, and a second signal
|
|
541
|
+
stops the process), or dies of an uncaught exception that nothing catches. Both
|
|
542
|
+
locks are created and tracked in one synchronous step, so only a hard kill (SIGKILL, power loss) can leave one. A
|
|
543
|
+
lock held by another is waited for; any other refusal to create one fails at once (on Windows, `EPERM`/`EBUSY`/
|
|
544
|
+
`EACCES` are waited for too). A deleted `~/.b6p` is created again. After 10 s a waiter gives up with an error naming the
|
|
545
|
+
lockfile and its holder (or saying the lock is empty): "If no b6p or VS Code process is running, delete <path>." A pull whose host cannot be recorded still succeeds.
|
|
546
|
+
- The helper command defaults to `GitCredential.DEFAULT_HELPER`; pass `{ helper }` to write another.
|
|
547
|
+
- The token never reaches git's argv, a config file, a log line or an error message. Failures of `git config`, and
|
|
548
|
+
of a config file edit, are `Err.GitCredentialSetupError` (`exitCode`).
|
|
549
|
+
|
|
406
550
|
## Development
|
|
407
551
|
|
|
408
552
|
```bash
|
package/dist/B6PCore.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ import type { AuthProvider, B6PProviders } from "./providers";
|
|
|
3
3
|
import type { AuthParams } from "./types";
|
|
4
4
|
import { ScriptMetaDataStore } from "./cache/ScriptMetaDataStore";
|
|
5
5
|
import { OrgCache } from "./cache/OrgCache";
|
|
6
|
+
import { GitCredentialHosts } from "./cache/GitCredentialHosts";
|
|
7
|
+
import { GitCredentialService } from "./gitCredential/GitCredentialService";
|
|
6
8
|
import { ScriptService } from "./script/ScriptService";
|
|
7
9
|
import { UpdateService } from "./update/UpdateService";
|
|
8
10
|
import { GatewayService } from "./gateway/GatewayService";
|
|
@@ -55,6 +57,11 @@ export declare class B6PCore {
|
|
|
55
57
|
readonly sessionManager: SessionManager;
|
|
56
58
|
readonly scriptMetadataStore: ScriptMetaDataStore;
|
|
57
59
|
readonly orgCache: OrgCache;
|
|
60
|
+
/**
|
|
61
|
+
* The tenant hosts script pulls reached with the stored token.
|
|
62
|
+
* @lastreviewed null
|
|
63
|
+
*/
|
|
64
|
+
readonly gitCredentialHosts: GitCredentialHosts;
|
|
58
65
|
readonly updateService: UpdateService | null;
|
|
59
66
|
/**
|
|
60
67
|
* Script management: push, pull, audit, deploy, and setup-URL resolution.
|
|
@@ -72,6 +79,12 @@ export declare class B6PCore {
|
|
|
72
79
|
* @lastreviewed null
|
|
73
80
|
*/
|
|
74
81
|
readonly schema: SchemaService;
|
|
82
|
+
/**
|
|
83
|
+
* b6p as git's credential helper: answer git for the gateway and the tenant hosts script pulls
|
|
84
|
+
* reached, and set that up in (or take it out of) the user's global git config.
|
|
85
|
+
* @lastreviewed null
|
|
86
|
+
*/
|
|
87
|
+
readonly gitCredential: GitCredentialService;
|
|
75
88
|
private readonly _isDebugMode;
|
|
76
89
|
constructor(providers: B6PProviders);
|
|
77
90
|
isDebugMode(): boolean;
|
|
@@ -79,6 +92,15 @@ export declare class B6PCore {
|
|
|
79
92
|
clearSessions(): Promise<void>;
|
|
80
93
|
clearSettings(): Promise<void>;
|
|
81
94
|
clearAll(): Promise<void>;
|
|
95
|
+
/**
|
|
96
|
+
* Clear public state, all but the record of the resets b6p wrote into the user's git config
|
|
97
|
+
* ({@link GitCredentialResets}): those entries stay in the git config until `removeGit` takes them
|
|
98
|
+
* out, and without the record it could not tell them from the user's. One write when the
|
|
99
|
+
* persistence has `clearPublicExcept` (`SharedFilePersistence` does); otherwise a clear and a
|
|
100
|
+
* write-back, both under the record's lock, which every read of the record also takes.
|
|
101
|
+
* @lastreviewed null
|
|
102
|
+
*/
|
|
103
|
+
private clearPublicState;
|
|
82
104
|
report(): Promise<ReportResult>;
|
|
83
105
|
checkForUpdates(): Promise<void>;
|
|
84
106
|
setConfig(key: string, value: unknown): Promise<void>;
|
package/dist/B6PCore.js
CHANGED
|
@@ -40,6 +40,12 @@ const BearerAuthProvider_1 = require("./auth/BearerAuthProvider");
|
|
|
40
40
|
const SessionManager_1 = require("./session/SessionManager");
|
|
41
41
|
const ScriptMetaDataStore_1 = require("./cache/ScriptMetaDataStore");
|
|
42
42
|
const OrgCache_1 = require("./cache/OrgCache");
|
|
43
|
+
const GitCredentialHosts_1 = require("./cache/GitCredentialHosts");
|
|
44
|
+
const GitCredentialResets_1 = require("./cache/GitCredentialResets");
|
|
45
|
+
const lockedMutation_1 = require("./persistence/lockedMutation");
|
|
46
|
+
const PersistenceKeys_1 = require("./persistence/PersistenceKeys");
|
|
47
|
+
const GitCredentialService_1 = require("./gitCredential/GitCredentialService");
|
|
48
|
+
const GitConfigRunner_1 = require("./gitCredential/GitConfigRunner");
|
|
43
49
|
const ScriptService_1 = require("./script/ScriptService");
|
|
44
50
|
const UpdateService_1 = require("./update/UpdateService");
|
|
45
51
|
const GatewayService_1 = require("./gateway/GatewayService");
|
|
@@ -117,6 +123,11 @@ class B6PCore {
|
|
|
117
123
|
sessionManager;
|
|
118
124
|
scriptMetadataStore;
|
|
119
125
|
orgCache;
|
|
126
|
+
/**
|
|
127
|
+
* The tenant hosts script pulls reached with the stored token.
|
|
128
|
+
* @lastreviewed null
|
|
129
|
+
*/
|
|
130
|
+
gitCredentialHosts;
|
|
120
131
|
updateService = null;
|
|
121
132
|
/**
|
|
122
133
|
* Script management: push, pull, audit, deploy, and setup-URL resolution.
|
|
@@ -134,6 +145,12 @@ class B6PCore {
|
|
|
134
145
|
* @lastreviewed null
|
|
135
146
|
*/
|
|
136
147
|
schema;
|
|
148
|
+
/**
|
|
149
|
+
* b6p as git's credential helper: answer git for the gateway and the tenant hosts script pulls
|
|
150
|
+
* reached, and set that up in (or take it out of) the user's global git config.
|
|
151
|
+
* @lastreviewed null
|
|
152
|
+
*/
|
|
153
|
+
gitCredential;
|
|
137
154
|
_isDebugMode;
|
|
138
155
|
constructor(providers) {
|
|
139
156
|
this.fs = providers.fs;
|
|
@@ -146,6 +163,7 @@ class B6PCore {
|
|
|
146
163
|
this.sessionManager = new SessionManager_1.SessionManager(this.persistence, this.logger, this.auth, this._isDebugMode, this.prompt, providers.fetchFn);
|
|
147
164
|
this.scriptMetadataStore = new ScriptMetaDataStore_1.ScriptMetaDataStore(this.persistence);
|
|
148
165
|
this.orgCache = new OrgCache_1.OrgCache(this.persistence, this.logger, providers.orgCacheSettings ?? NOOP_ORG_CACHE_SETTINGS, this._isDebugMode, this.prompt);
|
|
166
|
+
this.gitCredentialHosts = new GitCredentialHosts_1.GitCredentialHosts(this.persistence);
|
|
149
167
|
// The shared half of every subsystem's dependency bundle, built once. A second
|
|
150
168
|
// service spreads this same object and adds only what is specific to it, so the
|
|
151
169
|
// members below have one construction site rather than one per subsystem.
|
|
@@ -164,6 +182,7 @@ class B6PCore {
|
|
|
164
182
|
...platform,
|
|
165
183
|
scriptMetadataStore: this.scriptMetadataStore,
|
|
166
184
|
orgCache: this.orgCache,
|
|
185
|
+
gitCredentialHosts: this.gitCredentialHosts,
|
|
167
186
|
gitFs: providers.gitFs ?? nodeFs,
|
|
168
187
|
gitToken: async () => {
|
|
169
188
|
const header = await this.auth.authHeaderValue();
|
|
@@ -178,18 +197,29 @@ class B6PCore {
|
|
|
178
197
|
// bootstrap or `auth.authHeaderValue()`. Its URL is read from core config on every
|
|
179
198
|
// request (default gateway.bluestep.net) and validated by the client.
|
|
180
199
|
const persistence = this.persistence;
|
|
200
|
+
const gatewayUrl = async () => {
|
|
201
|
+
const configured = await persistence.get(`settings.${SettingsKeys_1.SettingsKeys.GATEWAY_URL}`);
|
|
202
|
+
return configured === undefined || configured === null || configured === ""
|
|
203
|
+
? Gateway_1.Gateway.DEFAULT_URL
|
|
204
|
+
: String(configured);
|
|
205
|
+
};
|
|
181
206
|
this.gateway = new GatewayService_1.GatewayService({
|
|
182
207
|
...platform,
|
|
183
208
|
gatewayToken: gatewayTokenFrom(this.auth),
|
|
184
209
|
gatewayTokenStore: gatewayTokenStoreFrom(this.auth),
|
|
185
|
-
gatewayUrl
|
|
186
|
-
const configured = await persistence.get(`settings.${SettingsKeys_1.SettingsKeys.GATEWAY_URL}`);
|
|
187
|
-
return configured === undefined || configured === null || configured === ""
|
|
188
|
-
? Gateway_1.Gateway.DEFAULT_URL
|
|
189
|
-
: String(configured);
|
|
190
|
-
},
|
|
210
|
+
gatewayUrl,
|
|
191
211
|
fetchFn: providers.fetchFn ?? globalThis.fetch.bind(globalThis),
|
|
192
212
|
});
|
|
213
|
+
// git's credential helper reads the same stored token the gateway does (never prompting) and
|
|
214
|
+
// answers only the gateway's host and the tenant hosts recorded by successful script pulls.
|
|
215
|
+
this.gitCredential = new GitCredentialService_1.GitCredentialService({
|
|
216
|
+
...platform,
|
|
217
|
+
token: gatewayTokenFrom(this.auth),
|
|
218
|
+
gatewayUrl,
|
|
219
|
+
hosts: this.gitCredentialHosts,
|
|
220
|
+
resets: new GitCredentialResets_1.GitCredentialResets(this.persistence),
|
|
221
|
+
gitConfig: (0, GitConfigRunner_1.gitConfigRunner)(),
|
|
222
|
+
});
|
|
193
223
|
// Initialize update service if configuration is provided
|
|
194
224
|
if (providers.updateServiceConfig) {
|
|
195
225
|
this.updateService = new UpdateService_1.UpdateService(this.persistence, this.logger, providers.updateServiceConfig, providers.fetchFn);
|
|
@@ -210,14 +240,36 @@ class B6PCore {
|
|
|
210
240
|
// ── Settings ──────────────────────────────────────────────────────
|
|
211
241
|
async clearSettings() {
|
|
212
242
|
this.prompt.info("Reverting to default settings");
|
|
213
|
-
await this.
|
|
243
|
+
await this.clearPublicState();
|
|
214
244
|
}
|
|
215
245
|
async clearAll() {
|
|
216
246
|
this.prompt.info("Clearing sessions, auth, and settings");
|
|
217
|
-
await this.
|
|
247
|
+
await this.clearPublicState();
|
|
218
248
|
await this.sessionManager.clearAll();
|
|
219
249
|
await this.auth.clear();
|
|
220
250
|
}
|
|
251
|
+
/**
|
|
252
|
+
* Clear public state, all but the record of the resets b6p wrote into the user's git config
|
|
253
|
+
* ({@link GitCredentialResets}): those entries stay in the git config until `removeGit` takes them
|
|
254
|
+
* out, and without the record it could not tell them from the user's. One write when the
|
|
255
|
+
* persistence has `clearPublicExcept` (`SharedFilePersistence` does); otherwise a clear and a
|
|
256
|
+
* write-back, both under the record's lock, which every read of the record also takes.
|
|
257
|
+
* @lastreviewed null
|
|
258
|
+
*/
|
|
259
|
+
async clearPublicState() {
|
|
260
|
+
const key = PersistenceKeys_1.PublicKeys.GIT_CREDENTIAL_RESETS;
|
|
261
|
+
await (0, lockedMutation_1.exclusive)(this.persistence, key, async () => {
|
|
262
|
+
if (this.persistence.clearPublicExcept) {
|
|
263
|
+
await this.persistence.clearPublicExcept([key]);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
const kept = await this.persistence.get(key);
|
|
267
|
+
await this.persistence.clearPublic();
|
|
268
|
+
if (kept !== undefined) {
|
|
269
|
+
await this.persistence.set(key, kept);
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
}
|
|
221
273
|
// ── State ─────────────────────────────────────────────────────────
|
|
222
274
|
async report() {
|
|
223
275
|
// Note: This is a basic implementation. Full functionality requires
|
package/dist/B6PCore.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"B6PCore.js","sourceRoot":"","sources":["../src/B6PCore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,MAAM,oCAAgB;AAClC,2CAAwC;AACxC,kEAA+D;AAC/D,6DAA0D;AAG1D,qEAAkE;AAClE,+CAAmE;
|
|
1
|
+
{"version":3,"file":"B6PCore.js","sourceRoot":"","sources":["../src/B6PCore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAY,MAAM,oCAAgB;AAClC,2CAAwC;AACxC,kEAA+D;AAC/D,6DAA0D;AAG1D,qEAAkE;AAClE,+CAAmE;AACnE,mEAAgE;AAChE,qEAAkE;AAClE,iEAAyD;AACzD,mEAA2D;AAC3D,+EAA4E;AAC5E,qEAAkE;AAElE,0DAAuD;AACvD,0DAAuD;AACvD,6DAA0D;AAC1D,0DAAuD;AAEvD,iDAA8C;AAC9C,2DAAwD;AAExD,MAAM,uBAAuB,GAAqB;IAChD,6BAA6B,EAAE,GAAG,EAAE,CAAC,IAAI;CAC1C,CAAC;AAEF;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,IAA8B;IACtD,IAAI,IAAI,YAAY,uCAAkB,EAAE,CAAC;QACvC,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,CAAC;IAC7C,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,KAAK,IAAI,EAAE,CAAC,SAAS,EAAE,CAAC;AAC1C,CAAC;AAED;;;;;GAKG;AACH,SAAS,qBAAqB,CAAC,IAA8B;IAC3D,IAAI,IAAI,YAAY,uCAAkB,EAAE,CAAC;QACvC,OAAO,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,IA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|
|
632
632
|
class GatewayInvalidRequestError extends GatewayError {
|
|
633
633
|
constructor(message: string, code: string | null);
|
|
634
634
|
}
|
|
635
|
+
/**
|
|
636
|
+
* `400` on a request that named an `access` (a knowledge-base create or update): the gateway refused it. A
|
|
637
|
+
* gateway or web-global that predates public knowledge bases answers this way, but so does any other
|
|
638
|
+
* malformed field, so the message and `code` are the gateway's. Nothing was changed.
|
|
639
|
+
* @lastreviewed null
|
|
640
|
+
*/
|
|
641
|
+
class GatewayAccessRefusedError extends GatewayInvalidRequestError {
|
|
642
|
+
constructor(message: string, code: string | null);
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* `412 precondition-failed`: the `If-Match` named a version of the knowledge base that is no longer the
|
|
646
|
+
* current one, so nothing was changed. Read it again and decide again.
|
|
647
|
+
* @lastreviewed null
|
|
648
|
+
*/
|
|
649
|
+
class GatewayPreconditionFailedError extends GatewayError {
|
|
650
|
+
constructor(message: string, code: string | null);
|
|
651
|
+
}
|
|
652
|
+
/**
|
|
653
|
+
* `428 precondition-required`: the change carried no `If-Match`. Core always sends one, so this is a bug
|
|
654
|
+
* or an `etag` that was empty.
|
|
655
|
+
* @lastreviewed null
|
|
656
|
+
*/
|
|
657
|
+
class GatewayPreconditionRequiredError extends GatewayError {
|
|
658
|
+
constructor(message: string, code: string | null);
|
|
659
|
+
}
|
|
635
660
|
/**
|
|
636
661
|
* `409 token-limit`: the user already holds the maximum number of live tokens.
|
|
637
662
|
* @lastreviewed null
|
|
@@ -922,4 +947,19 @@ export declare namespace Err {
|
|
|
922
947
|
readonly ref: string;
|
|
923
948
|
constructor(message: string, ref: string);
|
|
924
949
|
}
|
|
950
|
+
/**
|
|
951
|
+
* Setting b6p up as git's credential helper, taking it out, or reading its status failed: git
|
|
952
|
+
* could not be run or is too old, `git config` refused, or a config file could not be locked,
|
|
953
|
+
* parsed or written. The message never contains the token, which never reaches git's arguments
|
|
954
|
+
* or a config file.
|
|
955
|
+
* @lastreviewed null
|
|
956
|
+
*/
|
|
957
|
+
class GitCredentialSetupError extends Error {
|
|
958
|
+
/**
|
|
959
|
+
* git's exit code, or `null` when git could not be run or the request was refused before it.
|
|
960
|
+
* @lastreviewed null
|
|
961
|
+
*/
|
|
962
|
+
readonly exitCode: number | null;
|
|
963
|
+
constructor(message: string, exitCode: number | null);
|
|
964
|
+
}
|
|
925
965
|
}
|