@takeshape/schema 8.32.0 → 8.33.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.
Files changed (68) hide show
  1. package/es/migration-utils.js +186 -0
  2. package/es/migration.js +105 -4
  3. package/es/mocks.js +1 -0
  4. package/es/project-schema/index.js +1 -0
  5. package/es/project-schema/v3.11.0.js +1 -0
  6. package/es/schemas/index.js +4 -3
  7. package/es/schemas/index.ts +4 -2
  8. package/es/schemas/project-schema/v3.11.0.json +2135 -0
  9. package/es/services.js +57 -255
  10. package/es/types/types.js +9 -0
  11. package/es/types/utils.js +19 -12
  12. package/examples/latest/blog-schema.json +2 -1
  13. package/examples/latest/brewery-schema.json +2 -1
  14. package/examples/latest/complex-project-schema.json +2 -1
  15. package/examples/latest/fabric-ecommerce.json +2 -2
  16. package/examples/latest/frank-and-fred-schema.json +2 -1
  17. package/examples/latest/massive-schema.json +2 -1
  18. package/examples/latest/mill-components-schema.json +2 -1
  19. package/examples/latest/pet-oneof-array.json +2 -1
  20. package/examples/latest/post-schema.json +2 -1
  21. package/examples/latest/pruned-shopify-product-schema.json +2 -2
  22. package/examples/latest/real-world-schema.json +2 -1
  23. package/examples/latest/recursive-repeater-schema.json +2 -1
  24. package/examples/latest/recursive-schema.json +2 -1
  25. package/examples/latest/rick-and-morty-ast.json +1 -1
  26. package/examples/latest/rick-and-morty-graphql.json +1 -1
  27. package/examples/latest/rick-and-morty-rest.json +1 -1
  28. package/examples/latest/schema-with-repeater-draftjs.json +2 -1
  29. package/examples/latest/shape-books-v3_2_0.json +2 -1
  30. package/examples/latest/shape-books.json +2 -1
  31. package/examples/latest/shopify-lookbook.json +1 -1
  32. package/examples/latest/shopify-store-with-widget.json +2 -2
  33. package/examples/latest/stripe-starter-resolved.json +2 -2
  34. package/examples/latest/user-schema-no-required.json +2 -1
  35. package/examples/latest/user-schema-with-defaults.json +2 -1
  36. package/lib/migration-utils.d.ts +18 -0
  37. package/lib/migration-utils.d.ts.map +1 -0
  38. package/lib/migration-utils.js +203 -0
  39. package/lib/migration.d.ts +3 -3
  40. package/lib/migration.d.ts.map +1 -1
  41. package/lib/migration.js +110 -5
  42. package/lib/mocks.d.ts.map +1 -1
  43. package/lib/mocks.js +1 -0
  44. package/lib/project-schema/index.d.ts +3 -1
  45. package/lib/project-schema/index.d.ts.map +1 -1
  46. package/lib/project-schema/index.js +26 -13
  47. package/lib/project-schema/latest.d.ts +26 -17
  48. package/lib/project-schema/latest.d.ts.map +1 -1
  49. package/lib/project-schema/v3.11.0.d.ts +1211 -0
  50. package/lib/project-schema/v3.11.0.d.ts.map +1 -0
  51. package/lib/project-schema/v3.11.0.js +5 -0
  52. package/lib/schemas/index.d.ts +2051 -2
  53. package/lib/schemas/index.d.ts.map +1 -1
  54. package/lib/schemas/index.js +17 -15
  55. package/lib/schemas/index.ts +4 -2
  56. package/lib/schemas/project-schema/v3.11.0.json +2135 -0
  57. package/lib/services.d.ts +11 -27
  58. package/lib/services.d.ts.map +1 -1
  59. package/lib/services.js +54 -261
  60. package/lib/types/types.d.ts +16 -5
  61. package/lib/types/types.d.ts.map +1 -1
  62. package/lib/types/types.js +9 -0
  63. package/lib/types/utils.d.ts +8 -5
  64. package/lib/types/utils.d.ts.map +1 -1
  65. package/lib/types/utils.js +25 -13
  66. package/lib/validate.d.ts +1 -1
  67. package/lib/validate.d.ts.map +1 -1
  68. package/package.json +4 -4
