@logto/connector-github 1.0.0-beta.11 → 1.0.0-beta.12

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/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 1743:
4
+ /***/ 375:
5
5
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
6
6
 
7
7
  "use strict";
@@ -22,22 +22,22 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
22
22
  };
23
23
  Object.defineProperty(exports, "__esModule", ({ value: true }));
24
24
  exports.parseJson = exports.validateConfig = void 0;
25
- const types_1 = __nccwpck_require__(8053);
26
- __exportStar(__nccwpck_require__(8053), exports);
25
+ const types_js_1 = __nccwpck_require__(6309);
26
+ __exportStar(__nccwpck_require__(6309), exports);
27
27
  function validateConfig(config, guard) {
28
28
  const result = guard.safeParse(config);
29
29
  if (!result.success) {
30
- throw new types_1.ConnectorError(types_1.ConnectorErrorCodes.InvalidConfig, result.error);
30
+ throw new types_js_1.ConnectorError(types_js_1.ConnectorErrorCodes.InvalidConfig, result.error);
31
31
  }
32
32
  }
33
33
  exports.validateConfig = validateConfig;
34
- const parseJson = (jsonString, errorCode = types_1.ConnectorErrorCodes.InvalidResponse, errorPayload) => {
34
+ const parseJson = (jsonString, errorCode = types_js_1.ConnectorErrorCodes.InvalidResponse, errorPayload) => {
35
35
  try {
36
36
  // eslint-disable-next-line @typescript-eslint/no-unsafe-return
37
37
  return JSON.parse(jsonString);
38
38
  }
39
39
  catch {
40
- throw new types_1.ConnectorError(errorCode, errorPayload ?? jsonString);
40
+ throw new types_js_1.ConnectorError(errorCode, errorPayload ?? jsonString);
41
41
  }
42
42
  };
43
43
  exports.parseJson = parseJson;
@@ -45,13 +45,14 @@ exports.parseJson = parseJson;
45
45
 
46
46
  /***/ }),
47
47
 
48
- /***/ 8053:
48
+ /***/ 6309:
49
49
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
50
50
 
51
51
  "use strict";
52
52
 
53
53
  Object.defineProperty(exports, "__esModule", ({ value: true }));
54
- exports.messageTypesGuard = exports.MessageTypes = exports.ConnectorError = exports.ConnectorErrorCodes = exports.ConnectorPlatform = exports.ConnectorType = void 0;
54
+ exports.configurableConnectorMetadataGuard = exports.messageTypesGuard = exports.MessageTypes = exports.ConnectorError = exports.ConnectorErrorCodes = exports.i18nPhrasesGuard = exports.ConnectorPlatform = exports.ConnectorType = void 0;
55
+ const language_kit_1 = __nccwpck_require__(7266);
55
56
  const zod_1 = __nccwpck_require__(8062);
56
57
  // MARK: Foundation
57
58
  var ConnectorType;
@@ -66,6 +67,21 @@ var ConnectorPlatform;
66
67
  ConnectorPlatform["Universal"] = "Universal";
67
68
  ConnectorPlatform["Web"] = "Web";
68
69
  })(ConnectorPlatform = exports.ConnectorPlatform || (exports.ConnectorPlatform = {}));
70
+ exports.i18nPhrasesGuard = zod_1.z
71
+ .object({ en: zod_1.z.string() })
72
+ .and(zod_1.z.record(zod_1.z.string()))
73
+ .refine((i18nObject) => {
74
+ const keys = Object.keys(i18nObject);
75
+ if (!keys.includes('en')) {
76
+ return false;
77
+ }
78
+ for (const value of keys) {
79
+ if (!(0, language_kit_1.isLanguageTag)(value)) {
80
+ return false;
81
+ }
82
+ }
83
+ return true;
84
+ });
69
85
  var ConnectorErrorCodes;
70
86
  (function (ConnectorErrorCodes) {
71
87
  ConnectorErrorCodes["General"] = "general";
@@ -100,6 +116,217 @@ var MessageTypes;
100
116
  MessageTypes["Test"] = "Test";
101
117
  })(MessageTypes = exports.MessageTypes || (exports.MessageTypes = {}));
102
118
  exports.messageTypesGuard = zod_1.z.nativeEnum(MessageTypes);
