@stigmer/sdk 0.0.36

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.
Files changed (138) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +199 -0
  3. package/config.d.ts +40 -0
  4. package/config.d.ts.map +1 -0
  5. package/config.js +17 -0
  6. package/config.js.map +1 -0
  7. package/errors.d.ts +77 -0
  8. package/errors.d.ts.map +1 -0
  9. package/errors.js +163 -0
  10. package/errors.js.map +1 -0
  11. package/gen/agent.d.ts +56 -0
  12. package/gen/agent.d.ts.map +1 -0
  13. package/gen/agent.js +113 -0
  14. package/gen/agent.js.map +1 -0
  15. package/gen/agentexecution.d.ts +68 -0
  16. package/gen/agentexecution.d.ts.map +1 -0
  17. package/gen/agentexecution.js +197 -0
  18. package/gen/agentexecution.js.map +1 -0
  19. package/gen/agentinstance.d.ts +26 -0
  20. package/gen/agentinstance.d.ts.map +1 -0
  21. package/gen/agentinstance.js +92 -0
  22. package/gen/agentinstance.js.map +1 -0
  23. package/gen/apikey.d.ts +25 -0
  24. package/gen/apikey.d.ts.map +1 -0
  25. package/gen/apikey.js +85 -0
  26. package/gen/apikey.js.map +1 -0
  27. package/gen/client.d.ts +76 -0
  28. package/gen/client.d.ts.map +1 -0
  29. package/gen/client.js +77 -0
  30. package/gen/client.js.map +1 -0
  31. package/gen/environment.d.ts +23 -0
  32. package/gen/environment.d.ts.map +1 -0
  33. package/gen/environment.js +86 -0
  34. package/gen/environment.js.map +1 -0
  35. package/gen/errors.d.ts +15 -0
  36. package/gen/errors.d.ts.map +1 -0
  37. package/gen/errors.js +52 -0
  38. package/gen/errors.js.map +1 -0
  39. package/gen/executioncontext.d.ts +24 -0
  40. package/gen/executioncontext.d.ts.map +1 -0
  41. package/gen/executioncontext.js +87 -0
  42. package/gen/executioncontext.js.map +1 -0
  43. package/gen/iampolicy.d.ts +34 -0
  44. package/gen/iampolicy.d.ts.map +1 -0
  45. package/gen/iampolicy.js +107 -0
  46. package/gen/iampolicy.js.map +1 -0
  47. package/gen/identityaccount.d.ts +35 -0
  48. package/gen/identityaccount.d.ts.map +1 -0
  49. package/gen/identityaccount.js +113 -0
  50. package/gen/identityaccount.js.map +1 -0
  51. package/gen/identityprovider.d.ts +27 -0
  52. package/gen/identityprovider.d.ts.map +1 -0
  53. package/gen/identityprovider.js +90 -0
  54. package/gen/identityprovider.js.map +1 -0
  55. package/gen/mcpserver.d.ts +50 -0
  56. package/gen/mcpserver.d.ts.map +1 -0
  57. package/gen/mcpserver.js +124 -0
  58. package/gen/mcpserver.js.map +1 -0
  59. package/gen/organization.d.ts +31 -0
  60. package/gen/organization.d.ts.map +1 -0
  61. package/gen/organization.js +102 -0
  62. package/gen/organization.js.map +1 -0
  63. package/gen/project.d.ts +24 -0
  64. package/gen/project.d.ts.map +1 -0
  65. package/gen/project.js +84 -0
  66. package/gen/project.js.map +1 -0
  67. package/gen/session.d.ts +49 -0
  68. package/gen/session.d.ts.map +1 -0
  69. package/gen/session.js +94 -0
  70. package/gen/session.js.map +1 -0
  71. package/gen/skill.d.ts +26 -0
  72. package/gen/skill.d.ts.map +1 -0
  73. package/gen/skill.js +101 -0
  74. package/gen/skill.js.map +1 -0
  75. package/gen/types.d.ts +43 -0
  76. package/gen/types.d.ts.map +1 -0
  77. package/gen/types.js +3 -0
  78. package/gen/types.js.map +1 -0
  79. package/gen/workflow.d.ts +51 -0
  80. package/gen/workflow.d.ts.map +1 -0
  81. package/gen/workflow.js +85 -0
  82. package/gen/workflow.js.map +1 -0
  83. package/gen/workflowexecution.d.ts +37 -0
  84. package/gen/workflowexecution.d.ts.map +1 -0
  85. package/gen/workflowexecution.js +161 -0
  86. package/gen/workflowexecution.js.map +1 -0
  87. package/gen/workflowinstance.d.ts +26 -0
  88. package/gen/workflowinstance.d.ts.map +1 -0
  89. package/gen/workflowinstance.js +92 -0
  90. package/gen/workflowinstance.js.map +1 -0
  91. package/index.d.ts +23 -0
  92. package/index.d.ts.map +1 -0
  93. package/index.js +26 -0
  94. package/index.js.map +1 -0
  95. package/internal/interceptors.d.ts +25 -0
  96. package/internal/interceptors.d.ts.map +1 -0
  97. package/internal/interceptors.js +75 -0
  98. package/internal/interceptors.js.map +1 -0
  99. package/package.json +40 -0
  100. package/search.d.ts +41 -0
  101. package/search.d.ts.map +1 -0
  102. package/search.js +45 -0
  103. package/search.js.map +1 -0
  104. package/src/config.ts +64 -0
  105. package/src/errors.ts +219 -0
  106. package/src/gen/agent.ts +146 -0
  107. package/src/gen/agentexecution.ts +205 -0
  108. package/src/gen/agentinstance.ts +91 -0
  109. package/src/gen/apikey.ts +86 -0
  110. package/src/gen/client.ts +99 -0
  111. package/src/gen/environment.ts +86 -0
  112. package/src/gen/errors.ts +74 -0
  113. package/src/gen/executioncontext.ts +87 -0
  114. package/src/gen/iampolicy.ts +108 -0
  115. package/src/gen/identityaccount.ts +115 -0
  116. package/src/gen/identityprovider.ts +94 -0
  117. package/src/gen/mcpserver.ts +147 -0
  118. package/src/gen/organization.ts +103 -0
  119. package/src/gen/project.ts +85 -0
  120. package/src/gen/session.ts +120 -0
  121. package/src/gen/skill.ts +102 -0
  122. package/src/gen/types.ts +51 -0
  123. package/src/gen/workflow.ts +116 -0
  124. package/src/gen/workflowexecution.ts +147 -0
  125. package/src/gen/workflowinstance.ts +91 -0
  126. package/src/index.ts +124 -0
  127. package/src/internal/interceptors.ts +83 -0
  128. package/src/search.ts +71 -0
  129. package/src/stigmer.ts +83 -0
  130. package/src/transport.ts +46 -0
  131. package/stigmer.d.ts +57 -0
  132. package/stigmer.d.ts.map +1 -0
  133. package/stigmer.js +64 -0
  134. package/stigmer.js.map +1 -0
  135. package/transport.d.ts +13 -0
  136. package/transport.d.ts.map +1 -0
  137. package/transport.js +34 -0
  138. package/transport.js.map +1 -0