package/es/services.js CHANGED
@@ -1,33 +1,30 @@
1
- import { isEncryptedServiceConfig, isAnyServiceConfig } from './types/utils';
2
- import { pascalCase, deepClone, mergeWithArrayMerge } from '@takeshape/util';
3
- import projectMetaSchema from './schemas/project-schema/v3.1.0.json';
4
- import { createSchemaValidator } from '@takeshape/json-schema';
5
- import isObject from 'lodash/isObject';
1
+ import { mergeWithArrayMerge } from '@takeshape/util';
2
+ import { createAjv } from '@takeshape/json-schema';
3
+ import { SchemaValidationError } from '@takeshape/errors';
6
4
  import isNull from 'lodash/isNull';
7
- import isString from 'lodash/isString';
8
- import isUndefined from 'lodash/isUndefined';
5
+ import { isEncryptedServiceConfig, isServiceAuthentication } from './types/utils';
9
6
  import { getServiceInfo, SERVICE_OBJECT_PATTERN_NAME } from './schema-util';
10
-
7
+ import { latestSchemaJson } from './schemas';
8
+ import { formatError } from './validate';
11
9
  /**
12
- * `graphql:my-key` `my-key`
10
+ * Decrypt an encrypted authentication JSON string
11
+ * Throws an error if decryption fails
13
12
  */
14
- export function parseV3ServiceStr(service) {
15
- const parts = service.split(':');
16
- return {
17
- provider: parts.length > 1 ? parts[0] : undefined,
18
- id: parts.length > 1 ? parts[1] : parts[0]
19
- };
20
- }
13
+ // eslint-disable-next-line @typescript-eslint/ban-types
14
+
21
15
  /**
22
16
  * Given a `StoredServiceConfig` returns a usable `ServiceConfig` with the
23
17
  * authentication object decrypted.
24
18
  */
25
-
26
19
  export function decryptServiceConfig(decryptFn, storedServiceConfig) {
27
20
  let authentication;
28
21
 
29
22
  if (isEncryptedServiceConfig(storedServiceConfig)) {
30
- authentication = decryptFn(storedServiceConfig.authentication);
23
+ const decrypted = decryptFn(storedServiceConfig.authentication);
24
+
25
+ if (isServiceAuthentication(decrypted)) {
26
+ authentication = decrypted;
27
+ }
31
28
  }
32
29
 
33
30
  return { ...storedServiceConfig,
@@ -44,95 +41,70 @@ export async function decryptServiceMap(decryptFn, storedServiceMap) {
44
41
  return result.set(serviceKey, decryptServiceConfig(decryptFn, serviceConfig));
45
42
  }, new Map());
46
43
  }
47
- /**
48
- * Provides a `ServiceConfig` validator based on the JSON-schema.
49
- */
50
44
 
51
45
  function createServiceConfigValidator() {
46
+ const validator = createAjv();
52
47
  const {
53
- serviceConfig: schema,
48
+ serviceConfig,
54
49
  ...definitions
55
- } = projectMetaSchema.definitions;
56
- const validationSchema = {
57
- $id: '#serviceConfig',
50
+ } = latestSchemaJson.definitions;
51
+ return validator.compile({
52
+ $id: 'ServiceConfig',
58
53
  definitions,
59
- ...schema
60
- };
61
- return createSchemaValidator(validationSchema);
54
+ ...serviceConfig
55
+ });
62
56
  }
57
+
58
+ const serviceConfigValidator = createServiceConfigValidator();
63
59
  /**
64
- * Provides a `ServiceAuthentication` validator. Due to a behavior of `oneOf` and
65
- * the `removeAdditional` setting, where valid properties are being stripped,
66
- * this is validated separate from the overall config. May have something to do with
67
- * JSON Schema's lack of handling for discriminated unions?
60
+ * Validates a `ServiceConfig` validator based on the JSON-schema.
68
61
  */
69
62
 