119
+ const connectorMetadataGuard = zod_1.z.object({
120
+ id: zod_1.z.string(),
121
+ target: zod_1.z.string(),
122
+ platform: zod_1.z.nativeEnum(ConnectorPlatform).nullable(),
123
+ name: exports.i18nPhrasesGuard,
124
+ logo: zod_1.z.string(),
125
+ logoDark: zod_1.z.string().nullable(),
126
+ description: exports.i18nPhrasesGuard,
127
+ isStandard: zod_1.z.boolean().optional(),
128
+ readme: zod_1.z.string(),
129
+ configTemplate: zod_1.z.string(),
130
+ });
131
+ exports.configurableConnectorMetadataGuard = connectorMetadataGuard
132
+ .pick({
133
+ target: true,
134
+ name: true,
135
+ logo: true,
136
+ logoDark: true,
137
+ })
138
+ .partial();
139
+
140
+
141
+ /***/ }),
142
+
143
+ /***/ 6921:
144
+ /***/ ((__unused_webpack_module, exports) => {
145
+
146
+ "use strict";
147
+
148
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
149
+ exports.languages = void 0;
150
+ exports.languages = Object.freeze({
151
+ 'af-ZA': 'Afrikaans',
152
+ 'am-ET': 'አማርኛ',
153
+ 'ar-AR': 'العربية',
154
+ 'as-IN': 'অসমীয়া',
155
+ 'az-AZ': 'Azərbaycan dili',
156
+ 'be-BY': 'Беларуская',
157
+ 'bg-BG': 'Български',
158
+ 'bn-IN': 'বাংলা',
159
+ 'br-FR': 'Brezhoneg',
160
+ 'bs-BA': 'Bosanski',
161
+ 'ca-ES': 'Català',
162
+ 'cb-IQ': 'کوردیی ناوەندی',
163
+ 'co-FR': 'Corsu',
164
+ 'cs-CZ': 'Čeština',
165
+ 'cx-PH': 'Bisaya',
166
+ 'cy-GB': 'Cymraeg',
167
+ 'da-DK': 'Dansk',
168
+ de: 'Deutsch',
169
+ 'de-DE': 'Deutsch (Deutschland)',
170
+ 'el-GR': 'Ελληνικά',
171
+ en: 'English',
172
+ 'en-GB': 'English (UK)',
173
+ 'en-US': 'English (US)',
174
+ 'eo-EO': 'Esperanto',
175
+ es: 'Español',
176
+ 'es-ES': 'Español (España)',
177
+ 'es-419': 'Español (Latinoamérica)',
178
+ 'et-EE': 'Eesti',
179
+ 'eu-ES': 'Euskara',
180
+ 'fa-IR': 'فارسی',
181
+ 'ff-NG': 'Fula',
182
+ 'fi-FI': 'Suomi',
183
+ 'fo-FO': 'Føroyskt',
184
+ fr: 'Français',
185
+ 'fr-CA': 'Français (Canada)',
186
+ 'fr-FR': 'Français (France)',
187
+ 'fy-NL': 'Frysk',
188
+ 'ga-IE': 'Gaeilge',
189
+ 'gl-ES': 'Galego',
190
+ 'gn-PY': 'Guarani',
191
+ 'gu-IN': 'ગુજરાતી',
192
+ 'ha-NG': 'Hausa',
193
+ 'he-IL': 'עברית',
194
+ 'hi-IN': 'हिन्दी',
195
+ 'hr-HR': 'Hrvatski',
196
+ 'ht-HT': 'Kreyòl Ayisyen',
197
+ 'hu-HU': 'Magyar',
198
+ 'hy-AM': 'Հայերեն',
199
+ 'id-ID': 'Bahasa Indonesia',
200
+ 'ik-US': 'Iñupiatun',
201
+ 'is-IS': 'Íslenska',
202
+ it: 'Italiano',
203
+ 'it-IT': 'italiano (Italia)',
204
+ 'iu-CA': 'Inuktitut',
205
+ ja: '日本語',
206
+ 'ja-JP': '日本語',
207
+ 'ja-KS': '日本語(関西)',
208
+ 'jv-ID': 'Basa Jawa',
209
+ 'ka-GE': 'ქართული',
210
+ 'kk-KZ': 'Қазақша',
211
+ 'km-KH': 'ភាសាខ្មែរ',
212
+ 'kn-IN': 'ಕನ್ನಡ',
213
+ ko: '한국어',
214
+ 'ko-KR': '한국어',
215
+ 'ku-TR': 'Kurdî (Kurmancî)',
216
+ 'ky-KG': 'кыргызча',
217
+ 'lo-LA': 'ພາສາລາວ',
218
+ 'lt-LT': 'Lietuvių',
219
+ 'lv-LV': 'Latviešu',
220
+ 'mg-MG': 'Malagasy',
221
+ 'mk-MK': 'Македонски',
222
+ 'ml-IN': 'മലയാളം',
223
+ 'mn-MN': 'Монгол',
224
+ 'mr-IN': 'मराठी',
225
+ 'ms-MY': 'Bahasa Melayu',
226
+ 'mt-MT': 'Malti',
227
+ 'my-MM': 'မြန်မာဘာသာ',
228
+ 'nb-NO': 'Norsk (bokmål)',
229
+ 'ne-NP': 'नेपाली',
230
+ 'nl-BE': 'Vlaams',
231
+ 'nl-NL': 'Nederlands',
232
+ 'nn-NO': 'Norsk (nynorsk)',
233
+ 'or-IN': 'ଓଡ଼ିଆ',
234
+ 'pa-IN': 'ਪੰਜਾਬੀ',
235
+ 'pl-PL': 'Polski',
236
+ 'ps-AF': 'پښتو',
237
+ pt: 'português',
238
+ 'pt-BR': 'Português (Brasil)',
239
+ 'pt-PT': 'português (Portugal)',
240
+ 'ro-RO': 'Română',
241
+ ru: 'Русский',
242
+ 'ru-RU': 'Русский',
243
+ 'rw-RW': 'Ikinyarwanda',
244
+ 'sc-IT': 'Sardu',
245
+ 'si-LK': 'සිංහල',
246
+ 'sk-SK': 'Slovenčina',
247
+ 'sl-SI': 'Slovenščina',
248
+ 'sn-ZW': 'Shona',
249
+ 'sq-AL': 'Shqip',
250
+ 'sr-RS': 'Српски',
251
+ 'sv-SE': 'Svenska',
252
+ 'sw-KE': 'Kiswahili',
253
+ 'sy-SY': 'ܣܘܪܝܝܐ',
254
+ 'sz-PL': 'ślōnskŏ gŏdka',
255
+ 'ta-IN': 'தமிழ்',
256
+ 'te-IN': 'తెలుగు',
257
+ 'tg-TJ': 'Тоҷикӣ',
258
+ 'th-TH': 'ภาษาไทย',
259
+ 'tl-PH': 'Filipino',
260
+ tr: 'Türkçe',
261
+ 'tr-TR': 'Türkçe',
262
+ 'tt-RU': 'Татарча',
263
+ 'tz-MA': 'ⵜⴰⵎⴰⵣⵉⵖⵜ',
264
+ 'uk-UA': 'Українська',
265
+ 'ur-PK': 'اردو',
266
+ 'uz-UZ': "O'zbek",
267
+ 'vi-VN': 'Tiếng Việt',
268
+ zh: '中文',
269
+ 'zh-CN': '简体中文',
270
+ 'zh-HK': '繁體中文(香港)',
271
+ 'zh-MO': '繁體中文(澳門)',
272
+ 'zh-TW': '繁體中文(台灣)',
273
+ 'zz-TR': 'Zaza',
274
+ });
275
+
276
+
277
+ /***/ }),
278
+
279
+ /***/ 7266:
280
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
281
+
282
+ "use strict";
283
+
284
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
285
+ if (k2 === undefined) k2 = k;
286
+ var desc = Object.getOwnPropertyDescriptor(m, k);
287
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
288
+ desc = { enumerable: true, get: function() { return m[k]; } };
289
+ }
290
+ Object.defineProperty(o, k2, desc);
291
+ }) : (function(o, m, k, k2) {
292
+ if (k2 === undefined) k2 = k;
293
+ o[k2] = m[k];
294
+ }));
295
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
296
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
297
+ };
298
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
299
+ __exportStar(__nccwpck_require__(6921), exports);
300
+ __exportStar(__nccwpck_require__(9962), exports);
301
+ __exportStar(__nccwpck_require__(9715), exports);
302
+
303
+
304
+ /***/ }),
305
+
306
+ /***/ 9962:
307
+ /***/ ((__unused_webpack_module, exports) => {
308
+
309
+ "use strict";
310
+
311
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
312
+
313
+
314
+ /***/ }),
315
+
316
+ /***/ 9715:
317
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
318
+
319
+ "use strict";
320
+
321
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
322
+ exports.languageTagGuard = exports.isLanguageTag = void 0;
323
+ const zod_1 = __nccwpck_require__(8062);
324
+ const const_1 = __nccwpck_require__(6921);
325
+ const isLanguageTag = (value) => typeof value === 'string' && value in const_1.languages;
326
+ exports.isLanguageTag = isLanguageTag;
327
+ exports.languageTagGuard = zod_1.z
328
+ .any()
329
+ .refine((value) => (0, exports.isLanguageTag)(value));
103
330
 
