@yxw007/translate 0.0.4 → 0.0.6

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.
@@ -1,4 +1,4 @@
1
- // translate v0.0.4 Copyright (c) 2024 Potter<aa4790139@gmail.com> and contributors
1
+ // translate v0.0.6 Copyright (c) 2024 Potter<aa4790139@gmail.com> and contributors
2
2
  import { Buffer as Buffer$1 } from 'buffer';
3
3
  import { Readable, Writable } from 'stream';
4
4
  import { Agent, request as request$1 } from 'http';
@@ -53,7 +53,7 @@ function azure(options) {
53
53
  name: "azure",
54
54
  async translate(text, opts) {
55
55
  const { from, to } = opts;
56
- const url = `${base}&to=${to}${from ? `&from=${from}` : ""}`;
56
+ const url = `${base}&to=${to}${from && from !== "auto" ? `&from=${from}` : ""}`;
57
57
  if (!Array.isArray(text)) {
58
58
  text = [text];
59
59
  }
@@ -66,7 +66,11 @@ function azure(options) {
66
66
  },
67
67
  body: JSON.stringify(text.map((it) => ({ Text: it }))),
68
68
  });
69
- const body = await res.json();
69
+ const bodyRes = await res.json();
70
+ if (bodyRes.error) {
71
+ throw new Error(`Translate fail ! code: ${bodyRes.error.code}, message: ${bodyRes.error.message}`);
72
+ }
73
+ const body = bodyRes;
70
74
  if (!body || body.length === 0) {
71
75
  throw new Error("Translate fail ! translate's result is null or empty");
72
76
  }
@@ -340,6 +344,56 @@ function resolveUserAgentConfig(input) {
340
344
  };
341
345
  }
342
346
 
347
+ class EndpointCache {
348
+ constructor({ size, params }) {
349
+ this.data = new Map();
350
+ this.parameters = [];
351
+ this.capacity = size ?? 50;
352
+ if (params) {
353
+ this.parameters = params;
354
+ }
355
+ }
356
+ get(endpointParams, resolver) {
357
+ const key = this.hash(endpointParams);
358
+ if (key === false) {
359
+ return resolver();
360
+ }
361
+ if (!this.data.has(key)) {
362
+ if (this.data.size > this.capacity + 10) {
363
+ const keys = this.data.keys();
364
+ let i = 0;
365
+ while (true) {
366
+ const { value, done } = keys.next();
367
+ this.data.delete(value);
368
+ if (done || ++i > 10) {
369
+ break;
370
+ }
371
+ }
372
+ }
373
+ this.data.set(key, resolver());
374
+ }
375
+ return this.data.get(key);
376
+ }
377
+ size() {
378
+ return this.data.size;
379
+ }
380
+ hash(endpointParams) {
381
+ let buffer = "";
382
+ const { parameters } = this;
383
+ if (parameters.length === 0) {
384
+ return false;
385
+ }
386
+ for (const param of parameters) {
387
+ const val = String(endpointParams[param] ?? "");
388
+ if (val.includes("|;")) {
389
+ return false;
390
+ }
391
+ buffer += val + "|;";
392
+ }
393
+ return buffer;
394
+ }
395
+ }
396
+
343
397
  const IP_V4_REGEX = new RegExp(`^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$`);
344
398
  const isIpAddress = (value) => IP_V4_REGEX.test(value) || (value.startsWith("[") && value.endsWith("]"));
345
399
 