63
+ export function validateServiceConfig(maybeServiceConfig) {
64
+ var _serviceConfigValidat;
70
65
 
71
- function createServiceAuthenticationValidator() {
72
- const {
73
- serviceAuthentication: schema,
74
- ...definitions
75
- } = projectMetaSchema.definitions;
76
- const validationSchema = {
77
- $id: '#serviceAuthentication',
78
- definitions,
79
- ...schema
80
- };
81
- return createSchemaValidator(validationSchema, [], {
82
- removeAdditional: false
83
- });
84
- }
66
+ if (serviceConfigValidator(maybeServiceConfig)) {
67
+ return maybeServiceConfig;
68
+ }
85
69
 
86
- const serviceConfigValidator = createServiceConfigValidator();
87
- const serviceAuthenticationValidator = createServiceAuthenticationValidator();
70
+ throw new SchemaValidationError('ServiceConfig was invalid', (_serviceConfigValidat = serviceConfigValidator.errors) === null || _serviceConfigValidat === void 0 ? void 0 : _serviceConfigValidat.map(formatError));
71
+ }
88
72
  /**
89
73
  * Prepare a `ServiceConfig` object update, validating the overall structure
90
74
  * and encrypting the `ServiceAuthentication` object.
91
75
  */
92
76
  // eslint-disable-next-line max-params
93
77
 