104
331
 
105
332
  /***/ }),
@@ -15263,7 +15490,7 @@ exports.oboolean = oboolean;
15263
15490
 
15264
15491
  Object.defineProperty(exports, "__esModule", ({ value: true }));
15265
15492
  exports.defaultTimeout = exports.defaultMetadata = exports.userInfoEndpoint = exports.accessTokenEndpoint = exports.scope = exports.authorizationEndpoint = void 0;
15266
- const connector_kit_1 = __nccwpck_require__(1743);
15493
+ const connector_kit_1 = __nccwpck_require__(375);
15267
15494
  exports.authorizationEndpoint = 'https://github.com/login/oauth/authorize';
15268
15495
  exports.scope = 'read:user';
15269
15496
  exports.accessTokenEndpoint = 'https://github.com/login/oauth/access_token';
@@ -15324,7 +15551,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
15324
15551
  };
15325
15552
  Object.defineProperty(exports, "__esModule", ({ value: true }));
15326
15553
  exports.getAccessToken = void 0;
15327
- const connector_kit_1 = __nccwpck_require__(1743);
15554
+ const connector_kit_1 = __nccwpck_require__(375);
15328
15555
  const essentials_1 = __nccwpck_require__(8138);
15329
15556
  const got_1 = __importStar(__nccwpck_require__(5569));