@@ -0,0 +1,86 @@
1
+ // Code generated by stigmer-codegen. DO NOT EDIT.
2
+
3
+ import { wrapError } from "./errors";
4
+ import { type DeleteResourceInput, type ResourceRef, type EnvVarInput } from "./types";
5
+ import { create } from "@bufbuild/protobuf";
6
+ import { createClient, type Client, type Transport } from "@connectrpc/connect";
7
+ import { EnvironmentSchema, type Environment } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/api_pb";
8
+ import { EnvironmentCommandController } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/command_pb";
9
+ import { EnvironmentQueryController } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/query_pb";
10
+ import { EnvironmentSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
11
+ import { ApiResourceIdSchema, ApiResourceReferenceSchema, ApiResourceDeleteInputSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
12
+ import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
13
+
14
+ /** Provides operations on environment resources. */
15
+ export class EnvironmentClient {
16
+ private readonly command: Client<typeof EnvironmentCommandController>;
17
+ private readonly query: Client<typeof EnvironmentQueryController>;
18
+
19
+ constructor(transport: Transport) {
20
+ this.command = createClient(EnvironmentCommandController, transport);
21
+ this.query = createClient(EnvironmentQueryController, transport);
22
+ }
23
+
24
+ async apply(input: EnvironmentInput): Promise<Environment> {
25
+ try {
26
+ return await this.command.apply(buildEnvironmentProto(input));
27
+ } catch (e) { throw wrapError(e); }
28
+ }
29
+
30
+ async create(input: EnvironmentInput): Promise<Environment> {
31
+ try {
32
+ return await this.command.create(buildEnvironmentProto(input));
33
+ } catch (e) { throw wrapError(e); }
34
+ }
35
+
36
+ async update(input: EnvironmentInput): Promise<Environment> {
37
+ try {
38
+ return await this.command.update(buildEnvironmentProto(input));
39
+ } catch (e) { throw wrapError(e); }
40
+ }
41
+
42
+ async delete(input: DeleteResourceInput): Promise<Environment> {
43
+ try {
44
+ return await this.command.delete(create(ApiResourceDeleteInputSchema, {
45
+ resourceId: input.resourceId,
46
+ versionMessage: input.versionMessage,
47
+ force: input.force,
48
+ }));
49
+ } catch (e) { throw wrapError(e); }
50
+ }
51
+
52
+ async get(id: string): Promise<Environment> {
53
+ try {
54
+ return await this.query.get(create(ApiResourceIdSchema, { value: id }));
55
+ } catch (e) { throw wrapError(e); }
56
+ }
57
+
58
+ async getByReference(ref: ResourceRef): Promise<Environment> {
59
+ try {
60
+ return await this.query.getByReference(create(ApiResourceReferenceSchema, ref));
61
+ } catch (e) { throw wrapError(e); }
62
+ }
63
+ }
64
+
65
+ /** Input for creating/updating a Environment. */
66
+ export interface EnvironmentInput {
67
+ name: string;
68
+ org: string;
69
+ description?: string;
70
+ data?: Record<string, EnvVarInput>;
71
+ }
72
+
73
+ function buildEnvironmentProto(input: EnvironmentInput): Environment {
74
+ return Object.assign(create(EnvironmentSchema), {
75
+ apiVersion: "agentic.stigmer.ai/v1",
76
+ kind: "Environment",
77
+ metadata: Object.assign(create(ApiResourceMetadataSchema), {
78
+ name: input.name,
79
+ org: input.org,
80
+ }),
81
+ spec: Object.assign(create(EnvironmentSpecSchema), {
82
+ description: input.description,
83
+ data: input.data,
84
+ }),
85
+ }) as Environment;
86
+ }
@@ -0,0 +1,74 @@
1
+ // Code generated by stigmer-codegen. DO NOT EDIT.
2
+
3
+ import { ConnectError, Code } from "@connectrpc/connect";
4
+
5
+ /** Error codes mapped from gRPC/Connect status codes. */
6
+ export type ErrorCode =
7
+ | "unknown"
8
+ | "not-found"
9
+ | "permission-denied"
10
+ | "unauthenticated"
11
+ | "invalid-argument"
12
+ | "already-exists"
13
+ | "resource-exhausted"
14
+ | "failed-precondition"
15
+ | "internal"
16
+ | "unavailable"
17
+ | "cancelled";
18
+
19
+ const CODE_MAP: Record<number, ErrorCode> = {
20
+ [Code.NotFound]: "not-found",
21
+ [Code.PermissionDenied]: "permission-denied",
22
+ [Code.Unauthenticated]: "unauthenticated",
23
+ [Code.InvalidArgument]: "invalid-argument",
24
+ [Code.AlreadyExists]: "already-exists",
25
+ [Code.ResourceExhausted]: "resource-exhausted",
26
+ [Code.FailedPrecondition]: "failed-precondition",
27
+ [Code.Internal]: "internal",
28
+ [Code.Unavailable]: "unavailable",
29
+ [Code.Canceled]: "cancelled",
30
+ };
31
+
32
+ /** Structured error type returned by all SDK operations. */
33
+ export class StigmerError extends Error {
34
+ readonly code: ErrorCode;
35
+ readonly connectCode: number;
36
+
37
+ constructor(code: ErrorCode, message: string, connectCode: number) {
38
+ super(message);
39
+ this.name = "StigmerError";
40
+ this.code = code;
41
+ this.connectCode = connectCode;
42
+ }
43
+ }
44
+
45
+ /** @internal Convert any thrown value to a StigmerError. */
46
+ export function wrapError(err: unknown): StigmerError {
47
+ if (err instanceof ConnectError) {
48
+ const code = CODE_MAP[err.code] ?? "unknown";
49
+ return new StigmerError(code, err.rawMessage || err.message, err.code);
50
+ }
51
+ if (err instanceof StigmerError) {
52
+ return err;
53
+ }
54
+ if (err instanceof Error) {
55
+ return new StigmerError("unknown", err.message, Code.Unknown);
56
+ }
57
+ return new StigmerError("unknown", String(err), Code.Unknown);
58
+ }
59
+
60
+ export function isNotFound(err: unknown): boolean {
61
+ return err instanceof StigmerError && err.code === "not-found";
62
+ }
63
+
64
+ export function isUnauthenticated(err: unknown): boolean {
65
+ return err instanceof StigmerError && err.code === "unauthenticated";
66
+ }
67
+
68
+ export function isPermissionDenied(err: unknown): boolean {
69
+ return err instanceof StigmerError && err.code === "permission-denied";
70
+ }
71
+
72
+ export function isRetryable(err: unknown): boolean {
73
+ return err instanceof StigmerError && (err.code === "internal" || err.code === "unavailable");
74
+ }
@@ -0,0 +1,87 @@
1
+ // Code generated by stigmer-codegen. DO NOT EDIT.
2
+
3
+ import { wrapError } from "./errors";
4
+ import { type DeleteResourceInput, type ResourceRef, type EnvVarInput } from "./types";
5
+ import { create } from "@bufbuild/protobuf";
6
+ import { createClient, type Client, type Transport } from "@connectrpc/connect";
7
+ import { ExecutionContextSchema, type ExecutionContext } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/api_pb";
8
+ import { ExecutionContextCommandController } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/command_pb";
9
+ import { ExecutionContextIdSchema, ExecutionContextExecutionIdInputSchema, type ExecutionContextExecutionIdInput } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/io_pb";
10
+ import { ExecutionContextQueryController } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/query_pb";
11
+ import { ExecutionContextSpecSchema } from "@stigmer/protos/ai/stigmer/agentic/executioncontext/v1/spec_pb";
12
+ import { ApiResourceReferenceSchema, ApiResourceDeleteInputSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
13
+ import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
14
+
15
+ /** Provides operations on executioncontext resources. */
16
+ export class ExecutionContextClient {
17
+ private readonly command: Client<typeof ExecutionContextCommandController>;
18
+ private readonly query: Client<typeof ExecutionContextQueryController>;
19
+
20
+ constructor(transport: Transport) {
21
+ this.command = createClient(ExecutionContextCommandController, transport);
22
+ this.query = createClient(ExecutionContextQueryController, transport);
23
+ }
24
+
25
+ async apply(input: ExecutionContextInput): Promise<ExecutionContext> {
26
+ try {
27
+ return await this.command.apply(buildExecutionContextProto(input));
28
+ } catch (e) { throw wrapError(e); }
29
+ }
30
+
31
+ async create(input: ExecutionContextInput): Promise<ExecutionContext> {
32
+ try {
33
+ return await this.command.create(buildExecutionContextProto(input));
34
+ } catch (e) { throw wrapError(e); }
35
+ }
36
+
37
+ async delete(input: DeleteResourceInput): Promise<ExecutionContext> {
38
+ try {
39
+ return await this.command.delete(create(ApiResourceDeleteInputSchema, {
40
+ resourceId: input.resourceId,
41
+ versionMessage: input.versionMessage,
42
+ force: input.force,
43
+ }));
44
+ } catch (e) { throw wrapError(e); }
45
+ }
46
+
47
+ async get(id: string): Promise<ExecutionContext> {
48
+ try {
49
+ return await this.query.get(create(ExecutionContextIdSchema, { value: id }));
50
+ } catch (e) { throw wrapError(e); }
51
+ }
52
+
53
+ async getByReference(ref: ResourceRef): Promise<ExecutionContext> {
54
+ try {
55
+ return await this.query.getByReference(create(ApiResourceReferenceSchema, ref));
56
+ } catch (e) { throw wrapError(e); }
57
+ }
58
+
59
+ async getByExecutionId(input: ExecutionContextExecutionIdInput): Promise<ExecutionContext> {
60
+ try {
61
+ return await this.query.getByExecutionId(input);
62
+ } catch (e) { throw wrapError(e); }
63
+ }
64
+ }
65
+
66
+ /** Input for creating/updating a ExecutionContext. */
67
+ export interface ExecutionContextInput {
68
+ name: string;
69
+ org: string;
70
+ executionId?: string;
71
+ data?: Record<string, EnvVarInput>;
72
+ }
73
+
74
+ function buildExecutionContextProto(input: ExecutionContextInput): ExecutionContext {
75
+ return Object.assign(create(ExecutionContextSchema), {
76
+ apiVersion: "agentic.stigmer.ai/v1",
77
+ kind: "ExecutionContext",
78
+ metadata: Object.assign(create(ApiResourceMetadataSchema), {
79
+ name: input.name,
80
+ org: input.org,
81
+ }),
82
+ spec: Object.assign(create(ExecutionContextSpecSchema), {
83
+ executionId: input.executionId,
84
+ data: input.data,
85
+ }),
86
+ }) as ExecutionContext;
87
+ }
@@ -0,0 +1,108 @@
1
+ // Code generated by stigmer-codegen. DO NOT EDIT.
2
+
3
+ import { wrapError } from "./errors";
4
+ import { create } from "@bufbuild/protobuf";
5
+ import { createClient, type Client, type Transport } from "@connectrpc/connect";
6
+ import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
7
+ import { IamPolicySchema, type IamPolicy } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/api_pb";
8
+ import { IamPolicyCommandController } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/command_pb";
9
+ import { IamPolicyIdSchema, CheckAuthorizationInputSchema, CheckAuthorizationResultSchema, ListAuthorizedResourceIdsInputSchema, AuthorizedResourceIdsListSchema, ListAuthorizedPrincipalIdsInputSchema, AuthorizedPrincipalIdsListSchema, type CheckAuthorizationInput, type CheckAuthorizationResult, type ListAuthorizedResourceIdsInput, type AuthorizedResourceIdsList, type ListAuthorizedPrincipalIdsInput, type AuthorizedPrincipalIdsList } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/io_pb";
10
+ import { IamPolicyQueryController } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/query_pb";
11
+ import { ApiResourceRefSchema, IamPolicySpecSchema, type IamPolicySpec, type ApiResourceRef } from "@stigmer/protos/ai/stigmer/iam/iampolicy/v1/spec_pb";
12
+
13
+ /** Provides operations on iampolicy resources. */
14
+ export class IamPolicyClient {
15
+ private readonly command: Client<typeof IamPolicyCommandController>;
16
+ private readonly query: Client<typeof IamPolicyQueryController>;
17
+
18
+ constructor(transport: Transport) {
19
+ this.command = createClient(IamPolicyCommandController, transport);
20
+ this.query = createClient(IamPolicyQueryController, transport);
21
+ }
22
+
23
+ async create(input: IamPolicySpec): Promise<IamPolicy> {
24
+ try {
25
+ return await this.command.create(input);
26
+ } catch (e) { throw wrapError(e); }
27
+ }
28
+
29
+ async delete(input: IamPolicySpec): Promise<IamPolicy> {
30
+ try {
31
+ return await this.command.delete(input);
32
+ } catch (e) { throw wrapError(e); }
33
+ }
34
+
35
+ async createPlatformLink(input: IamPolicySpec): Promise<IamPolicy> {
36
+ try {
37
+ return await this.command.createPlatformLink(input);
38
+ } catch (e) { throw wrapError(e); }
39
+ }
40
+
41
+ async bootstrapPolicy(input: IamPolicySpec): Promise<IamPolicy> {
42
+ try {
43
+ return await this.command.bootstrapPolicy(input);
44
+ } catch (e) { throw wrapError(e); }
45
+ }
46
+
47
+ async cleanupResourcePolicies(input: ApiResourceRef): Promise<void> {
48
+ try {
49
+ await this.command.cleanupResourcePolicies(input);
50
+ } catch (e) { throw wrapError(e); }
51
+ }
52
+
53
+ async get(id: string): Promise<IamPolicy> {
54
+ try {
55
+ return await this.query.get(create(IamPolicyIdSchema, { value: id }));
56
+ } catch (e) { throw wrapError(e); }
57
+ }
58
+
59
+ async checkAuthorization(input: CheckAuthorizationInput): Promise<CheckAuthorizationResult> {
60
+ try {
61
+ return await this.query.checkAuthorization(input);
62
+ } catch (e) { throw wrapError(e); }
63
+ }
64
+
65
+ async listAuthorizedResourceIds(input: ListAuthorizedResourceIdsInput): Promise<AuthorizedResourceIdsList> {
66
+ try {
67
+ return await this.query.listAuthorizedResourceIds(input);
68
+ } catch (e) { throw wrapError(e); }
69
+ }
70
+
71
+ async listAuthorizedPrincipalIds(input: ListAuthorizedPrincipalIdsInput): Promise<AuthorizedPrincipalIdsList> {
72
+ try {
73
+ return await this.query.listAuthorizedPrincipalIds(input);
74
+ } catch (e) { throw wrapError(e); }
75
+ }
76
+ }
77
+
78
+ /** Input for creating/updating a IamPolicy. */
79
+ export interface IamPolicyInput {
80
+ name: string;
81
+ org: string;
82
+ principal: ApiResourceRefInput;
83
+ resource: ApiResourceRefInput;
84
+ relation: string;
85
+ }
86
+
87
+ /** SDK input type for ApiResourceRef. */
88
+ export interface ApiResourceRefInput {
89
+ kind: string;
90
+ id: string;
91
+ relation?: string;
92
+ }
93
+
94
+ function buildIamPolicyProto(input: IamPolicyInput): IamPolicy {
95
+ return Object.assign(create(IamPolicySchema), {
96
+ apiVersion: "iam.stigmer.ai/v1",
97
+ kind: "IamPolicy",
98
+ metadata: Object.assign(create(ApiResourceMetadataSchema), {
99
+ name: input.name,
100
+ org: input.org,
101
+ }),
102
+ spec: Object.assign(create(IamPolicySpecSchema), {
103
+ principal: input.principal,
104
+ resource: input.resource,
105
+ relation: input.relation,
106
+ }),
107
+ }) as IamPolicy;
108
+ }
@@ -0,0 +1,115 @@
1
+ // Code generated by stigmer-codegen. DO NOT EDIT.
2
+
3
+ import { wrapError } from "./errors";
4
+ import { type ResourceRef } from "./types";
5
+ import { create } from "@bufbuild/protobuf";
6
+ import { EmptySchema } from "@bufbuild/protobuf/wkt";
7
+ import { createClient, type Client, type Transport } from "@connectrpc/connect";
8
+ import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
9
+ import { type ApiResourceAuditActor } from "@stigmer/protos/ai/stigmer/commons/apiresource/status_pb";
10
+ import { IdentityAccountSchema, type IdentityAccount } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/api_pb";
11
+ import { IdentityAccountCommandController } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/command_pb";
12
+ import { IdentityAccountProvisioningMode } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/enum_pb";
13
+ import { IdentityAccountIdSchema, IdentityAccountEmailSchema, IdpIdSchema, type IdentityAccountEmail } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/io_pb";
14
+ import { IdentityAccountQueryController } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/query_pb";
15
+ import { IdentityAccountSpecSchema } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/spec_pb";
16
+
17
+ /** Provides operations on identityaccount resources. */
18
+ export class IdentityAccountClient {
19
+ private readonly command: Client<typeof IdentityAccountCommandController>;
20
+ private readonly query: Client<typeof IdentityAccountQueryController>;
21
+
22
+ constructor(transport: Transport) {
23
+ this.command = createClient(IdentityAccountCommandController, transport);
24
+ this.query = createClient(IdentityAccountQueryController, transport);
25
+ }
26
+
27
+ async create(input: IdentityAccountInput): Promise<IdentityAccount> {
28
+ try {
29
+ return await this.command.create(buildIdentityAccountProto(input));
30
+ } catch (e) { throw wrapError(e); }
31
+ }
32
+
33
+ async update(input: IdentityAccountInput): Promise<IdentityAccount> {
34
+ try {
35
+ return await this.command.update(buildIdentityAccountProto(input));
36
+ } catch (e) { throw wrapError(e); }
37
+ }
38
+
39
+ async delete(id: string): Promise<IdentityAccount> {
40
+ try {
41
+ return await this.command.delete(create(IdentityAccountIdSchema, { value: id }));
42
+ } catch (e) { throw wrapError(e); }
43
+ }
44
+
45
+ async simulateSignupWebhook(input: IdentityAccountEmail): Promise<void> {
46
+ try {
47
+ await this.command.simulateSignupWebhook(input);
48
+ } catch (e) { throw wrapError(e); }
49
+ }
50
+
51
+ async get(id: string): Promise<IdentityAccount> {
52
+ try {
53
+ return await this.query.get(create(IdentityAccountIdSchema, { value: id }));
54
+ } catch (e) { throw wrapError(e); }
55
+ }
56
+
57
+ async whoAmI(): Promise<IdentityAccount> {
58
+ try {
59
+ return await this.query.whoAmI(create(EmptySchema, {}));
60
+ } catch (e) { throw wrapError(e); }
61
+ }
62
+
63
+ async getByEmail(input: IdentityAccountEmail): Promise<IdentityAccount> {
64
+ try {
65
+ return await this.query.getByEmail(input);
66
+ } catch (e) { throw wrapError(e); }
67
+ }
68
+
69
+ async getByIdpId(id: string): Promise<IdentityAccount> {
70
+ try {
71
+ return await this.query.getByIdpId(create(IdpIdSchema, { value: id }));
72
+ } catch (e) { throw wrapError(e); }
73
+ }
74
+
75
+ async getActorInfo(id: string): Promise<ApiResourceAuditActor> {
76
+ try {
77
+ return await this.query.getActorInfo(create(IdentityAccountIdSchema, { value: id }));
78
+ } catch (e) { throw wrapError(e); }
79
+ }
80
+ }
81
+
82
+ /** Input for creating/updating a IdentityAccount. */
83
+ export interface IdentityAccountInput {
84
+ name: string;
85
+ org: string;
86
+ idpId: string;
87
+ email?: string;
88
+ firstName?: string;
89
+ lastName?: string;
90
+ pictureUrl?: string;
91
+ isMachineAccount?: boolean;
92
+ provisioningMode?: IdentityAccountProvisioningMode;
93
+ identityProviderRef?: ResourceRef;
94
+ }
95
+
96
+ function buildIdentityAccountProto(input: IdentityAccountInput): IdentityAccount {
97
+ return Object.assign(create(IdentityAccountSchema), {
98
+ apiVersion: "iam.stigmer.ai/v1",
99
+ kind: "IdentityAccount",
100
+ metadata: Object.assign(create(ApiResourceMetadataSchema), {
101
+ name: input.name,
102
+ org: input.org,
103
+ }),
104
+ spec: Object.assign(create(IdentityAccountSpecSchema), {
105
+ idpId: input.idpId,
106
+ email: input.email,
107
+ firstName: input.firstName,
108
+ lastName: input.lastName,
109
+ pictureUrl: input.pictureUrl,
110
+ isMachineAccount: input.isMachineAccount,
111
+ provisioningMode: input.provisioningMode,
112
+ identityProviderRef: input.identityProviderRef,
113
+ }),
114
+ }) as IdentityAccount;
115
+ }
@@ -0,0 +1,94 @@
1
+ // Code generated by stigmer-codegen. DO NOT EDIT.
2
+
3
+ import { wrapError } from "./errors";
4
+ import { type DeleteResourceInput, type ResourceRef } from "./types";
5
+ import { create } from "@bufbuild/protobuf";
6
+ import { createClient, type Client, type Transport } from "@connectrpc/connect";
7
+ import { ApiResourceIdSchema, ApiResourceReferenceSchema, ApiResourceDeleteInputSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
8
+ import { ApiResourceMetadataSchema } from "@stigmer/protos/ai/stigmer/commons/apiresource/metadata_pb";
9
+ import { IdentityProviderSchema, type IdentityProvider } from "@stigmer/protos/ai/stigmer/iam/identityprovider/v1/api_pb";
10
+ import { IdentityProviderCommandController } from "@stigmer/protos/ai/stigmer/iam/identityprovider/v1/command_pb";
11
+ import { IdentityProviderQueryController } from "@stigmer/protos/ai/stigmer/iam/identityprovider/v1/query_pb";
12
+ import { IdentityProviderSpecSchema } from "@stigmer/protos/ai/stigmer/iam/identityprovider/v1/spec_pb";
13
+
14
+ /** Provides operations on identityprovider resources. */
15
+ export class IdentityProviderClient {
16
+ private readonly command: Client<typeof IdentityProviderCommandController>;
17
+ private readonly query: Client<typeof IdentityProviderQueryController>;
18
+
19
+ constructor(transport: Transport) {
20
+ this.command = createClient(IdentityProviderCommandController, transport);
21
+ this.query = createClient(IdentityProviderQueryController, transport);
22
+ }
23
+
24
+ async apply(input: IdentityProviderInput): Promise<IdentityProvider> {
25
+ try {
26
+ return await this.command.apply(buildIdentityProviderProto(input));
27
+ } catch (e) { throw wrapError(e); }
28
+ }
29
+
30
+ async create(input: IdentityProviderInput): Promise<IdentityProvider> {
31
+ try {
32
+ return await this.command.create(buildIdentityProviderProto(input));
33
+ } catch (e) { throw wrapError(e); }
34
+ }
35
+
36
+ async update(input: IdentityProviderInput): Promise<IdentityProvider> {
37
+ try {
38
+ return await this.command.update(buildIdentityProviderProto(input));
39
+ } catch (e) { throw wrapError(e); }
40
+ }
41
+
42
+ async delete(input: DeleteResourceInput): Promise<IdentityProvider> {
43
+ try {
44
+ return await this.command.delete(create(ApiResourceDeleteInputSchema, {
45
+ resourceId: input.resourceId,
46
+ versionMessage: input.versionMessage,
47
+ force: input.force,
48
+ }));
49
+ } catch (e) { throw wrapError(e); }
50
+ }
51
+
52
+ async get(id: string): Promise<IdentityProvider> {
53
+ try {
54
+ return await this.query.get(create(ApiResourceIdSchema, { value: id }));
55
+ } catch (e) { throw wrapError(e); }
56
+ }
57
+
58
+ async getByReference(ref: ResourceRef): Promise<IdentityProvider> {
59
+ try {
60
+ return await this.query.getByReference(create(ApiResourceReferenceSchema, ref));
61
+ } catch (e) { throw wrapError(e); }
62
+ }
63
+ }
64
+
65
+ /** Input for creating/updating a IdentityProvider. */
66
+ export interface IdentityProviderInput {
67
+ name: string;
68
+ org: string;
69
+ displayName?: string;
70
+ jwksUri?: string;
71
+ allowedIssuers?: string[];
72
+ expectedAudience?: string;
73
+ rateLimitBudget?: number;
74
+ userinfoEndpoint?: string;
75
+ }
76
+
77
+ function buildIdentityProviderProto(input: IdentityProviderInput): IdentityProvider {
78
+ return Object.assign(create(IdentityProviderSchema), {
79
+ apiVersion: "iam.stigmer.ai/v1",
80
+ kind: "IdentityProvider",
81
+ metadata: Object.assign(create(ApiResourceMetadataSchema), {
82
+ name: input.name,
83
+ org: input.org,
84
+ }),
85
+ spec: Object.assign(create(IdentityProviderSpecSchema), {
86
+ displayName: input.displayName,
87
+ jwksUri: input.jwksUri,
88
+ allowedIssuers: input.allowedIssuers,
89
+ expectedAudience: input.expectedAudience,
90
+ rateLimitBudget: input.rateLimitBudget,
91
+ userinfoEndpoint: input.userinfoEndpoint,
92
+ }),
93
+ }) as IdentityProvider;
94
+ }