@@ -7221,7 +7275,7 @@ const commonParams$3 = {
7221
7275
 
7222
7276
  var name$3 = "@aws-sdk/client-translate";
7223
7277
  var description$3 = "AWS SDK for JavaScript Translate Client for Node.js, Browser and React Native";
7224
- var version$3 = "3.645.0";
7278
+ var version$3 = "3.651.1";
7225
7279
  var scripts$3 = {
7226
7280
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7227
7281
  "build:cjs": "node ../../scripts/compilation/inline client-translate",
@@ -7240,43 +7294,43 @@ var sideEffects$3 = false;
7240
7294
  var dependencies$3 = {
7241
7295
  "@aws-crypto/sha256-browser": "5.2.0",
7242
7296
  "@aws-crypto/sha256-js": "5.2.0",
7243
- "@aws-sdk/client-sso-oidc": "3.645.0",
7244
- "@aws-sdk/client-sts": "3.645.0",
7245
- "@aws-sdk/core": "3.635.0",
7246
- "@aws-sdk/credential-provider-node": "3.645.0",
7247
- "@aws-sdk/middleware-host-header": "3.620.0",
7248
- "@aws-sdk/middleware-logger": "3.609.0",
7249
- "@aws-sdk/middleware-recursion-detection": "3.620.0",
7250
- "@aws-sdk/middleware-user-agent": "3.645.0",
7251
- "@aws-sdk/region-config-resolver": "3.614.0",
7252
- "@aws-sdk/types": "3.609.0",
7253
- "@aws-sdk/util-endpoints": "3.645.0",
7254
- "@aws-sdk/util-user-agent-browser": "3.609.0",
7255
- "@aws-sdk/util-user-agent-node": "3.614.0",
7256
- "@smithy/config-resolver": "^3.0.5",
7257
- "@smithy/core": "^2.4.0",
7258
- "@smithy/fetch-http-handler": "^3.2.4",
7259
- "@smithy/hash-node": "^3.0.3",
7260
- "@smithy/invalid-dependency": "^3.0.3",
7261
- "@smithy/middleware-content-length": "^3.0.5",
7262
- "@smithy/middleware-endpoint": "^3.1.0",
7263
- "@smithy/middleware-retry": "^3.0.15",
7264
- "@smithy/middleware-serde": "^3.0.3",
7265
- "@smithy/middleware-stack": "^3.0.3",
7266
- "@smithy/node-config-provider": "^3.1.4",
7267
- "@smithy/node-http-handler": "^3.1.4",
7268
- "@smithy/protocol-http": "^4.1.0",
7269
- "@smithy/smithy-client": "^3.2.0",
7270
- "@smithy/types": "^3.3.0",
7271
- "@smithy/url-parser": "^3.0.3",
7297
+ "@aws-sdk/client-sso-oidc": "3.651.1",
7298
+ "@aws-sdk/client-sts": "3.651.1",
7299
+ "@aws-sdk/core": "3.651.1",
7300
+ "@aws-sdk/credential-provider-node": "3.651.1",
7301
+ "@aws-sdk/middleware-host-header": "3.649.0",
7302
+ "@aws-sdk/middleware-logger": "3.649.0",
7303
+ "@aws-sdk/middleware-recursion-detection": "3.649.0",
7304
+ "@aws-sdk/middleware-user-agent": "3.649.0",
7305
+ "@aws-sdk/region-config-resolver": "3.649.0",
7306
+ "@aws-sdk/types": "3.649.0",
7307
+ "@aws-sdk/util-endpoints": "3.649.0",
7308
+ "@aws-sdk/util-user-agent-browser": "3.649.0",
7309
+ "@aws-sdk/util-user-agent-node": "3.649.0",
7310
+ "@smithy/config-resolver": "^3.0.6",
7311
+ "@smithy/core": "^2.4.1",
7312
+ "@smithy/fetch-http-handler": "^3.2.5",
7313
+ "@smithy/hash-node": "^3.0.4",
7314
+ "@smithy/invalid-dependency": "^3.0.4",
7315
+ "@smithy/middleware-content-length": "^3.0.6",
7316
+ "@smithy/middleware-endpoint": "^3.1.1",
7317
+ "@smithy/middleware-retry": "^3.0.16",
7318
+ "@smithy/middleware-serde": "^3.0.4",
7319
+ "@smithy/middleware-stack": "^3.0.4",
7320
+ "@smithy/node-config-provider": "^3.1.5",
7321
+ "@smithy/node-http-handler": "^3.2.0",
7322
+ "@smithy/protocol-http": "^4.1.1",
7323
+ "@smithy/smithy-client": "^3.3.0",
7324
+ "@smithy/types": "^3.4.0",
7325
+ "@smithy/url-parser": "^3.0.4",
7272
7326
  "@smithy/util-base64": "^3.0.0",
7273
7327
  "@smithy/util-body-length-browser": "^3.0.0",
7274
7328
  "@smithy/util-body-length-node": "^3.0.0",
7275
- "@smithy/util-defaults-mode-browser": "^3.0.15",
7276
- "@smithy/util-defaults-mode-node": "^3.0.15",
7277
- "@smithy/util-endpoints": "^2.0.5",
7278
- "@smithy/util-middleware": "^3.0.3",
7279
- "@smithy/util-retry": "^3.0.3",
7329
+ "@smithy/util-defaults-mode-browser": "^3.0.16",
7330
+ "@smithy/util-defaults-mode-node": "^3.0.16",
7331
+ "@smithy/util-endpoints": "^2.1.0",
7332
+ "@smithy/util-middleware": "^3.0.4",
7333
+ "@smithy/util-retry": "^3.0.4",
7280
7334
  "@smithy/util-utf8": "^3.0.0",
7281
7335
  tslib: "^2.6.2",
7282
7336
  uuid: "^9.0.1"
@@ -7555,11 +7609,15 @@ const a$3 = true, b$3 = "isSet", c$3 = "booleanEquals", d$3 = "error", e$3 = "en
7555
7609
  const _data$3 = { version: "1.0", parameters: { Region: h$3, UseDualStack: i$3, UseFIPS: i$3, Endpoint: h$3 }, rules: [{ conditions: [{ [t$3]: b$3, [u$3]: [j$3] }], rules: [{ conditions: p$3, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d$3 }, { conditions: q$3, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d$3 }, { endpoint: { url: j$3, properties: m$3, headers: m$3 }, type: e$3 }], type: f$3 }, { conditions: [{ [t$3]: b$3, [u$3]: r$3 }], rules: [{ conditions: [{ [t$3]: "aws.partition", [u$3]: r$3, assign: g$3 }], rules: [{ conditions: [k$3, l$3], rules: [{ conditions: [{ [t$3]: c$3, [u$3]: [a$3, n$3] }, o$3], rules: [{ endpoint: { url: "https://translate-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m$3, headers: m$3 }, type: e$3 }], type: f$3 }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d$3 }], type: f$3 }, { conditions: p$3, rules: [{ conditions: [{ [t$3]: c$3, [u$3]: [n$3, a$3] }], rules: [{ endpoint: { url: "https://translate-fips.{Region}.{PartitionResult#dnsSuffix}", properties: m$3, headers: m$3 }, type: e$3 }], type: f$3 }, { error: "FIPS is enabled but this partition does not support FIPS", type: d$3 }], type: f$3 }, { conditions: q$3, rules: [{ conditions: [o$3], rules: [{ endpoint: { url: "https://translate.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: m$3, headers: m$3 }, type: e$3 }], type: f$3 }, { error: "DualStack is enabled but this partition does not support DualStack", type: d$3 }], type: f$3 }, { endpoint: { url: "https://translate.{Region}.{PartitionResult#dnsSuffix}", properties: m$3, headers: m$3 }, type: e$3 }], type: f$3 }], type: f$3 }, { error: "Invalid Configuration: Missing Region", type: d$3 }] };
7556
7610
  const ruleSet$3 = _data$3;
7557
7611
 
7612
+ const cache$4 = new EndpointCache({
7613
+ size: 50,
7614
+ params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"],
7615
+ });
7558
7616
  const defaultEndpointResolver$3 = (endpointParams, context = {}) => {
7559
- return resolveEndpoint(ruleSet$3, {
7617
+ return cache$4.get(endpointParams, () => resolveEndpoint(ruleSet$3, {
7560
7618
  endpointParams: endpointParams,
7561
7619
  logger: context.logger,
7562
- });
7620
+ }));
7563
7621
  };
7564
7622
  customEndpointFunctions.aws = awsEndpointFunctions;
7565
7623
 
@@ -8252,9 +8310,7 @@ function sharedHeaders(operation) {
8252
8310
 
8253
8311
  class TranslateTextCommand extends Command
8254
8312
  .classBuilder()
8255
- .ep({
8256
- ...commonParams$3,
8257
- })
8313
+ .ep(commonParams$3)
8258
8314
  .m(function (Command, cs, config, o) {
8259
8315
  return [
8260
8316
  getSerdePlugin(config, this.serialize, this.deserialize),
@@ -9615,13 +9671,255 @@ var iso = {
9615
9671
  zul: "zu",
9616
9672
  };
9617
9673
 
9618
- const isoKeys = Object.values(iso).sort();
9619
- function language(name) {
9674
+ var languageNames = {
9675
+ afar: "aa",
9676
+ abkhazian: "ab",
9677
+ afrikaans: "af",
9678
+ akan: "ak",
9679
+ albanian: "sq",
9680
+ amharic: "am",
9681
+ arabic: "ar",
9682
+ aragonese: "an",
9683
+ armenian: "hy",
9684
+ assamese: "as",
9685
+ avaric: "av",
9686
+ avestan: "ae",
9687
+ aymara: "ay",
9688
+ azerbaijani: "az",
9689
+ bashkir: "ba",
9690
+ bambara: "bm",
9691
+ basque: "eu",
9692
+ belarusian: "be",
9693
+ bengali: "bn",
9694
+ "bihari languages": "bh",
9695
+ bislama: "bi",
9696
+ tibetan: "bo",
9697
+ bosnian: "bs",
9698
+ breton: "br",
9699
+ bulgarian: "bg",
9700
+ burmese: "my",
9701
+ catalan: "ca",
9702
+ valencian: "ca",
9703
+ czech: "cs",
9704
+ chamorro: "ch",
9705
+ chechen: "ce",
9706
+ chinese: "zh",
9707
+ "church slavic": "cu",
9708
+ "old slavonic": "cu",
9709
+ "church slavonic": "cu",
9710
+ "old bulgarian": "cu",
9711
+ "old church slavonic": "cu",
9712
+ chuvash: "cv",
9713
+ cornish: "kw",
9714
+ corsican: "co",
9715
+ cree: "cr",
9716
+ welsh: "cy",
9717
+ danish: "da",
9718
+ german: "de",
9719
+ divehi: "dv",
9720
+ dhivehi: "dv",
9721
+ maldivian: "dv",
9722
+ dutch: "nl",
9723
+ flemish: "nl",
9724
+ dzongkha: "dz",
9725
+ greek: "el",
9726
+ english: "en",
9727
+ esperanto: "eo",
9728
+ estonian: "et",
9729
+ ewe: "ee",
9730
+ faroese: "fo",
9731
+ persian: "fa",
9732
+ fijian: "fj",
9733
+ finnish: "fi",
9734
+ french: "fr",
9735
+ "western frisian": "fy",
9736
+ fulah: "ff",
9737
+ georgian: "ka",
9738
+ gaelic: "gd",
9739
+ "scottish gaelic": "gd",
9740
+ irish: "ga",
9741
+ galician: "gl",
9742
+ manx: "gv",
9743
+ guarani: "gn",
9744
+ gujarati: "gu",
9745
+ haitian: "ht",
9746
+ "haitian creole": "ht",
9747
+ hausa: "ha",
9748
+ hebrew: "he",
9749
+ herero: "hz",
9750
+ hindi: "hi",
9751
+ "hiri motu": "ho",
9752
+ croatian: "hr",
9753
+ hungarian: "hu",
9754
+ igbo: "ig",
9755
+ icelandic: "is",
9756
+ ido: "io",
9757
+ "sichuan yi": "ii",
9758
+ nuosu: "ii",
9759
+ inuktitut: "iu",
9760
+ interlingue: "ie",
9761
+ occidental: "ie",
9762
+ interlingua: "ia",
9763
+ indonesian: "id",
9764
+ inupiaq: "ik",
9765
+ italian: "it",
9766
+ javanese: "jv",
9767
+ japanese: "ja",
9768
+ kalaallisut: "kl",
9769
+ greenlandic: "kl",
9770
+ kannada: "kn",
9771
+ kashmiri: "ks",
9772
+ kanuri: "kr",
9773
+ kazakh: "kk",
9774
+ "central khmer": "km",
9775
+ kikuyu: "ki",
9776
+ gikuyu: "ki",
9777
+ kinyarwanda: "rw",
9778
+ kirghiz: "ky",
9779
+ kyrgyz: "ky",
9780
+ komi: "kv",
9781
+ kongo: "kg",
9782
+ korean: "ko",
9783
+ kuanyama: "kj",
9784
+ kwanyama: "kj",
9785
+ kurdish: "ku",
9786
+ lao: "lo",
9787
+ latin: "la",
9788
+ latvian: "lv",
9789
+ limburgan: "li",
9790
+ limburger: "li",
9791
+ limburgish: "li",
9792
+ lingala: "ln",
9793
+ lithuanian: "lt",
9794
+ luxembourgish: "lb",
9795
+ letzeburgesch: "lb",
9796
+ "luba-katanga": "lu",
9797
+ ganda: "lg",
9798
+ macedonian: "mk",
9799
+ marshallese: "mh",
9800
+ malayalam: "ml",
9801
+ maori: "mi",
9802
+ marathi: "mr",
9803
+ malay: "ms",
9804
+ malagasy: "mg",
9805
+ maltese: "mt",
9806
+ mongolian: "mn",
9807
+ nauru: "na",
9808
+ navajo: "nv",
9809
+ navaho: "nv",
9810
+ "ndebele, south": "nr",
9811
+ "south ndebele": "nr",
9812
+ "ndebele, north": "nd",
9813
+ "north ndebele": "nd",
9814
+ ndonga: "ng",
9815
+ nepali: "ne",
9816
+ "norwegian nynorsk": "nn",
9817
+ "nynorsk, norwegian": "nn",
9818
+ "norwegian bokmål": "nb",
9819
+ "bokmål, norwegian": "nb",
9820
+ norwegian: "no",
9821
+ chichewa: "ny",
9822
+ chewa: "ny",
9823
+ nyanja: "ny",
9824
+ occitan: "oc",
9825
+ ojibwa: "oj",
9826
+ oriya: "or",
9827
+ oromo: "om",
9828
+ ossetian: "os",
9829
+ ossetic: "os",
9830
+ panjabi: "pa",
9831
+ punjabi: "pa",
9832
+ pali: "pi",
9833
+ polish: "pl",
9834
+ portuguese: "pt",
9835
+ pushto: "ps",
9836
+ pashto: "ps",
9837
+ quechua: "qu",
9838
+ romansh: "rm",
9839
+ romanian: "ro",
9840
+ moldavian: "ro",
9841
+ moldovan: "ro",
9842
+ rundi: "rn",
9843
+ russian: "ru",
9844
+ sango: "sg",
9845
+ sanskrit: "sa",
9846
+ sinhala: "si",
9847
+ sinhalese: "si",
9848
+ slovak: "sk",
9849
+ slovenian: "sl",
9850
+ "northern sami": "se",
9851
+ samoan: "sm",
9852
+ shona: "sn",
9853
+ sindhi: "sd",
9854
+ somali: "so",
9855
+ "sotho, southern": "st",
9856
+ spanish: "es",
9857
+ castilian: "es",
9858
+ sardinian: "sc",
9859
+ serbian: "sr",
9860
+ swati: "ss",
9861
+ sundanese: "su",
9862
+ swahili: "sw",
9863
+ swedish: "sv",
9864
+ tahitian: "ty",
9865
+ tamil: "ta",
9866
+ tatar: "tt",
9867
+ telugu: "te",
9868
+ tajik: "tg",
9869
+ tagalog: "tl",
9870
+ thai: "th",
9871
+ tigrinya: "ti",
9872
+ tonga: "to",
9873
+ tswana: "tn",
9874
+ tsonga: "ts",
9875
+ turkmen: "tk",
9876
+ turkish: "tr",
9877
+ twi: "tw",
9878
+ uighur: "ug",
9879
+ uyghur: "ug",
9880
+ ukrainian: "uk",
9881
+ urdu: "ur",
9882
+ uzbek: "uz",
9883
+ venda: "ve",
9884
+ vietnamese: "vi",
9885
+ volapük: "vo",
9886
+ walloon: "wa",
9887
+ wolof: "wo",
9888
+ xhosa: "xh",
9889
+ yiddish: "yi",
9890
+ yoruba: "yo",
9891
+ zhuang: "za",
9892
+ chuang: "za",
9893
+ zulu: "zu",
9894
+ };
9895
+
9896
+ const nameKeys = Object.keys(languageNames).sort();
9897
+ const isoKeys = Object.keys(iso).sort();
9898
+ const iosValues = Object.values(iso);
9899
+ function isValidLanguage(name) {
9900
+ if (!name) {
9901
+ return false;
9902
+ }
9903
+ if (name === "auto") {
9904
+ return true;
9905
+ }
9620
9906
  if (name.length > 100) {
9621
9907
  throw new Error(`The "language" is too long at ${name.length} characters`);
9622
9908
  }
9623
- if (!isoKeys.includes(name)) {
9624
- throw new Error(`The language "${name}" is not part of the ISO 639-1`);
9909
+ return isoKeys.includes(name) || nameKeys.includes(name) || iosValues.includes(name);
9910
+ }
9911
+ function getISO(name) {
9912
+ if (name === "auto") {
9913
+ return name;
9914
+ }
9915
+ if (nameKeys.includes(name)) {
9916
+ return languageNames[name];
9917
+ }
9918
+ if (isoKeys.includes(name)) {
9919
+ return iso[name];
9920
+ }
9921
+ if (iosValues.includes(name)) {
9922
+ return name;
9625
9923
  }
9626
9924
  return name;
9627
9925
  }
@@ -9704,7 +10002,7 @@ function useLogger(name = "") {
9704
10002
  }
9705
10003
 
9706
10004
  const logger = useLogger();
9707
- const cache = new Cache();
10005
+ const cache$3 = new Cache();
9708
10006
  class Translator {
9709
10007
  engines;
9710
10008
  constructor() {
@@ -9718,26 +10016,32 @@ class Translator {
9718
10016
  this.engines.set(engine.name, engine);
9719
10017
  }
9720
10018
  translate(text, options) {
9721
- const { from, to, engine = "google", cache_time = 60 * 1000 } = options;
10019
+ const { engine = "google", cache_time = 60 * 1000 } = options;
10020
+ let { from = "auto", to } = options;
10021
+ from = options.from = getISO(from);
10022
+ to = options.to = getISO(to);
9722
10023
  //1. Check if engine exists
9723
10024
  if (!this.engines.has(engine)) {
9724
10025
  throw new Error(`Engine ${engine} not found`);
9725
10026
  }
9726
10027
  //2. Check if language exists
9727
- if (!language(to)) {
9728
- throw new Error(`Language ${to} not found`);
10028
+ if (!isValidLanguage(to)) {
10029
+ throw new Error(`The language "${to}" is not part of the ISO 639-1 or is not part of the language names`);
10030
+ }
10031
+ if (!isValidLanguage(from)) {
10032
+ throw new Error(`The language "${from}" is not part of the ISO 639-1 or is not part of the language names`);
9729
10033
  }
9730
10034
  const key = `${from}:${to}:${engine}:${text}`;
9731
10035
  //3. If the cache is matched, the cache is used directly
9732
- if (cache.get(key)) {
9733
- return cache.get(key)?.value;
10036
+ if (cache$3.get(key)) {
10037
+ return Promise.resolve(cache$3.get(key)?.value);
9734
10038
  }
9735
10039
  const engineInstance = this.engines.get(engine);
9736
10040
  if (!engineInstance) {
9737
10041
  throw new Error(`Engine ${engine} not found`);
9738
10042
  }
9739
10043
  return engineInstance.translate(text, options).then((translated) => {
9740
- cache.set(key, translated, cache_time);
10044
+ cache$3.set(key, translated, cache_time);
9741
10045
  return translated;
9742
10046
  });
9743
10047
  }
@@ -9746,6 +10050,8 @@ const translator = new Translator();
9746
10050
  var index$8 = {
9747
10051
  engines: engines$3,
9748
10052
  translator,
10053
+ Cache,
10054
+ languageNames,
9749
10055
  };
9750
10056
 
9751
10057
  function httpRequest(options) {
@@ -10625,33 +10931,35 @@ const resolveAssumeRoleCredentials = async (profileName, profiles, options, visi
10625
10931
  }
10626
10932
  options.logger?.debug(`@aws-sdk/credential-provider-ini - finding credential resolver using ${source_profile ? `source_profile=[${source_profile}]` : `profile=[${profileName}]`}`);
10627
10933
  const sourceCredsProvider = source_profile
10628
- ? resolveProfileData(source_profile, {
10629
- ...profiles,
10630
- [source_profile]: {
10631
- ...profiles[source_profile],
10632
- role_arn: data.role_arn ?? profiles[source_profile].role_arn,
10633
- },
10634
- }, options, {
10934
+ ? resolveProfileData(source_profile, profiles, options, {
10635
10935
  ...visitedProfiles,
10636
10936
  [source_profile]: true,
10637
- })
10937
+ }, isCredentialSourceWithoutRoleArn(profiles[source_profile] ?? {}))
10638
10938
  : (await resolveCredentialSource(data.credential_source, profileName, options.logger)(options))();
10639
- const params = {
10640
- RoleArn: data.role_arn,
10641
- RoleSessionName: data.role_session_name || `aws-sdk-js-${Date.now()}`,
10642
- ExternalId: data.external_id,
10643
- DurationSeconds: parseInt(data.duration_seconds || "3600", 10),
10644
- };
10645
- const { mfa_serial } = data;
10646
- if (mfa_serial) {
10647
- if (!options.mfaCodeProvider) {
10648
- throw new CredentialsProviderError(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, { logger: options.logger, tryNextLink: false });
10939
+ if (isCredentialSourceWithoutRoleArn(data)) {
10940
+ return sourceCredsProvider;
10941
+ }
10942
+ else {
10943
+ const params = {
10944
+ RoleArn: data.role_arn,
10945
+ RoleSessionName: data.role_session_name || `aws-sdk-js-${Date.now()}`,
10946
+ ExternalId: data.external_id,
10947
+ DurationSeconds: parseInt(data.duration_seconds || "3600", 10),
10948
+ };
10949
+ const { mfa_serial } = data;
10950
+ if (mfa_serial) {
10951
+ if (!options.mfaCodeProvider) {
10952
+ throw new CredentialsProviderError(`Profile ${profileName} requires multi-factor authentication, but no MFA code callback was provided.`, { logger: options.logger, tryNextLink: false });
10953
+ }
10954
+ params.SerialNumber = mfa_serial;
10955
+ params.TokenCode = await options.mfaCodeProvider(mfa_serial);
10649
10956
  }
10650
- params.SerialNumber = mfa_serial;
10651
- params.TokenCode = await options.mfaCodeProvider(mfa_serial);
10957
+ const sourceCreds = await sourceCredsProvider;
10958
+ return options.roleAssumer(sourceCreds, params);
10652
10959
  }
10653
- const sourceCreds = await sourceCredsProvider;
10654
- return options.roleAssumer(sourceCreds, params);
10960
+ };
10961
+ const isCredentialSourceWithoutRoleArn = (section) => {
10962
+ return !section.role_arn && !!section.credential_source;
10655
10963
  };
10656
10964
 
10657
10965
  const isProcessProfile = (arg) => Boolean(arg) && typeof arg === "object" && typeof arg.credential_process === "string";
@@ -10705,12 +11013,12 @@ const resolveWebIdentityCredentials = async (profile, options) => Promise.resolv
10705
11013
  parentClientConfig: options.parentClientConfig,
10706
11014
  })());
10707
11015
 
10708
- const resolveProfileData = async (profileName, profiles, options, visitedProfiles = {}) => {
11016
+ const resolveProfileData = async (profileName, profiles, options, visitedProfiles = {}, isAssumeRoleRecursiveCall = false) => {
10709
11017
  const data = profiles[profileName];
10710
11018
  if (Object.keys(visitedProfiles).length > 0 && isStaticCredsProfile(data)) {
10711
11019
  return resolveStaticCredentials(data, options);
10712
11020
  }
10713
- if (isAssumeRoleProfile(data, { profile: profileName, logger: options.logger })) {
11021
+ if (isAssumeRoleRecursiveCall || isAssumeRoleProfile(data, { profile: profileName, logger: options.logger })) {
10714
11022
  return resolveAssumeRoleCredentials(profileName, profiles, options, visitedProfiles);
10715
11023
  }
10716
11024
  if (isStaticCredsProfile(data)) {
@@ -10934,7 +11242,7 @@ const commonParams$2 = {
10934
11242
 
10935
11243
  var name$2 = "@aws-sdk/client-sso-oidc";
10936
11244
  var description$2 = "AWS SDK for JavaScript Sso Oidc Client for Node.js, Browser and React Native";
10937
- var version$2 = "3.645.0";
11245
+ var version$2 = "3.651.1";
10938
11246
  var scripts$2 = {
10939
11247
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
10940
11248
  "build:cjs": "node ../../scripts/compilation/inline client-sso-oidc",
@@ -10953,41 +11261,41 @@ var sideEffects$2 = false;
10953
11261
  var dependencies$2 = {
10954
11262
  "@aws-crypto/sha256-browser": "5.2.0",
10955
11263
  "@aws-crypto/sha256-js": "5.2.0",
10956
- "@aws-sdk/core": "3.635.0",
10957
- "@aws-sdk/credential-provider-node": "3.645.0",
10958
- "@aws-sdk/middleware-host-header": "3.620.0",
10959
- "@aws-sdk/middleware-logger": "3.609.0",
10960
- "@aws-sdk/middleware-recursion-detection": "3.620.0",
10961
- "@aws-sdk/middleware-user-agent": "3.645.0",
10962
- "@aws-sdk/region-config-resolver": "3.614.0",
10963
- "@aws-sdk/types": "3.609.0",
10964
- "@aws-sdk/util-endpoints": "3.645.0",
10965
- "@aws-sdk/util-user-agent-browser": "3.609.0",
10966
- "@aws-sdk/util-user-agent-node": "3.614.0",
10967
- "@smithy/config-resolver": "^3.0.5",
10968
- "@smithy/core": "^2.4.0",
10969
- "@smithy/fetch-http-handler": "^3.2.4",
10970
- "@smithy/hash-node": "^3.0.3",
10971
- "@smithy/invalid-dependency": "^3.0.3",
10972
- "@smithy/middleware-content-length": "^3.0.5",
10973
- "@smithy/middleware-endpoint": "^3.1.0",
10974
- "@smithy/middleware-retry": "^3.0.15",
10975
- "@smithy/middleware-serde": "^3.0.3",
10976
- "@smithy/middleware-stack": "^3.0.3",
10977
- "@smithy/node-config-provider": "^3.1.4",
10978
- "@smithy/node-http-handler": "^3.1.4",
10979
- "@smithy/protocol-http": "^4.1.0",
10980
- "@smithy/smithy-client": "^3.2.0",
10981
- "@smithy/types": "^3.3.0",
10982
- "@smithy/url-parser": "^3.0.3",
11264
+ "@aws-sdk/core": "3.651.1",
11265
+ "@aws-sdk/credential-provider-node": "3.651.1",
11266
+ "@aws-sdk/middleware-host-header": "3.649.0",
11267
+ "@aws-sdk/middleware-logger": "3.649.0",
11268
+ "@aws-sdk/middleware-recursion-detection": "3.649.0",
11269
+ "@aws-sdk/middleware-user-agent": "3.649.0",
11270
+ "@aws-sdk/region-config-resolver": "3.649.0",
11271
+ "@aws-sdk/types": "3.649.0",
11272
+ "@aws-sdk/util-endpoints": "3.649.0",
11273
+ "@aws-sdk/util-user-agent-browser": "3.649.0",
11274
+ "@aws-sdk/util-user-agent-node": "3.649.0",
11275
+ "@smithy/config-resolver": "^3.0.6",
11276
+ "@smithy/core": "^2.4.1",
11277
+ "@smithy/fetch-http-handler": "^3.2.5",
11278
+ "@smithy/hash-node": "^3.0.4",
11279
+ "@smithy/invalid-dependency": "^3.0.4",
11280
+ "@smithy/middleware-content-length": "^3.0.6",
11281
+ "@smithy/middleware-endpoint": "^3.1.1",
11282
+ "@smithy/middleware-retry": "^3.0.16",
11283
+ "@smithy/middleware-serde": "^3.0.4",
11284
+ "@smithy/middleware-stack": "^3.0.4",
11285
+ "@smithy/node-config-provider": "^3.1.5",
11286
+ "@smithy/node-http-handler": "^3.2.0",
11287
+ "@smithy/protocol-http": "^4.1.1",
11288
+ "@smithy/smithy-client": "^3.3.0",
11289
+ "@smithy/types": "^3.4.0",
11290
+ "@smithy/url-parser": "^3.0.4",
10983
11291
  "@smithy/util-base64": "^3.0.0",
10984
11292
  "@smithy/util-body-length-browser": "^3.0.0",
10985
11293
  "@smithy/util-body-length-node": "^3.0.0",
10986
- "@smithy/util-defaults-mode-browser": "^3.0.15",
10987
- "@smithy/util-defaults-mode-node": "^3.0.15",
10988
- "@smithy/util-endpoints": "^2.0.5",
10989
- "@smithy/util-middleware": "^3.0.3",
10990
- "@smithy/util-retry": "^3.0.3",
11294
+ "@smithy/util-defaults-mode-browser": "^3.0.16",
11295
+ "@smithy/util-defaults-mode-node": "^3.0.16",
11296
+ "@smithy/util-endpoints": "^2.1.0",
11297
+ "@smithy/util-middleware": "^3.0.4",
11298
+ "@smithy/util-retry": "^3.0.4",
10991
11299
  "@smithy/util-utf8": "^3.0.0",
10992
11300
  tslib: "^2.6.2"
10993
11301
  };
@@ -11018,7 +11326,7 @@ var author$2 = {
11018
11326
  };
11019
11327
  var license$2 = "Apache-2.0";
11020
11328
  var peerDependencies = {
11021
- "@aws-sdk/client-sts": "^3.645.0"
11329
+ "@aws-sdk/client-sts": "^3.651.1"
11022
11330
  };
11023
11331
  var browser$2 = {
11024
11332
  "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
@@ -11059,11 +11367,15 @@ const a$2 = true, b$2 = "isSet", c$2 = "booleanEquals", d$2 = "error", e$2 = "en
11059
11367
  const _data$2 = { version: "1.0", parameters: { Region: i$2, UseDualStack: j$2, UseFIPS: j$2, Endpoint: i$2 }, rules: [{ conditions: [{ [v$2]: b$2, [w$2]: [k$2] }], rules: [{ conditions: r$2, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d$2 }, { conditions: s$2, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d$2 }, { endpoint: { url: k$2, properties: n$2, headers: n$2 }, type: e$2 }], type: f$2 }, { conditions: [{ [v$2]: b$2, [w$2]: t$2 }], rules: [{ conditions: [{ [v$2]: "aws.partition", [w$2]: t$2, assign: g$2 }], rules: [{ conditions: [l$2, m$2], rules: [{ conditions: [{ [v$2]: c$2, [w$2]: [a$2, o$2] }, q$2], rules: [{ endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n$2, headers: n$2 }, type: e$2 }], type: f$2 }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d$2 }], type: f$2 }, { conditions: r$2, rules: [{ conditions: [{ [v$2]: c$2, [w$2]: [o$2, a$2] }], rules: [{ conditions: [{ [v$2]: "stringEquals", [w$2]: [{ [v$2]: h$2, [w$2]: [p$2, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://oidc.{Region}.amazonaws.com", properties: n$2, headers: n$2 }, type: e$2 }, { endpoint: { url: "https://oidc-fips.{Region}.{PartitionResult#dnsSuffix}", properties: n$2, headers: n$2 }, type: e$2 }], type: f$2 }, { error: "FIPS is enabled but this partition does not support FIPS", type: d$2 }], type: f$2 }, { conditions: s$2, rules: [{ conditions: [q$2], rules: [{ endpoint: { url: "https://oidc.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n$2, headers: n$2 }, type: e$2 }], type: f$2 }, { error: "DualStack is enabled but this partition does not support DualStack", type: d$2 }], type: f$2 }, { endpoint: { url: "https://oidc.{Region}.{PartitionResult#dnsSuffix}", properties: n$2, headers: n$2 }, type: e$2 }], type: f$2 }], type: f$2 }, { error: "Invalid Configuration: Missing Region", type: d$2 }] };
11060
11368
  const ruleSet$2 = _data$2;
11061
11369
 
11370
+ const cache$2 = new EndpointCache({
11371
+ size: 50,
11372
+ params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"],
11373
+ });
11062
11374
  const defaultEndpointResolver$2 = (endpointParams, context = {}) => {
11063
- return resolveEndpoint(ruleSet$2, {
11375
+ return cache$2.get(endpointParams, () => resolveEndpoint(ruleSet$2, {
11064
11376
  endpointParams: endpointParams,
11065
11377
  logger: context.logger,
11066
- });
11378
+ }));
11067
11379
  };
11068
11380
  customEndpointFunctions.aws = awsEndpointFunctions;
11069
11381
 
@@ -11738,9 +12050,7 @@ const deserializeMetadata$2 = (output) => ({
11738
12050
 
11739
12051
  class CreateTokenCommand extends Command
11740
12052
  .classBuilder()
11741
- .ep({
11742
- ...commonParams$2,
11743
- })
12053
+ .ep(commonParams$2)
11744
12054
  .m(function (Command, cs, config, o) {
11745
12055
  return [
11746
12056
  getSerdePlugin(config, this.serialize, this.deserialize),
@@ -11858,7 +12168,7 @@ const commonParams$1 = {
11858
12168
 
11859
12169
  var name$1 = "@aws-sdk/client-sso";
11860
12170
  var description$1 = "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native";
11861
- var version$1 = "3.645.0";
12171
+ var version$1 = "3.651.1";
11862
12172
  var scripts$1 = {
11863
12173
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
11864
12174
  "build:cjs": "node ../../scripts/compilation/inline client-sso",
@@ -11877,40 +12187,40 @@ var sideEffects$1 = false;
11877
12187
  var dependencies$1 = {
11878
12188
  "@aws-crypto/sha256-browser": "5.2.0",
11879
12189
  "@aws-crypto/sha256-js": "5.2.0",
11880
- "@aws-sdk/core": "3.635.0",
11881
- "@aws-sdk/middleware-host-header": "3.620.0",
11882
- "@aws-sdk/middleware-logger": "3.609.0",
11883
- "@aws-sdk/middleware-recursion-detection": "3.620.0",
11884
- "@aws-sdk/middleware-user-agent": "3.645.0",
11885
- "@aws-sdk/region-config-resolver": "3.614.0",
11886
- "@aws-sdk/types": "3.609.0",
11887
- "@aws-sdk/util-endpoints": "3.645.0",
11888
- "@aws-sdk/util-user-agent-browser": "3.609.0",
11889
- "@aws-sdk/util-user-agent-node": "3.614.0",
11890
- "@smithy/config-resolver": "^3.0.5",
11891
- "@smithy/core": "^2.4.0",
11892
- "@smithy/fetch-http-handler": "^3.2.4",
11893
- "@smithy/hash-node": "^3.0.3",
11894
- "@smithy/invalid-dependency": "^3.0.3",
11895
- "@smithy/middleware-content-length": "^3.0.5",
11896
- "@smithy/middleware-endpoint": "^3.1.0",
11897
- "@smithy/middleware-retry": "^3.0.15",
11898
- "@smithy/middleware-serde": "^3.0.3",
11899
- "@smithy/middleware-stack": "^3.0.3",
11900
- "@smithy/node-config-provider": "^3.1.4",
11901
- "@smithy/node-http-handler": "^3.1.4",
11902
- "@smithy/protocol-http": "^4.1.0",
11903
- "@smithy/smithy-client": "^3.2.0",
11904
- "@smithy/types": "^3.3.0",
11905
- "@smithy/url-parser": "^3.0.3",
12190
+ "@aws-sdk/core": "3.651.1",
12191
+ "@aws-sdk/middleware-host-header": "3.649.0",
12192
+ "@aws-sdk/middleware-logger": "3.649.0",
12193
+ "@aws-sdk/middleware-recursion-detection": "3.649.0",
12194
+ "@aws-sdk/middleware-user-agent": "3.649.0",
12195
+ "@aws-sdk/region-config-resolver": "3.649.0",
12196
+ "@aws-sdk/types": "3.649.0",
12197
+ "@aws-sdk/util-endpoints": "3.649.0",
12198
+ "@aws-sdk/util-user-agent-browser": "3.649.0",
12199
+ "@aws-sdk/util-user-agent-node": "3.649.0",
12200
+ "@smithy/config-resolver": "^3.0.6",
12201
+ "@smithy/core": "^2.4.1",
12202
+ "@smithy/fetch-http-handler": "^3.2.5",
12203
+ "@smithy/hash-node": "^3.0.4",
12204
+ "@smithy/invalid-dependency": "^3.0.4",
12205
+ "@smithy/middleware-content-length": "^3.0.6",
12206
+ "@smithy/middleware-endpoint": "^3.1.1",
12207
+ "@smithy/middleware-retry": "^3.0.16",
12208
+ "@smithy/middleware-serde": "^3.0.4",
12209
+ "@smithy/middleware-stack": "^3.0.4",
12210
+ "@smithy/node-config-provider": "^3.1.5",
12211
+ "@smithy/node-http-handler": "^3.2.0",
12212
+ "@smithy/protocol-http": "^4.1.1",
12213
+ "@smithy/smithy-client": "^3.3.0",
12214
+ "@smithy/types": "^3.4.0",
12215
+ "@smithy/url-parser": "^3.0.4",
11906
12216
  "@smithy/util-base64": "^3.0.0",
11907
12217
  "@smithy/util-body-length-browser": "^3.0.0",
11908
12218
  "@smithy/util-body-length-node": "^3.0.0",
11909
- "@smithy/util-defaults-mode-browser": "^3.0.15",
11910
- "@smithy/util-defaults-mode-node": "^3.0.15",
11911
- "@smithy/util-endpoints": "^2.0.5",
11912
- "@smithy/util-middleware": "^3.0.3",
11913
- "@smithy/util-retry": "^3.0.3",
12219
+ "@smithy/util-defaults-mode-browser": "^3.0.16",
12220
+ "@smithy/util-defaults-mode-node": "^3.0.16",
12221
+ "@smithy/util-endpoints": "^2.1.0",
12222
+ "@smithy/util-middleware": "^3.0.4",
12223
+ "@smithy/util-retry": "^3.0.4",
11914
12224
  "@smithy/util-utf8": "^3.0.0",
11915
12225
  tslib: "^2.6.2"
11916
12226
  };
@@ -11978,11 +12288,15 @@ const a$1 = true, b$1 = "isSet", c$1 = "booleanEquals", d$1 = "error", e$1 = "en
11978
12288
  const _data$1 = { version: "1.0", parameters: { Region: i$1, UseDualStack: j$1, UseFIPS: j$1, Endpoint: i$1 }, rules: [{ conditions: [{ [v$1]: b$1, [w$1]: [k$1] }], rules: [{ conditions: r$1, error: "Invalid Configuration: FIPS and custom endpoint are not supported", type: d$1 }, { conditions: s$1, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", type: d$1 }, { endpoint: { url: k$1, properties: n$1, headers: n$1 }, type: e$1 }], type: f$1 }, { conditions: [{ [v$1]: b$1, [w$1]: t$1 }], rules: [{ conditions: [{ [v$1]: "aws.partition", [w$1]: t$1, assign: g$1 }], rules: [{ conditions: [l$1, m$1], rules: [{ conditions: [{ [v$1]: c$1, [w$1]: [a$1, o$1] }, q$1], rules: [{ endpoint: { url: "https://portal.sso-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n$1, headers: n$1 }, type: e$1 }], type: f$1 }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", type: d$1 }], type: f$1 }, { conditions: r$1, rules: [{ conditions: [{ [v$1]: c$1, [w$1]: [o$1, a$1] }], rules: [{ conditions: [{ [v$1]: "stringEquals", [w$1]: [{ [v$1]: h$1, [w$1]: [p$1, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://portal.sso.{Region}.amazonaws.com", properties: n$1, headers: n$1 }, type: e$1 }, { endpoint: { url: "https://portal.sso-fips.{Region}.{PartitionResult#dnsSuffix}", properties: n$1, headers: n$1 }, type: e$1 }], type: f$1 }, { error: "FIPS is enabled but this partition does not support FIPS", type: d$1 }], type: f$1 }, { conditions: s$1, rules: [{ conditions: [q$1], rules: [{ endpoint: { url: "https://portal.sso.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: n$1, headers: n$1 }, type: e$1 }], type: f$1 }, { error: "DualStack is enabled but this partition does not support DualStack", type: d$1 }], type: f$1 }, { endpoint: { url: "https://portal.sso.{Region}.{PartitionResult#dnsSuffix}", properties: n$1, headers: n$1 }, type: e$1 }], type: f$1 }], type: f$1 }, { error: "Invalid Configuration: Missing Region", type: d$1 }] };
11979
12289
  const ruleSet$1 = _data$1;
11980
12290
 
12291
+ const cache$1 = new EndpointCache({
12292
+ size: 50,
12293
+ params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"],
12294
+ });
11981
12295
  const defaultEndpointResolver$1 = (endpointParams, context = {}) => {
11982
- return resolveEndpoint(ruleSet$1, {
12296
+ return cache$1.get(endpointParams, () => resolveEndpoint(ruleSet$1, {
11983
12297
  endpointParams: endpointParams,
11984
12298
  logger: context.logger,
11985
- });
12299
+ }));
11986
12300
  };
11987
12301
  customEndpointFunctions.aws = awsEndpointFunctions;
11988
12302
 
@@ -12331,9 +12645,7 @@ const _xasbt = "x-amz-sso_bearer_token";
12331
12645
 
12332
12646
  class GetRoleCredentialsCommand extends Command
12333
12647
  .classBuilder()
12334
- .ep({
12335
- ...commonParams$1,
12336
- })
12648
+ .ep(commonParams$1)
12337
12649
  .m(function (Command, cs, config, o) {
12338
12650
  return [
12339
12651
  getSerdePlugin(config, this.serialize, this.deserialize),
@@ -12431,7 +12743,7 @@ const commonParams = {
12431
12743
 
12432
12744
  var name = "@aws-sdk/client-sts";
12433
12745
  var description = "AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native";
12434
- var version = "3.645.0";
12746
+ var version = "3.651.1";
12435
12747
  var scripts = {
12436
12748
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
12437
12749
  "build:cjs": "node ../../scripts/compilation/inline client-sts",
@@ -12452,42 +12764,42 @@ var sideEffects = false;
12452
12764
  var dependencies = {
12453
12765
  "@aws-crypto/sha256-browser": "5.2.0",
12454
12766
  "@aws-crypto/sha256-js": "5.2.0",
12455
- "@aws-sdk/client-sso-oidc": "3.645.0",
12456
- "@aws-sdk/core": "3.635.0",
12457
- "@aws-sdk/credential-provider-node": "3.645.0",
12458
- "@aws-sdk/middleware-host-header": "3.620.0",
12459
- "@aws-sdk/middleware-logger": "3.609.0",
12460
- "@aws-sdk/middleware-recursion-detection": "3.620.0",
12461
- "@aws-sdk/middleware-user-agent": "3.645.0",
12462
- "@aws-sdk/region-config-resolver": "3.614.0",
12463
- "@aws-sdk/types": "3.609.0",
12464
- "@aws-sdk/util-endpoints": "3.645.0",
12465
- "@aws-sdk/util-user-agent-browser": "3.609.0",
12466
- "@aws-sdk/util-user-agent-node": "3.614.0",
12467
- "@smithy/config-resolver": "^3.0.5",
12468
- "@smithy/core": "^2.4.0",
12469
- "@smithy/fetch-http-handler": "^3.2.4",
12470
- "@smithy/hash-node": "^3.0.3",
12471
- "@smithy/invalid-dependency": "^3.0.3",
12472
- "@smithy/middleware-content-length": "^3.0.5",
12473
- "@smithy/middleware-endpoint": "^3.1.0",
12474
- "@smithy/middleware-retry": "^3.0.15",
12475
- "@smithy/middleware-serde": "^3.0.3",
12476
- "@smithy/middleware-stack": "^3.0.3",
12477
- "@smithy/node-config-provider": "^3.1.4",
12478
- "@smithy/node-http-handler": "^3.1.4",
12479
- "@smithy/protocol-http": "^4.1.0",
12480
- "@smithy/smithy-client": "^3.2.0",
12481
- "@smithy/types": "^3.3.0",
12482
- "@smithy/url-parser": "^3.0.3",
12767
+ "@aws-sdk/client-sso-oidc": "3.651.1",
12768
+ "@aws-sdk/core": "3.651.1",
12769
+ "@aws-sdk/credential-provider-node": "3.651.1",
12770
+ "@aws-sdk/middleware-host-header": "3.649.0",
12771
+ "@aws-sdk/middleware-logger": "3.649.0",
12772
+ "@aws-sdk/middleware-recursion-detection": "3.649.0",
12773
+ "@aws-sdk/middleware-user-agent": "3.649.0",
12774
+ "@aws-sdk/region-config-resolver": "3.649.0",
12775
+ "@aws-sdk/types": "3.649.0",
12776
+ "@aws-sdk/util-endpoints": "3.649.0",
12777
+ "@aws-sdk/util-user-agent-browser": "3.649.0",
12778
+ "@aws-sdk/util-user-agent-node": "3.649.0",
12779
+ "@smithy/config-resolver": "^3.0.6",
12780
+ "@smithy/core": "^2.4.1",
12781
+ "@smithy/fetch-http-handler": "^3.2.5",
12782
+ "@smithy/hash-node": "^3.0.4",
12783
+ "@smithy/invalid-dependency": "^3.0.4",
12784
+ "@smithy/middleware-content-length": "^3.0.6",
12785
+ "@smithy/middleware-endpoint": "^3.1.1",
12786
+ "@smithy/middleware-retry": "^3.0.16",
12787
+ "@smithy/middleware-serde": "^3.0.4",
12788
+ "@smithy/middleware-stack": "^3.0.4",
12789
+ "@smithy/node-config-provider": "^3.1.5",
12790
+ "@smithy/node-http-handler": "^3.2.0",
12791
+ "@smithy/protocol-http": "^4.1.1",
12792
+ "@smithy/smithy-client": "^3.3.0",
12793
+ "@smithy/types": "^3.4.0",
12794
+ "@smithy/url-parser": "^3.0.4",
12483
12795
  "@smithy/util-base64": "^3.0.0",
12484
12796
  "@smithy/util-body-length-browser": "^3.0.0",
12485
12797
  "@smithy/util-body-length-node": "^3.0.0",
12486
- "@smithy/util-defaults-mode-browser": "^3.0.15",
12487
- "@smithy/util-defaults-mode-node": "^3.0.15",
12488
- "@smithy/util-endpoints": "^2.0.5",
12489
- "@smithy/util-middleware": "^3.0.3",
12490
- "@smithy/util-retry": "^3.0.3",
12798
+ "@smithy/util-defaults-mode-browser": "^3.0.16",
12799
+ "@smithy/util-defaults-mode-node": "^3.0.16",
12800
+ "@smithy/util-endpoints": "^2.1.0",
12801
+ "@smithy/util-middleware": "^3.0.4",
12802
+ "@smithy/util-retry": "^3.0.4",
12491
12803
  "@smithy/util-utf8": "^3.0.0",
12492
12804
  tslib: "^2.6.2"
12493
12805
  };
@@ -12555,11 +12867,15 @@ const a = false, b = true, c = "booleanEquals", d = "stringEquals", e = "sigv4",
12555
12867
  const _data = { version: "1.0", parameters: { Region: m, UseDualStack: n, UseFIPS: n, Endpoint: m, UseGlobalEndpoint: n }, rules: [{ conditions: [{ [H]: c, [I]: [{ [J]: "UseGlobalEndpoint" }, b] }, { [H]: "not", [I]: C }, p, r, { [H]: c, [I]: [s, a] }, { [H]: c, [I]: [t, a] }], rules: [{ conditions: [{ [H]: d, [I]: [q, "ap-northeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-south-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "ap-southeast-2"] }], endpoint: u, [G]: h }, w, { conditions: [{ [H]: d, [I]: [q, "ca-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-central-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-north-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "eu-west-3"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "sa-east-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, g] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-east-2"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-1"] }], endpoint: u, [G]: h }, { conditions: [{ [H]: d, [I]: [q, "us-west-2"] }], endpoint: u, [G]: h }, { endpoint: { url: i, properties: { authSchemes: [{ name: e, signingName: f, signingRegion: "{Region}" }] }, headers: v }, [G]: h }], [G]: j }, { conditions: C, rules: [{ conditions: D, error: "Invalid Configuration: FIPS and custom endpoint are not supported", [G]: k }, { conditions: E, error: "Invalid Configuration: Dualstack and custom endpoint are not supported", [G]: k }, { endpoint: { url: o, properties: v, headers: v }, [G]: h }], [G]: j }, { conditions: [p], rules: [{ conditions: [r], rules: [{ conditions: [x, y], rules: [{ conditions: [{ [H]: c, [I]: [b, z] }, B], rules: [{ endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS and DualStack are enabled, but this partition does not support one or both", [G]: k }], [G]: j }, { conditions: D, rules: [{ conditions: [{ [H]: c, [I]: [z, b] }], rules: [{ conditions: [{ [H]: d, [I]: [{ [H]: l, [I]: [A, "name"] }, "aws-us-gov"] }], endpoint: { url: "https://sts.{Region}.amazonaws.com", properties: v, headers: v }, [G]: h }, { endpoint: { url: "https://sts-fips.{Region}.{PartitionResult#dnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "FIPS is enabled but this partition does not support FIPS", [G]: k }], [G]: j }, { conditions: E, rules: [{ conditions: [B], rules: [{ endpoint: { url: "https://sts.{Region}.{PartitionResult#dualStackDnsSuffix}", properties: v, headers: v }, [G]: h }], [G]: j }, { error: "DualStack is enabled but this partition does not support DualStack", [G]: k }], [G]: j }, w, { endpoint: { url: i, properties: v, headers: v }, [G]: h }], [G]: j }], [G]: j }, { error: "Invalid Configuration: Missing Region", [G]: k }] };
12556
12868
  const ruleSet = _data;
12557
12869
 
12870
+ const cache = new EndpointCache({
12871
+ size: 50,
12872
+ params: ["Endpoint", "Region", "UseDualStack", "UseFIPS", "UseGlobalEndpoint"],
12873
+ });
12558
12874
  const defaultEndpointResolver = (endpointParams, context = {}) => {
12559
- return resolveEndpoint(ruleSet, {
12875
+ return cache.get(endpointParams, () => resolveEndpoint(ruleSet, {
12560
12876
  endpointParams: endpointParams,
12561
12877
  logger: context.logger,
12562
- });
12878
+ }));
12563
12879
  };
12564
12880
  customEndpointFunctions.aws = awsEndpointFunctions;
12565
12881
 
@@ -13385,9 +13701,7 @@ const loadQueryErrorCode = (output, data) => {
13385
13701
 
13386
13702
  class AssumeRoleCommand extends Command
13387
13703
  .classBuilder()
13388
- .ep({
13389
- ...commonParams,
13390
- })
13704
+ .ep(commonParams)
13391
13705
  .m(function (Command, cs, config, o) {
13392
13706
  return [
13393
13707
  getSerdePlugin(config, this.serialize, this.deserialize),
@@ -13404,9 +13718,7 @@ class AssumeRoleCommand extends Command
13404
13718
 
13405
13719
  class AssumeRoleWithWebIdentityCommand extends Command
13406
13720
  .classBuilder()
13407
- .ep({
13408
- ...commonParams,
13409
- })
13721
+ .ep(commonParams)
13410
13722
  .m(function (Command, cs, config, o) {
13411
13723
  return [
13412
13724
  getSerdePlugin(config, this.serialize, this.deserialize),
@@ -13540,5 +13852,5 @@ var index = /*#__PURE__*/Object.freeze({
13540
13852
  getDefaultRoleAssumerWithWebIdentity: getDefaultRoleAssumerWithWebIdentity
13541
13853
  });
13542
13854
 
13543
- export { Cache, index$8 as default, engines$3 as engines, translator };
13855
+ export { Cache, index$8 as default, engines$3 as engines, languageNames, translator };
13544
13856
  //# sourceMappingURL=index.js.map