94
- export function prepareServiceUpdate(encryptFn, decryptFn, projectSchema, partialServiceConfig, serviceKey) {
95
- var _projectSchema$servic;
96
-
97
- const storedServiceConfig = (_projectSchema$servic = projectSchema.services) === null || _projectSchema$servic === void 0 ? void 0 : _projectSchema$servic[serviceKey];
98
- let newServiceConfig = partialServiceConfig;
78
+ export function prepareServiceUpdate(encryptFn, decryptFn, projectSchema, serviceConfigUpdate, serviceKey) {
79
+ const storedServiceConfig = getStoredServiceConfig(projectSchema, serviceKey);
80
+ let newServiceConfig = serviceConfigUpdate;
99
81
 
100
82
  if (storedServiceConfig) {
101
83
  const existingServiceConfig = decryptServiceConfig(decryptFn, storedServiceConfig);
102
- newServiceConfig = mergeWithArrayMerge(existingServiceConfig, partialServiceConfig);
103
- }
104
-
105
- if (isNull(newServiceConfig.authentication)) {
106
- delete newServiceConfig.authentication;
107
- }
108
-
109
- let authentication;
110
-
111
- if (newServiceConfig.authentication) {
112
- // Copy authentication, to ensure validation doesn't remove any properties
113
- authentication = deepClone(newServiceConfig.authentication);
114
- const {
115
- errorsText: authenticationErrors
116
- } = serviceAuthenticationValidator(authentication);
117
-
118
- if (authenticationErrors) {
119
- throw new Error(authenticationErrors);
120
- }
84
+ newServiceConfig = mergeWithArrayMerge(existingServiceConfig, serviceConfigUpdate);
121
85
  }
122
86
 
123
87
  const {
124
- errorsText: configErrors
125
- } = serviceConfigValidator(newServiceConfig);
88
+ authentication,
89
+ authenticationType
90
+ } = newServiceConfig;
126
91
 
127
- if (configErrors) {
128
- throw new Error(configErrors);
92
+ if (authenticationType === 'none' || isNull(authentication)) {
93
+ delete newServiceConfig.authentication;
94
+ } else if (authentication !== undefined) {
95
+ // Add the discriminator to the authentication object, set authenticationType
96
+ // to ensure the update is correct for the auth type.
97
+ newServiceConfig.authentication = { ...authentication,
98
+ type: authenticationType
99
+ };
129
100
  }
130
101
 
102
+ validateServiceConfig(newServiceConfig);
131
103
  let serviceConfig;
132
104
 
133
- if (authentication) {
105
+ if (newServiceConfig.authentication) {
134
106
  serviceConfig = { ...newServiceConfig,
135
- authentication: encryptFn(authentication)
107
+ authentication: encryptFn(newServiceConfig.authentication)
136
108
  };
137
109
  } else {
138
110
  serviceConfig = newServiceConfig;
@@ -145,191 +117,21 @@ export function prepareServiceUpdate(encryptFn, decryptFn, projectSchema, partia
145
117
  */
146
118
 
147
119
  export function getStoredServiceConfig(projectSchema, serviceKey) {
148
- var _projectSchema$servic2;
149
-
150
- return (_projectSchema$servic2 = projectSchema.services) === null || _projectSchema$servic2 === void 0 ? void 0 : _projectSchema$servic2[serviceKey];
151
- }
152
- /**
153
- * Migration-related Functions
154
- *
155
- * All the following code is used in the migration process. At some point
156
- * migraton code should live outside the standard runtime code.
157
- */
158
-
159
- /**
160
- * Ensures a consistent service config, inluding updating the service
161
- * authentication object.
162
- */
163
- // eslint-disable-next-line complexity
164
-
165
- export function updateServiceConfigV3ToV3_1(serviceConfig, serviceKey) {
166
- if (isAnyServiceConfig(serviceConfig)) {
167
- if (isString(serviceConfig.authentication) || isUndefined(serviceConfig.authentication)) {
168
- return serviceConfig;
169
- }
170
-
171
- return serviceConfig;
172
- }
173
-
174
- const {
175
- auth
176
- } = serviceConfig;
177
- const serviceParams = serviceConfig.params || {};
178
- let {
179
- provider: serviceKeyProvider,
180
- id: serviceKeyId
181
- } = parseV3ServiceStr(serviceKey);
182
- const authType = serviceParams.authType || undefined;
183
- const title = serviceParams.name || serviceKeyId;
184
-
185
- if (serviceKeyId === 'vercel') {
186
- serviceKeyProvider = 'vercel';
187
- } else if (serviceKeyId === 'netlify') {
188
- serviceKeyProvider = 'netlify';
189
- } // Example schemas had this in params, which are untyped, so adding here just in case
190
-
191
-
192
- if (serviceParams.type === 'rest') {
193
- serviceKeyProvider = 'rest';
194
- } else if (serviceParams.type === 'graphql' && serviceKeyProvider !== 'shopify') {
195
- serviceKeyProvider = 'graphql';
196
- }
197
-
198
- let provider;
199
- let authenticationType;
200
- let serviceType;
201
- let namespace;
202
-
203
- if (serviceKeyProvider === 'shopify') {
204
- provider = 'shopify';
205
- authenticationType = 'oauth2Bearer';
206
- serviceType = 'graphql';
207
- namespace = serviceParams.namespace ?? 'Shopify';
208
- } else if (serviceKeyProvider === 'takeshape') {
209
- provider = 'takeshape';
210
- authenticationType = 'none';
211
- serviceType = 'takeshape';
212
- namespace = serviceParams.namespace ?? 'TakeShape';
213
- } else if (serviceKeyProvider === 'bigcommerce') {
214
- provider = 'bigcommerce';
215
- authenticationType = 'bearer';
216
- serviceType = 'graphql';
217
- namespace = serviceParams.namespace ?? 'BigCommerce';
218
- } else if (serviceKeyProvider === 'rest') {
219
- provider = 'generic';
220
- authenticationType = mapAuthType(authType, auth);
221
- serviceType = 'rest';
222
- namespace = serviceParams.namespace ?? pascalCase(title);
223
- } else if (serviceKeyProvider === 'graphql') {
224
- provider = 'generic';
225
- authenticationType = mapAuthType(authType, auth);
226
- serviceType = 'graphql';
227
- namespace = serviceParams.namespace ?? pascalCase(title);
228
- } else if (serviceKeyProvider === 'vercel') {
229
- provider = 'vercel';
230
- authenticationType = 'oauth2Bearer';
231
- serviceType = 'deployment';
232
- } else if (serviceKeyProvider === 'netlify') {
233
- provider = 'netlify';
234
- authenticationType = 'oauth2Bearer';
235
- serviceType = 'deployment';
236
- } else {
237
- provider = 'generic';
238
- authenticationType = mapAuthType(authType, auth);
239
- serviceType = 'unknown';
240
- namespace = serviceParams.namespace ?? pascalCase(title);
241
- }
242
-
243
- const updatedServiceConfig = {
244
- title,
245
- id: serviceKey,
246
- provider,
247
- namespace,
248
- serviceType,
249
- authenticationType,
250
- options: { ...serviceParams
251
- }
252
- };
253
-
254
- if (serviceConfig.auth && isObject(serviceConfig.auth)) {
255
- const authentication = updateServiceAuthentication(updatedServiceConfig.authenticationType, serviceConfig.auth, serviceParams);
256
- return { ...updatedServiceConfig,
257
- authentication
258
- };
259
- }
260
-
261
- return updatedServiceConfig;
262
- }
263
- /**
264
- * V1/V3 unencrypted `auth` -> V3.1 `authentication
265
- */
266
-
267
- function updateServiceAuthentication(authenticationType, legacyAuth, legacyParams) {
268
- if (authenticationType === 'oauth2Bearer') {
269
- return {
270
- token: legacyAuth.accessToken,
271
- scope: legacyAuth.scope,
272
- header: legacyParams.authHeader
273
- };
274
- }
275
-
276
- if (authenticationType === 'searchParams' && legacyParams.authProp) {
277
- return [{
278
- name: legacyParams.authProp,
279
- value: legacyAuth.accessToken
280
- }];
281
- }
282
-
283
- if (authenticationType === 'basic') {
284
- const [username, password] = Buffer.from(legacyAuth.accessToken, 'base64').toString('utf-8').split(':');
285
- return {
286
- username,
287
- password
288
- };
289
- }
290
-
291
- if (authenticationType === 'bearer') {
292
- return {
293
- token: legacyAuth.accessToken,
294
- header: legacyParams.authHeader
295
- };
296
- }
297
- }
298
-
299
- function mapAuthType(authType, auth) {
300
- if (authType === 'none') {
301
- return 'none';
302
- }
303
-
304
- if (authType === 'searchParams') {
305
- return 'searchParams';
306
- }
307
-
308
- if (authType === 'bearer') {
309
- return 'bearer';
310
- }
311
-
312
- if (authType === 'bearer') {
313
- return 'basic';
314
- }
315
-
316
- if (!auth) {
317
- return 'none';
318
- }
319
-
320
- if (auth) {
321
- return 'bearer';
322
- }
120
+ var _projectSchema$servic;
323
121
 
324
- return 'unknown';
122
+ return (_projectSchema$servic = projectSchema.services) === null || _projectSchema$servic === void 0 ? void 0 : _projectSchema$servic[serviceKey];
325
123
  }
326
-
327
124
  export function getServiceNamespace(serviceConfig) {
328
125
  var _serviceConfig$params;
329
126
 
330
127
  if ('namespace' in serviceConfig && serviceConfig.namespace) {
331
128
  return serviceConfig.namespace;
332
129
  }
130
+ /**
131
+ * TODO This is only necessary if this fn gets called on a schema before migration.
132
+ * Figure that out and remove if possible.
133
+ **/
134
+
333
135
 
334
136
  if ('params' in serviceConfig && (_serviceConfig$params = serviceConfig.params) !== null && _serviceConfig$params !== void 0 && _serviceConfig$params.namespace) {
335
137
  return serviceConfig.params.namespace;
package/es/types/types.js CHANGED
@@ -13,6 +13,15 @@
13
13
  * @deprecated
14
14
  */
15
15
 
16
+ /**
17
+ * Support null sentinels for authentication
18
+ */
19
+
20
+ /**
21
+ * A type suitable for service object updates, mostly concerns authentication
22
+ * requirements.
23
+ */
24
+
16
25
  /**
17
26
  * Types of refs
18
27
  */
package/es/types/utils.js CHANGED
@@ -68,6 +68,7 @@ export const isProjectSchemaV3_7 = createVersionPredicate('3.7.0');
68
68
  export const isProjectSchemaV3_8 = createVersionPredicate('3.8.0');
69
69
  export const isProjectSchemaV3_9 = createVersionPredicate('3.9.0');
70
70
  export const isProjectSchemaV3_10 = createVersionPredicate('3.10.0');
71
+ export const isProjectSchemaV3_11 = createVersionPredicate('3.11.0');
71
72
  export const isLatestProjectSchema = createVersionPredicate(CURRENT_SCHEMA_VERSION);
72
73
  export function isV3XSchema(maybeSchema) {
73
74
  if (!isObject(maybeSchema) || !isString(maybeSchema.projectId) || !isString(maybeSchema.schemaVersion)) {
@@ -87,7 +88,7 @@ export function isAnyProjectSchema(value) {
87
88
  }
88
89
 
89
90
  const maybeSchema = value;
90
- return isObject(value) && isString(maybeSchema.projectId) && (isProjectSchemaV1(maybeSchema) || isProjectSchemaV3(maybeSchema) || isProjectSchemaV3_1(maybeSchema) || isProjectSchemaV3_2(maybeSchema) || isProjectSchemaV3_3(maybeSchema) || isProjectSchemaV3_4(maybeSchema) || isProjectSchemaV3_5(maybeSchema) || isProjectSchemaV3_5_1(maybeSchema) || isProjectSchemaV3_6(maybeSchema) || isProjectSchemaV3_7(maybeSchema) || isProjectSchemaV3_8(maybeSchema) || isProjectSchemaV3_9(maybeSchema) || isProjectSchemaV3_10(maybeSchema));
91
+ return isObject(value) && isString(maybeSchema.projectId) && (isProjectSchemaV1(maybeSchema) || isProjectSchemaV3(maybeSchema) || isProjectSchemaV3_1(maybeSchema) || isProjectSchemaV3_2(maybeSchema) || isProjectSchemaV3_3(maybeSchema) || isProjectSchemaV3_4(maybeSchema) || isProjectSchemaV3_5(maybeSchema) || isProjectSchemaV3_5_1(maybeSchema) || isProjectSchemaV3_6(maybeSchema) || isProjectSchemaV3_7(maybeSchema) || isProjectSchemaV3_8(maybeSchema) || isProjectSchemaV3_9(maybeSchema) || isProjectSchemaV3_10(maybeSchema) || isProjectSchemaV3_11(maybeSchema));
91
92
  }
92
93
  export function isProjectSchemaWithServices(schema) {
93
94
  return typeof schema.dataKey !== 'undefined' && typeof schema.services !== 'undefined';
@@ -239,27 +240,33 @@ export function isEncryptedServiceConfig(maybeConfig) {
239
240
  return isAnyServiceConfig(maybeConfig) && isString(maybeConfig.authentication);
240
241
  }
241
242
  export function isServiceConfigWithOAuth2Authentication(maybeServiceConfig) {
242
- return isAnyServiceConfig(maybeServiceConfig) && maybeServiceConfig.authenticationType === 'oauth2' && isOAuth2Authentication(maybeServiceConfig.authentication);
243
+ return isAnyServiceConfig(maybeServiceConfig) && isServiceAuthentication(maybeServiceConfig.authentication) && isOAuth2Authentication(maybeServiceConfig.authentication);
243
244
  }
244
245
  export function isServiceConfigWithCustomAuthentication(maybeServiceConfig) {
245
- return isAnyServiceConfig(maybeServiceConfig) && maybeServiceConfig.authenticationType === 'custom' && isServiceAuthentication(maybeServiceConfig.authentication);
246
+ return isAnyServiceConfig(maybeServiceConfig) && isServiceAuthentication(maybeServiceConfig.authentication) && isCustomAuthentication(maybeServiceConfig.authentication);
246
247
  }
247
248
  /** Authentication Utils **/
248
249
 
249
250
  export function isServiceAuthentication(maybeAuthentication) {
250
- return maybeAuthentication && isObject(maybeAuthentication);
251
+ return maybeAuthentication === null || maybeAuthentication === void 0 ? void 0 : maybeAuthentication.type;
251
252
  }
252
- export function isBearerAuthentication(maybeAuthentication) {
253
- return isServiceAuthentication(maybeAuthentication) && isString(maybeAuthentication.token);
253
+ export function isBearerAuthentication(authentication) {
254
+ return (authentication === null || authentication === void 0 ? void 0 : authentication.type) === 'bearer';
254
255
  }
255
- export function isBasicAuthentication(maybeAuthentication) {
256
- return isServiceAuthentication(maybeAuthentication) && (isString(maybeAuthentication.username) || isString(maybeAuthentication.password));
256
+ export function isBasicAuthentication(authentication) {
257
+ return (authentication === null || authentication === void 0 ? void 0 : authentication.type) === 'basic';
257
258
  }
258
- export function isSearchParamsAuthentication(maybeAuthentication) {
259
- return isArray(maybeAuthentication) && maybeAuthentication.every(value => isObject(value) && Object.entries(value).every(([k, v]) => (k === 'name' || k === 'value') && isString(v)));
259
+ export function isSearchParamsAuthentication(authentication) {
260
+ return (authentication === null || authentication === void 0 ? void 0 : authentication.type) === 'searchParams';
260
261
  }
261
- export function isOAuth2Authentication(maybeAuthentication) {
262
- return isServiceAuthentication(maybeAuthentication) && isString(maybeAuthentication.clientId);
262
+ export function isOAuth2Authentication(authentication) {
263
+ return (authentication === null || authentication === void 0 ? void 0 : authentication.type) === 'oauth2';
264
+ }
265
+ export function isOAuth2BearerAuthentication(authentication) {
266
+ return (authentication === null || authentication === void 0 ? void 0 : authentication.type) === 'oauth2Bearer';
267
+ }
268
+ export function isCustomAuthentication(authentication) {
269
+ return (authentication === null || authentication === void 0 ? void 0 : authentication.type) === 'custom';
263
270
  }
264
271
  /** Miscellaneous Utils **/
265
272
 
@@ -373,5 +373,6 @@
373
373
  }
374
374
  }
375
375
  },
376
- "schemaVersion": "3.10.0"
376
+ "schemaVersion": "3.11.0",
377
+ "services": {}
377
378
  }
@@ -378,5 +378,6 @@
378
378
  }
379
379
  }
380
380
  },
381
- "schemaVersion": "3.10.0"
381
+ "schemaVersion": "3.11.0",
382
+ "services": {}
382
383
  }
@@ -3892,5 +3892,6 @@
3892
3892
  }
3893
3893
  }
3894
3894
  },
3895
- "schemaVersion": "3.10.0"
3895
+ "schemaVersion": "3.11.0",
3896
+ "services": {}
3896
3897
  }
@@ -119,7 +119,7 @@
119
119
  "provider": "shopify",
120
120
  "serviceType": "graphql",
121
121
  "authenticationType": "oauth2Bearer",
122
- "authentication": "secret",
122
+ "authentication": "abc",
123
123
  "options": {
124
124
  "shop": "michaels-store-takeshape",
125
125
  "endpoint": "https://michaels-store-takeshape.myshopify.com/admin/api/2020-07/graphql.json"
@@ -10516,5 +10516,5 @@
10516
10516
  }
10517
10517
  }