15330
15557
  const qs = __importStar(__nccwpck_require__(7348));
@@ -1,4 +1,4 @@
1
- import { ConnectorMetadata } from '@logto/connector-kit';
1
+ import type { ConnectorMetadata } from '@logto/connector-kit';
2
2
  export declare const authorizationEndpoint = "https://github.com/login/oauth/authorize";
3
3
  export declare const scope = "read:user";
4
4
  export declare const accessTokenEndpoint = "https://github.com/login/oauth/access_token";
@@ -1,5 +1,5 @@
1
- import { SocialConnector, CreateConnector } from '@logto/connector-kit';
2
- import { GithubConfig } from './types';
1
+ import type { SocialConnector, CreateConnector } from '@logto/connector-kit';
2
+ import type { GithubConfig } from './types';
3
3
  export declare const getAccessToken: (config: GithubConfig, codeObject: {
4
4
  code: string;
5
5
  }) => Promise<{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/connector-github",
3
- "version": "1.0.0-beta.11",
3
+ "version": "1.0.0-beta.12",
4
4
  "description": "Github web connector implementation.",
5
5
  "main": "./lib/index.js",
6
6
  "exports": "./lib/index.js",
@@ -24,17 +24,17 @@
24
24
  "prepack": "pnpm build"
25
25
  },
26
26
  "dependencies": {
27
- "@logto/connector-kit": "^1.0.0-beta.20",
27
+ "@logto/connector-kit": "^1.0.0-beta.26",
28
28
  "@silverhand/essentials": "^1.2.0",
29
- "@silverhand/jest-config": "1.0.0",
29
+ "@silverhand/jest-config": "1.2.2",
30
30
  "got": "^11.8.2",
31
31
  "query-string": "^7.0.1",
32
32
  "zod": "^3.14.3"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@jest/types": "^28.1.3",
36
- "@silverhand/eslint-config": "1.0.0",
37
- "@silverhand/ts-config": "1.0.0",
36
+ "@silverhand/eslint-config": "1.3.0",
37
+ "@silverhand/ts-config": "1.2.1",
38
38
  "@types/jest": "^28.1.6",
39
39
  "@types/node": "^16.3.1",
40
40
  "@vercel/ncc": "^0.34.0",
@@ -56,5 +56,5 @@
56
56
  "publishConfig": {
57
57
  "access": "public"
58
58
  },
59
- "gitHead": "62c344b3983e465958ff1210cc9e0ea959002510"
59
+ "gitHead": "4644de2adacd83128a38f923df19c5b1767901e0"
60
60
  }