@go-mondo/identity-sdk 0.0.2-beta.49 → 0.0.2-beta.55
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/.github/workflows/release.yaml +1 -0
- package/.release-please-manifest.json +1 -1
- package/.tsbuildinfo/cjs.json +1 -1
- package/.tsbuildinfo/esm.json +1 -1
- package/CHANGELOG.md +42 -0
- package/dist/cjs/oauth/common/schema.d.ts +2 -1
- package/dist/cjs/oauth/common/schema.d.ts.map +1 -1
- package/dist/cjs/oauth/common/schema.js +3 -8
- package/dist/cjs/oauth/common/schema.test.js +4 -4
- package/dist/cjs/oauth/index.d.ts +1 -1
- package/dist/cjs/oauth/index.d.ts.map +1 -1
- package/dist/cjs/oauth/index.js +2 -1
- package/dist/cjs/oauth/token/schema/grants/client-credentials.js +1 -1
- package/dist/cjs/oauth/token/schema/grants/refresh-token.js +1 -1
- package/dist/cjs/oauth/token/schema/schema.js +1 -1
- package/dist/esm/oauth/common/schema.d.ts +2 -1
- package/dist/esm/oauth/common/schema.d.ts.map +1 -1
- package/dist/esm/oauth/common/schema.js +2 -7
- package/dist/esm/oauth/common/schema.test.js +5 -5
- package/dist/esm/oauth/index.d.ts +1 -1
- package/dist/esm/oauth/index.d.ts.map +1 -1
- package/dist/esm/oauth/index.js +1 -1
- package/dist/esm/oauth/token/schema/grants/client-credentials.js +2 -2
- package/dist/esm/oauth/token/schema/grants/refresh-token.js +2 -2
- package/dist/esm/oauth/token/schema/schema.js +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.2-beta.55](https://github.com/go-mondo/identity-node-sdk/compare/identity-sdk-v0.0.2-beta.54...identity-sdk-v0.0.2-beta.55) (2025-12-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* restore token for now ([e94db3e](https://github.com/go-mondo/identity-node-sdk/commit/e94db3e3ba685167c91f24712dc26332fea02db5))
|
|
9
|
+
|
|
10
|
+
## [0.0.2-beta.54](https://github.com/go-mondo/identity-node-sdk/compare/identity-sdk-v0.0.2-beta.53...identity-sdk-v0.0.2-beta.54) (2025-12-13)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* remove env token ([478a0a0](https://github.com/go-mondo/identity-node-sdk/commit/478a0a06e6450000575dc8cdfed7f12a6c5138c9))
|
|
16
|
+
|
|
17
|
+
## [0.0.2-beta.53](https://github.com/go-mondo/identity-node-sdk/compare/identity-sdk-v0.0.2-beta.52...identity-sdk-v0.0.2-beta.53) (2025-12-13)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* trusted publisher ([52f77d2](https://github.com/go-mondo/identity-node-sdk/commit/52f77d2e97b0c0ee8273b1f2ac57dee7702c6971))
|
|
23
|
+
|
|
24
|
+
## [0.0.2-beta.52](https://github.com/go-mondo/identity-node-sdk/compare/identity-sdk-v0.0.2-beta.51...identity-sdk-v0.0.2-beta.52) (2025-12-13)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
* bump ([82b975b](https://github.com/go-mondo/identity-node-sdk/commit/82b975b47a84a0e6e15b684ffe04f30af32a5704))
|
|
30
|
+
|
|
31
|
+
## [0.0.2-beta.51](https://github.com/go-mondo/identity-node-sdk/compare/identity-sdk-v0.0.2-beta.50...identity-sdk-v0.0.2-beta.51) (2025-12-13)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Bug Fixes
|
|
35
|
+
|
|
36
|
+
* bump ([c8a82e1](https://github.com/go-mondo/identity-node-sdk/commit/c8a82e116d470b3ca404e70292f8f89160c270b2))
|
|
37
|
+
|
|
38
|
+
## [0.0.2-beta.50](https://github.com/go-mondo/identity-node-sdk/compare/identity-sdk-v0.0.2-beta.49...identity-sdk-v0.0.2-beta.50) (2025-12-12)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### Bug Fixes
|
|
42
|
+
|
|
43
|
+
* renaming ScopeSchema to ScopeStringSchema and exporting it ([d793d58](https://github.com/go-mondo/identity-node-sdk/commit/d793d5868490acba478fc4acd35df4b41ae7992a))
|
|
44
|
+
|
|
3
45
|
## [0.0.2-beta.49](https://github.com/go-mondo/identity-node-sdk/compare/identity-sdk-v0.0.2-beta.48...identity-sdk-v0.0.2-beta.49) (2025-12-06)
|
|
4
46
|
|
|
5
47
|
|
|
@@ -78,5 +78,6 @@ export declare const Scope: {
|
|
|
78
78
|
PHONE: "phone";
|
|
79
79
|
};
|
|
80
80
|
export type AnyScope = AnyOAuthScope | AnyOIDCScope | string;
|
|
81
|
-
export declare const
|
|
81
|
+
export declare const ScopeStringSchema: z.ZodString;
|
|
82
|
+
export type ScopeString = z.output<typeof ScopeStringSchema>;
|
|
82
83
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/oauth/common/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,eAAO,MAAM,SAAS;;;;;CAKZ,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEtE,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAG/E,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AACX,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC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;;CAKtB,CAAC;AACX,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AACjE,eAAO,MAAM,yBAAyB;;;;;EAErC,CAAC;AAEF,eAAO,MAAM,cAAc;;iBAEzB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;CAMZ,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEtE,eAAO,MAAM,UAAU;;CAEb,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEzE,eAAO,MAAM,KAAK;;;;;;;CAGjB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,YAAY,GAAG,MAAM,CAAC;AAE7D,eAAO,MAAM,iBAAiB,aAGmC,CAAC;AAClE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.
|
|
36
|
+
exports.ScopeStringSchema = exports.Scope = exports.OAuthScope = exports.OIDCScope = exports.OptionalSchema = exports.AuthorizationPromptSchema = exports.AuthorizationPrompt = exports.AuthorizationDisplaySchema = exports.AuthorizationDisplay = exports.CodeChallengeMethodSchema = exports.CodeChallengeMethod = exports.ResponseType = exports.GrantTypeLabel = exports.GrantType = void 0;
|
|
37
37
|
const z = __importStar(require("zod/v4"));
|
|
38
38
|
exports.GrantType = {
|
|
39
39
|
CLIENT_CREDENTIALS: 'client_credentials',
|
|
@@ -79,12 +79,7 @@ exports.AuthorizationPrompt = {
|
|
|
79
79
|
CONSENT: 'consent',
|
|
80
80
|
SELECT_ACCOUNT: 'select_account',
|
|
81
81
|
};
|
|
82
|
-
exports.AuthorizationPromptSchema = z.enum(
|
|
83
|
-
exports.AuthorizationPrompt.NONE,
|
|
84
|
-
exports.AuthorizationPrompt.LOGIN,
|
|
85
|
-
exports.AuthorizationPrompt.CONSENT,
|
|
86
|
-
exports.AuthorizationPrompt.SELECT_ACCOUNT,
|
|
87
|
-
]);
|
|
82
|
+
exports.AuthorizationPromptSchema = z.enum(Object.values(exports.AuthorizationPrompt));
|
|
88
83
|
exports.OptionalSchema = z.object({
|
|
89
84
|
audience: z.string().optional(),
|
|
90
85
|
});
|
|
@@ -102,7 +97,7 @@ exports.Scope = {
|
|
|
102
97
|
...exports.OIDCScope,
|
|
103
98
|
...exports.OAuthScope,
|
|
104
99
|
};
|
|
105
|
-
exports.
|
|
100
|
+
exports.ScopeStringSchema = z
|
|
106
101
|
.string()
|
|
107
102
|
.min(1)
|
|
108
103
|
.describe('A list of space-delimited, case-sensitive strings.');
|
|
@@ -223,14 +223,14 @@ const schema_js_1 = require("./schema.js");
|
|
|
223
223
|
'offline_access',
|
|
224
224
|
];
|
|
225
225
|
for (const scope of validScopes) {
|
|
226
|
-
const result = schema_js_1.
|
|
226
|
+
const result = schema_js_1.ScopeStringSchema.parse(scope);
|
|
227
227
|
(0, vitest_1.expect)(result).toBe(scope);
|
|
228
228
|
}
|
|
229
229
|
});
|
|
230
230
|
(0, vitest_1.test)('ScopeSchema should reject non-string values', () => {
|
|
231
231
|
const invalidValues = [123, true, null, undefined, {}, []];
|
|
232
232
|
for (const value of invalidValues) {
|
|
233
|
-
const result = schema_js_1.
|
|
233
|
+
const result = schema_js_1.ScopeStringSchema.safeParse(value);
|
|
234
234
|
(0, vitest_1.expect)(result.success).toBe(false);
|
|
235
235
|
}
|
|
236
236
|
});
|
|
@@ -264,10 +264,10 @@ const schema_js_1 = require("./schema.js");
|
|
|
264
264
|
(0, vitest_1.describe)('Schema edge cases', () => {
|
|
265
265
|
(0, vitest_1.test)('should handle whitespace and special characters', () => {
|
|
266
266
|
const spacedScope = ' openid profile ';
|
|
267
|
-
const result = schema_js_1.
|
|
267
|
+
const result = schema_js_1.ScopeStringSchema.parse(spacedScope);
|
|
268
268
|
(0, vitest_1.expect)(result).toBe(spacedScope); // Preserves whitespace
|
|
269
269
|
const specialScope = 'custom:read+write';
|
|
270
|
-
const specialResult = schema_js_1.
|
|
270
|
+
const specialResult = schema_js_1.ScopeStringSchema.parse(specialScope);
|
|
271
271
|
(0, vitest_1.expect)(specialResult).toBe(specialScope);
|
|
272
272
|
});
|
|
273
273
|
(0, vitest_1.test)('should validate complex optional schema scenarios', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthorizationDisplay, AuthorizationDisplaySchema, AuthorizationPrompt, AuthorizationPromptSchema, CodeChallengeMethod, CodeChallengeMethodSchema, GrantType, GrantTypeLabel, OAuthScope, OIDCScope, ResponseType, type AnyAuthorizationDisplay, type AnyAuthorizationPrompt, type AnyCodeChallengeMethod, type AnyGrantType, type AnyOAuthScope, type AnyOIDCScope, type AnyResponseType, type AnyScope, } from './common/schema.js';
|
|
1
|
+
export { AuthorizationDisplay, AuthorizationDisplaySchema, AuthorizationPrompt, AuthorizationPromptSchema, CodeChallengeMethod, CodeChallengeMethodSchema, GrantType, GrantTypeLabel, OAuthScope, OIDCScope, ResponseType, ScopeStringSchema, type AnyAuthorizationDisplay, type AnyAuthorizationPrompt, type AnyCodeChallengeMethod, type AnyGrantType, type AnyOAuthScope, type AnyOIDCScope, type AnyResponseType, type AnyScope, type ScopeString, } from './common/schema.js';
|
|
2
2
|
export * as Authorize from './authorize/index.js';
|
|
3
3
|
export * as Token from './token/index.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/oauth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,SAAS,EACT,cAAc,EACd,UAAU,EACV,SAAS,EACT,YAAY,EACZ,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/oauth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,SAAS,EACT,cAAc,EACd,UAAU,EACV,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC"}
|
package/dist/cjs/oauth/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.Token = exports.Authorize = exports.ResponseType = exports.OIDCScope = exports.OAuthScope = exports.GrantTypeLabel = exports.GrantType = exports.CodeChallengeMethodSchema = exports.CodeChallengeMethod = exports.AuthorizationPromptSchema = exports.AuthorizationPrompt = exports.AuthorizationDisplaySchema = exports.AuthorizationDisplay = void 0;
|
|
36
|
+
exports.Token = exports.Authorize = exports.ScopeStringSchema = exports.ResponseType = exports.OIDCScope = exports.OAuthScope = exports.GrantTypeLabel = exports.GrantType = exports.CodeChallengeMethodSchema = exports.CodeChallengeMethod = exports.AuthorizationPromptSchema = exports.AuthorizationPrompt = exports.AuthorizationDisplaySchema = exports.AuthorizationDisplay = void 0;
|
|
37
37
|
var schema_js_1 = require("./common/schema.js");
|
|
38
38
|
Object.defineProperty(exports, "AuthorizationDisplay", { enumerable: true, get: function () { return schema_js_1.AuthorizationDisplay; } });
|
|
39
39
|
Object.defineProperty(exports, "AuthorizationDisplaySchema", { enumerable: true, get: function () { return schema_js_1.AuthorizationDisplaySchema; } });
|
|
@@ -46,5 +46,6 @@ Object.defineProperty(exports, "GrantTypeLabel", { enumerable: true, get: functi
|
|
|
46
46
|
Object.defineProperty(exports, "OAuthScope", { enumerable: true, get: function () { return schema_js_1.OAuthScope; } });
|
|
47
47
|
Object.defineProperty(exports, "OIDCScope", { enumerable: true, get: function () { return schema_js_1.OIDCScope; } });
|
|
48
48
|
Object.defineProperty(exports, "ResponseType", { enumerable: true, get: function () { return schema_js_1.ResponseType; } });
|
|
49
|
+
Object.defineProperty(exports, "ScopeStringSchema", { enumerable: true, get: function () { return schema_js_1.ScopeStringSchema; } });
|
|
49
50
|
exports.Authorize = __importStar(require("./authorize/index.js"));
|
|
50
51
|
exports.Token = __importStar(require("./token/index.js"));
|
|
@@ -56,7 +56,7 @@ exports.ClientCredentialsRequestSchema = z.object({
|
|
|
56
56
|
/**
|
|
57
57
|
* OPTIONAL. The scope of the access request.
|
|
58
58
|
*/
|
|
59
|
-
scope: schema_js_1.
|
|
59
|
+
scope: schema_js_1.ScopeStringSchema.optional(),
|
|
60
60
|
...common_js_1.ClientRequestSchema.shape,
|
|
61
61
|
...schema_js_1.OptionalSchema.shape,
|
|
62
62
|
});
|
|
@@ -58,6 +58,6 @@ exports.RefreshTokenRequestSchema = z.object({
|
|
|
58
58
|
* unchanged from the original grant. If specified, it must be equal to or
|
|
59
59
|
* a subset of the original scope.
|
|
60
60
|
*/
|
|
61
|
-
scope: schema_js_1.
|
|
61
|
+
scope: schema_js_1.ScopeStringSchema.optional(),
|
|
62
62
|
...common_js_1.ClientRequestSchema.shape,
|
|
63
63
|
});
|
|
@@ -91,7 +91,7 @@ exports.ResponseSchema = z.object({
|
|
|
91
91
|
* OPTIONAL. The scope of the access token as issued by the authorization server.
|
|
92
92
|
* If omitted, the scope is the same as the scope originally requested by the client.
|
|
93
93
|
*/
|
|
94
|
-
scope: schema_js_1.
|
|
94
|
+
scope: schema_js_1.ScopeStringSchema.optional(),
|
|
95
95
|
/**
|
|
96
96
|
* OPTIONAL, for OpenID Connect (OIDC). The ID token, a JWT that contains claims
|
|
97
97
|
* about the authentication of the end-user.
|
|
@@ -78,5 +78,6 @@ export declare const Scope: {
|
|
|
78
78
|
PHONE: "phone";
|
|
79
79
|
};
|
|
80
80
|
export type AnyScope = AnyOAuthScope | AnyOIDCScope | string;
|
|
81
|
-
export declare const
|
|
81
|
+
export declare const ScopeStringSchema: z.ZodString;
|
|
82
|
+
export type ScopeString = z.output<typeof ScopeStringSchema>;
|
|
82
83
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/oauth/common/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B,eAAO,MAAM,SAAS;;;;;CAKZ,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEtE,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC;AAEX,eAAO,MAAM,YAAY;;;;CAIf,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAG/E,eAAO,MAAM,mBAAmB;;;;CAItB,CAAC;AACX,MAAM,MAAM,sBAAsB,GAChC,CAAC,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,0BAA0B;;;;;EAK5B,CAAC;AAEZ,eAAO,MAAM,mBAAmB;;;;;CAKtB,CAAC;AACX,MAAM,MAAM,sBAAsB,GAChC,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AACjE,eAAO,MAAM,yBAAyB;;;;;EAErC,CAAC;AAEF,eAAO,MAAM,cAAc;;iBAEzB,CAAC;AAEH,eAAO,MAAM,SAAS;;;;;;CAMZ,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEtE,eAAO,MAAM,UAAU;;CAEb,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEzE,eAAO,MAAM,KAAK;;;;;;;CAGjB,CAAC;AACF,MAAM,MAAM,QAAQ,GAAG,aAAa,GAAG,YAAY,GAAG,MAAM,CAAC;AAE7D,eAAO,MAAM,iBAAiB,aAGmC,CAAC;AAClE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -43,12 +43,7 @@ export const AuthorizationPrompt = {
|
|
|
43
43
|
CONSENT: 'consent',
|
|
44
44
|
SELECT_ACCOUNT: 'select_account',
|
|
45
45
|
};
|
|
46
|
-
export const AuthorizationPromptSchema = z.enum(
|
|
47
|
-
AuthorizationPrompt.NONE,
|
|
48
|
-
AuthorizationPrompt.LOGIN,
|
|
49
|
-
AuthorizationPrompt.CONSENT,
|
|
50
|
-
AuthorizationPrompt.SELECT_ACCOUNT,
|
|
51
|
-
]);
|
|
46
|
+
export const AuthorizationPromptSchema = z.enum(Object.values(AuthorizationPrompt));
|
|
52
47
|
export const OptionalSchema = z.object({
|
|
53
48
|
audience: z.string().optional(),
|
|
54
49
|
});
|
|
@@ -66,7 +61,7 @@ export const Scope = {
|
|
|
66
61
|
...OIDCScope,
|
|
67
62
|
...OAuthScope,
|
|
68
63
|
};
|
|
69
|
-
export const
|
|
64
|
+
export const ScopeStringSchema = z
|
|
70
65
|
.string()
|
|
71
66
|
.min(1)
|
|
72
67
|
.describe('A list of space-delimited, case-sensitive strings.');
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { describe, expect, test } from 'vitest';
|
|
2
|
-
import { AuthorizationDisplay, AuthorizationDisplaySchema, AuthorizationPrompt, AuthorizationPromptSchema, CodeChallengeMethod, CodeChallengeMethodSchema, GrantType, GrantTypeLabel, OAuthScope, OIDCScope, OptionalSchema, ResponseType, Scope,
|
|
2
|
+
import { AuthorizationDisplay, AuthorizationDisplaySchema, AuthorizationPrompt, AuthorizationPromptSchema, CodeChallengeMethod, CodeChallengeMethodSchema, GrantType, GrantTypeLabel, OAuthScope, OIDCScope, OptionalSchema, ResponseType, Scope, ScopeStringSchema, } from './schema.js';
|
|
3
3
|
describe('OAuth Common Schema', () => {
|
|
4
4
|
describe('GrantType constants', () => {
|
|
5
5
|
test('should define correct grant type values', () => {
|
|
@@ -221,14 +221,14 @@ describe('OAuth Common Schema', () => {
|
|
|
221
221
|
'offline_access',
|
|
222
222
|
];
|
|
223
223
|
for (const scope of validScopes) {
|
|
224
|
-
const result =
|
|
224
|
+
const result = ScopeStringSchema.parse(scope);
|
|
225
225
|
expect(result).toBe(scope);
|
|
226
226
|
}
|
|
227
227
|
});
|
|
228
228
|
test('ScopeSchema should reject non-string values', () => {
|
|
229
229
|
const invalidValues = [123, true, null, undefined, {}, []];
|
|
230
230
|
for (const value of invalidValues) {
|
|
231
|
-
const result =
|
|
231
|
+
const result = ScopeStringSchema.safeParse(value);
|
|
232
232
|
expect(result.success).toBe(false);
|
|
233
233
|
}
|
|
234
234
|
});
|
|
@@ -262,10 +262,10 @@ describe('OAuth Common Schema', () => {
|
|
|
262
262
|
describe('Schema edge cases', () => {
|
|
263
263
|
test('should handle whitespace and special characters', () => {
|
|
264
264
|
const spacedScope = ' openid profile ';
|
|
265
|
-
const result =
|
|
265
|
+
const result = ScopeStringSchema.parse(spacedScope);
|
|
266
266
|
expect(result).toBe(spacedScope); // Preserves whitespace
|
|
267
267
|
const specialScope = 'custom:read+write';
|
|
268
|
-
const specialResult =
|
|
268
|
+
const specialResult = ScopeStringSchema.parse(specialScope);
|
|
269
269
|
expect(specialResult).toBe(specialScope);
|
|
270
270
|
});
|
|
271
271
|
test('should validate complex optional schema scenarios', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AuthorizationDisplay, AuthorizationDisplaySchema, AuthorizationPrompt, AuthorizationPromptSchema, CodeChallengeMethod, CodeChallengeMethodSchema, GrantType, GrantTypeLabel, OAuthScope, OIDCScope, ResponseType, type AnyAuthorizationDisplay, type AnyAuthorizationPrompt, type AnyCodeChallengeMethod, type AnyGrantType, type AnyOAuthScope, type AnyOIDCScope, type AnyResponseType, type AnyScope, } from './common/schema.js';
|
|
1
|
+
export { AuthorizationDisplay, AuthorizationDisplaySchema, AuthorizationPrompt, AuthorizationPromptSchema, CodeChallengeMethod, CodeChallengeMethodSchema, GrantType, GrantTypeLabel, OAuthScope, OIDCScope, ResponseType, ScopeStringSchema, type AnyAuthorizationDisplay, type AnyAuthorizationPrompt, type AnyCodeChallengeMethod, type AnyGrantType, type AnyOAuthScope, type AnyOIDCScope, type AnyResponseType, type AnyScope, type ScopeString, } from './common/schema.js';
|
|
2
2
|
export * as Authorize from './authorize/index.js';
|
|
3
3
|
export * as Token from './token/index.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/oauth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,SAAS,EACT,cAAc,EACd,UAAU,EACV,SAAS,EACT,YAAY,EACZ,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/oauth/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,yBAAyB,EACzB,SAAS,EACT,cAAc,EACd,UAAU,EACV,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,WAAW,GACjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC"}
|
package/dist/esm/oauth/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { AuthorizationDisplay, AuthorizationDisplaySchema, AuthorizationPrompt, AuthorizationPromptSchema, CodeChallengeMethod, CodeChallengeMethodSchema, GrantType, GrantTypeLabel, OAuthScope, OIDCScope, ResponseType, } from './common/schema.js';
|
|
1
|
+
export { AuthorizationDisplay, AuthorizationDisplaySchema, AuthorizationPrompt, AuthorizationPromptSchema, CodeChallengeMethod, CodeChallengeMethodSchema, GrantType, GrantTypeLabel, OAuthScope, OIDCScope, ResponseType, ScopeStringSchema, } from './common/schema.js';
|
|
2
2
|
export * as Authorize from './authorize/index.js';
|
|
3
3
|
export * as Token from './token/index.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod/v4';
|
|
2
|
-
import { GrantType, OptionalSchema,
|
|
2
|
+
import { GrantType, OptionalSchema, ScopeStringSchema, } from '../../../common/schema.js';
|
|
3
3
|
import { ClientRequestSchema } from './common.js';
|
|
4
4
|
/**
|
|
5
5
|
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-4.4.2
|
|
@@ -20,7 +20,7 @@ export const ClientCredentialsRequestSchema = z.object({
|
|
|
20
20
|
/**
|
|
21
21
|
* OPTIONAL. The scope of the access request.
|
|
22
22
|
*/
|
|
23
|
-
scope:
|
|
23
|
+
scope: ScopeStringSchema.optional(),
|
|
24
24
|
...ClientRequestSchema.shape,
|
|
25
25
|
...OptionalSchema.shape,
|
|
26
26
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod/v4';
|
|
2
|
-
import { GrantType,
|
|
2
|
+
import { GrantType, ScopeStringSchema } from '../../../common/schema.js';
|
|
3
3
|
import { ClientRequestSchema } from './common.js';
|
|
4
4
|
/**
|
|
5
5
|
* @see https://datatracker.ietf.org/doc/html/rfc6749#section-6
|
|
@@ -22,6 +22,6 @@ export const RefreshTokenRequestSchema = z.object({
|
|
|
22
22
|
* unchanged from the original grant. If specified, it must be equal to or
|
|
23
23
|
* a subset of the original scope.
|
|
24
24
|
*/
|
|
25
|
-
scope:
|
|
25
|
+
scope: ScopeStringSchema.optional(),
|
|
26
26
|
...ClientRequestSchema.shape,
|
|
27
27
|
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as z from 'zod/v4';
|
|
2
|
-
import {
|
|
2
|
+
import { ScopeStringSchema } from '../../common/schema.js';
|
|
3
3
|
import { AuthorizationCodeRequestSchema } from './grants/authorization-code.js';
|
|
4
4
|
import { ClientCredentialsRequestSchema } from './grants/client-credentials.js';
|
|
5
5
|
import { RefreshTokenRequestSchema } from './grants/refresh-token.js';
|
|
@@ -52,7 +52,7 @@ export const ResponseSchema = z.object({
|
|
|
52
52
|
* OPTIONAL. The scope of the access token as issued by the authorization server.
|
|
53
53
|
* If omitted, the scope is the same as the scope originally requested by the client.
|
|
54
54
|
*/
|
|
55
|
-
scope:
|
|
55
|
+
scope: ScopeStringSchema.optional(),
|
|
56
56
|
/**
|
|
57
57
|
* OPTIONAL, for OpenID Connect (OIDC). The ID token, a JWT that contains claims
|
|
58
58
|
* about the authentication of the end-user.
|