sim 2.2.26 → 2.2.27-preview.302.1
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/dist/generated/v2-api.d.ts +1 -1
- package/dist/index.js +7 -2
- package/dist/runtime.js +7 -2
- package/package.json +1 -1
|
@@ -13165,7 +13165,7 @@ export declare const V2_OPERATIONS: {
|
|
|
13165
13165
|
};
|
|
13166
13166
|
readonly credentialId: {
|
|
13167
13167
|
readonly kind: 'string';
|
|
13168
|
-
readonly describe: 'OAuth credential identifier for connector types whose `auth.mode` is `oauth` (see connector types), or
|
|
13168
|
+
readonly describe: 'OAuth credential identifier for connector types whose `auth.mode` is `oauth` (see connector types), or a saved credential for an `apiKey` connector type that declares `auth.savedCredential` (such as Amazon S3 with a saved AWS credential); otherwise omit it for `apiKey` connectors.';
|
|
13169
13169
|
};
|
|
13170
13170
|
readonly apiKey: {
|
|
13171
13171
|
readonly kind: 'string';
|
package/dist/index.js
CHANGED
|
@@ -10474,7 +10474,7 @@ var V2_OPERATIONS = {
|
|
|
10474
10474
|
connectorType: { kind: "string", required: true, describe: "Registered connector type." },
|
|
10475
10475
|
credentialId: {
|
|
10476
10476
|
kind: "string",
|
|
10477
|
-
describe: "OAuth credential identifier for connector types whose `auth.mode` is `oauth` (see connector types), or
|
|
10477
|
+
describe: "OAuth credential identifier for connector types whose `auth.mode` is `oauth` (see connector types), or a saved credential for an `apiKey` connector type that declares `auth.savedCredential` (such as Amazon S3 with a saved AWS credential); otherwise omit it for `apiKey` connectors."
|
|
10478
10478
|
},
|
|
10479
10479
|
apiKey: {
|
|
10480
10480
|
kind: "string",
|
|
@@ -23351,12 +23351,17 @@ async function credentialValues(provider, raw) {
|
|
|
23351
23351
|
return values;
|
|
23352
23352
|
}
|
|
23353
23353
|
const authMethod = typeof values.authMethod === "string" ? values.authMethod : undefined;
|
|
23354
|
-
const missing = provider.fields.filter((field) => field
|
|
23354
|
+
const missing = provider.fields.filter((field) => isFieldRequired(field, authMethod)).filter((field) => values[field.id] === undefined).map((field) => field.id);
|
|
23355
23355
|
if (missing.length > 0) {
|
|
23356
23356
|
throw new SimApiError(`--credentials is missing required fields for ${provider.providerId}: ${missing.join(", ")}.`, 0);
|
|
23357
23357
|
}
|
|
23358
23358
|
return values;
|
|
23359
23359
|
}
|
|
23360
|
+
function isFieldRequired(field, authMethod) {
|
|
23361
|
+
if (authMethod === undefined || !field.requiredForAuthMethods)
|
|
23362
|
+
return field.required;
|
|
23363
|
+
return field.requiredForAuthMethods.includes(authMethod);
|
|
23364
|
+
}
|
|
23360
23365
|
function offersConfigurationAlternative(provider) {
|
|
23361
23366
|
return provider.fields.some((field) => field.id === "serviceAccountJson" && !field.required);
|
|
23362
23367
|
}
|
package/dist/runtime.js
CHANGED
|
@@ -10523,7 +10523,7 @@ var V2_OPERATIONS = {
|
|
|
10523
10523
|
connectorType: { kind: "string", required: true, describe: "Registered connector type." },
|
|
10524
10524
|
credentialId: {
|
|
10525
10525
|
kind: "string",
|
|
10526
|
-
describe: "OAuth credential identifier for connector types whose `auth.mode` is `oauth` (see connector types), or
|
|
10526
|
+
describe: "OAuth credential identifier for connector types whose `auth.mode` is `oauth` (see connector types), or a saved credential for an `apiKey` connector type that declares `auth.savedCredential` (such as Amazon S3 with a saved AWS credential); otherwise omit it for `apiKey` connectors."
|
|
10527
10527
|
},
|
|
10528
10528
|
apiKey: {
|
|
10529
10529
|
kind: "string",
|
|
@@ -23400,12 +23400,17 @@ async function credentialValues(provider, raw) {
|
|
|
23400
23400
|
return values;
|
|
23401
23401
|
}
|
|
23402
23402
|
const authMethod = typeof values.authMethod === "string" ? values.authMethod : undefined;
|
|
23403
|
-
const missing = provider.fields.filter((field) => field
|
|
23403
|
+
const missing = provider.fields.filter((field) => isFieldRequired(field, authMethod)).filter((field) => values[field.id] === undefined).map((field) => field.id);
|
|
23404
23404
|
if (missing.length > 0) {
|
|
23405
23405
|
throw new SimApiError(`--credentials is missing required fields for ${provider.providerId}: ${missing.join(", ")}.`, 0);
|
|
23406
23406
|
}
|
|
23407
23407
|
return values;
|
|
23408
23408
|
}
|
|
23409
|
+
function isFieldRequired(field, authMethod) {
|
|
23410
|
+
if (authMethod === undefined || !field.requiredForAuthMethods)
|
|
23411
|
+
return field.required;
|
|
23412
|
+
return field.requiredForAuthMethods.includes(authMethod);
|
|
23413
|
+
}
|
|
23409
23414
|
function offersConfigurationAlternative(provider) {
|
|
23410
23415
|
return provider.fields.some((field) => field.id === "serviceAccountJson" && !field.required);
|
|
23411
23416
|
}
|