@stigmer/sdk 3.14.0-dev.20260910084630 → 3.14.1
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/__tests__/platform.test.d.ts +2 -0
- package/__tests__/platform.test.d.ts.map +1 -0
- package/__tests__/platform.test.js +32 -0
- package/__tests__/platform.test.js.map +1 -0
- package/__tests__/resource-availability.test.d.ts +2 -0
- package/__tests__/resource-availability.test.d.ts.map +1 -0
- package/__tests__/resource-availability.test.js +71 -0
- package/__tests__/resource-availability.test.js.map +1 -0
- package/gen/resource-availability.d.ts +6 -3
- package/gen/resource-availability.d.ts.map +1 -1
- package/gen/resource-availability.js +34 -11
- package/gen/resource-availability.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +2 -2
- package/index.js.map +1 -1
- package/package.json +2 -2
- package/platform.d.ts +5 -3
- package/platform.d.ts.map +1 -1
- package/platform.js +6 -3
- package/platform.js.map +1 -1
- package/resource-availability.d.ts +52 -11
- package/resource-availability.d.ts.map +1 -1
- package/resource-availability.js +101 -8
- package/resource-availability.js.map +1 -1
- package/src/__tests__/platform.test.ts +44 -0
- package/src/__tests__/resource-availability.test.ts +106 -0
- package/src/gen/resource-availability.ts +34 -11
- package/src/index.ts +2 -1
- package/src/platform.ts +11 -4
- package/src/resource-availability.ts +117 -14
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/platform.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pins PlatformClient.getServerInfo's edition-to-mode mapping: the client
|
|
3
|
+
* reports the server's edition through the one converter
|
|
4
|
+
* (`deploymentModeOf`), so a third edition on the wire reaches consumers
|
|
5
|
+
* as its own mode and never collapses into "cloud" by accident. The raw
|
|
6
|
+
* edition rides beside it for callers that want the wire value.
|
|
7
|
+
*/
|
|
8
|
+
import { describe, expect, it } from "vitest";
|
|
9
|
+
import { createRouterTransport } from "@connectrpc/connect";
|
|
10
|
+
import { create } from "@bufbuild/protobuf";
|
|
11
|
+
import { GetServerInfoOutputSchema, PlatformQueryController, ServerEdition, } from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
12
|
+
import { PlatformClient } from "../platform";
|
|
13
|
+
function clientAnswering(edition) {
|
|
14
|
+
return new PlatformClient(createRouterTransport(({ service }) => {
|
|
15
|
+
service(PlatformQueryController, {
|
|
16
|
+
getServerInfo: () => create(GetServerInfoOutputSchema, { edition, version: "1.2.3" }),
|
|
17
|
+
});
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
describe("PlatformClient.getServerInfo", () => {
|
|
21
|
+
it.each([
|
|
22
|
+
[ServerEdition.oss, "local"],
|
|
23
|
+
[ServerEdition.enterprise, "enterprise"],
|
|
24
|
+
[ServerEdition.cloud, "cloud"],
|
|
25
|
+
])("maps edition %d to deploymentMode %s and keeps the raw edition", async (edition, mode) => {
|
|
26
|
+
const info = await clientAnswering(edition).getServerInfo();
|
|
27
|
+
expect(info.deploymentMode).toBe(mode);
|
|
28
|
+
expect(info.edition).toBe(edition);
|
|
29
|
+
expect(info.version).toBe("1.2.3");
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=platform.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform.test.js","sourceRoot":"","sources":["../../src/__tests__/platform.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EACL,yBAAyB,EACzB,uBAAuB,EACvB,aAAa,GACd,MAAM,uDAAuD,CAAC;AAE/D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,SAAS,eAAe,CAAC,OAAsB;IAC7C,OAAO,IAAI,cAAc,CACvB,qBAAqB,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;QACpC,OAAO,CAAC,uBAAuB,EAAE;YAC/B,aAAa,EAAE,GAAG,EAAE,CAClB,MAAM,CAAC,yBAAyB,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;SACnE,CAAC,CAAC;IACL,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,8BAA8B,EAAE,GAAG,EAAE;IAC5C,EAAE,CAAC,IAAI,CAAC;QACN,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC;QAC5B,CAAC,aAAa,CAAC,UAAU,EAAE,YAAY,CAAC;QACxC,CAAC,aAAa,CAAC,KAAK,EAAE,OAAO,CAAC;KACtB,CAAC,CACT,gEAAgE,EAChE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACtB,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,CAAC;QAC5D,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-availability.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/resource-availability.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pins the edition vocabulary (`resource-availability.ts`): the one
|
|
3
|
+
* edition-to-mode converter, the rank comparison behind
|
|
4
|
+
* `isResourceAvailable`, and the two properties the DDs assumed and this
|
|
5
|
+
* module has to make true —
|
|
6
|
+
*
|
|
7
|
+
* - ranks, never wire numbers: `enterprise = 3` sits ABOVE `cloud = 2`
|
|
8
|
+
* and `cloud_only = 2` on the wire, so a comparison on enum values
|
|
9
|
+
* would say an Enterprise-tier kind is not served by a Cloud server;
|
|
10
|
+
* - forward compatibility: an edition value this SDK does not know
|
|
11
|
+
* (a newer server) maps to `"cloud"` instead of throwing, so an older
|
|
12
|
+
* console never breaks against a newer server.
|
|
13
|
+
*
|
|
14
|
+
* The kinds named here are chosen one per tier; re-tiering any of them is
|
|
15
|
+
* a contract change and must touch this file (editions program, DD-001).
|
|
16
|
+
*/
|
|
17
|
+
import { describe, expect, it } from "vitest";
|
|
18
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
19
|
+
import { ServerEdition } from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
20
|
+
import { deploymentModeOf, isResourceAvailable, } from "../resource-availability";
|
|
21
|
+
const MODES = ["local", "enterprise", "cloud"];
|
|
22
|
+
describe("deploymentModeOf — the one edition-to-mode converter", () => {
|
|
23
|
+
it("maps each known edition to its mode", () => {
|
|
24
|
+
expect(deploymentModeOf(ServerEdition.oss)).toBe("local");
|
|
25
|
+
expect(deploymentModeOf(ServerEdition.enterprise)).toBe("enterprise");
|
|
26
|
+
expect(deploymentModeOf(ServerEdition.cloud)).toBe("cloud");
|
|
27
|
+
});
|
|
28
|
+
it("maps unspecified to cloud — the documented safe default (nothing hidden on a broken server)", () => {
|
|
29
|
+
expect(deploymentModeOf(ServerEdition.server_edition_unspecified)).toBe("cloud");
|
|
30
|
+
});
|
|
31
|
+
it("maps an edition this SDK does not know to cloud instead of throwing — older client, newer server", () => {
|
|
32
|
+
// A future fourth edition arrives off the wire as a number the enum
|
|
33
|
+
// type does not name. The cast is the test's point.
|
|
34
|
+
expect(deploymentModeOf(99)).toBe("cloud");
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
describe("isResourceAvailable — a tier is a minimum edition", () => {
|
|
38
|
+
it("open_source-tier kinds are available in every mode", () => {
|
|
39
|
+
for (const mode of MODES) {
|
|
40
|
+
expect(isResourceAvailable(ApiResourceKind.agent, mode), mode).toBe(true);
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
it("enterprise-tier kinds are available in enterprise and cloud, not local", () => {
|
|
44
|
+
expect(isResourceAvailable(ApiResourceKind.iam_policy, "local")).toBe(false);
|
|
45
|
+
expect(isResourceAvailable(ApiResourceKind.iam_policy, "enterprise")).toBe(true);
|
|
46
|
+
// The inversion case: enterprise = 3 > cloud = 2 on the wire. A
|
|
47
|
+
// wire-number comparison fails exactly here.
|
|
48
|
+
expect(isResourceAvailable(ApiResourceKind.iam_policy, "cloud")).toBe(true);
|
|
49
|
+
});
|
|
50
|
+
it("cloud_only-tier kinds are available in cloud only", () => {
|
|
51
|
+
expect(isResourceAvailable(ApiResourceKind.api_resource_version, "local")).toBe(false);
|
|
52
|
+
expect(isResourceAvailable(ApiResourceKind.api_resource_version, "enterprise")).toBe(false);
|
|
53
|
+
expect(isResourceAvailable(ApiResourceKind.api_resource_version, "cloud")).toBe(true);
|
|
54
|
+
});
|
|
55
|
+
it("the kinds this entry re-tiers read as their new tier", () => {
|
|
56
|
+
// oauth_app: served by the OSS server; the cloud_only tier was drift.
|
|
57
|
+
expect(isResourceAvailable(ApiResourceKind.oauth_app, "local")).toBe(true);
|
|
58
|
+
// platform: the operator seat a self-hosting Enterprise company owns.
|
|
59
|
+
expect(isResourceAvailable(ApiResourceKind.platform, "local")).toBe(false);
|
|
60
|
+
expect(isResourceAvailable(ApiResourceKind.platform, "enterprise")).toBe(true);
|
|
61
|
+
// identity_account: flips to open_source in P1's serving PR, not here.
|
|
62
|
+
expect(isResourceAvailable(ApiResourceKind.identity_account, "local")).toBe(false);
|
|
63
|
+
// agent_share and channel_app: served by OSS; they never moved.
|
|
64
|
+
expect(isResourceAvailable(ApiResourceKind.agent_share, "local")).toBe(true);
|
|
65
|
+
expect(isResourceAvailable(ApiResourceKind.channel_app, "local")).toBe(true);
|
|
66
|
+
});
|
|
67
|
+
it("refuses a kind with no tier — a programming error, never silently available", () => {
|
|
68
|
+
expect(() => isResourceAvailable(ApiResourceKind.api_resource_kind_unknown, "cloud")).toThrow(/no tier/);
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
//# sourceMappingURL=resource-availability.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resource-availability.test.js","sourceRoot":"","sources":["../../src/__tests__/resource-availability.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AACtH,OAAO,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AAEtF,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GAEpB,MAAM,0BAA0B,CAAC;AAElC,MAAM,KAAK,GAA8B,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;AAE1E,QAAQ,CAAC,sDAAsD,EAAE,GAAG,EAAE;IACpE,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;QAC7C,MAAM,CAAC,gBAAgB,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1D,MAAM,CAAC,gBAAgB,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACtE,MAAM,CAAC,gBAAgB,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC9D,CAAC,CAAC,C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AS,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
1
|
+
import { ApiResourceKind, ResourceTier } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* The minimum edition that serves each resource kind (kind_meta.tier).
|
|
4
|
+
*
|
|
5
|
+
* Every kind with kind_meta is present, in enum-number order; a kind
|
|
6
|
+
* absent here has no tier and is a programming error to ask about.
|
|
4
7
|
*
|
|
5
8
|
* Source of truth: api_resource_kind.proto — each ApiResourceKind enum
|
|
6
9
|
* value carries a ResourceTier in its kind_meta options.
|
|
7
10
|
*/
|
|
8
|
-
export declare const
|
|
11
|
+
export declare const KIND_TIERS: ReadonlyMap<ApiResourceKind, ResourceTier>;
|
|
9
12
|
//# sourceMappingURL=resource-availability.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-availability.d.ts","sourceRoot":"","sources":["../../src/gen/resource-availability.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;
|
|
1
|
+
{"version":3,"file":"resource-availability.d.ts","sourceRoot":"","sources":["../../src/gen/resource-availability.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qFAAqF,CAAC;AAEpI;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,EAAE,WAAW,CAAC,eAAe,EAAE,YAAY,CA6BhE,CAAC"}
|
|
@@ -1,19 +1,42 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen from api_resource_kind.proto kind_meta. DO NOT EDIT.
|
|
2
|
-
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
2
|
+
import { ApiResourceKind, ResourceTier } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* The minimum edition that serves each resource kind (kind_meta.tier).
|
|
5
|
+
*
|
|
6
|
+
* Every kind with kind_meta is present, in enum-number order; a kind
|
|
7
|
+
* absent here has no tier and is a programming error to ask about.
|
|
5
8
|
*
|
|
6
9
|
* Source of truth: api_resource_kind.proto — each ApiResourceKind enum
|
|
7
10
|
* value carries a ResourceTier in its kind_meta options.
|
|
8
11
|
*/
|
|
9
|
-
export const
|
|
10
|
-
ApiResourceKind.api_resource_version,
|
|
11
|
-
ApiResourceKind.iam_policy,
|
|
12
|
-
ApiResourceKind.identity_account,
|
|
13
|
-
ApiResourceKind.
|
|
14
|
-
ApiResourceKind.
|
|
15
|
-
ApiResourceKind.
|
|
16
|
-
ApiResourceKind.
|
|
17
|
-
ApiResourceKind.
|
|
12
|
+
export const KIND_TIERS = new Map([
|
|
13
|
+
[ApiResourceKind.api_resource_version, ResourceTier.cloud_only],
|
|
14
|
+
[ApiResourceKind.iam_policy, ResourceTier.enterprise],
|
|
15
|
+
[ApiResourceKind.identity_account, ResourceTier.cloud_only],
|
|
16
|
+
[ApiResourceKind.api_key, ResourceTier.open_source],
|
|
17
|
+
[ApiResourceKind.invitation, ResourceTier.enterprise],
|
|
18
|
+
[ApiResourceKind.identity_provider, ResourceTier.enterprise],
|
|
19
|
+
[ApiResourceKind.oauth_app, ResourceTier.open_source],
|
|
20
|
+
[ApiResourceKind.platform_client, ResourceTier.cloud_only],
|
|
21
|
+
[ApiResourceKind.organization, ResourceTier.open_source],
|
|
22
|
+
[ApiResourceKind.platform, ResourceTier.enterprise],
|
|
23
|
+
[ApiResourceKind.agent, ResourceTier.open_source],
|
|
24
|
+
[ApiResourceKind.agent_execution, ResourceTier.open_source],
|
|
25
|
+
[ApiResourceKind.session, ResourceTier.open_source],
|
|
26
|
+
[ApiResourceKind.skill, ResourceTier.open_source],
|
|
27
|
+
[ApiResourceKind.mcp_server, ResourceTier.open_source],
|
|
28
|
+
[ApiResourceKind.agent_instance, ResourceTier.open_source],
|
|
29
|
+
[ApiResourceKind.agent_share, ResourceTier.open_source],
|
|
30
|
+
[ApiResourceKind.agent_channel, ResourceTier.open_source],
|
|
31
|
+
[ApiResourceKind.channel_app, ResourceTier.open_source],
|
|
32
|
+
[ApiResourceKind.workflow, ResourceTier.open_source],
|
|
33
|
+
[ApiResourceKind.workflow_instance, ResourceTier.open_source],
|
|
34
|
+
[ApiResourceKind.workflow_execution, ResourceTier.open_source],
|
|
35
|
+
[ApiResourceKind.environment, ResourceTier.open_source],
|
|
36
|
+
[ApiResourceKind.execution_context, ResourceTier.open_source],
|
|
37
|
+
[ApiResourceKind.artifact, ResourceTier.open_source],
|
|
38
|
+
[ApiResourceKind.schedule, ResourceTier.open_source],
|
|
39
|
+
[ApiResourceKind.memory, ResourceTier.open_source],
|
|
40
|
+
[ApiResourceKind.project, ResourceTier.open_source],
|
|
18
41
|
]);
|
|
19
42
|
//# sourceMappingURL=resource-availability.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-availability.js","sourceRoot":"","sources":["../../src/gen/resource-availability.ts"],"names":[],"mappings":"AAAA,yFAAyF;AAEzF,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;
|
|
1
|
+
{"version":3,"file":"resource-availability.js","sourceRoot":"","sources":["../../src/gen/resource-availability.ts"],"names":[],"mappings":"AAAA,yFAAyF;AAEzF,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,qFAAqF,CAAC;AAEpI;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAA+C,IAAI,GAAG,CAAC;IAC5E,CAAC,eAAe,CAAC,oBAAoB,EAAE,YAAY,CAAC,UAAU,CAAC;IAC/D,CAAC,eAAe,CAAC,UAAU,EAAE,YAAY,CAAC,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C;IAC9D,CAAC,eAAe,CAAC,WAAW,EAAE,YAAY,CAAC,WAAW,CAAC;IACvD,CAAC,eAAe,CAAC,iBAAiB,EAAE,YAAY,CAAC,WAAW,CAAC;IAC7D,CAAC,eAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,WAAW,CAAC;IACpD,CAAC,eAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,WAAW,CAAC;IACpD,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,WAAW,CAAC;IAClD,CAAC,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,WAAW,CAAC;CACpD,CAAC,CAAC"}
|
package/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { type StigmerConfig, type TokenProvider } from "./config.js";
|
|
|
4
4
|
export { createGuestAuth, GuestAuth, type GuestAuthConfig, type GuestIdStorage, } from "./guest-auth.js";
|
|
5
5
|
export { MAX_ALLOWED_ORIGINS, LINK_TOKEN_PARAM, validateOrigin, chatPath, buildChatUrl, appendLinkToken, buildEmbedLoaderUrl, buildEmbedSnippet, } from "./sharing.js";
|
|
6
6
|
export { StigmerError, type ErrorCode, isNotFound, isUnauthenticated, isPermissionDenied, isRetryable, isUnimplemented, type ErrorCategory, isConnectError, classifyError, isRetryableError, isTransientStreamError, getUserMessage, type ErrorReason, getErrorReason, type RpcErrorMetadata, annotateRpcError, getRpcMetadata, } from "./errors.js";
|
|
7
|
-
export { type DeploymentMode, isResourceAvailable, } from "./resource-availability.js";
|
|
7
|
+
export { type DeploymentMode, deploymentModeOf, isResourceAvailable, } from "./resource-availability.js";
|
|
8
8
|
export { getGrantableRoles, hasGrantableRoles, isRoleGrantable, } from "./authorization-config.js";
|
|
9
9
|
export { iamRoleToString, iamRoleFromString, iamRoleDisplayName, iamRoleDescription, } from "./iam-role.js";
|
|
10
10
|
export { IamRole } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAGrE,OAAO,EACL,eAAe,EACf,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,YAAY,EACZ,KAAK,SAAS,EACd,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,eAAe,EACf,KAAK,aAAa,EAClB,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACd,KAAK,WAAW,EAChB,cAAc,EACd,KAAK,gBAAgB,EACrB,gBAAgB,EAChB,cAAc,GACf,MAAM,aAAa,CAAC;AAGrB,OAAO,EACL,KAAK,cAAc,EACnB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AAGpE,OAAO,EACL,cAAc,EACd,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,GAChC,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,mBAAmB,IAAI,wBAAwB,EAAE,MAAM,eAAe,CAAC;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uestAuth, } from "./guest-auth.js";
|
|
|
9
9
|
export { MAX_ALLOWED_ORIGINS, LINK_TOKEN_PARAM, validateOrigin, chatPath, buildChatUrl, appendLinkToken, buildEmbedLoaderUrl, buildEmbedSnippet, } from "./sharing.js";
|
|
10
10
|
// Error handling
|
|
11
11
|
export { StigmerError, isNotFound, isUnauthenticated, isPermissionDenied, isRetryable, isUnimplemented, isConnectError, classifyError, isRetryableError, isTransientStreamError, getUserMessage, getErrorReason, annotateRpcError, getRpcMetadata, } from "./errors.js";
|
|
12
|
-
//
|
|
13
|
-
export { isResourceAvailable, } from "./resource-availability.js";
|
|
12
|
+
// Edition vocabulary and resource availability
|
|
13
|
+
export { deploymentModeOf, isResourceAvailable, } from "./resource-availability.js";
|
|
14
14
|
// Authorization config and IAM role utilities
|
|
15
15
|
export { getGrantableRoles, hasGrantableRoles, isRoleGrantable, } from "./authorization-config.js";
|
|
16
16
|
export { iamRoleToString, iamRoleFromString, iamRoleDisplayName, iamRoleDescription, } from "./iam-role.js";
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAE9B,mBAAmB;AACnB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,iBAAiB;AACjB,OAAO,EAGL,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAK7B,4EAA4E;AAC5E,OAAO,EACL,eAAe,EACf,SAAS,GAGV,MAAM,iBAAiB,CAAC;AAEzB,8DAA8D;AAC9D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,eAAe,EACf,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,cAAc,CAAC;AAEtB,iBAAiB;AACjB,OAAO,EACL,YAAY,EAEZ,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,EACX,eAAe,EAEf,cAAc,EAC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EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,yBAAyB,EACzB,sBAAsB,EACtB,uBAAuB,EACvB,oBAAoB,EACpB,gBAAgB,GAQjB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAmB,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,yBAAyB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EACL,cAAc,EACd,qBAAqB,GAMtB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,uBAAuB,EACvB,8BAA8B,GAE/B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,6BAA6B,GAE9B,MAAM,2BAA2B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/sdk",
|
|
3
|
-
"version": "3.14.
|
|
3
|
+
"version": "3.14.1",
|
|
4
4
|
"description": "Stigmer TypeScript SDK — typed API client for all Stigmer platform resources",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"@bufbuild/protobuf": "^2.0.0",
|
|
47
47
|
"@connectrpc/connect-node": "^2.0.0",
|
|
48
|
-
"@stigmer/protos": "3.14.
|
|
48
|
+
"@stigmer/protos": "3.14.1"
|
|
49
49
|
}
|
|
50
50
|
}
|
package/platform.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Transport } from "@connectrpc/connect";
|
|
2
|
-
import { ServerEdition } from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
3
|
-
import type
|
|
2
|
+
import type { ServerEdition } from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
3
|
+
import { type DeploymentMode } from "./resource-availability.js";
|
|
4
4
|
/** Server identity information returned by {@link PlatformClient.getServerInfo}. */
|
|
5
5
|
export interface ServerInfo {
|
|
6
6
|
/** Server edition mapped to a {@link DeploymentMode}. */
|
|
@@ -23,8 +23,10 @@ export declare class PlatformClient {
|
|
|
23
23
|
/**
|
|
24
24
|
* Retrieve the connected server's edition and version.
|
|
25
25
|
*
|
|
26
|
-
* Maps the proto {@link ServerEdition} to a {@link DeploymentMode}
|
|
26
|
+
* Maps the proto {@link ServerEdition} to a {@link DeploymentMode}
|
|
27
|
+
* through {@link deploymentModeOf}:
|
|
27
28
|
* - `oss` -> `"local"`
|
|
29
|
+
* - `enterprise` -> `"enterprise"`
|
|
28
30
|
* - `cloud` -> `"cloud"`
|
|
29
31
|
* - unspecified/unknown -> `"cloud"` (safe default)
|
|
30
32
|
*/
|
package/platform.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMhF,OAAO,KAAK,EAEV,aAAa,EACd,MAAM,uDAAuD,CAAC;AAE/D,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAC;AAEpC,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyC;gBAEtD,SAAS,EAAE,SAAS;IAIhC;;;;;;;;;OASG;IACG,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;CAc3C"}
|
package/platform.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createClient } from "@connectrpc/connect";
|
|
2
2
|
import { create } from "@bufbuild/protobuf";
|
|
3
|
-
import { GetServerInfoInputSchema, PlatformQueryController,
|
|
3
|
+
import { GetServerInfoInputSchema, PlatformQueryController, } from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
4
4
|
import { wrapError } from "./gen/errors.js";
|
|
5
|
+
import { deploymentModeOf, } from "./resource-availability.js";
|
|
5
6
|
/**
|
|
6
7
|
* Client for platform-level queries (server info, capabilities).
|
|
7
8
|
*
|
|
@@ -17,8 +18,10 @@ export class PlatformClient {
|
|
|
17
18
|
/**
|
|
18
19
|
* Retrieve the connected server's edition and version.
|
|
19
20
|
*
|
|
20
|
-
* Maps the proto {@link ServerEdition} to a {@link DeploymentMode}
|
|
21
|
+
* Maps the proto {@link ServerEdition} to a {@link DeploymentMode}
|
|
22
|
+
* through {@link deploymentModeOf}:
|
|
21
23
|
* - `oss` -> `"local"`
|
|
24
|
+
* - `enterprise` -> `"enterprise"`
|
|
22
25
|
* - `cloud` -> `"cloud"`
|
|
23
26
|
* - unspecified/unknown -> `"cloud"` (safe default)
|
|
24
27
|
*/
|
|
@@ -26,7 +29,7 @@ export class PlatformClient {
|
|
|
26
29
|
try {
|
|
27
30
|
const resp = await this.platform.getServerInfo(create(GetServerInfoInputSchema, {}));
|
|
28
31
|
return {
|
|
29
|
-
deploymentMode: resp.edition
|
|
32
|
+
deploymentMode: deploymentModeOf(resp.edition),
|
|
30
33
|
edition: resp.edition,
|
|
31
34
|
version: resp.version,
|
|
32
35
|
};
|
package/platform.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA+B,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EACL,wBAAwB,EACxB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA+B,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EACL,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,uDAAuD,CAAC;AAK/D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EACL,gBAAgB,GAEjB,MAAM,4BAA4B,CAAC;AAYpC;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IACR,QAAQ,CAAyC;IAElE,YAAY,SAAoB;QAC9B,IAAI,CAAC,QAAQ,GAAG,YAAY,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC;IACnE,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,aAAa;QACjB,IAAI,CAAC;YACH,MAAM,IAAI,GAAwB,MAAM,IAAI,CAAC,QAAQ,CAAC,aAAa,CACjE,MAAM,CAAC,wBAAwB,EAAE,EAAE,CAAC,CACrC,CAAC;YACF,OAAO;gBACL,cAAc,EAAE,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC;gBAC9C,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,OAAO,EAAE,IAAI,CAAC,OAAO;aACtB,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,SAAS,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,19 +1,60 @@
|
|
|
1
|
-
import type { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* The edition vocabulary of the SDK: which edition a server is, in the
|
|
3
|
+
* SDK's own words, and whether a resource kind is served there.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* - `
|
|
8
|
-
*
|
|
5
|
+
* Four facts this module is built on (editions program, DD-001):
|
|
6
|
+
*
|
|
7
|
+
* - A kind's `ResourceTier` names the MINIMUM edition that serves it. The
|
|
8
|
+
* editions are ordered oss < enterprise < cloud because each composes the
|
|
9
|
+
* previous one's extension units, so a tier admits its own edition and
|
|
10
|
+
* every edition above it.
|
|
11
|
+
* - The proto enums' numbers are wire identifiers, not ranks: `enterprise`
|
|
12
|
+
* was added after `cloud` / `cloud_only` and sits at 3 in both. The two
|
|
13
|
+
* rank functions below are the ONLY place a tier meets an edition; nothing
|
|
14
|
+
* compares enum numbers.
|
|
15
|
+
* - `DeploymentMode` is `ServerEdition` in string-literal form, the shape
|
|
16
|
+
* React consumers expect (`colorMode: "light" | "dark"` is the sibling),
|
|
17
|
+
* with `oss` spelled `"local"` for history's sake. `deploymentModeOf` is
|
|
18
|
+
* the ONE converter; it must never grow a second implementation.
|
|
19
|
+
* - An older client must not break against a newer server: an edition value
|
|
20
|
+
* this SDK does not know maps to `"cloud"` (nothing hidden) instead of
|
|
21
|
+
* throwing. The switch is exhaustive at compile time so a new edition is
|
|
22
|
+
* still a compile error here; the runtime fallback is for the wire.
|
|
23
|
+
*
|
|
24
|
+
* `DeploymentMode` answers a TIER question ("is this kind served here?").
|
|
25
|
+
* Sites that use it to ask a FACILITY question ("does this server have a
|
|
26
|
+
* wallet?") compare `=== "cloud"` deliberately and say which facility they
|
|
27
|
+
* mean; see the React SDK's deployment-mode consumers.
|
|
28
|
+
*/
|
|
29
|
+
import { type ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
30
|
+
import { ServerEdition } from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
31
|
+
/**
|
|
32
|
+
* Edition of the Stigmer backend the client is connected to, as reported
|
|
33
|
+
* by {@link PlatformClient.getServerInfo}.
|
|
34
|
+
*
|
|
35
|
+
* - `"local"` — Stigmer, the open-source edition. `open_source`-tier
|
|
36
|
+
* resources are served.
|
|
37
|
+
* - `"enterprise"` — Stigmer Enterprise, self-hosted. `open_source`- and
|
|
38
|
+
* `enterprise`-tier resources are served.
|
|
39
|
+
* - `"cloud"` — Stigmer Cloud. Every resource is served.
|
|
40
|
+
*/
|
|
41
|
+
export type DeploymentMode = "local" | "enterprise" | "cloud";
|
|
42
|
+
/**
|
|
43
|
+
* The one edition-to-mode converter.
|
|
44
|
+
*
|
|
45
|
+
* `server_edition_unspecified` and any value this SDK does not know map to
|
|
46
|
+
* `"cloud"`: a broken or newer server hides nothing, which is the failure a
|
|
47
|
+
* client can live with. The `never` default keeps the switch exhaustive for
|
|
48
|
+
* the editions this SDK knows.
|
|
9
49
|
*/
|
|
10
|
-
export
|
|
50
|
+
export declare function deploymentModeOf(edition: ServerEdition): DeploymentMode;
|
|
11
51
|
/**
|
|
12
|
-
* Check whether a resource kind is
|
|
52
|
+
* Check whether a resource kind is served in the given deployment mode.
|
|
13
53
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
54
|
+
* A kind is served when the mode's edition ranks at or above the kind's
|
|
55
|
+
* minimum edition. Throws for a kind with no tier (only
|
|
56
|
+
* `api_resource_kind_unknown`): that is a programming error, and answering
|
|
57
|
+
* "available" for it would hide the bug.
|
|
17
58
|
*/
|
|
18
59
|
export declare function isResourceAvailable(kind: ApiResourceKind, mode: DeploymentMode): boolean;
|
|
19
60
|
//# sourceMappingURL=resource-availability.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-availability.d.ts","sourceRoot":"","sources":["../src/resource-availability.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"resource-availability.d.ts","sourceRoot":"","sources":["../src/resource-availability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,qFAAqF,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AAGtF;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,YAAY,GAAG,OAAO,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,aAAa,GAAG,cAAc,CAevE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,eAAe,EACrB,IAAI,EAAE,cAAc,GACnB,OAAO,CAQT"}
|
package/resource-availability.js
CHANGED
|
@@ -1,14 +1,107 @@
|
|
|
1
|
-
import { CLOUD_ONLY_KINDS } from "./gen/resource-availability.js";
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
2
|
+
* The edition vocabulary of the SDK: which edition a server is, in the
|
|
3
|
+
* SDK's own words, and whether a resource kind is served there.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
5
|
+
* Four facts this module is built on (editions program, DD-001):
|
|
6
|
+
*
|
|
7
|
+
* - A kind's `ResourceTier` names the MINIMUM edition that serves it. The
|
|
8
|
+
* editions are ordered oss < enterprise < cloud because each composes the
|
|
9
|
+
* previous one's extension units, so a tier admits its own edition and
|
|
10
|
+
* every edition above it.
|
|
11
|
+
* - The proto enums' numbers are wire identifiers, not ranks: `enterprise`
|
|
12
|
+
* was added after `cloud` / `cloud_only` and sits at 3 in both. The two
|
|
13
|
+
* rank functions below are the ONLY place a tier meets an edition; nothing
|
|
14
|
+
* compares enum numbers.
|
|
15
|
+
* - `DeploymentMode` is `ServerEdition` in string-literal form, the shape
|
|
16
|
+
* React consumers expect (`colorMode: "light" | "dark"` is the sibling),
|
|
17
|
+
* with `oss` spelled `"local"` for history's sake. `deploymentModeOf` is
|
|
18
|
+
* the ONE converter; it must never grow a second implementation.
|
|
19
|
+
* - An older client must not break against a newer server: an edition value
|
|
20
|
+
* this SDK does not know maps to `"cloud"` (nothing hidden) instead of
|
|
21
|
+
* throwing. The switch is exhaustive at compile time so a new edition is
|
|
22
|
+
* still a compile error here; the runtime fallback is for the wire.
|
|
23
|
+
*
|
|
24
|
+
* `DeploymentMode` answers a TIER question ("is this kind served here?").
|
|
25
|
+
* Sites that use it to ask a FACILITY question ("does this server have a
|
|
26
|
+
* wallet?") compare `=== "cloud"` deliberately and say which facility they
|
|
27
|
+
* mean; see the React SDK's deployment-mode consumers.
|
|
28
|
+
*/
|
|
29
|
+
import { ResourceTier, } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
30
|
+
import { ServerEdition } from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
31
|
+
import { KIND_TIERS } from "./gen/resource-availability.js";
|
|
32
|
+
/**
|
|
33
|
+
* The one edition-to-mode converter.
|
|
34
|
+
*
|
|
35
|
+
* `server_edition_unspecified` and any value this SDK does not know map to
|
|
36
|
+
* `"cloud"`: a broken or newer server hides nothing, which is the failure a
|
|
37
|
+
* client can live with. The `never` default keeps the switch exhaustive for
|
|
38
|
+
* the editions this SDK knows.
|
|
39
|
+
*/
|
|
40
|
+
export function deploymentModeOf(edition) {
|
|
41
|
+
switch (edition) {
|
|
42
|
+
case ServerEdition.oss:
|
|
43
|
+
return "local";
|
|
44
|
+
case ServerEdition.enterprise:
|
|
45
|
+
return "enterprise";
|
|
46
|
+
case ServerEdition.cloud:
|
|
47
|
+
case ServerEdition.server_edition_unspecified:
|
|
48
|
+
return "cloud";
|
|
49
|
+
default: {
|
|
50
|
+
const _exhaustive = edition;
|
|
51
|
+
void _exhaustive;
|
|
52
|
+
return "cloud";
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Check whether a resource kind is served in the given deployment mode.
|
|
58
|
+
*
|
|
59
|
+
* A kind is served when the mode's edition ranks at or above the kind's
|
|
60
|
+
* minimum edition. Throws for a kind with no tier (only
|
|
61
|
+
* `api_resource_kind_unknown`): that is a programming error, and answering
|
|
62
|
+
* "available" for it would hide the bug.
|
|
8
63
|
*/
|
|
9
64
|
export function isResourceAvailable(kind, mode) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
65
|
+
const tier = KIND_TIERS.get(kind);
|
|
66
|
+
if (tier === undefined) {
|
|
67
|
+
throw new Error(`isResourceAvailable: kind ${kind} has no tier — only kinds with kind_meta can be asked about`);
|
|
68
|
+
}
|
|
69
|
+
return editionRank(mode) >= tierRank(tier);
|
|
70
|
+
}
|
|
71
|
+
/** Position of an edition in the oss < enterprise < cloud order. */
|
|
72
|
+
function editionRank(mode) {
|
|
73
|
+
switch (mode) {
|
|
74
|
+
case "local":
|
|
75
|
+
return 1;
|
|
76
|
+
case "enterprise":
|
|
77
|
+
return 2;
|
|
78
|
+
case "cloud":
|
|
79
|
+
return 3;
|
|
80
|
+
default: {
|
|
81
|
+
const _exhaustive = mode;
|
|
82
|
+
throw new Error(`unknown deployment mode: ${String(_exhaustive)}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/** Position of a tier's minimum edition in the same order. */
|
|
87
|
+
function tierRank(tier) {
|
|
88
|
+
switch (tier) {
|
|
89
|
+
case ResourceTier.open_source:
|
|
90
|
+
return 1;
|
|
91
|
+
case ResourceTier.enterprise:
|
|
92
|
+
return 2;
|
|
93
|
+
case ResourceTier.cloud_only:
|
|
94
|
+
return 3;
|
|
95
|
+
case ResourceTier.resource_tier_unspecified:
|
|
96
|
+
// A kind without a declared tier is treated as core: the generator
|
|
97
|
+
// emits every kind_meta tier verbatim, so this arm is reachable only
|
|
98
|
+
// by a proto that forgot the field, and hiding a kind is the worse
|
|
99
|
+
// failure for a client.
|
|
100
|
+
return 1;
|
|
101
|
+
default: {
|
|
102
|
+
const _exhaustive = tier;
|
|
103
|
+
throw new Error(`unknown resource tier: ${String(_exhaustive)}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
13
106
|
}
|
|
14
107
|
//# sourceMappingURL=resource-availability.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-availability.js","sourceRoot":"","sources":["../src/resource-availability.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resource-availability.js","sourceRoot":"","sources":["../src/resource-availability.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EACL,YAAY,GAEb,MAAM,qFAAqF,CAAC;AAC7F,OAAO,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAc5D;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAsB;IACrD,QAAQ,OAAO,EAAE,CAAC;QAChB,KAAK,aAAa,CAAC,GAAG;YACpB,OAAO,OAAO,CAAC;QACjB,KAAK,aAAa,CAAC,UAAU;YAC3B,OAAO,YAAY,CAAC;QACtB,KAAK,aAAa,CAAC,KAAK,CAAC;QACzB,KAAK,aAAa,CAAC,0BAA0B;YAC3C,OAAO,OAAO,CAAC;QACjB,OAAO,CAAC,CAAC,CAAC;YACR,MAAM,WAAW,GAAU,OAAO,CAAC;YACnC,KAAK,WAAW,CAAC;YACjB,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAqB,EACrB,IAAoB;IAEpB,M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atformClient.getServerInfo's edition-to-mode mapping: the client
|
|
3
|
+
* reports the server's edition through the one converter
|
|
4
|
+
* (`deploymentModeOf`), so a third edition on the wire reaches consumers
|
|
5
|
+
* as its own mode and never collapses into "cloud" by accident. The raw
|
|
6
|
+
* edition rides beside it for callers that want the wire value.
|
|
7
|
+
*/
|
|
8
|
+
import { describe, expect, it } from "vitest";
|
|
9
|
+
import { createRouterTransport } from "@connectrpc/connect";
|
|
10
|
+
import { create } from "@bufbuild/protobuf";
|
|
11
|
+
import {
|
|
12
|
+
GetServerInfoOutputSchema,
|
|
13
|
+
PlatformQueryController,
|
|
14
|
+
ServerEdition,
|
|
15
|
+
} from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
16
|
+
|
|
17
|
+
import { PlatformClient } from "../platform";
|
|
18
|
+
|
|
19
|
+
function clientAnswering(edition: ServerEdition): PlatformClient {
|
|
20
|
+
return new PlatformClient(
|
|
21
|
+
createRouterTransport(({ service }) => {
|
|
22
|
+
service(PlatformQueryController, {
|
|
23
|
+
getServerInfo: () =>
|
|
24
|
+
create(GetServerInfoOutputSchema, { edition, version: "1.2.3" }),
|
|
25
|
+
});
|
|
26
|
+
}),
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe("PlatformClient.getServerInfo", () => {
|
|
31
|
+
it.each([
|
|
32
|
+
[ServerEdition.oss, "local"],
|
|
33
|
+
[ServerEdition.enterprise, "enterprise"],
|
|
34
|
+
[ServerEdition.cloud, "cloud"],
|
|
35
|
+
] as const)(
|
|
36
|
+
"maps edition %d to deploymentMode %s and keeps the raw edition",
|
|
37
|
+
async (edition, mode) => {
|
|
38
|
+
const info = await clientAnswering(edition).getServerInfo();
|
|
39
|
+
expect(info.deploymentMode).toBe(mode);
|
|
40
|
+
expect(info.edition).toBe(edition);
|
|
41
|
+
expect(info.version).toBe("1.2.3");
|
|
42
|
+
},
|
|
43
|
+
);
|
|
44
|
+
});
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pins the edition vocabulary (`resource-availability.ts`): the one
|
|
3
|
+
* edition-to-mode converter, the rank comparison behind
|
|
4
|
+
* `isResourceAvailable`, and the two properties the DDs assumed and this
|
|
5
|
+
* module has to make true —
|
|
6
|
+
*
|
|
7
|
+
* - ranks, never wire numbers: `enterprise = 3` sits ABOVE `cloud = 2`
|
|
8
|
+
* and `cloud_only = 2` on the wire, so a comparison on enum values
|
|
9
|
+
* would say an Enterprise-tier kind is not served by a Cloud server;
|
|
10
|
+
* - forward compatibility: an edition value this SDK does not know
|
|
11
|
+
* (a newer server) maps to `"cloud"` instead of throwing, so an older
|
|
12
|
+
* console never breaks against a newer server.
|
|
13
|
+
*
|
|
14
|
+
* The kinds named here are chosen one per tier; re-tiering any of them is
|
|
15
|
+
* a contract change and must touch this file (editions program, DD-001).
|
|
16
|
+
*/
|
|
17
|
+
import { describe, expect, it } from "vitest";
|
|
18
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
19
|
+
import { ServerEdition } from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
20
|
+
|
|
21
|
+
import {
|
|
22
|
+
deploymentModeOf,
|
|
23
|
+
isResourceAvailable,
|
|
24
|
+
type DeploymentMode,
|
|
25
|
+
} from "../resource-availability";
|
|
26
|
+
|
|
27
|
+
const MODES: readonly DeploymentMode[] = ["local", "enterprise", "cloud"];
|
|
28
|
+
|
|
29
|
+
describe("deploymentModeOf — the one edition-to-mode converter", () => {
|
|
30
|
+
it("maps each known edition to its mode", () => {
|
|
31
|
+
expect(deploymentModeOf(ServerEdition.oss)).toBe("local");
|
|
32
|
+
expect(deploymentModeOf(ServerEdition.enterprise)).toBe("enterprise");
|
|
33
|
+
expect(deploymentModeOf(ServerEdition.cloud)).toBe("cloud");
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it("maps unspecified to cloud — the documented safe default (nothing hidden on a broken server)", () => {
|
|
37
|
+
expect(deploymentModeOf(ServerEdition.server_edition_unspecified)).toBe(
|
|
38
|
+
"cloud",
|
|
39
|
+
);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it("maps an edition this SDK does not know to cloud instead of throwing — older client, newer server", () => {
|
|
43
|
+
// A future fourth edition arrives off the wire as a number the enum
|
|
44
|
+
// type does not name. The cast is the test's point.
|
|
45
|
+
expect(deploymentModeOf(99 as ServerEdition)).toBe("cloud");
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
describe("isResourceAvailable — a tier is a minimum edition", () => {
|
|
50
|
+
it("open_source-tier kinds are available in every mode", () => {
|
|
51
|
+
for (const mode of MODES) {
|
|
52
|
+
expect(isResourceAvailable(ApiResourceKind.agent, mode), mode).toBe(true);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("enterprise-tier kinds are available in enterprise and cloud, not local", () => {
|
|
57
|
+
expect(isResourceAvailable(ApiResourceKind.iam_policy, "local")).toBe(
|
|
58
|
+
false,
|
|
59
|
+
);
|
|
60
|
+
expect(isResourceAvailable(ApiResourceKind.iam_policy, "enterprise")).toBe(
|
|
61
|
+
true,
|
|
62
|
+
);
|
|
63
|
+
// The inversion case: enterprise = 3 > cloud = 2 on the wire. A
|
|
64
|
+
// wire-number comparison fails exactly here.
|
|
65
|
+
expect(isResourceAvailable(ApiResourceKind.iam_policy, "cloud")).toBe(true);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it("cloud_only-tier kinds are available in cloud only", () => {
|
|
69
|
+
expect(
|
|
70
|
+
isResourceAvailable(ApiResourceKind.api_resource_version, "local"),
|
|
71
|
+
).toBe(false);
|
|
72
|
+
expect(
|
|
73
|
+
isResourceAvailable(ApiResourceKind.api_resource_version, "enterprise"),
|
|
74
|
+
).toBe(false);
|
|
75
|
+
expect(
|
|
76
|
+
isResourceAvailable(ApiResourceKind.api_resource_version, "cloud"),
|
|
77
|
+
).toBe(true);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it("the kinds this entry re-tiers read as their new tier", () => {
|
|
81
|
+
// oauth_app: served by the OSS server; the cloud_only tier was drift.
|
|
82
|
+
expect(isResourceAvailable(ApiResourceKind.oauth_app, "local")).toBe(true);
|
|
83
|
+
// platform: the operator seat a self-hosting Enterprise company owns.
|
|
84
|
+
expect(isResourceAvailable(ApiResourceKind.platform, "local")).toBe(false);
|
|
85
|
+
expect(isResourceAvailable(ApiResourceKind.platform, "enterprise")).toBe(
|
|
86
|
+
true,
|
|
87
|
+
);
|
|
88
|
+
// identity_account: flips to open_source in P1's serving PR, not here.
|
|
89
|
+
expect(isResourceAvailable(ApiResourceKind.identity_account, "local")).toBe(
|
|
90
|
+
false,
|
|
91
|
+
);
|
|
92
|
+
// agent_share and channel_app: served by OSS; they never moved.
|
|
93
|
+
expect(isResourceAvailable(ApiResourceKind.agent_share, "local")).toBe(
|
|
94
|
+
true,
|
|
95
|
+
);
|
|
96
|
+
expect(isResourceAvailable(ApiResourceKind.channel_app, "local")).toBe(
|
|
97
|
+
true,
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("refuses a kind with no tier — a programming error, never silently available", () => {
|
|
102
|
+
expect(() =>
|
|
103
|
+
isResourceAvailable(ApiResourceKind.api_resource_kind_unknown, "cloud"),
|
|
104
|
+
).toThrow(/no tier/);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
@@ -1,20 +1,43 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen from api_resource_kind.proto kind_meta. DO NOT EDIT.
|
|
2
2
|
|
|
3
|
-
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
3
|
+
import { ApiResourceKind, ResourceTier } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* The minimum edition that serves each resource kind (kind_meta.tier).
|
|
7
|
+
*
|
|
8
|
+
* Every kind with kind_meta is present, in enum-number order; a kind
|
|
9
|
+
* absent here has no tier and is a programming error to ask about.
|
|
7
10
|
*
|
|
8
11
|
* Source of truth: api_resource_kind.proto — each ApiResourceKind enum
|
|
9
12
|
* value carries a ResourceTier in its kind_meta options.
|
|
10
13
|
*/
|
|
11
|
-
export const
|
|
12
|
-
ApiResourceKind.api_resource_version,
|
|
13
|
-
ApiResourceKind.iam_policy,
|
|
14
|
-
ApiResourceKind.identity_account,
|
|
15
|
-
ApiResourceKind.
|
|
16
|
-
ApiResourceKind.
|
|
17
|
-
ApiResourceKind.
|
|
18
|
-
ApiResourceKind.
|
|
19
|
-
ApiResourceKind.
|
|
14
|
+
export const KIND_TIERS: ReadonlyMap<ApiResourceKind, ResourceTier> = new Map([
|
|
15
|
+
[ApiResourceKind.api_resource_version, ResourceTier.cloud_only],
|
|
16
|
+
[ApiResourceKind.iam_policy, ResourceTier.enterprise],
|
|
17
|
+
[ApiResourceKind.identity_account, ResourceTier.cloud_only],
|
|
18
|
+
[ApiResourceKind.api_key, ResourceTier.open_source],
|
|
19
|
+
[ApiResourceKind.invitation, ResourceTier.enterprise],
|
|
20
|
+
[ApiResourceKind.identity_provider, ResourceTier.enterprise],
|
|
21
|
+
[ApiResourceKind.oauth_app, ResourceTier.open_source],
|
|
22
|
+
[ApiResourceKind.platform_client, ResourceTier.cloud_only],
|
|
23
|
+
[ApiResourceKind.organization, ResourceTier.open_source],
|
|
24
|
+
[ApiResourceKind.platform, ResourceTier.enterprise],
|
|
25
|
+
[ApiResourceKind.agent, ResourceTier.open_source],
|
|
26
|
+
[ApiResourceKind.agent_execution, ResourceTier.open_source],
|
|
27
|
+
[ApiResourceKind.session, ResourceTier.open_source],
|
|
28
|
+
[ApiResourceKind.skill, ResourceTier.open_source],
|
|
29
|
+
[ApiResourceKind.mcp_server, ResourceTier.open_source],
|
|
30
|
+
[ApiResourceKind.agent_instance, ResourceTier.open_source],
|
|
31
|
+
[ApiResourceKind.agent_share, ResourceTier.open_source],
|
|
32
|
+
[ApiResourceKind.agent_channel, ResourceTier.open_source],
|
|
33
|
+
[ApiResourceKind.channel_app, ResourceTier.open_source],
|
|
34
|
+
[ApiResourceKind.workflow, ResourceTier.open_source],
|
|
35
|
+
[ApiResourceKind.workflow_instance, ResourceTier.open_source],
|
|
36
|
+
[ApiResourceKind.workflow_execution, ResourceTier.open_source],
|
|
37
|
+
[ApiResourceKind.environment, ResourceTier.open_source],
|
|
38
|
+
[ApiResourceKind.execution_context, ResourceTier.open_source],
|
|
39
|
+
[ApiResourceKind.artifact, ResourceTier.open_source],
|
|
40
|
+
[ApiResourceKind.schedule, ResourceTier.open_source],
|
|
41
|
+
[ApiResourceKind.memory, ResourceTier.open_source],
|
|
42
|
+
[ApiResourceKind.project, ResourceTier.open_source],
|
|
20
43
|
]);
|
package/src/index.ts
CHANGED
|
@@ -55,9 +55,10 @@ export {
|
|
|
55
55
|
getRpcMetadata,
|
|
56
56
|
} from "./errors.js";
|
|
57
57
|
|
|
58
|
-
//
|
|
58
|
+
// Edition vocabulary and resource availability
|
|
59
59
|
export {
|
|
60
60
|
type DeploymentMode,
|
|
61
|
+
deploymentModeOf,
|
|
61
62
|
isResourceAvailable,
|
|
62
63
|
} from "./resource-availability.js";
|
|
63
64
|
|
package/src/platform.ts
CHANGED
|
@@ -3,11 +3,16 @@ import { create } from "@bufbuild/protobuf";
|
|
|
3
3
|
import {
|
|
4
4
|
GetServerInfoInputSchema,
|
|
5
5
|
PlatformQueryController,
|
|
6
|
+
} from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
7
|
+
import type {
|
|
8
|
+
GetServerInfoOutput,
|
|
6
9
|
ServerEdition,
|
|
7
10
|
} from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
8
|
-
import type { GetServerInfoOutput } from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
9
11
|
import { wrapError } from "./gen/errors.js";
|
|
10
|
-
import
|
|
12
|
+
import {
|
|
13
|
+
deploymentModeOf,
|
|
14
|
+
type DeploymentMode,
|
|
15
|
+
} from "./resource-availability.js";
|
|
11
16
|
|
|
12
17
|
/** Server identity information returned by {@link PlatformClient.getServerInfo}. */
|
|
13
18
|
export interface ServerInfo {
|
|
@@ -36,8 +41,10 @@ export class PlatformClient {
|
|
|
36
41
|
/**
|
|
37
42
|
* Retrieve the connected server's edition and version.
|
|
38
43
|
*
|
|
39
|
-
* Maps the proto {@link ServerEdition} to a {@link DeploymentMode}
|
|
44
|
+
* Maps the proto {@link ServerEdition} to a {@link DeploymentMode}
|
|
45
|
+
* through {@link deploymentModeOf}:
|
|
40
46
|
* - `oss` -> `"local"`
|
|
47
|
+
* - `enterprise` -> `"enterprise"`
|
|
41
48
|
* - `cloud` -> `"cloud"`
|
|
42
49
|
* - unspecified/unknown -> `"cloud"` (safe default)
|
|
43
50
|
*/
|
|
@@ -47,7 +54,7 @@ export class PlatformClient {
|
|
|
47
54
|
create(GetServerInfoInputSchema, {}),
|
|
48
55
|
);
|
|
49
56
|
return {
|
|
50
|
-
deploymentMode: resp.edition
|
|
57
|
+
deploymentMode: deploymentModeOf(resp.edition),
|
|
51
58
|
edition: resp.edition,
|
|
52
59
|
version: resp.version,
|
|
53
60
|
};
|
|
@@ -1,27 +1,130 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The edition vocabulary of the SDK: which edition a server is, in the
|
|
3
|
+
* SDK's own words, and whether a resource kind is served there.
|
|
4
|
+
*
|
|
5
|
+
* Four facts this module is built on (editions program, DD-001):
|
|
6
|
+
*
|
|
7
|
+
* - A kind's `ResourceTier` names the MINIMUM edition that serves it. The
|
|
8
|
+
* editions are ordered oss < enterprise < cloud because each composes the
|
|
9
|
+
* previous one's extension units, so a tier admits its own edition and
|
|
10
|
+
* every edition above it.
|
|
11
|
+
* - The proto enums' numbers are wire identifiers, not ranks: `enterprise`
|
|
12
|
+
* was added after `cloud` / `cloud_only` and sits at 3 in both. The two
|
|
13
|
+
* rank functions below are the ONLY place a tier meets an edition; nothing
|
|
14
|
+
* compares enum numbers.
|
|
15
|
+
* - `DeploymentMode` is `ServerEdition` in string-literal form, the shape
|
|
16
|
+
* React consumers expect (`colorMode: "light" | "dark"` is the sibling),
|
|
17
|
+
* with `oss` spelled `"local"` for history's sake. `deploymentModeOf` is
|
|
18
|
+
* the ONE converter; it must never grow a second implementation.
|
|
19
|
+
* - An older client must not break against a newer server: an edition value
|
|
20
|
+
* this SDK does not know maps to `"cloud"` (nothing hidden) instead of
|
|
21
|
+
* throwing. The switch is exhaustive at compile time so a new edition is
|
|
22
|
+
* still a compile error here; the runtime fallback is for the wire.
|
|
23
|
+
*
|
|
24
|
+
* `DeploymentMode` answers a TIER question ("is this kind served here?").
|
|
25
|
+
* Sites that use it to ask a FACILITY question ("does this server have a
|
|
26
|
+
* wallet?") compare `=== "cloud"` deliberately and say which facility they
|
|
27
|
+
* mean; see the React SDK's deployment-mode consumers.
|
|
28
|
+
*/
|
|
29
|
+
import {
|
|
30
|
+
ResourceTier,
|
|
31
|
+
type ApiResourceKind,
|
|
32
|
+
} from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
33
|
+
import { ServerEdition } from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
34
|
+
import { KIND_TIERS } from "./gen/resource-availability.js";
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Edition of the Stigmer backend the client is connected to, as reported
|
|
38
|
+
* by {@link PlatformClient.getServerInfo}.
|
|
39
|
+
*
|
|
40
|
+
* - `"local"` — Stigmer, the open-source edition. `open_source`-tier
|
|
41
|
+
* resources are served.
|
|
42
|
+
* - `"enterprise"` — Stigmer Enterprise, self-hosted. `open_source`- and
|
|
43
|
+
* `enterprise`-tier resources are served.
|
|
44
|
+
* - `"cloud"` — Stigmer Cloud. Every resource is served.
|
|
45
|
+
*/
|
|
46
|
+
export type DeploymentMode = "local" | "enterprise" | "cloud";
|
|
3
47
|
|
|
4
48
|
/**
|
|
5
|
-
*
|
|
49
|
+
* The one edition-to-mode converter.
|
|
6
50
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
51
|
+
* `server_edition_unspecified` and any value this SDK does not know map to
|
|
52
|
+
* `"cloud"`: a broken or newer server hides nothing, which is the failure a
|
|
53
|
+
* client can live with. The `never` default keeps the switch exhaustive for
|
|
54
|
+
* the editions this SDK knows.
|
|
11
55
|
*/
|
|
12
|
-
export
|
|
56
|
+
export function deploymentModeOf(edition: ServerEdition): DeploymentMode {
|
|
57
|
+
switch (edition) {
|
|
58
|
+
case ServerEdition.oss:
|
|
59
|
+
return "local";
|
|
60
|
+
case ServerEdition.enterprise:
|
|
61
|
+
return "enterprise";
|
|
62
|
+
case ServerEdition.cloud:
|
|
63
|
+
case ServerEdition.server_edition_unspecified:
|
|
64
|
+
return "cloud";
|
|
65
|
+
default: {
|
|
66
|
+
const _exhaustive: never = edition;
|
|
67
|
+
void _exhaustive;
|
|
68
|
+
return "cloud";
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
13
72
|
|
|
14
73
|
/**
|
|
15
|
-
* Check whether a resource kind is
|
|
74
|
+
* Check whether a resource kind is served in the given deployment mode.
|
|
16
75
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
76
|
+
* A kind is served when the mode's edition ranks at or above the kind's
|
|
77
|
+
* minimum edition. Throws for a kind with no tier (only
|
|
78
|
+
* `api_resource_kind_unknown`): that is a programming error, and answering
|
|
79
|
+
* "available" for it would hide the bug.
|
|
20
80
|
*/
|
|
21
81
|
export function isResourceAvailable(
|
|
22
82
|
kind: ApiResourceKind,
|
|
23
83
|
mode: DeploymentMode,
|
|
24
84
|
): boolean {
|
|
25
|
-
|
|
26
|
-
|
|
85
|
+
const tier = KIND_TIERS.get(kind);
|
|
86
|
+
if (tier === undefined) {
|
|
87
|
+
throw new Error(
|
|
88
|
+
`isResourceAvailable: kind ${kind} has no tier — only kinds with kind_meta can be asked about`,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
return editionRank(mode) >= tierRank(tier);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Position of an edition in the oss < enterprise < cloud order. */
|
|
95
|
+
function editionRank(mode: DeploymentMode): number {
|
|
96
|
+
switch (mode) {
|
|
97
|
+
case "local":
|
|
98
|
+
return 1;
|
|
99
|
+
case "enterprise":
|
|
100
|
+
return 2;
|
|
101
|
+
case "cloud":
|
|
102
|
+
return 3;
|
|
103
|
+
default: {
|
|
104
|
+
const _exhaustive: never = mode;
|
|
105
|
+
throw new Error(`unknown deployment mode: ${String(_exhaustive)}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Position of a tier's minimum edition in the same order. */
|
|
111
|
+
function tierRank(tier: ResourceTier): number {
|
|
112
|
+
switch (tier) {
|
|
113
|
+
case ResourceTier.open_source:
|
|
114
|
+
return 1;
|
|
115
|
+
case ResourceTier.enterprise:
|
|
116
|
+
return 2;
|
|
117
|
+
case ResourceTier.cloud_only:
|
|
118
|
+
return 3;
|
|
119
|
+
case ResourceTier.resource_tier_unspecified:
|
|
120
|
+
// A kind without a declared tier is treated as core: the generator
|
|
121
|
+
// emits every kind_meta tier verbatim, so this arm is reachable only
|
|
122
|
+
// by a proto that forgot the field, and hiding a kind is the worse
|
|
123
|
+
// failure for a client.
|
|
124
|
+
return 1;
|
|
125
|
+
default: {
|
|
126
|
+
const _exhaustive: never = tier;
|
|
127
|
+
throw new Error(`unknown resource tier: ${String(_exhaustive)}`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
27
130
|
}
|