10518
10518
  },
10519
- "schemaVersion": "3.10.0"
10519
+ "schemaVersion": "3.11.0"
10520
10520
  }
@@ -19833,5 +19833,6 @@
19833
19833
  }
19834
19834
  }
19835
19835
  },
19836
- "schemaVersion": "3.10.0"
19836
+ "schemaVersion": "3.11.0",
19837
+ "services": {}
19837
19838
  }
@@ -7021,5 +7021,6 @@
7021
7021
  }
7022
7022
  }
7023
7023
  },
7024
- "schemaVersion": "3.10.0"
7024
+ "schemaVersion": "3.11.0",
7025
+ "services": {}
7025
7026
  }
@@ -1787,5 +1787,6 @@
1787
1787
  }
1788
1788
  }
1789
1789
  },
1790
- "schemaVersion": "3.10.0"
1790
+ "schemaVersion": "3.11.0",
1791
+ "services": {}
1791
1792
  }
@@ -404,5 +404,6 @@
404
404
  }
405
405
  }
406
406
  },
407
- "schemaVersion": "3.10.0"
407
+ "schemaVersion": "3.11.0",
408
+ "services": {}
408
409
  }
@@ -220,5 +220,6 @@
220
220
  }
221
221
  }
222
222
  },
223
- "schemaVersion": "3.10.0"
223
+ "schemaVersion": "3.11.0",
224
+ "services": {}
224
225
  }
