@smartcrab/contracts-management 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -182,6 +182,7 @@ export declare const connectionGetResponseSchema: z.ZodObject<{
182
182
  }, z.core.$strict>;
183
183
  export type ConnectionGetResponse = z.infer<typeof connectionGetResponseSchema>;
184
184
  export declare const connectionUpdateRequestSchema: z.ZodObject<{
185
+ expected_updated_at: z.ZodOptional<z.ZodISODateTime>;
185
186
  issuer: z.ZodOptional<z.ZodURL>;
186
187
  provider_client_id: z.ZodOptional<z.ZodString>;
187
188
  provider_client_secret: z.ZodOptional<z.ZodString>;
@@ -42,11 +42,9 @@ export const connectionSchema = z.strictObject({
42
42
  profile_mapping: profileMappingSchema,
43
43
  status: connectionStatusSchema,
44
44
  /**
45
- * design.md §20.3: "Dashboard上で所有者が明示確認するまでConnectionを有効化
46
- * しない" — a `generic_oidc` connection's owner-supplied issuer is a real
47
- * SSRF surface, so it stays unusable until the Dashboard owner explicitly
48
- * confirms it here. Always `true` for every other provider (nothing to
49
- * confirm).
45
+ * Generic OIDC is true only after a workspace Owner approved the exact
46
+ * current issuer; changing the issuer invalidates that approval. Always
47
+ * `true` for fixed providers.
50
48
  */
51
49
  owner_confirmed: z.boolean(),
52
50
  created_at: z.iso.datetime(),
@@ -91,6 +89,10 @@ export const connectionGetResponseSchema = connectionSchema;
91
89
  // PATCH /connections/:connectionId
92
90
  // ---------------------------------------------------------------------------
93
91
  export const connectionUpdateRequestSchema = z.strictObject({
92
+ expected_updated_at: z.iso
93
+ .datetime()
94
+ .optional()
95
+ .describe("現在のConnectionのupdated_at。汎用OIDCの更新ではIf-Matchを送らない場合に必須です。"),
94
96
  issuer: httpsUrlSchema.optional(),
95
97
  provider_client_id: z.string().min(1).optional(),
96
98
  /** Write-only; omit to leave the stored secret unchanged. */
@@ -98,8 +100,10 @@ export const connectionUpdateRequestSchema = z.strictObject({
98
100
  scopes: z.array(providerScopeSchema).max(20).optional(),
99
101
  profile_mapping: profileMappingSchema.optional(),
100
102
  status: connectionStatusSchema.optional(),
101
- /** design.md §20.3: the Dashboard owner's explicit confirmation step (only meaningful for `generic_oidc`; see `connectionSchema.owner_confirmed`). */
102
- owner_confirmed: z.boolean().optional(),
103
+ owner_confirmed: z
104
+ .boolean()
105
+ .optional()
106
+ .describe("現在の汎用OIDC issuerへの承認。trueは非impersonationのWorkspace Ownerのみ指定でき、issuer変更とは別のPATCHが必要です。"),
103
107
  });
104
108
  export const connectionUpdateResponseSchema = connectionSchema;
105
109
  // ---------------------------------------------------------------------------
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartcrab/contracts-management",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "zod": "4.6.7",
31
- "@smartcrab/contracts-public": "0.7.1"
31
+ "@smartcrab/contracts-public": "0.8.0"
32
32
  },
33
33
  "devDependencies": {
34
34
  "typescript": "5.9.3",
@@ -3,6 +3,7 @@ import {
3
3
  connectionCreateRequestSchema,
4
4
  connectionCreateResponseSchema,
5
5
  connectionSchema,
6
+ connectionUpdateRequestSchema,
6
7
  } from "./connections.js";
7
8
 
8
9
  const VALID_CONNECTION = {
@@ -39,6 +40,17 @@ describe("connectionSchema (design.md §11.10)", () => {
39
40
  });
40
41
  });
41
42
 
43
+ describe("connectionUpdateRequestSchema", () => {
44
+ test("accepts a reviewed revision and Owner approval", () => {
45
+ expect(
46
+ connectionUpdateRequestSchema.safeParse({
47
+ expected_updated_at: VALID_CONNECTION.updated_at,
48
+ owner_confirmed: true,
49
+ }).success,
50
+ ).toBe(true);
51
+ });
52
+ });
53
+
42
54
  describe("connectionCreateRequestSchema / connectionCreateResponseSchema", () => {
43
55
  test("create request accepts a write-only provider_client_secret", () => {
44
56
  expect(
@@ -50,11 +50,9 @@ export const connectionSchema = z.strictObject({
50
50
  profile_mapping: profileMappingSchema,
51
51
  status: connectionStatusSchema,
52
52
  /**
53
- * design.md §20.3: "Dashboard上で所有者が明示確認するまでConnectionを有効化
54
- * しない" — a `generic_oidc` connection's owner-supplied issuer is a real
55
- * SSRF surface, so it stays unusable until the Dashboard owner explicitly
56
- * confirms it here. Always `true` for every other provider (nothing to
57
- * confirm).
53
+ * Generic OIDC is true only after a workspace Owner approved the exact
54
+ * current issuer; changing the issuer invalidates that approval. Always
55
+ * `true` for fixed providers.
58
56
  */
59
57
  owner_confirmed: z.boolean(),
60
58
  created_at: z.iso.datetime(),
@@ -115,6 +113,10 @@ export type ConnectionGetResponse = z.infer<typeof connectionGetResponseSchema>;
115
113
  // ---------------------------------------------------------------------------
116
114
 
117
115
  export const connectionUpdateRequestSchema = z.strictObject({
116
+ expected_updated_at: z.iso
117
+ .datetime()
118
+ .optional()
119
+ .describe("現在のConnectionのupdated_at。汎用OIDCの更新ではIf-Matchを送らない場合に必須です。"),
118
120
  issuer: httpsUrlSchema.optional(),
119
121
  provider_client_id: z.string().min(1).optional(),
120
122
  /** Write-only; omit to leave the stored secret unchanged. */
@@ -122,8 +124,12 @@ export const connectionUpdateRequestSchema = z.strictObject({
122
124
  scopes: z.array(providerScopeSchema).max(20).optional(),
123
125
  profile_mapping: profileMappingSchema.optional(),
124
126
  status: connectionStatusSchema.optional(),
125
- /** design.md §20.3: the Dashboard owner's explicit confirmation step (only meaningful for `generic_oidc`; see `connectionSchema.owner_confirmed`). */
126
- owner_confirmed: z.boolean().optional(),
127
+ owner_confirmed: z
128
+ .boolean()
129
+ .optional()
130
+ .describe(
131
+ "現在の汎用OIDC issuerへの承認。trueは非impersonationのWorkspace Ownerのみ指定でき、issuer変更とは別のPATCHが必要です。",
132
+ ),
127
133
  });
128
134
  export type ConnectionUpdateRequest = z.infer<typeof connectionUpdateRequestSchema>;
129
135