@astrale-os/cli 1.0.0-beta.2 → 1.0.0-beta.20
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 +16 -1
- package/dist/astrale.js +51105 -58057
- package/dist/public/connect-core.js +2085 -30702
- package/dist/public/keys/index.js +884 -29476
- package/dist/public/paths/index.js +13101 -41452
- package/dist/types/admin/contract.d.ts +26 -0
- package/dist/types/admin/instance/client.d.ts +20 -0
- package/dist/types/admin/instance/index.d.ts +2 -0
- package/dist/types/admin/instance/model.d.ts +6 -10
- package/dist/types/connection/auth.d.ts +3 -0
- package/dist/types/connection/call.d.ts +3 -0
- package/dist/types/connection/command.d.ts +27 -0
- package/dist/types/connection/credential.d.ts +14 -0
- package/dist/types/connection/errors.d.ts +1 -0
- package/dist/types/connection/exchange.d.ts +9 -0
- package/dist/types/connection/failure/classify.d.ts +2 -0
- package/dist/types/connection/failure/index.d.ts +5 -0
- package/dist/types/connection/failure/model.d.ts +25 -0
- package/dist/types/connection/failure/render.d.ts +3 -0
- package/dist/types/connection/index.d.ts +8 -0
- package/dist/types/connection/reasons.d.ts +37 -0
- package/dist/types/connection/self.d.ts +37 -0
- package/dist/types/connection/session.d.ts +31 -0
- package/dist/types/connection/target.d.ts +38 -0
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/lib/admin-instance.d.ts +17 -0
- package/dist/types/lib/admin-target.d.ts +11 -36
- package/dist/types/lib/config.d.ts +7 -59
- package/dist/types/lib/failure-debug.d.ts +1 -0
- package/dist/types/lib/idp.d.ts +25 -173
- package/dist/types/lib/instance-target.d.ts +1 -1
- package/dist/types/lib/instance.d.ts +30 -88
- package/dist/types/lib/log.d.ts +5 -3
- package/dist/types/lib/output.d.ts +1 -1
- package/dist/types/lib/proc.d.ts +43 -0
- package/dist/types/lib/self.d.ts +9 -0
- package/dist/types/lib/update.d.ts +109 -0
- package/dist/types/lib/validation.d.ts +4 -1
- package/package.json +15 -20
- package/src/__tests__/fixtures/publication.ts +20 -0
- package/src/admin/.spec/architecture.md +12 -5
- package/src/admin/__tests__/fixture.ts +25 -0
- package/src/admin/catalog/.spec/api.d.ts +1 -3
- package/src/admin/catalog/.spec/architecture.md +5 -4
- package/src/admin/catalog/__tests__/client.test.ts +143 -69
- package/src/admin/catalog/client.ts +40 -54
- package/src/admin/catalog/model.ts +3 -4
- package/src/admin/contract.ts +46 -0
- package/src/admin/graph/.spec/api.d.ts +4 -10
- package/src/admin/graph/nodes.ts +1 -1
- package/src/admin/instance/.spec/api.d.ts +5 -9
- package/src/admin/instance/.spec/architecture.md +7 -7
- package/src/admin/instance/__tests__/client.test.ts +157 -175
- package/src/admin/instance/client.ts +39 -128
- package/src/admin/instance/index.ts +1 -2
- package/src/admin/instance/model.ts +12 -18
- package/src/commands/__tests__/admin-instance.test.ts +11 -8
- package/src/commands/__tests__/call-describe.test.ts +46 -33
- package/src/commands/__tests__/call.test.ts +34 -0
- package/src/commands/__tests__/domain-install-operation.test.ts +7 -22
- package/src/commands/__tests__/domain-install-owned.test.ts +1 -1
- package/src/commands/__tests__/domain-list.test.ts +5 -25
- package/src/commands/__tests__/install-direct.test.ts +115 -8
- package/src/commands/__tests__/install-identity-override.test.ts +3 -14
- package/src/commands/__tests__/instance-list-rows.test.ts +1 -1
- package/src/commands/__tests__/instance-status.test.ts +139 -0
- package/src/commands/__tests__/introspect-parse.test.ts +80 -1
- package/src/commands/__tests__/logs.test.ts +250 -2
- package/src/commands/__tests__/read-commands.test.ts +62 -10
- package/src/commands/__tests__/token-ttl.test.ts +49 -4
- package/src/commands/__tests__/update.test.ts +25 -3
- package/src/commands/__tests__/view.test.ts +49 -0
- package/src/commands/call-describe.ts +60 -68
- package/src/commands/call.ts +71 -59
- package/src/commands/domain/install.ts +54 -35
- package/src/commands/domain/list.ts +1 -1
- package/src/commands/domain/publish.ts +14 -11
- package/src/commands/domain/uninstall.ts +2 -2
- package/src/commands/get.ts +14 -15
- package/src/commands/identity/__tests__/register.test.ts +3 -3
- package/src/commands/identity/register.ts +5 -4
- package/src/commands/instance/create.ts +8 -16
- package/src/commands/instance/delete.ts +12 -9
- package/src/commands/instance/list.ts +2 -2
- package/src/commands/instance/status.ts +66 -20
- package/src/commands/instance/use.ts +16 -12
- package/src/commands/introspect.ts +48 -35
- package/src/commands/logs.ts +123 -33
- package/src/commands/mutate.ts +6 -5
- package/src/commands/query.ts +35 -32
- package/src/commands/token.ts +42 -27
- package/src/commands/ui/__tests__/commands.test.ts +152 -0
- package/src/commands/ui/add.ts +51 -0
- package/src/commands/ui/doctor.ts +13 -0
- package/src/commands/ui/init.ts +38 -0
- package/src/commands/ui/list.ts +26 -0
- package/src/commands/ui/preset-apply.ts +19 -0
- package/src/commands/ui/preset-list.ts +12 -0
- package/src/commands/ui/shared.ts +25 -0
- package/src/commands/update.ts +31 -11
- package/src/commands/view.ts +82 -37
- package/src/connection/.spec/api.d.ts +7 -8
- package/src/connection/.spec/architecture.md +5 -4
- package/src/connection/.spec/flows/session.ts +2 -2
- package/src/connection/.spec/laws/connection.ts +6 -2
- package/src/connection/.spec/layout.ts +1 -0
- package/src/connection/__tests__/credential.test.ts +20 -1
- package/src/connection/__tests__/errors.test.ts +27 -20
- package/src/connection/__tests__/exchange.test.ts +30 -1
- package/src/connection/__tests__/failure-fixtures.ts +39 -0
- package/src/connection/__tests__/failure-safety.test.ts +75 -0
- package/src/connection/__tests__/self.test.ts +31 -11
- package/src/connection/__tests__/session.test.ts +3 -3
- package/src/connection/__tests__/target.test.ts +1 -0
- package/src/connection/auth.ts +13 -0
- package/src/connection/call.ts +1 -1
- package/src/connection/credential.ts +2 -2
- package/src/connection/errors.ts +1 -355
- package/src/connection/exchange.ts +47 -23
- package/src/connection/failure/classify.ts +110 -0
- package/src/connection/failure/index.ts +18 -0
- package/src/connection/failure/model.ts +28 -0
- package/src/connection/failure/render.ts +116 -0
- package/src/connection/reasons.ts +16 -0
- package/src/connection/self.ts +39 -21
- package/src/connection/session.ts +19 -8
- package/src/errors.ts +3 -2
- package/src/graph/.spec/api.d.ts +12 -5
- package/src/graph/.spec/layout.ts +9 -1
- package/src/graph/__tests__/mutation.test.ts +2 -2
- package/src/graph/__tests__/query.test.ts +25 -6
- package/src/graph/class.ts +30 -0
- package/src/graph/index.ts +1 -0
- package/src/graph/query.ts +21 -32
- package/src/identity/.spec/api.d.ts +2 -2
- package/src/identity/__tests__/registration.test.ts +1 -1
- package/src/identity/registration.ts +3 -3
- package/src/keys/__tests__/keys.test.ts +4 -0
- package/src/keys/credential.ts +1 -0
- package/src/lib/__tests__/admin-target.test.ts +12 -0
- package/src/lib/__tests__/binary.test.ts +16 -1
- package/src/lib/__tests__/command-dx.test.ts +1 -1
- package/src/lib/__tests__/domain-publication.test.ts +10 -16
- package/src/lib/__tests__/idp.test.ts +34 -4
- package/src/lib/__tests__/instance-candidates.test.ts +1 -3
- package/src/lib/__tests__/instance-target.test.ts +7 -39
- package/src/lib/__tests__/log-errors.test.ts +64 -0
- package/src/lib/__tests__/studio-server-deps.test.ts +1 -1
- package/src/lib/__tests__/update.test.ts +264 -11
- package/src/lib/__tests__/view-assets.test.ts +14 -0
- package/src/lib/__tests__/view-external-open-intent.test.ts +150 -0
- package/src/lib/__tests__/view-external-open-origins.test.ts +27 -0
- package/src/lib/__tests__/view-open-intent.test.ts +0 -2
- package/src/lib/__tests__/view-server.test.ts +26 -3
- package/src/lib/__tests__/view-session.test.ts +2 -1
- package/src/lib/admin-instance.ts +14 -8
- package/src/lib/admin-target.ts +21 -2
- package/src/lib/binary.ts +22 -5
- package/src/lib/command-dx.ts +9 -9
- package/src/lib/domain-publication.ts +9 -7
- package/src/lib/failure-debug.ts +26 -0
- package/src/lib/idp.ts +34 -3
- package/src/lib/instance-candidates.ts +2 -2
- package/src/lib/instance-target.ts +3 -14
- package/src/lib/instance.ts +16 -11
- package/src/lib/log.ts +16 -9
- package/src/lib/output.ts +1 -1
- package/src/lib/proc.ts +7 -2
- package/src/lib/provision-instance.ts +34 -57
- package/src/lib/update.ts +298 -45
- package/src/lib/validation.ts +2 -2
- package/src/lib/view/assets.ts +11 -2
- package/src/lib/view/external-open-intent.ts +41 -0
- package/src/lib/view/external-open-origins.ts +37 -0
- package/src/lib/view/host-capabilities.ts +17 -0
- package/src/lib/view/resolve.ts +1 -1
- package/src/lib/view/server.ts +18 -3
- package/src/lib/view/session.ts +2 -0
- package/src/program/.spec/api.d.ts +1 -0
- package/src/program/__tests__/program.test.ts +163 -6
- package/src/program/argv.ts +14 -0
- package/src/program/build.ts +26 -4
- package/src/program/command.ts +1 -0
- package/src/program/index.ts +1 -0
- package/src/program/registry.ts +2 -1
- package/src/setup/__tests__/instance-step.test.ts +27 -10
- package/src/setup/steps/instance.ts +22 -15
- package/src/telemetry/__tests__/recorder.test.ts +1 -0
- package/src/telemetry/recorder.ts +9 -1
- package/src/ui/.spec/api.d.ts +14 -0
- package/src/ui/.spec/architecture.md +10 -0
- package/src/ui/.spec/laws.ts +36 -0
- package/src/ui/.spec/layout.ts +16 -0
- package/src/ui/__tests__/ui.test.ts +981 -0
- package/src/ui/index.ts +13 -0
- package/src/ui/lock.ts +87 -0
- package/src/ui/model.ts +83 -0
- package/src/ui/operations.ts +710 -0
- package/src/ui/project.ts +219 -0
- package/src/ui/release.ts +321 -0
- package/src/ui/runner.ts +18 -0
- package/studio/client/dist/assets/elk-api-DjmKsHXc.js +1 -0
- package/studio/client/dist/assets/index-7YHdeCxp.js +81 -0
- package/studio/client/dist/assets/index-C0FAnwNw.css +2 -0
- package/studio/client/dist/assets/rolldown-runtime-Dd_uD5pT.js +1 -0
- package/studio/client/dist/assets/schema-studio-BilUNb6Z.css +1 -0
- package/studio/client/dist/assets/schema-studio-CABpTfvH.js +8 -0
- package/studio/client/dist/index.html +3 -2
- package/studio/package.json +7 -13
- package/studio/server/agent/ask.test.ts +1 -1
- package/studio/server/agent/bridge/grant.test.ts +1 -1
- package/studio/server/agent/bridge/routes.test.ts +1 -1
- package/studio/server/agent/harness/claude/adapter.test.ts +15 -5
- package/studio/server/agent/harness/gateway/token.test.ts +1 -1
- package/studio/server/agent/harness/gateway/token.ts +3 -3
- package/studio/server/agent/prompts/anchors.test.ts +32 -36
- package/studio/server/agent/prompts/anchors.ts +20 -49
- package/studio/server/agent/prompts/system.test.ts +3 -2
- package/studio/server/agent/prompts/system.ts +3 -3
- package/studio/server/agent/routes.test.ts +1 -1
- package/studio/server/agent/run/coordinator.test.ts +1 -1
- package/studio/server/api/canvas.ts +0 -1
- package/studio/server/api-agent-loadout.test.ts +1 -1
- package/studio/server/api.test.ts +1 -1
- package/studio/server/cache.test.ts +23 -12
- package/studio/server/cache.ts +12 -15
- package/studio/server/domain.test.ts +50 -68
- package/studio/server/domain.ts +82 -63
- package/studio/server/handoff/copy.ts +1 -1
- package/studio/server/index.ts +1 -1
- package/studio/server/instances/probe.test.ts +1 -1
- package/studio/server/introspect/anatomy/views/routes.ts +46 -37
- package/studio/server/introspect/anatomy/views.ts +9 -14
- package/studio/server/introspect/anatomy-extras.test.ts +26 -42
- package/studio/server/introspect/anatomy.test.ts +22 -14
- package/studio/server/introspect/anatomy.ts +6 -9
- package/studio/server/introspect/bundle.ts +0 -3
- package/studio/server/introspect/canonical-schema.test.ts +94 -389
- package/studio/server/introspect/canonical-schema.ts +227 -457
- package/studio/server/introspect/core-extractor.ts +18 -127
- package/studio/server/introspect/core.ts +1 -2
- package/studio/server/introspect/diff.test.ts +11 -7
- package/studio/server/introspect/diff.ts +18 -55
- package/studio/server/introspect/extractor.ts +22 -117
- package/studio/server/introspect/overlay-tsmorph.test.ts +119 -240
- package/studio/server/introspect/overlay.test.ts +26 -54
- package/studio/server/introspect/overlay.ts +10 -37
- package/studio/server/introspect/revision.test.ts +1 -1
- package/studio/server/introspect/revision.ts +1 -1
- package/studio/server/introspect/runtime.test.ts +65 -183
- package/studio/server/introspect/runtime.ts +8 -25
- package/studio/server/introspect/schema-ir-json.test.ts +70 -0
- package/studio/server/introspect/schema-ir-json.ts +38 -68
- package/studio/server/introspect/schema-refs.test.ts +43 -88
- package/studio/server/introspect/schema-refs.ts +14 -49
- package/studio/server/introspect/source-overlay/handlers.ts +116 -636
- package/studio/server/introspect/source-overlay/kernel-calls.ts +0 -3
- package/studio/server/introspect/source-overlay/spans.ts +15 -45
- package/studio/server/state/baseline.test.ts +14 -9
- package/studio/server/state/baseline.ts +3 -5
- package/studio/server/state/visibility.ts +1 -5
- package/studio/server/views/model.ts +3 -3
- package/studio/server/views/target.test.ts +17 -74
- package/studio/server/views/target.ts +24 -50
- package/studio/server/watch.test.ts +11 -11
- package/studio/server/watch.ts +8 -4
- package/studio/server/workspace-watch.ts +2 -2
- package/studio/shared/contracts/schema.ts +38 -107
- package/studio/shared/contracts/surface.test.ts +13 -15
- package/studio/shared/contracts/workspace.ts +2 -11
- package/studio/shared/schema/identity.test.ts +20 -44
- package/studio/shared/schema/identity.ts +9 -23
- package/viewer/dist/main.js +30 -51
- package/.check-workspace.cjs +0 -40
- package/src/admin/binding.ts +0 -168
- package/src/commands/__tests__/instance-create-hosts.test.ts +0 -29
- package/studio/client/dist/assets/elk-api-lwhFo7vB.js +0 -1
- package/studio/client/dist/assets/index-B-c-smo9.js +0 -8
- package/studio/client/dist/assets/index-BckHuAWk.js +0 -81
- package/studio/client/dist/assets/index-C4aNQ6dz.css +0 -1
- package/studio/client/dist/assets/index-ChOr3yP0.css +0 -1
- package/studio/server/introspect/anatomy/views/legacy.ts +0 -232
package/.check-workspace.cjs
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const p = require('path')
|
|
2
|
-
const f = require('fs')
|
|
3
|
-
|
|
4
|
-
// Guard against developers running `pnpm install` directly inside this submodule
|
|
5
|
-
// (which would resolve PUBLISHED packages instead of the workspace ones).
|
|
6
|
-
//
|
|
7
|
-
// IMPORTANT: this runs as a `preinstall` script, so it ALSO fires for end users
|
|
8
|
-
// who `npm i -g @astrale-os/astrale`. It must pass for them. The discriminator
|
|
9
|
-
// is the `.astrale-workspace` marker at the monorepo root: we only fail when the
|
|
10
|
-
// install originates from *inside* the monorepo but not at its root.
|
|
11
|
-
if (process.env.STANDALONE) process.exit(0)
|
|
12
|
-
|
|
13
|
-
const start = process.env.INIT_CWD || process.cwd()
|
|
14
|
-
|
|
15
|
-
let dir = start
|
|
16
|
-
let workspaceRoot = null
|
|
17
|
-
for (;;) {
|
|
18
|
-
if (f.existsSync(p.join(dir, '.astrale-workspace'))) {
|
|
19
|
-
workspaceRoot = dir
|
|
20
|
-
break
|
|
21
|
-
}
|
|
22
|
-
const parent = p.dirname(dir)
|
|
23
|
-
if (parent === dir) break
|
|
24
|
-
dir = parent
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Not inside the Astrale monorepo (e.g. an end user): allow.
|
|
28
|
-
if (!workspaceRoot) process.exit(0)
|
|
29
|
-
// Installing from the workspace root itself: correct.
|
|
30
|
-
if (workspaceRoot === start) process.exit(0)
|
|
31
|
-
|
|
32
|
-
console.error(`
|
|
33
|
-
⚠️ WARNING: Running pnpm install directly in this package will use PUBLISHED packages.
|
|
34
|
-
|
|
35
|
-
Run from workspace root instead:
|
|
36
|
-
cd <workspace-root> && pnpm install
|
|
37
|
-
|
|
38
|
-
To bypass: STANDALONE=true pnpm install
|
|
39
|
-
`)
|
|
40
|
-
process.exit(1)
|
package/src/admin/binding.ts
DELETED
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import type { Input, Result } from '@astrale-os/kernel-client'
|
|
2
|
-
import type {
|
|
3
|
-
ClientSession,
|
|
4
|
-
SessionRequestOptions,
|
|
5
|
-
SessionSnapshot,
|
|
6
|
-
} from '@astrale-os/kernel-client/session'
|
|
7
|
-
import type {
|
|
8
|
-
Definition,
|
|
9
|
-
Domain as RichDomain,
|
|
10
|
-
InstanceMethod,
|
|
11
|
-
StaticMethod,
|
|
12
|
-
} from '@astrale-os/sdk/domain'
|
|
13
|
-
import type { PathLike } from '@astrale-os/sdk/graph/path'
|
|
14
|
-
import type { Key } from '@astrale-os/sdk/schema'
|
|
15
|
-
|
|
16
|
-
import { call } from '@astrale-os/kernel-client'
|
|
17
|
-
import * as sessionModule from '@astrale-os/kernel-client/session'
|
|
18
|
-
import { Domain } from '@astrale-os/sdk/domain'
|
|
19
|
-
import { Path } from '@astrale-os/sdk/graph/path'
|
|
20
|
-
|
|
21
|
-
const ADMIN_ORIGIN = 'admin.astrale.ai'
|
|
22
|
-
|
|
23
|
-
type DynamicCallable =
|
|
24
|
-
| (Definition<'function'> & { readonly path: NonNullable<Definition<'function'>['path']> })
|
|
25
|
-
| StaticMethod
|
|
26
|
-
| InstanceMethod
|
|
27
|
-
|
|
28
|
-
export interface AdminBindingOperations {
|
|
29
|
-
readonly installation: unknown
|
|
30
|
-
readonly publication: SessionSnapshot['publication']
|
|
31
|
-
invoke(
|
|
32
|
-
callable: DynamicCallable,
|
|
33
|
-
receiverOrInput: PathLike | Input,
|
|
34
|
-
inputOrOptions?: Input | SessionRequestOptions,
|
|
35
|
-
options?: SessionRequestOptions,
|
|
36
|
-
): Promise<unknown>
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export type AdminBinding = RichDomain & {
|
|
40
|
-
readonly $: RichDomain['$'] & AdminBindingOperations
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
interface CompatibleCallableReference {
|
|
44
|
-
readonly origin: typeof ADMIN_ORIGIN
|
|
45
|
-
readonly revision: SessionSnapshot['publication']['schema']['revision']
|
|
46
|
-
readonly callable: Key.Callable
|
|
47
|
-
readonly target: PathLike
|
|
48
|
-
readonly outputMode: DynamicCallable['definition']['output']['mode']
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
interface CompatibleSession {
|
|
52
|
-
readonly installation?: (origin: typeof ADMIN_ORIGIN) => Promise<unknown>
|
|
53
|
-
readonly installed?: (origin: typeof ADMIN_ORIGIN) => Promise<unknown>
|
|
54
|
-
readonly invoke?: (
|
|
55
|
-
reference: CompatibleCallableReference,
|
|
56
|
-
input: Input,
|
|
57
|
-
options?: SessionRequestOptions,
|
|
58
|
-
) => Promise<unknown>
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
type LegacyDispatchBound = (
|
|
62
|
-
session: ClientSession,
|
|
63
|
-
request: ReturnType<typeof call>,
|
|
64
|
-
expected: {
|
|
65
|
-
readonly schema: { readonly revision: CompatibleCallableReference['revision'] }
|
|
66
|
-
readonly publication: {
|
|
67
|
-
readonly origin: SessionSnapshot['publication']['origin']
|
|
68
|
-
readonly identity: SessionSnapshot['publication']['identity']
|
|
69
|
-
readonly revision: CompatibleCallableReference['revision']
|
|
70
|
-
readonly etag: SessionSnapshot['publication']['etag']
|
|
71
|
-
}
|
|
72
|
-
},
|
|
73
|
-
options?: SessionRequestOptions,
|
|
74
|
-
) => Promise<Result>
|
|
75
|
-
|
|
76
|
-
/** Bind the Admin revision advertised by this exact Session snapshot. */
|
|
77
|
-
export async function bindAdmin(session: ClientSession): Promise<AdminBinding> {
|
|
78
|
-
const snapshot = await session.snapshot()
|
|
79
|
-
if (
|
|
80
|
-
snapshot.publication.origin !== ADMIN_ORIGIN ||
|
|
81
|
-
snapshot.bundle.root.origin !== ADMIN_ORIGIN
|
|
82
|
-
) {
|
|
83
|
-
throw new TypeError('Configured Admin target does not serve the Admin Domain.')
|
|
84
|
-
}
|
|
85
|
-
const compatible = session as unknown as CompatibleSession
|
|
86
|
-
const resolveInstallation = compatible.installation ?? compatible.installed
|
|
87
|
-
if (resolveInstallation === undefined) {
|
|
88
|
-
throw new TypeError('Client Session cannot resolve an installed Admin Domain.')
|
|
89
|
-
}
|
|
90
|
-
const installation = await resolveInstallation.call(session, ADMIN_ORIGIN)
|
|
91
|
-
const domain = Domain.fromSchema(snapshot.bundle.root)
|
|
92
|
-
const invoke = ((
|
|
93
|
-
callable: DynamicCallable,
|
|
94
|
-
receiverOrInput: PathLike | Input,
|
|
95
|
-
inputOrOptions?: Input | SessionRequestOptions,
|
|
96
|
-
options?: SessionRequestOptions,
|
|
97
|
-
) => {
|
|
98
|
-
const target =
|
|
99
|
-
'on' in callable ? callable.on(Path.from(receiverOrInput as PathLike)) : callable.path
|
|
100
|
-
const reference: CompatibleCallableReference = Object.freeze({
|
|
101
|
-
origin: ADMIN_ORIGIN,
|
|
102
|
-
revision: snapshot.publication.schema.revision,
|
|
103
|
-
callable: callable.key as Key.Callable,
|
|
104
|
-
target,
|
|
105
|
-
outputMode: callable.definition.output.mode,
|
|
106
|
-
})
|
|
107
|
-
return invokeCompatible(
|
|
108
|
-
session,
|
|
109
|
-
snapshot,
|
|
110
|
-
reference,
|
|
111
|
-
('on' in callable ? inputOrOptions : receiverOrInput) as Input,
|
|
112
|
-
('on' in callable ? options : inputOrOptions) as SessionRequestOptions | undefined,
|
|
113
|
-
)
|
|
114
|
-
}) as AdminBindingOperations['invoke']
|
|
115
|
-
|
|
116
|
-
return Object.freeze({
|
|
117
|
-
...domain,
|
|
118
|
-
$: Object.freeze({
|
|
119
|
-
...domain.$,
|
|
120
|
-
installation,
|
|
121
|
-
publication: snapshot.publication,
|
|
122
|
-
invoke,
|
|
123
|
-
}),
|
|
124
|
-
}) as AdminBinding
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
async function invokeCompatible(
|
|
128
|
-
session: ClientSession,
|
|
129
|
-
snapshot: SessionSnapshot,
|
|
130
|
-
reference: CompatibleCallableReference,
|
|
131
|
-
input: Input,
|
|
132
|
-
options: SessionRequestOptions | undefined,
|
|
133
|
-
): Promise<unknown> {
|
|
134
|
-
const current = session as unknown as CompatibleSession
|
|
135
|
-
if (current.invoke !== undefined) return current.invoke(reference, input, options)
|
|
136
|
-
|
|
137
|
-
const dispatchBound = (sessionModule as unknown as { dispatchBound?: LegacyDispatchBound })
|
|
138
|
-
.dispatchBound
|
|
139
|
-
if (dispatchBound === undefined) {
|
|
140
|
-
throw new TypeError('Client Session cannot invoke an exact Admin publication.')
|
|
141
|
-
}
|
|
142
|
-
const result = await dispatchBound(
|
|
143
|
-
session,
|
|
144
|
-
call(reference.target, input),
|
|
145
|
-
{
|
|
146
|
-
schema: { revision: reference.revision },
|
|
147
|
-
publication: {
|
|
148
|
-
origin: snapshot.publication.origin,
|
|
149
|
-
identity: snapshot.publication.identity,
|
|
150
|
-
revision: snapshot.publication.schema.revision,
|
|
151
|
-
etag: snapshot.publication.etag,
|
|
152
|
-
},
|
|
153
|
-
},
|
|
154
|
-
options,
|
|
155
|
-
)
|
|
156
|
-
return requireOutput(reference.outputMode, result)
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function requireOutput(
|
|
160
|
-
expected: CompatibleCallableReference['outputMode'],
|
|
161
|
-
result: Result,
|
|
162
|
-
): unknown {
|
|
163
|
-
if (result.kind !== expected) {
|
|
164
|
-
if (result.kind === 'stream') void result.stream.cancel(`Admin callable declared ${expected}.`)
|
|
165
|
-
throw new TypeError(`Admin callable declared ${expected} output but returned ${result.kind}.`)
|
|
166
|
-
}
|
|
167
|
-
return result.kind === 'stream' ? result.stream : result.value
|
|
168
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'bun:test'
|
|
2
|
-
|
|
3
|
-
import { parseEligibleHostIds } from '../instance/create'
|
|
4
|
-
|
|
5
|
-
// `instance create` recovers from alphaCreate's MULTI-host ambiguity by popping
|
|
6
|
-
// a picker; the recovery hinges on pulling the eligible ids out of that error.
|
|
7
|
-
// These pin the parse to the server's wording (Option B — no admin change).
|
|
8
|
-
describe('parseEligibleHostIds', () => {
|
|
9
|
-
test('extracts the ids the server listed (the recoverable, >1 case)', () => {
|
|
10
|
-
const e = new Error(
|
|
11
|
-
'alphaCreate could not choose a host: 2 ready hosts are assigned (host-1, host-paris-02). ' +
|
|
12
|
-
'Specify host_id once multi-host placement is enabled.',
|
|
13
|
-
)
|
|
14
|
-
expect(parseEligibleHostIds(e)).toEqual(['host-1', 'host-paris-02'])
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
test('returns null for the no-host error (nothing to pick — falls through to fatal)', () => {
|
|
18
|
-
const e = new Error(
|
|
19
|
-
'alphaCreate could not choose a host: no ready host is assigned to this user. ' +
|
|
20
|
-
'Ask an admin to assign (grant USE) a host.',
|
|
21
|
-
)
|
|
22
|
-
expect(parseEligibleHostIds(e)).toBeNull()
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
test('returns null for unrelated errors and non-Error values', () => {
|
|
26
|
-
expect(parseEligibleHostIds(new Error('Permission denied'))).toBeNull()
|
|
27
|
-
expect(parseEligibleHostIds('something odd')).toBeNull()
|
|
28
|
-
})
|
|
29
|
-
})
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{m as L}from"./index-BckHuAWk.js";function S(y,b){for(var u=0;u<b.length;u++){const a=b[u];if(typeof a!="string"&&!Array.isArray(a)){for(const i in a)if(i!=="default"&&!(i in y)){const n=Object.getOwnPropertyDescriptor(a,i);n&&Object.defineProperty(y,i,n.get?n:{enumerable:!0,get:()=>a[i]})}}}return Object.freeze(Object.defineProperty(y,Symbol.toStringTag,{value:"Module"}))}function w(y){throw new Error('Could not dynamically require "'+y+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var O={exports:{}},j;function C(){return j||(j=1,(function(y,b){(function(u){y.exports=u()})(function(){return(function(){function u(a,i,n){function d(f,_){if(!i[f]){if(!a[f]){var h=typeof w=="function"&&w;if(!_&&h)return h(f,!0);if(g)return g(f,!0);var o=new Error("Cannot find module '"+f+"'");throw o.code="MODULE_NOT_FOUND",o}var e=i[f]={exports:{}};a[f][0].call(e.exports,function(r){var t=a[f][1][r];return d(t||r)},e,e.exports,u,a,i,n)}return i[f].exports}for(var g=typeof w=="function"&&w,m=0;m<n.length;m++)d(n[m]);return d}return u})()({1:[function(u,a,i){Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;function n(o){"@babel/helpers - typeof";return n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(o)}function d(o,e){if(!(o instanceof e))throw new TypeError("Cannot call a class as a function")}function g(o,e){for(var r=0;r<e.length;r++){var t=e[r];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(o,f(t.key),t)}}function m(o,e,r){return e&&g(o.prototype,e),Object.defineProperty(o,"prototype",{writable:!1}),o}function f(o){var e=_(o,"string");return n(e)=="symbol"?e:e+""}function _(o,e){if(n(o)!="object"||!o)return o;var r=o[Symbol.toPrimitive];if(r!==void 0){var t=r.call(o,e);if(n(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(o)}i.default=(function(){function o(){var e=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},t=r.defaultLayoutOptions,s=t===void 0?{}:t,l=r.algorithms,v=l===void 0?["layered","stress","mrtree","radial","force","disco","sporeOverlap","sporeCompaction","rectpacking"]:l,c=r.workerFactory,p=r.workerUrl;if(d(this,o),this.defaultLayoutOptions=s,this.initialized=!1,typeof p>"u"&&typeof c>"u")throw new Error("Cannot construct an ELK without both 'workerUrl' and 'workerFactory'.");var k=c;typeof p<"u"&&typeof c>"u"&&(k=function(M){return new Worker(M)});var E=k(p);if(typeof E.postMessage!="function")throw new TypeError("Created worker does not provide the required 'postMessage' function.");this.worker=new h(E),this.worker.postMessage({cmd:"register",algorithms:v}).then(function(P){return e.initialized=!0}).catch(console.err)}return m(o,[{key:"layout",value:function(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=t.layoutOptions,l=s===void 0?this.defaultLayoutOptions:s,v=t.logging,c=v===void 0?!1:v,p=t.measureExecutionTime,k=p===void 0?!1:p;return r?this.worker.postMessage({cmd:"layout",graph:r,layoutOptions:l,options:{logging:c,measureExecutionTime:k}}):Promise.reject(new Error("Missing mandatory parameter 'graph'."))}},{key:"knownLayoutAlgorithms",value:function(){return this.worker.postMessage({cmd:"algorithms"})}},{key:"knownLayoutOptions",value:function(){return this.worker.postMessage({cmd:"options"})}},{key:"knownLayoutCategories",value:function(){return this.worker.postMessage({cmd:"categories"})}},{key:"terminateWorker",value:function(){this.worker&&this.worker.terminate()}}])})();var h=(function(){function o(e){var r=this;if(d(this,o),e===void 0)throw new Error("Missing mandatory parameter 'worker'.");this.resolvers={},this.worker=e,this.worker.onmessage=function(t){setTimeout(function(){r.receive(r,t)},0)}}return m(o,[{key:"postMessage",value:function(r){var t=this.id||0;this.id=t+1,r.id=t;var s=this;return new Promise(function(l,v){s.resolvers[t]=function(c,p){c?(s.convertGwtStyleError(c),v(c)):l(p)},s.worker.postMessage(r)})}},{key:"receive",value:function(r,t){var s=t.data,l=r.resolvers[s.id];l&&(delete r.resolvers[s.id],s.error?l(s.error):l(null,s.data))}},{key:"terminate",value:function(){this.worker&&this.worker.terminate()}},{key:"convertGwtStyleError",value:function(r){if(r){var t=r.__java$exception;t&&(t.cause&&t.cause.backingJsObject&&(r.cause=t.cause.backingJsObject,this.convertGwtStyleError(r.cause)),delete r.__java$exception)}}}])})()},{}],2:[function(u,a,i){var n=u("./elk-api.js").default;Object.defineProperty(a.exports,"__esModule",{value:!0}),a.exports=n,n.default=n},{"./elk-api.js":1}]},{},[2])(2)})})(O)),O.exports}var x=C();const A=L(x),q=S({__proto__:null,default:A},[x]);export{q as e};
|