@@ -22,7 +22,7 @@
22
22
  "shop": "andrews-takeshape-store",
23
23
  "endpoint": "https://andrews-takeshape-store.myshopify.com/admin/api/2020-07/graphql.json"
24
24
  },
25
- "authentication": "secret"
25
+ "authentication": "abc"
26
26
  }
27
27
  },
28
28
  "dataKey": "secret",
@@ -9760,5 +9760,5 @@
9760
9760
  }
9761
9761
  }
9762
9762
  },
9763
- "schemaVersion": "3.10.0"
9763
+ "schemaVersion": "3.11.0"
9764
9764
  }
@@ -990,5 +990,6 @@
990
990
  }
991
991
  }
992
992
  },
993
- "schemaVersion": "3.10.0"
993
+ "schemaVersion": "3.11.0",
994
+ "services": {}
994
995
  }
@@ -138,5 +138,6 @@
138
138
  }
139
139
  }
140
140
  },
141
- "schemaVersion": "3.10.0"
141
+ "schemaVersion": "3.11.0",
142
+ "services": {}
142
143
  }
@@ -145,5 +145,6 @@
145
145
  }
146
146
  }
147
147
  },
148
- "schemaVersion": "3.10.0"
148
+ "schemaVersion": "3.11.0",
149
+ "services": {}
149
150
  }
