@logto/connector-github 1.1.0 → 1.2.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/LICENSE CHANGED
@@ -1,9 +1,3 @@
1
- Portions of this software are licensed as follows:
2
-
3
- * All content that resides under the "packages/cloud" directory of this repository, if that directory exists, is licensed under the license defined in "packages/cloud/LICENSE" (Elastic-2.0).
4
- * All third party components incorporated into this software are licensed under the original license provided by the owner of the applicable component.
5
- * Content outside of the above mentioned directories or restrictions above is available under the "MPL-2.0" license as defined below.
6
-
7
1
  Mozilla Public License Version 2.0
8
2
  ==================================
9
3
 
package/lib/index.js CHANGED
@@ -15,8 +15,22 @@ const assert = (value, error) => {
15
15
  // eslint-disable-next-line unicorn/prefer-native-coercion-functions
16
16
  const notFalsy = (value) => Boolean(value);
17
17
 
18
+ /**
19
+ * Conditional return the expression result when it's not {@link Falsy};
20
+ * otherwise return `undefined`.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * conditional(1 && '2') // '2'
25
+ * conditional(false && '1') // undefined
26
+ * ```
27
+ */
18
28
  const conditional = (exp) => (notFalsy(exp) ? exp : undefined);
19
29
 
30
+ function getDefaultExportFromCjs (x) {
31
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
32
+ }
33
+
20
34
  var token = '%[a-f0-9]{2}';
21
35
  var singleMatcher = new RegExp('(' + token + ')|([^%]+?)', 'gi');
22
36
  var multiMatcher = new RegExp('(' + token + ')+', 'gi');
@@ -111,6 +125,8 @@ var decodeUriComponent = function (encodedURI) {
111
125
  }
112
126
  };
113
127
 
128
+ var decodeComponent = /*@__PURE__*/getDefaultExportFromCjs(decodeUriComponent);
129
+
114
130
  var splitOnFirst = (string, separator) => {
115
131
  if (!(typeof string === 'string' && typeof separator === 'string')) {
116
132
  throw new TypeError('Expected the arguments to be of type `string`');
@@ -132,6 +148,8 @@ var splitOnFirst = (string, separator) => {
132
148
  ];
133
149
  };
134
150
 
151
+ var splitOnFirst$1 = /*@__PURE__*/getDefaultExportFromCjs(splitOnFirst);
152
+
135
153
  function parserForArrayFormat(options) {
136
154
  let result;
137
155
 
@@ -248,7 +266,7 @@ function validateArrayFormatSeparator(value) {
248
266
 
249
267
  function decode(value, options) {
250
268
  if (options.decode) {
251
- return decodeUriComponent(value);
269
+ return decodeComponent(value);
252
270
  }
253
271
 
254
272
  return value;
@@ -311,7 +329,7 @@ function parse(query, options) {
311
329
  continue;
312
330
  }
313
331
 
314
- let [key, value] = splitOnFirst(options.decode ? parameter.replace(/\+/g, ' ') : parameter, '=');
332
+ let [key, value] = splitOnFirst$1(options.decode ? parameter.replace(/\+/g, ' ') : parameter, '=');
315
333
 
316
334
  // Missing `=` should be `null`:
317
335
  // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
package/lib/types.d.ts CHANGED
@@ -4,13 +4,13 @@ export declare const githubConfigGuard: z.ZodObject<{
4
4
  clientSecret: z.ZodString;
5
5
  scope: z.ZodOptional<z.ZodString>;
6
6
  }, "strip", z.ZodTypeAny, {
7
- scope?: string | undefined;
8
7
  clientId: string;
9
8
  clientSecret: string;
10
- }, {
11
9
  scope?: string | undefined;
10
+ }, {
12
11
  clientId: string;
13
12
  clientSecret: string;
13
+ scope?: string | undefined;
14
14
  }>;
15
15
  export type GithubConfig = z.infer<typeof githubConfigGuard>;
16
16
  export declare const accessTokenResponseGuard: z.ZodObject<{
@@ -33,15 +33,15 @@ export declare const userInfoResponseGuard: z.ZodObject<{
33
33
  email: z.ZodNullable<z.ZodOptional<z.ZodString>>;
34
34
  name: z.ZodNullable<z.ZodOptional<z.ZodString>>;
35
35
  }, "strip", z.ZodTypeAny, {
36
+ id: number;
36
37
  avatar_url?: string | null | undefined;
37
38
  email?: string | null | undefined;
38
39
  name?: string | null | undefined;
39
- id: number;
40
40
  }, {
41
+ id: number;
41
42
  avatar_url?: string | null | undefined;
42
43
  email?: string | null | undefined;
43
44
  name?: string | null | undefined;
44
- id: number;
45
45
  }>;
46
46
  export type UserInfoResponse = z.infer<typeof userInfoResponseGuard>;
47
47
  export declare const authorizationCallbackErrorGuard: z.ZodObject<{
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@logto/connector-github",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Github web connector implementation.",
5
5
  "author": "Silverhand Inc. <contact@silverhand.io>",
6
6
  "dependencies": {
7
- "@logto/connector-kit": "^1.1.0",
7
+ "@logto/connector-kit": "^2.1.0",
8
8
  "query-string": "^8.0.0"
9
9
  },
10
10
  "main": "./lib/index.js",
@@ -19,7 +19,7 @@
19
19
  "logo-dark.svg"
20
20
  ],
21
21
  "engines": {
22
- "node": "^18.12.0"
22
+ "node": "^20.9.0"
23
23
  },
24
24
  "eslintConfig": {
25
25
  "extends": "@silverhand",