@logto/connector-google 1.0.0-beta.10 → 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
- /***/ 9539:
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__(8988);
26
- __exportStar(__nccwpck_require__(8988), 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
- /***/ 8988:
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
  /***/ }),
@@ -14606,7 +14833,7 @@ exports.oboolean = oboolean;
14606
14833
 
14607
14834
  Object.defineProperty(exports, "__esModule", ({ value: true }));
14608
14835
  exports.defaultTimeout = exports.defaultMetadata = exports.scope = exports.userInfoEndpoint = exports.accessTokenEndpoint = exports.authorizationEndpoint = void 0;
14609
- const connector_kit_1 = __nccwpck_require__(9539);
14836
+ const connector_kit_1 = __nccwpck_require__(375);
14610
14837
  exports.authorizationEndpoint = 'https://accounts.google.com/o/oauth2/v2/auth';
14611
14838
  exports.accessTokenEndpoint = 'https://oauth2.googleapis.com/token';
14612
14839
  exports.userInfoEndpoint = 'https://openidconnect.googleapis.com/v1/userinfo';
@@ -14619,7 +14846,7 @@ exports.defaultMetadata = {
14619
14846
  en: 'Google',
14620
14847
  'zh-CN': 'Google',
14621
14848
  'tr-TR': 'Google',
14622
- 'ko-KR': 'Google',
14849
+ ko: 'Google',
14623
14850
  },
14624
14851
  logo: './logo.svg',
14625
14852
  logoDark: null,
@@ -14627,7 +14854,7 @@ exports.defaultMetadata = {
14627
14854
  en: 'Google is a principal search engine technology and email service provider.',
14628
14855
  'zh-CN': 'Google 是全球性的搜索引擎和邮件服务提供商。',
14629
14856
  'tr-TR': 'Google, en büyük arama motoru teknolojisi ve e-posta servis sağlayıcısıdır.',
14630
- 'ko-KR': 'Google은 가장 큰 검색 엔진 기술과 이메일 서비스 제공자입니다.', // UNTRANSLATED
14857
+ ko: 'Google은 가장 큰 검색 엔진 기술과 이메일 서비스 제공자입니다.', // UNTRANSLATED
14631
14858
  },
14632
14859
  readme: './README.md',
14633
14860
  configTemplate: './docs/config-template.json',
@@ -14667,11 +14894,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
14667
14894
  };
14668
14895
  Object.defineProperty(exports, "__esModule", ({ value: true }));
14669
14896
  exports.getAccessToken = void 0;
14670
- /**
14671
- * The Implementation of OpenID Connect of Google Identity Platform.
14672
- * https://developers.google.com/identity/protocols/oauth2/openid-connect
14673
- */
14674
- const connector_kit_1 = __nccwpck_require__(9539);
14897
+ const connector_kit_1 = __nccwpck_require__(375);
14675
14898
  const essentials_1 = __nccwpck_require__(8138);
14676
14899
  const got_1 = __importStar(__nccwpck_require__(5569));
14677
14900
  const constant_1 = __nccwpck_require__(87);
@@ -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://accounts.google.com/o/oauth2/v2/auth";
3
3
  export declare const accessTokenEndpoint = "https://oauth2.googleapis.com/token";
4
4
  export declare const userInfoEndpoint = "https://openidconnect.googleapis.com/v1/userinfo";
@@ -2,8 +2,8 @@
2
2
  * The Implementation of OpenID Connect of Google Identity Platform.
3
3
  * https://developers.google.com/identity/protocols/oauth2/openid-connect
4
4
  */
5
- import { CreateConnector, SocialConnector } from '@logto/connector-kit';
6
- import { GoogleConfig } from './types';
5
+ import type { CreateConnector, SocialConnector } from '@logto/connector-kit';
6
+ import type { GoogleConfig } from './types';
7
7
  export declare const getAccessToken: (config: GoogleConfig, codeObject: {
8
8
  code: string;
9
9
  redirectUri: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/connector-google",
3
- "version": "1.0.0-beta.10",
3
+ "version": "1.0.0-beta.12",
4
4
  "description": "Google web connector implementation.",
5
5
  "main": "./lib/index.js",
6
6
  "exports": "./lib/index.js",
@@ -23,16 +23,16 @@
23
23
  "prepack": "pnpm build"
24
24
  },
25
25
  "dependencies": {
26
- "@logto/connector-kit": "^1.0.0-beta.13",
26
+ "@logto/connector-kit": "^1.0.0-beta.26",
27
27
  "@silverhand/essentials": "^1.2.0",
28
- "@silverhand/jest-config": "1.0.0",
28
+ "@silverhand/jest-config": "1.2.2",
29
29
  "got": "^11.8.2",
30
30
  "zod": "^3.14.3"
31
31
  },
32
32
  "devDependencies": {
33
33
  "@jest/types": "^28.1.3",
34
- "@silverhand/eslint-config": "1.0.0",
35
- "@silverhand/ts-config": "1.0.0",
34
+ "@silverhand/eslint-config": "1.3.0",
35
+ "@silverhand/ts-config": "1.2.1",
36
36
  "@types/jest": "^28.1.6",
37
37
  "@types/node": "^16.3.1",
38
38
  "@vercel/ncc": "^0.34.0",
@@ -54,5 +54,5 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "gitHead": "8995e8586ab2fb00fbb58a1c4d0032d67c30948d"
57
+ "gitHead": "4644de2adacd83128a38f923df19c5b1767901e0"
58
58
  }