@stigmer/sdk 3.12.4 → 3.12.6
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__/mcpserver-connect.test.d.ts +2 -0
- package/__tests__/mcpserver-connect.test.d.ts.map +1 -0
- package/__tests__/mcpserver-connect.test.js +146 -0
- package/__tests__/mcpserver-connect.test.js.map +1 -0
- package/__tests__/update-input-roundtrip.test.d.ts +2 -0
- package/__tests__/update-input-roundtrip.test.d.ts.map +1 -0
- package/__tests__/update-input-roundtrip.test.js +791 -0
- package/__tests__/update-input-roundtrip.test.js.map +1 -0
- package/__tests__/update-input.test.d.ts +2 -0
- package/__tests__/update-input.test.d.ts.map +1 -0
- package/__tests__/update-input.test.js +188 -0
- package/__tests__/update-input.test.js.map +1 -0
- package/gen/agent.d.ts +21 -0
- package/gen/agent.d.ts.map +1 -1
- package/gen/agent.js +73 -1
- package/gen/agent.js.map +1 -1
- package/gen/agentchannel.d.ts +23 -1
- package/gen/agentchannel.d.ts.map +1 -1
- package/gen/agentchannel.js +55 -1
- package/gen/agentchannel.js.map +1 -1
- package/gen/agentexecution.d.ts +29 -1
- package/gen/agentexecution.d.ts.map +1 -1
- package/gen/agentexecution.js +155 -2
- package/gen/agentexecution.js.map +1 -1
- package/gen/agentinstance.d.ts +21 -0
- package/gen/agentinstance.d.ts.map +1 -1
- package/gen/agentinstance.js +32 -1
- package/gen/agentinstance.js.map +1 -1
- package/gen/agentshare.d.ts +23 -1
- package/gen/agentshare.d.ts.map +1 -1
- package/gen/agentshare.js +53 -1
- package/gen/agentshare.js.map +1 -1
- package/gen/apikey.d.ts +21 -0
- package/gen/apikey.d.ts.map +1 -1
- package/gen/apikey.js +33 -1
- package/gen/apikey.js.map +1 -1
- package/gen/artifact.d.ts +8 -0
- package/gen/artifact.d.ts.map +1 -1
- package/gen/artifact.js +1 -0
- package/gen/artifact.js.map +1 -1
- package/gen/channelapp.d.ts +21 -0
- package/gen/channelapp.d.ts.map +1 -1
- package/gen/channelapp.js +45 -0
- package/gen/channelapp.js.map +1 -1
- package/gen/client.d.ts +3 -3
- package/gen/client.d.ts.map +1 -1
- package/gen/environment.d.ts +21 -0
- package/gen/environment.d.ts.map +1 -1
- package/gen/environment.js +31 -1
- package/gen/environment.js.map +1 -1
- package/gen/executioncontext.d.ts +8 -0
- package/gen/executioncontext.d.ts.map +1 -1
- package/gen/executioncontext.js +1 -0
- package/gen/executioncontext.js.map +1 -1
- package/gen/iampolicy.d.ts +8 -0
- package/gen/iampolicy.d.ts.map +1 -1
- package/gen/iampolicy.js +1 -0
- package/gen/iampolicy.js.map +1 -1
- package/gen/identityaccount.d.ts +29 -0
- package/gen/identityaccount.d.ts.map +1 -1
- package/gen/identityaccount.js +57 -2
- package/gen/identityaccount.js.map +1 -1
- package/gen/identityprovider.d.ts +21 -0
- package/gen/identityprovider.d.ts.map +1 -1
- package/gen/identityprovider.js +40 -0
- package/gen/identityprovider.js.map +1 -1
- package/gen/invitation.d.ts +8 -0
- package/gen/invitation.d.ts.map +1 -1
- package/gen/invitation.js +1 -0
- package/gen/invitation.js.map +1 -1
- package/gen/mcpserver.d.ts +22 -0
- package/gen/mcpserver.d.ts.map +1 -1
- package/gen/mcpserver.js +87 -1
- package/gen/mcpserver.js.map +1 -1
- package/gen/oauthapp.d.ts +23 -1
- package/gen/oauthapp.d.ts.map +1 -1
- package/gen/oauthapp.js +40 -0
- package/gen/oauthapp.js.map +1 -1
- package/gen/organization.d.ts +26 -0
- package/gen/organization.d.ts.map +1 -1
- package/gen/organization.js +49 -2
- package/gen/organization.js.map +1 -1
- package/gen/platformclient.d.ts +22 -0
- package/gen/platformclient.d.ts.map +1 -1
- package/gen/platformclient.js +42 -1
- package/gen/platformclient.js.map +1 -1
- package/gen/project.d.ts +21 -0
- package/gen/project.d.ts.map +1 -1
- package/gen/project.js +32 -1
- package/gen/project.js.map +1 -1
- package/gen/proto-utils.d.ts +36 -0
- package/gen/proto-utils.d.ts.map +1 -1
- package/gen/proto-utils.js +58 -0
- package/gen/proto-utils.js.map +1 -1
- package/gen/schedule.d.ts +23 -1
- package/gen/schedule.d.ts.map +1 -1
- package/gen/schedule.js +79 -1
- package/gen/schedule.js.map +1 -1
- package/gen/session.d.ts +21 -0
- package/gen/session.d.ts.map +1 -1
- package/gen/session.js +80 -1
- package/gen/session.js.map +1 -1
- package/gen/skill.d.ts +8 -0
- package/gen/skill.d.ts.map +1 -1
- package/gen/skill.js +1 -0
- package/gen/skill.js.map +1 -1
- package/gen/workflow.d.ts +21 -0
- package/gen/workflow.d.ts.map +1 -1
- package/gen/workflow.js +79 -0
- package/gen/workflow.js.map +1 -1
- package/gen/workflowexecution.d.ts +21 -0
- package/gen/workflowexecution.d.ts.map +1 -1
- package/gen/workflowexecution.js +36 -1
- package/gen/workflowexecution.js.map +1 -1
- package/gen/workflowinstance.d.ts +21 -0
- package/gen/workflowinstance.d.ts.map +1 -1
- package/gen/workflowinstance.js +33 -1
- package/gen/workflowinstance.js.map +1 -1
- package/index.d.ts +21 -20
- package/index.d.ts.map +1 -1
- package/index.js +25 -21
- package/index.js.map +1 -1
- package/mcpserver-connect.d.ts +79 -0
- package/mcpserver-connect.d.ts.map +1 -0
- package/mcpserver-connect.js +114 -0
- package/mcpserver-connect.js.map +1 -0
- package/package.json +2 -2
- package/src/__tests__/mcpserver-connect.test.ts +181 -0
- package/src/__tests__/update-input-roundtrip.test.ts +1031 -0
- package/src/__tests__/update-input.test.ts +250 -0
- package/src/gen/agent.ts +89 -3
- package/src/gen/agentchannel.ts +72 -4
- package/src/gen/agentexecution.ts +188 -6
- package/src/gen/agentinstance.ts +41 -1
- package/src/gen/agentshare.ts +68 -4
- package/src/gen/apikey.ts +42 -1
- package/src/gen/artifact.ts +9 -0
- package/src/gen/channelapp.ts +57 -1
- package/src/gen/client.ts +3 -3
- package/src/gen/environment.ts +40 -1
- package/src/gen/executioncontext.ts +9 -0
- package/src/gen/iampolicy.ts +9 -0
- package/src/gen/identityaccount.ts +77 -2
- package/src/gen/identityprovider.ts +49 -0
- package/src/gen/invitation.ts +9 -0
- package/src/gen/mcpserver.ts +101 -3
- package/src/gen/oauthapp.ts +51 -1
- package/src/gen/organization.ts +66 -2
- package/src/gen/platformclient.ts +52 -1
- package/src/gen/project.ts +41 -1
- package/src/gen/proto-utils.ts +64 -0
- package/src/gen/schedule.ts +98 -4
- package/src/gen/session.ts +97 -3
- package/src/gen/skill.ts +9 -0
- package/src/gen/workflow.ts +96 -2
- package/src/gen/workflowexecution.ts +45 -1
- package/src/gen/workflowinstance.ts +42 -1
- package/src/index.ts +32 -3
- package/src/mcpserver-connect.ts +159 -0
package/src/gen/environment.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors.js";
|
|
4
|
-
import { stripUndefined } from "./proto-utils.js";
|
|
4
|
+
import { stripUndefined, toEnvVarInputMap } from "./proto-utils.js";
|
|
5
5
|
import { type DeleteResourceInput, type ResourceRef, type EnvVarInput } from "./types.js";
|
|
6
6
|
import { create } from "@bufbuild/protobuf";
|
|
7
7
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
@@ -98,6 +98,14 @@ export class EnvironmentClient {
|
|
|
98
98
|
|
|
99
99
|
/** Input for creating/updating a Environment. */
|
|
100
100
|
export interface EnvironmentInput {
|
|
101
|
+
/**
|
|
102
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
103
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
104
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
105
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
106
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
107
|
+
*/
|
|
108
|
+
id?: string;
|
|
101
109
|
name: string;
|
|
102
110
|
slug?: string;
|
|
103
111
|
org: string;
|
|
@@ -117,6 +125,7 @@ export function buildEnvironmentProto(input: EnvironmentInput): Environment {
|
|
|
117
125
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
118
126
|
kind: "Environment",
|
|
119
127
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
128
|
+
...(input.id && { id: input.id }),
|
|
120
129
|
name: input.name,
|
|
121
130
|
org: input.org,
|
|
122
131
|
...(input.slug && { slug: input.slug }),
|
|
@@ -129,3 +138,33 @@ export function buildEnvironmentProto(input: EnvironmentInput): Environment {
|
|
|
129
138
|
})),
|
|
130
139
|
}) as Environment;
|
|
131
140
|
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Maps a fetched {@link Environment} to a complete {@link EnvironmentInput} for `update()`.
|
|
144
|
+
*
|
|
145
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
146
|
+
* and override only the fields you edit (spread nested objects the same
|
|
147
|
+
* way):
|
|
148
|
+
*
|
|
149
|
+
* await client.update({ ...toEnvironmentUpdateInput(res), description: next });
|
|
150
|
+
*
|
|
151
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
152
|
+
* `version` (pinned refs) and `kind`.
|
|
153
|
+
*/
|
|
154
|
+
export function toEnvironmentUpdateInput(resource: Environment): EnvironmentInput {
|
|
155
|
+
const meta = resource.metadata;
|
|
156
|
+
const spec = resource.spec ?? create(EnvironmentSpecSchema);
|
|
157
|
+
return {
|
|
158
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
159
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
160
|
+
// match, so the id is the ONLY working address.
|
|
161
|
+
id: meta?.id || undefined,
|
|
162
|
+
name: meta?.name ?? "",
|
|
163
|
+
slug: meta?.slug || undefined,
|
|
164
|
+
org: meta?.org ?? "",
|
|
165
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
166
|
+
visibility: meta?.visibility || undefined,
|
|
167
|
+
description: spec.description || undefined,
|
|
168
|
+
data: toEnvVarInputMap(spec.data),
|
|
169
|
+
};
|
|
170
|
+
}
|
|
@@ -68,6 +68,14 @@ export class ExecutionContextClient {
|
|
|
68
68
|
|
|
69
69
|
/** Input for creating/updating a ExecutionContext. */
|
|
70
70
|
export interface ExecutionContextInput {
|
|
71
|
+
/**
|
|
72
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
73
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
74
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
75
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
76
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
77
|
+
*/
|
|
78
|
+
id?: string;
|
|
71
79
|
name: string;
|
|
72
80
|
slug?: string;
|
|
73
81
|
org: string;
|
|
@@ -87,6 +95,7 @@ export function buildExecutionContextProto(input: ExecutionContextInput): Execut
|
|
|
87
95
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
88
96
|
kind: "ExecutionContext",
|
|
89
97
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
98
|
+
...(input.id && { id: input.id }),
|
|
90
99
|
name: input.name,
|
|
91
100
|
org: input.org,
|
|
92
101
|
...(input.slug && { slug: input.slug }),
|
package/src/gen/iampolicy.ts
CHANGED
|
@@ -109,6 +109,14 @@ export class IamPolicyClient {
|
|
|
109
109
|
|
|
110
110
|
/** Input for creating/updating a IamPolicy. */
|
|
111
111
|
export interface IamPolicyInput {
|
|
112
|
+
/**
|
|
113
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
114
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
115
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
116
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
117
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
118
|
+
*/
|
|
119
|
+
id?: string;
|
|
112
120
|
name: string;
|
|
113
121
|
slug?: string;
|
|
114
122
|
org: string;
|
|
@@ -141,6 +149,7 @@ export function buildIamPolicyProto(input: IamPolicyInput): IamPolicy {
|
|
|
141
149
|
apiVersion: "iam.stigmer.ai/v1",
|
|
142
150
|
kind: "IamPolicy",
|
|
143
151
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
152
|
+
...(input.id && { id: input.id }),
|
|
144
153
|
name: input.name,
|
|
145
154
|
org: input.org,
|
|
146
155
|
...(input.slug && { slug: input.slug }),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors.js";
|
|
4
|
-
import { stripUndefined } from "./proto-utils.js";
|
|
4
|
+
import { stripUndefined, toResourceRefInput } from "./proto-utils.js";
|
|
5
5
|
import { type ResourceRef } from "./types.js";
|
|
6
6
|
import { create } from "@bufbuild/protobuf";
|
|
7
7
|
import { EmptySchema } from "@bufbuild/protobuf/wkt";
|
|
@@ -15,7 +15,7 @@ import { IdentityAccountCommandController } from "@stigmer/protos/ai/stigmer/iam
|
|
|
15
15
|
import { IdentityAccountProvisioningMode } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/enum_pb";
|
|
16
16
|
import { IdentityAccountIdSchema, CreateFederatedAccountInputSchema, UpdateFederatedAccountInputSchema, DeprovisionFederatedAccountInputSchema, IdentityAccountEmailSchema, IdpIdSchema, ExternalSubLookupSchema, type CreateFederatedAccountInput, type UpdateFederatedAccountInput, type DeprovisionFederatedAccountInput, type IdentityAccountEmail, type ExternalSubLookup } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/io_pb";
|
|
17
17
|
import { IdentityAccountQueryController } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/query_pb";
|
|
18
|
-
import { IdentityAccountSpecSchema } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/spec_pb";
|
|
18
|
+
import { IdentityAccountSpecSchema, IdentityAccountPreferencesSchema, type IdentityAccountPreferences } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/spec_pb";
|
|
19
19
|
|
|
20
20
|
/** Provides operations on identityaccount resources. */
|
|
21
21
|
export class IdentityAccountClient {
|
|
@@ -108,6 +108,14 @@ export class IdentityAccountClient {
|
|
|
108
108
|
|
|
109
109
|
/** Input for creating/updating a IdentityAccount. */
|
|
110
110
|
export interface IdentityAccountInput {
|
|
111
|
+
/**
|
|
112
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
113
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
114
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
115
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
116
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
117
|
+
*/
|
|
118
|
+
id?: string;
|
|
111
119
|
name: string;
|
|
112
120
|
slug?: string;
|
|
113
121
|
org: string;
|
|
@@ -121,14 +129,34 @@ export interface IdentityAccountInput {
|
|
|
121
129
|
isMachineAccount?: boolean;
|
|
122
130
|
provisioningMode?: IdentityAccountProvisioningMode;
|
|
123
131
|
identityProviderRef?: ResourceRef;
|
|
132
|
+
preferences?: IdentityAccountPreferencesInput;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** SDK input type for IdentityAccountPreferences. */
|
|
136
|
+
export interface IdentityAccountPreferencesInput {
|
|
137
|
+
standingContext?: string;
|
|
138
|
+
defaultHarness?: string;
|
|
139
|
+
defaultNativeModel?: string;
|
|
140
|
+
defaultCursorModel?: string;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function buildIdentityAccountPreferencesProto(input: IdentityAccountPreferencesInput) {
|
|
144
|
+
return Object.assign(create(IdentityAccountPreferencesSchema), stripUndefined({
|
|
145
|
+
standingContext: input.standingContext,
|
|
146
|
+
defaultHarness: input.defaultHarness,
|
|
147
|
+
defaultNativeModel: input.defaultNativeModel,
|
|
148
|
+
defaultCursorModel: input.defaultCursorModel,
|
|
149
|
+
}));
|
|
124
150
|
}
|
|
125
151
|
|
|
126
152
|
export function buildIdentityAccountProto(input: IdentityAccountInput): IdentityAccount {
|
|
127
153
|
const identityProviderRef = (input.identityProviderRef?.slug || input.identityProviderRef?.org) ? create(ApiResourceReferenceSchema, input.identityProviderRef) : undefined;
|
|
154
|
+
const preferences = input.preferences ? buildIdentityAccountPreferencesProto(input.preferences) : undefined;
|
|
128
155
|
return Object.assign(create(IdentityAccountSchema), {
|
|
129
156
|
apiVersion: "iam.stigmer.ai/v1",
|
|
130
157
|
kind: "IdentityAccount",
|
|
131
158
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
159
|
+
...(input.id && { id: input.id }),
|
|
132
160
|
name: input.name,
|
|
133
161
|
org: input.org,
|
|
134
162
|
...(input.slug && { slug: input.slug }),
|
|
@@ -144,6 +172,53 @@ export function buildIdentityAccountProto(input: IdentityAccountInput): Identity
|
|
|
144
172
|
isMachineAccount: input.isMachineAccount,
|
|
145
173
|
provisioningMode: input.provisioningMode,
|
|
146
174
|
identityProviderRef,
|
|
175
|
+
preferences,
|
|
147
176
|
})),
|
|
148
177
|
}) as IdentityAccount;
|
|
149
178
|
}
|
|
179
|
+
|
|
180
|
+
function toIdentityAccountPreferencesInput(msg: IdentityAccountPreferences): IdentityAccountPreferencesInput {
|
|
181
|
+
return {
|
|
182
|
+
standingContext: msg.standingContext || undefined,
|
|
183
|
+
defaultHarness: msg.defaultHarness || undefined,
|
|
184
|
+
defaultNativeModel: msg.defaultNativeModel || undefined,
|
|
185
|
+
defaultCursorModel: msg.defaultCursorModel || undefined,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Maps a fetched {@link IdentityAccount} to a complete {@link IdentityAccountInput} for `update()`.
|
|
191
|
+
*
|
|
192
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
193
|
+
* and override only the fields you edit (spread nested objects the same
|
|
194
|
+
* way):
|
|
195
|
+
*
|
|
196
|
+
* await client.update({ ...toIdentityAccountUpdateInput(res), description: next });
|
|
197
|
+
*
|
|
198
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
199
|
+
* `version` (pinned refs) and `kind`.
|
|
200
|
+
*/
|
|
201
|
+
export function toIdentityAccountUpdateInput(resource: IdentityAccount): IdentityAccountInput {
|
|
202
|
+
const meta = resource.metadata;
|
|
203
|
+
const spec = resource.spec ?? create(IdentityAccountSpecSchema);
|
|
204
|
+
return {
|
|
205
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
206
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
207
|
+
// match, so the id is the ONLY working address.
|
|
208
|
+
id: meta?.id || undefined,
|
|
209
|
+
name: meta?.name ?? "",
|
|
210
|
+
slug: meta?.slug || undefined,
|
|
211
|
+
org: meta?.org ?? "",
|
|
212
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
213
|
+
visibility: meta?.visibility || undefined,
|
|
214
|
+
idpId: spec.idpId ?? "",
|
|
215
|
+
email: spec.email || undefined,
|
|
216
|
+
firstName: spec.firstName || undefined,
|
|
217
|
+
lastName: spec.lastName || undefined,
|
|
218
|
+
pictureUrl: spec.pictureUrl || undefined,
|
|
219
|
+
isMachineAccount: spec.isMachineAccount || undefined,
|
|
220
|
+
provisioningMode: spec.provisioningMode || undefined,
|
|
221
|
+
identityProviderRef: toResourceRefInput(spec.identityProviderRef),
|
|
222
|
+
preferences: spec.preferences ? toIdentityAccountPreferencesInput(spec.preferences) : undefined,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
@@ -81,6 +81,14 @@ export class IdentityProviderClient {
|
|
|
81
81
|
|
|
82
82
|
/** Input for creating/updating a IdentityProvider. */
|
|
83
83
|
export interface IdentityProviderInput {
|
|
84
|
+
/**
|
|
85
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
86
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
87
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
88
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
89
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
90
|
+
*/
|
|
91
|
+
id?: string;
|
|
84
92
|
name: string;
|
|
85
93
|
slug?: string;
|
|
86
94
|
org: string;
|
|
@@ -105,6 +113,7 @@ export function buildIdentityProviderProto(input: IdentityProviderInput): Identi
|
|
|
105
113
|
apiVersion: "iam.stigmer.ai/v1",
|
|
106
114
|
kind: "IdentityProvider",
|
|
107
115
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
116
|
+
...(input.id && { id: input.id }),
|
|
108
117
|
name: input.name,
|
|
109
118
|
org: input.org,
|
|
110
119
|
...(input.slug && { slug: input.slug }),
|
|
@@ -127,3 +136,43 @@ export function buildIdentityProviderProto(input: IdentityProviderInput): Identi
|
|
|
127
136
|
})),
|
|
128
137
|
}) as IdentityProvider;
|
|
129
138
|
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Maps a fetched {@link IdentityProvider} to a complete {@link IdentityProviderInput} for `update()`.
|
|
142
|
+
*
|
|
143
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
144
|
+
* and override only the fields you edit (spread nested objects the same
|
|
145
|
+
* way):
|
|
146
|
+
*
|
|
147
|
+
* await client.update({ ...toIdentityProviderUpdateInput(res), description: next });
|
|
148
|
+
*
|
|
149
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
150
|
+
* `version` (pinned refs) and `kind`.
|
|
151
|
+
*/
|
|
152
|
+
export function toIdentityProviderUpdateInput(resource: IdentityProvider): IdentityProviderInput {
|
|
153
|
+
const meta = resource.metadata;
|
|
154
|
+
const spec = resource.spec ?? create(IdentityProviderSpecSchema);
|
|
155
|
+
return {
|
|
156
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
157
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
158
|
+
// match, so the id is the ONLY working address.
|
|
159
|
+
id: meta?.id || undefined,
|
|
160
|
+
name: meta?.name ?? "",
|
|
161
|
+
slug: meta?.slug || undefined,
|
|
162
|
+
org: meta?.org ?? "",
|
|
163
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
164
|
+
visibility: meta?.visibility || undefined,
|
|
165
|
+
displayName: spec.displayName || undefined,
|
|
166
|
+
jwksUri: spec.jwksUri || undefined,
|
|
167
|
+
allowedIssuers: spec.allowedIssuers?.length ? [...spec.allowedIssuers] : undefined,
|
|
168
|
+
expectedAudience: spec.expectedAudience || undefined,
|
|
169
|
+
rateLimitBudget: spec.rateLimitBudget || undefined,
|
|
170
|
+
userinfoEndpoint: spec.userinfoEndpoint || undefined,
|
|
171
|
+
isSsoProvider: spec.isSsoProvider || undefined,
|
|
172
|
+
oidcClientId: spec.oidcClientId || undefined,
|
|
173
|
+
autoProvisionAccounts: spec.autoProvisionAccounts || undefined,
|
|
174
|
+
autoGrantOnOrg: spec.autoGrantOnOrg || undefined,
|
|
175
|
+
autoGrantRole: spec.autoGrantRole || undefined,
|
|
176
|
+
tenantOrgClaim: spec.tenantOrgClaim || undefined,
|
|
177
|
+
};
|
|
178
|
+
}
|
package/src/gen/invitation.ts
CHANGED
|
@@ -62,6 +62,14 @@ export class InvitationClient {
|
|
|
62
62
|
|
|
63
63
|
/** Input for creating/updating a Invitation. */
|
|
64
64
|
export interface InvitationInput {
|
|
65
|
+
/**
|
|
66
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
67
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
68
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
69
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
70
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
71
|
+
*/
|
|
72
|
+
id?: string;
|
|
65
73
|
name: string;
|
|
66
74
|
slug?: string;
|
|
67
75
|
org: string;
|
|
@@ -79,6 +87,7 @@ export function buildInvitationProto(input: InvitationInput): Invitation {
|
|
|
79
87
|
apiVersion: "iam.stigmer.ai/v1",
|
|
80
88
|
kind: "Invitation",
|
|
81
89
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
90
|
+
...(input.id && { id: input.id }),
|
|
82
91
|
name: input.name,
|
|
83
92
|
org: input.org,
|
|
84
93
|
...(input.slug && { slug: input.slug }),
|
package/src/gen/mcpserver.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors.js";
|
|
4
|
-
import { stripUndefined } from "./proto-utils.js";
|
|
4
|
+
import { stripUndefined, toResourceRefInput } from "./proto-utils.js";
|
|
5
5
|
import { type DeleteResourceInput, type ListParams, type ListResult, type ResourceRef } from "./types.js";
|
|
6
6
|
import { create } from "@bufbuild/protobuf";
|
|
7
7
|
import { createClient, type Client, type Transport } from "@connectrpc/connect";
|
|
8
|
-
import { EnvVarDeclarationSchema } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
|
|
8
|
+
import { EnvVarDeclarationSchema, type EnvVarDeclaration } from "@stigmer/protos/ai/stigmer/agentic/environment/v1/spec_pb";
|
|
9
9
|
import { McpServerSchema, type McpServer } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/api_pb";
|
|
10
10
|
import { McpServerCommandController } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/command_pb";
|
|
11
11
|
import { ConnectInputSchema, InitiateOAuthConnectInputSchema, InitiateOAuthConnectOutputSchema, CompleteOAuthConnectInputSchema, CompleteOAuthConnectOutputSchema, DisconnectOAuthInputSchema, DisconnectOAuthOutputSchema, SetOrgOAuthAppInputSchema, SetOrgOAuthAppOutputSchema, DeleteOrgOAuthAppInputSchema, DeleteOrgOAuthAppOutputSchema, GetOAuthGrantStatusInputSchema, GetOAuthGrantStatusOutputSchema, GetOrgOAuthAppInputSchema, GetOrgOAuthAppOutputSchema, type ConnectInput, type InitiateOAuthConnectInput, type InitiateOAuthConnectOutput, type CompleteOAuthConnectInput, type CompleteOAuthConnectOutput, type DisconnectOAuthInput, type DisconnectOAuthOutput, type SetOrgOAuthAppInput, type SetOrgOAuthAppOutput, type DeleteOrgOAuthAppInput, type DeleteOrgOAuthAppOutput, type GetOAuthGrantStatusInput, type GetOAuthGrantStatusOutput, type GetOrgOAuthAppInput, type GetOrgOAuthAppOutput } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/io_pb";
|
|
12
12
|
import { McpServerQueryController } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/query_pb";
|
|
13
|
-
import { McpServerSpecSchema, StdioServerConfigSchema, HttpServerConfigSchema, ToolApprovalPolicySchema, McpServerAuthSchema } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/spec_pb";
|
|
13
|
+
import { McpServerSpecSchema, StdioServerConfigSchema, HttpServerConfigSchema, ToolApprovalPolicySchema, McpServerAuthSchema, type StdioServerConfig, type HttpServerConfig, type ToolApprovalPolicy, type McpServerAuth } from "@stigmer/protos/ai/stigmer/agentic/mcpserver/v1/spec_pb";
|
|
14
14
|
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
15
15
|
import { ApiResourceVisibility } from "@stigmer/protos/ai/stigmer/commons/apiresource/enum_pb";
|
|
16
16
|
import { ApiResourceIdSchema, ApiResourceReferenceSchema, ApiResourceDeleteInputSchema, type UpdateVisibilityInput } from "@stigmer/protos/ai/stigmer/commons/apiresource/io_pb";
|
|
@@ -71,6 +71,12 @@ export class McpServerClient {
|
|
|
71
71
|
} catch (e) { throw wrapError(e); }
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
async startConnect(input: ConnectInput): Promise<McpServer> {
|
|
75
|
+
try {
|
|
76
|
+
return await this.command.startConnect(input);
|
|
77
|
+
} catch (e) { throw wrapError(e); }
|
|
78
|
+
}
|
|
79
|
+
|
|
74
80
|
async initiateOAuthConnect(input: InitiateOAuthConnectInput): Promise<InitiateOAuthConnectOutput> {
|
|
75
81
|
try {
|
|
76
82
|
return await this.command.initiateOAuthConnect(input);
|
|
@@ -146,6 +152,14 @@ export class McpServerClient {
|
|
|
146
152
|
|
|
147
153
|
/** Input for creating/updating a McpServer. */
|
|
148
154
|
export interface McpServerInput {
|
|
155
|
+
/**
|
|
156
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
157
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
158
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
159
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
160
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
161
|
+
*/
|
|
162
|
+
id?: string;
|
|
149
163
|
name: string;
|
|
150
164
|
slug?: string;
|
|
151
165
|
org: string;
|
|
@@ -274,6 +288,7 @@ export function buildMcpServerProto(input: McpServerInput): McpServer {
|
|
|
274
288
|
apiVersion: "agentic.stigmer.ai/v1",
|
|
275
289
|
kind: "McpServer",
|
|
276
290
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
291
|
+
...(input.id && { id: input.id }),
|
|
277
292
|
name: input.name,
|
|
278
293
|
org: input.org,
|
|
279
294
|
...(input.slug && { slug: input.slug }),
|
|
@@ -283,3 +298,86 @@ export function buildMcpServerProto(input: McpServerInput): McpServer {
|
|
|
283
298
|
spec,
|
|
284
299
|
}) as McpServer;
|
|
285
300
|
}
|
|
301
|
+
|
|
302
|
+
function toStdioServerConfigInput(msg: StdioServerConfig): StdioServerConfigInput {
|
|
303
|
+
return {
|
|
304
|
+
command: msg.command ?? "",
|
|
305
|
+
args: msg.args?.length ? [...msg.args] : undefined,
|
|
306
|
+
workingDir: msg.workingDir || undefined,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function toHttpServerConfigInput(msg: HttpServerConfig): HttpServerConfigInput {
|
|
311
|
+
return {
|
|
312
|
+
url: msg.url ?? "",
|
|
313
|
+
headers: Object.keys(msg.headers ?? {}).length > 0 ? { ...msg.headers } : undefined,
|
|
314
|
+
queryParams: Object.keys(msg.queryParams ?? {}).length > 0 ? { ...msg.queryParams } : undefined,
|
|
315
|
+
timeoutSeconds: msg.timeoutSeconds || undefined,
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function toEnvVarDeclarationInput(msg: EnvVarDeclaration): EnvVarDeclarationInput {
|
|
320
|
+
return {
|
|
321
|
+
isSecret: msg.isSecret || undefined,
|
|
322
|
+
description: msg.description || undefined,
|
|
323
|
+
optional: msg.optional || undefined,
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function toToolApprovalPolicyInput(msg: ToolApprovalPolicy): ToolApprovalPolicyInput {
|
|
328
|
+
return {
|
|
329
|
+
toolName: msg.toolName || undefined,
|
|
330
|
+
message: msg.message || undefined,
|
|
331
|
+
fromDestructiveHint: msg.fromDestructiveHint || undefined,
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function toMcpServerAuthInput(msg: McpServerAuth): McpServerAuthInput {
|
|
336
|
+
return {
|
|
337
|
+
oauthAppRef: toResourceRefInput(msg.oauthAppRef),
|
|
338
|
+
targetEnvVar: msg.targetEnvVar || undefined,
|
|
339
|
+
tokenLifetimeHint: msg.tokenLifetimeHint || undefined,
|
|
340
|
+
scopeHints: msg.scopeHints?.length ? [...msg.scopeHints] : undefined,
|
|
341
|
+
discoveryUrl: msg.discoveryUrl || undefined,
|
|
342
|
+
oauthOnly: msg.oauthOnly || undefined,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Maps a fetched {@link McpServer} to a complete {@link McpServerInput} for `update()`.
|
|
348
|
+
*
|
|
349
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
350
|
+
* and override only the fields you edit (spread nested objects the same
|
|
351
|
+
* way):
|
|
352
|
+
*
|
|
353
|
+
* await client.update({ ...toMcpServerUpdateInput(res), description: next });
|
|
354
|
+
*
|
|
355
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
356
|
+
* `version` (pinned refs) and `kind`.
|
|
357
|
+
*/
|
|
358
|
+
export function toMcpServerUpdateInput(resource: McpServer): McpServerInput {
|
|
359
|
+
const meta = resource.metadata;
|
|
360
|
+
const spec = resource.spec ?? create(McpServerSpecSchema);
|
|
361
|
+
return {
|
|
362
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
363
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
364
|
+
// match, so the id is the ONLY working address.
|
|
365
|
+
id: meta?.id || undefined,
|
|
366
|
+
name: meta?.name ?? "",
|
|
367
|
+
slug: meta?.slug || undefined,
|
|
368
|
+
org: meta?.org ?? "",
|
|
369
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
370
|
+
visibility: meta?.visibility || undefined,
|
|
371
|
+
description: spec.description || undefined,
|
|
372
|
+
iconUrl: spec.iconUrl || undefined,
|
|
373
|
+
tags: spec.tags?.length ? [...spec.tags] : undefined,
|
|
374
|
+
stdio: spec.serverType?.case === "stdio" ? toStdioServerConfigInput(spec.serverType.value) : undefined,
|
|
375
|
+
http: spec.serverType?.case === "http" ? toHttpServerConfigInput(spec.serverType.value) : undefined,
|
|
376
|
+
defaultEnabledTools: spec.defaultEnabledTools?.length ? [...spec.defaultEnabledTools] : undefined,
|
|
377
|
+
env: Object.keys(spec.env ?? {}).length > 0 ? Object.fromEntries(Object.entries(spec.env).map(([k, v]) => [k, toEnvVarDeclarationInput(v)])) : undefined,
|
|
378
|
+
pinnedToolApprovals: spec.pinnedToolApprovals?.length ? spec.pinnedToolApprovals.map(toToolApprovalPolicyInput) : undefined,
|
|
379
|
+
repositoryUrl: spec.repositoryUrl || undefined,
|
|
380
|
+
githubStars: spec.githubStars || undefined,
|
|
381
|
+
auth: spec.auth ? toMcpServerAuthInput(spec.auth) : undefined,
|
|
382
|
+
};
|
|
383
|
+
}
|
package/src/gen/oauthapp.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { OAuthAppSchema, type OAuthApp } from "@stigmer/protos/ai/stigmer/iam/oa
|
|
|
13
13
|
import { OAuthAppCommandController } from "@stigmer/protos/ai/stigmer/iam/oauthapp/v1/command_pb";
|
|
14
14
|
import { ListOAuthAppsByOrgInputSchema, OAuthAppsSchema, type ListOAuthAppsByOrgInput, type OAuthApps } from "@stigmer/protos/ai/stigmer/iam/oauthapp/v1/io_pb";
|
|
15
15
|
import { OAuthAppQueryController } from "@stigmer/protos/ai/stigmer/iam/oauthapp/v1/query_pb";
|
|
16
|
-
import { OAuthAppSpecSchema, VendorApprovalStatus } from "@stigmer/protos/ai/stigmer/iam/oauthapp/v1/spec_pb";
|
|
16
|
+
import { OAuthAppSpecSchema, VendorApprovalStatus, TokenEndpointAuthMethod } from "@stigmer/protos/ai/stigmer/iam/oauthapp/v1/spec_pb";
|
|
17
17
|
|
|
18
18
|
/** Provides operations on oauthapp resources. */
|
|
19
19
|
export class OAuthAppClient {
|
|
@@ -74,6 +74,14 @@ export class OAuthAppClient {
|
|
|
74
74
|
|
|
75
75
|
/** Input for creating/updating a OAuthApp. */
|
|
76
76
|
export interface OAuthAppInput {
|
|
77
|
+
/**
|
|
78
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
79
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
80
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
81
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
82
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
83
|
+
*/
|
|
84
|
+
id?: string;
|
|
77
85
|
name: string;
|
|
78
86
|
slug?: string;
|
|
79
87
|
org: string;
|
|
@@ -89,6 +97,7 @@ export interface OAuthAppInput {
|
|
|
89
97
|
scopeParameterName?: string;
|
|
90
98
|
vendorApprovalStatus?: VendorApprovalStatus;
|
|
91
99
|
vendorApprovalDocsUrl?: string;
|
|
100
|
+
tokenEndpointAuthMethod?: TokenEndpointAuthMethod;
|
|
92
101
|
}
|
|
93
102
|
|
|
94
103
|
export function buildOAuthAppProto(input: OAuthAppInput): OAuthApp {
|
|
@@ -96,6 +105,7 @@ export function buildOAuthAppProto(input: OAuthAppInput): OAuthApp {
|
|
|
96
105
|
apiVersion: "iam.stigmer.ai/v1",
|
|
97
106
|
kind: "OAuthApp",
|
|
98
107
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
108
|
+
...(input.id && { id: input.id }),
|
|
99
109
|
name: input.name,
|
|
100
110
|
org: input.org,
|
|
101
111
|
...(input.slug && { slug: input.slug }),
|
|
@@ -113,6 +123,46 @@ export function buildOAuthAppProto(input: OAuthAppInput): OAuthApp {
|
|
|
113
123
|
scopeParameterName: input.scopeParameterName,
|
|
114
124
|
vendorApprovalStatus: input.vendorApprovalStatus,
|
|
115
125
|
vendorApprovalDocsUrl: input.vendorApprovalDocsUrl,
|
|
126
|
+
tokenEndpointAuthMethod: input.tokenEndpointAuthMethod,
|
|
116
127
|
})),
|
|
117
128
|
}) as OAuthApp;
|
|
118
129
|
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Maps a fetched {@link OAuthApp} to a complete {@link OAuthAppInput} for `update()`.
|
|
133
|
+
*
|
|
134
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
135
|
+
* and override only the fields you edit (spread nested objects the same
|
|
136
|
+
* way):
|
|
137
|
+
*
|
|
138
|
+
* await client.update({ ...toOAuthAppUpdateInput(res), description: next });
|
|
139
|
+
*
|
|
140
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
141
|
+
* `version` (pinned refs) and `kind`.
|
|
142
|
+
*/
|
|
143
|
+
export function toOAuthAppUpdateInput(resource: OAuthApp): OAuthAppInput {
|
|
144
|
+
const meta = resource.metadata;
|
|
145
|
+
const spec = resource.spec ?? create(OAuthAppSpecSchema);
|
|
146
|
+
return {
|
|
147
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
148
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
149
|
+
// match, so the id is the ONLY working address.
|
|
150
|
+
id: meta?.id || undefined,
|
|
151
|
+
name: meta?.name ?? "",
|
|
152
|
+
slug: meta?.slug || undefined,
|
|
153
|
+
org: meta?.org ?? "",
|
|
154
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
155
|
+
visibility: meta?.visibility || undefined,
|
|
156
|
+
provider: spec.provider || undefined,
|
|
157
|
+
clientId: spec.clientId || undefined,
|
|
158
|
+
clientSecret: spec.clientSecret || undefined,
|
|
159
|
+
authorizationUrl: spec.authorizationUrl || undefined,
|
|
160
|
+
tokenUrl: spec.tokenUrl || undefined,
|
|
161
|
+
scopes: spec.scopes?.length ? [...spec.scopes] : undefined,
|
|
162
|
+
userinfoUrl: spec.userinfoUrl || undefined,
|
|
163
|
+
scopeParameterName: spec.scopeParameterName || undefined,
|
|
164
|
+
vendorApprovalStatus: spec.vendorApprovalStatus || undefined,
|
|
165
|
+
vendorApprovalDocsUrl: spec.vendorApprovalDocsUrl || undefined,
|
|
166
|
+
tokenEndpointAuthMethod: spec.tokenEndpointAuthMethod || undefined,
|
|
167
|
+
};
|
|
168
|
+
}
|
package/src/gen/organization.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Code generated by stigmer-codegen. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
import { wrapError } from "./errors.js";
|
|
4
|
-
import { stripUndefined } from "./proto-utils.js";
|
|
4
|
+
import { stripUndefined, toResourceRefInput } from "./proto-utils.js";
|
|
5
5
|
import { type ResourceRef } from "./types.js";
|
|
6
6
|
import { create } from "@bufbuild/protobuf";
|
|
7
7
|
import { EmptySchema } from "@bufbuild/protobuf/wkt";
|
|
@@ -14,7 +14,7 @@ import { OrganizationCommandController } from "@stigmer/protos/ai/stigmer/tenanc
|
|
|
14
14
|
import { ManagementMode } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/enum_pb";
|
|
15
15
|
import { OrganizationIdSchema, OrganizationListSchema, OrganizationsSchema, OrganizationExternalLookupSchema, type OrganizationList, type Organizations, type OrganizationExternalLookup } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/io_pb";
|
|
16
16
|
import { OrganizationQueryController } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/query_pb";
|
|
17
|
-
import { OrganizationSpecSchema } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/spec_pb";
|
|
17
|
+
import { OrganizationSpecSchema, OrganizationPreferencesSchema, type OrganizationPreferences } from "@stigmer/protos/ai/stigmer/tenancy/organization/v1/spec_pb";
|
|
18
18
|
|
|
19
19
|
/** Provides operations on organization resources. */
|
|
20
20
|
export class OrganizationClient {
|
|
@@ -77,6 +77,14 @@ export class OrganizationClient {
|
|
|
77
77
|
|
|
78
78
|
/** Input for creating/updating a Organization. */
|
|
79
79
|
export interface OrganizationInput {
|
|
80
|
+
/**
|
|
81
|
+
* The resource's `metadata.id`, for exact update addressing when set
|
|
82
|
+
* from a loaded resource. Required for updates to platform-scoped
|
|
83
|
+
* (org-less) kinds, where the org+slug fallback cannot match. On
|
|
84
|
+
* create, the cloud server stamps its own id regardless; the OSS
|
|
85
|
+
* server honors a caller-supplied id (existing apply semantics).
|
|
86
|
+
*/
|
|
87
|
+
id?: string;
|
|
80
88
|
name: string;
|
|
81
89
|
slug?: string;
|
|
82
90
|
org: string;
|
|
@@ -88,14 +96,28 @@ export interface OrganizationInput {
|
|
|
88
96
|
identityProviderRef?: ResourceRef;
|
|
89
97
|
externalOrgId?: string;
|
|
90
98
|
isPersonal?: boolean;
|
|
99
|
+
preferences?: OrganizationPreferencesInput;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** SDK input type for OrganizationPreferences. */
|
|
103
|
+
export interface OrganizationPreferencesInput {
|
|
104
|
+
standingContext?: string;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function buildOrganizationPreferencesProto(input: OrganizationPreferencesInput) {
|
|
108
|
+
return Object.assign(create(OrganizationPreferencesSchema), stripUndefined({
|
|
109
|
+
standingContext: input.standingContext,
|
|
110
|
+
}));
|
|
91
111
|
}
|
|
92
112
|
|
|
93
113
|
export function buildOrganizationProto(input: OrganizationInput): Organization {
|
|
94
114
|
const identityProviderRef = (input.identityProviderRef?.slug || input.identityProviderRef?.org) ? create(ApiResourceReferenceSchema, input.identityProviderRef) : undefined;
|
|
115
|
+
const preferences = input.preferences ? buildOrganizationPreferencesProto(input.preferences) : undefined;
|
|
95
116
|
return Object.assign(create(OrganizationSchema), {
|
|
96
117
|
apiVersion: "tenancy.stigmer.ai/v1",
|
|
97
118
|
kind: "Organization",
|
|
98
119
|
metadata: Object.assign(create(ApiResourceMetadataSchema), {
|
|
120
|
+
...(input.id && { id: input.id }),
|
|
99
121
|
name: input.name,
|
|
100
122
|
org: input.org,
|
|
101
123
|
...(input.slug && { slug: input.slug }),
|
|
@@ -109,6 +131,48 @@ export function buildOrganizationProto(input: OrganizationInput): Organization {
|
|
|
109
131
|
identityProviderRef,
|
|
110
132
|
externalOrgId: input.externalOrgId,
|
|
111
133
|
isPersonal: input.isPersonal,
|
|
134
|
+
preferences,
|
|
112
135
|
})),
|
|
113
136
|
}) as Organization;
|
|
114
137
|
}
|
|
138
|
+
|
|
139
|
+
function toOrganizationPreferencesInput(msg: OrganizationPreferences): OrganizationPreferencesInput {
|
|
140
|
+
return {
|
|
141
|
+
standingContext: msg.standingContext || undefined,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Maps a fetched {@link Organization} to a complete {@link OrganizationInput} for `update()`.
|
|
147
|
+
*
|
|
148
|
+
* The update RPC replaces the ENTIRE spec — spread this mapper's output
|
|
149
|
+
* and override only the fields you edit (spread nested objects the same
|
|
150
|
+
* way):
|
|
151
|
+
*
|
|
152
|
+
* await client.update({ ...toOrganizationUpdateInput(res), description: next });
|
|
153
|
+
*
|
|
154
|
+
* Proto3 defaults normalize to `undefined`; resource references keep
|
|
155
|
+
* `version` (pinned refs) and `kind`.
|
|
156
|
+
*/
|
|
157
|
+
export function toOrganizationUpdateInput(resource: Organization): OrganizationInput {
|
|
158
|
+
const meta = resource.metadata;
|
|
159
|
+
const spec = resource.spec ?? create(OrganizationSpecSchema);
|
|
160
|
+
return {
|
|
161
|
+
// Exact update addressing (id-first in the update pipeline) — for
|
|
162
|
+
// platform-scoped (org-less) kinds the org+slug fallback cannot
|
|
163
|
+
// match, so the id is the ONLY working address.
|
|
164
|
+
id: meta?.id || undefined,
|
|
165
|
+
name: meta?.name ?? "",
|
|
166
|
+
slug: meta?.slug || undefined,
|
|
167
|
+
org: meta?.org || meta?.slug || "",
|
|
168
|
+
labels: meta?.labels && Object.keys(meta.labels).length > 0 ? { ...meta.labels } : undefined,
|
|
169
|
+
visibility: meta?.visibility || undefined,
|
|
170
|
+
description: spec.description || undefined,
|
|
171
|
+
logoUrl: spec.logoUrl || undefined,
|
|
172
|
+
managementMode: spec.managementMode || undefined,
|
|
173
|
+
identityProviderRef: toResourceRefInput(spec.identityProviderRef),
|
|
174
|
+
externalOrgId: spec.externalOrgId || undefined,
|
|
175
|
+
isPersonal: spec.isPersonal || undefined,
|
|
176
|
+
preferences: spec.preferences ? toOrganizationPreferencesInput(spec.preferences) : undefined,
|
|
177
|
+
};
|
|
178
|
+
}
|