@@ -2673,5 +2673,5 @@
2673
2673
  }
2674
2674
  }
2675
2675
  },
2676
- "schemaVersion": "3.10.0"
2676
+ "schemaVersion": "3.11.0"
2677
2677
  }
@@ -2198,5 +2198,5 @@
2198
2198
  }
2199
2199
  }
2200
2200
  },
2201
- "schemaVersion": "3.10.0"
2201
+ "schemaVersion": "3.11.0"
2202
2202
  }
@@ -96,5 +96,5 @@
96
96
  }
97
97
  }
98
98
  },
99
- "schemaVersion": "3.10.0"
99
+ "schemaVersion": "3.11.0"
100
100
  }
@@ -377,5 +377,6 @@
377
377
  }
378
378
  }
379
379
  },
380
- "schemaVersion": "3.10.0"
380
+ "schemaVersion": "3.11.0",
381
+ "services": {}
381
382
  }
@@ -1077,5 +1077,6 @@
1077
1077
  }
1078
1078
  }
1079
1079
  },
1080
- "schemaVersion": "3.10.0"
1080
+ "schemaVersion": "3.11.0",
1081
+ "services": {}
1081
1082
  }
@@ -1037,5 +1037,6 @@
1037
1037
  }
1038
1038
  }
1039
1039
  },
1040
- "schemaVersion": "3.10.0"
1040
+ "schemaVersion": "3.11.0",
1041
+ "services": {}
1041
1042
  }
@@ -1176,5 +1176,5 @@
1176
1176
  }
1177
1177
  }
1178
1178
  },
1179
- "schemaVersion": "3.10.0"
1179
+ "schemaVersion": "3.11.0"
1180
1180
  }
@@ -707,7 +707,7 @@
707
707
  "namespace": "Shopify",
708
708
  "serviceType": "graphql",
709
709
  "authenticationType": "oauth2Bearer",
710
- "authentication": "secret",
710
+ "authentication": "abc",
711
711
  "options": {
712
712
  "type": "graphql",
713
713
  "namespace": "Shopify",
@@ -12534,5 +12534,5 @@
12534
12534
  }
12535
12535
  }
12536
12536
  },
12537
- "schemaVersion": "3.10.0"
12537
+ "schemaVersion": "3.11.0"
12538
12538
  }