@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.
- package/dist/connections.d.ts +1 -0
- package/dist/connections.js +11 -7
- package/package.json +2 -2
- package/src/connections.test.ts +12 -0
- package/src/connections.ts +13 -7
package/dist/connections.d.ts
CHANGED
|
@@ -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>;
|
package/dist/connections.js
CHANGED
|
@@ -42,11 +42,9 @@ export const connectionSchema = z.strictObject({
|
|
|
42
42
|
profile_mapping: profileMappingSchema,
|
|
43
43
|
status: connectionStatusSchema,
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
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
|
-
|
|
102
|
-
|
|
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.
|
|
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.
|
|
31
|
+
"@smartcrab/contracts-public": "0.8.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"typescript": "5.9.3",
|
package/src/connections.test.ts
CHANGED
|
@@ -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(
|
package/src/connections.ts
CHANGED
|
@@ -50,11 +50,9 @@ export const connectionSchema = z.strictObject({
|
|
|
50
50
|
profile_mapping: profileMappingSchema,
|
|
51
51
|
status: connectionStatusSchema,
|
|
52
52
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
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
|
-
|
|
126
|
-
|
|
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
|
|