@yxw007/translate 0.0.3 → 0.0.5

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.3 Copyright (c) 2024 Potter<aa4790139@gmail.com> and contributors
1
+ // translate v0.0.5 Copyright (c) 2024 Potter<aa4790139@gmail.com> and contributors
2
2
  'use strict';
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
@@ -23,7 +23,7 @@ function google(options) {
23
23
  return {
24
24
  name: "google",
25
25
  async translate(text, opts) {
26
- const { from, to } = opts;
26
+ const { from = "auto", to } = opts;
27
27
  if (!Array.isArray(text)) {
28
28
  text = [text];
29
29
  }
@@ -57,7 +57,7 @@ function azure(options) {
57
57
  name: "azure",
58
58
  async translate(text, opts) {
59
59
  const { from, to } = opts;
60
- const url = `${base}&from=${from}&to=${to}`;
60
+ const url = `${base}&to=${to}${from && from !== "auto" ? `&from=${from}` : ""}`;
61
61
  if (!Array.isArray(text)) {
62
62
  text = [text];
63
63
  }
@@ -344,6 +344,56 @@ function resolveUserAgentConfig(input) {
344
344
  };
345
345
  }
346
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
+
347
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}$`);
348
398
  const isIpAddress = (value) => IP_V4_REGEX.test(value) || (value.startsWith("[") && value.endsWith("]"));
349
399
 
@@ -7225,7 +7275,7 @@ const commonParams$3 = {
7225
7275
 
7226
7276
  var name$3 = "@aws-sdk/client-translate";
7227
7277
  var description$3 = "AWS SDK for JavaScript Translate Client for Node.js, Browser and React Native";
7228
- var version$3 = "3.645.0";
7278
+ var version$3 = "3.649.0";
7229
7279
  var scripts$3 = {
7230
7280
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7231
7281
  "build:cjs": "node ../../scripts/compilation/inline client-translate",
@@ -7244,43 +7294,43 @@ var sideEffects$3 = false;
7244
7294
  var dependencies$3 = {
7245
7295
  "@aws-crypto/sha256-browser": "5.2.0",
7246
7296
  "@aws-crypto/sha256-js": "5.2.0",
7247
- "@aws-sdk/client-sso-oidc": "3.645.0",
7248
- "@aws-sdk/client-sts": "3.645.0",
7249
- "@aws-sdk/core": "3.635.0",
7250
- "@aws-sdk/credential-provider-node": "3.645.0",
7251
- "@aws-sdk/middleware-host-header": "3.620.0",
7252
- "@aws-sdk/middleware-logger": "3.609.0",
7253
- "@aws-sdk/middleware-recursion-detection": "3.620.0",
7254
- "@aws-sdk/middleware-user-agent": "3.645.0",
7255
- "@aws-sdk/region-config-resolver": "3.614.0",
7256
- "@aws-sdk/types": "3.609.0",
7257
- "@aws-sdk/util-endpoints": "3.645.0",
7258
- "@aws-sdk/util-user-agent-browser": "3.609.0",
7259
- "@aws-sdk/util-user-agent-node": "3.614.0",
7260
- "@smithy/config-resolver": "^3.0.5",
7261
- "@smithy/core": "^2.4.0",
7262
- "@smithy/fetch-http-handler": "^3.2.4",
7263
- "@smithy/hash-node": "^3.0.3",
7264
- "@smithy/invalid-dependency": "^3.0.3",
7265
- "@smithy/middleware-content-length": "^3.0.5",
7266
- "@smithy/middleware-endpoint": "^3.1.0",
7267
- "@smithy/middleware-retry": "^3.0.15",
7268
- "@smithy/middleware-serde": "^3.0.3",
7269
- "@smithy/middleware-stack": "^3.0.3",
7270
- "@smithy/node-config-provider": "^3.1.4",
7271
- "@smithy/node-http-handler": "^3.1.4",
7272
- "@smithy/protocol-http": "^4.1.0",
7273
- "@smithy/smithy-client": "^3.2.0",
7274
- "@smithy/types": "^3.3.0",
7275
- "@smithy/url-parser": "^3.0.3",
7297
+ "@aws-sdk/client-sso-oidc": "3.649.0",
7298
+ "@aws-sdk/client-sts": "3.649.0",
7299
+ "@aws-sdk/core": "3.649.0",
7300
+ "@aws-sdk/credential-provider-node": "3.649.0",
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",
7276
7326
  "@smithy/util-base64": "^3.0.0",
7277
7327
  "@smithy/util-body-length-browser": "^3.0.0",
7278
7328
  "@smithy/util-body-length-node": "^3.0.0",
7279
- "@smithy/util-defaults-mode-browser": "^3.0.15",
7280
- "@smithy/util-defaults-mode-node": "^3.0.15",
7281
- "@smithy/util-endpoints": "^2.0.5",
7282
- "@smithy/util-middleware": "^3.0.3",
7283
- "@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",
7284
7334
  "@smithy/util-utf8": "^3.0.0",
7285
7335
  tslib: "^2.6.2",
7286
7336
  uuid: "^9.0.1"
@@ -8278,7 +8328,7 @@ function amazon(options) {
8278
8328
  return {
8279
8329
  name: "amazon",
8280
8330
  async translate(text, opts) {
8281
- const { from, to } = opts;
8331
+ const { from = "auto", to } = opts;
8282
8332
  const translateClient = new TranslateClient({ region: region, credentials: { accessKeyId, secretAccessKey } });
8283
8333
  if (!Array.isArray(text)) {
8284
8334
  text = [text];
@@ -9388,7 +9438,7 @@ function baidu(options) {
9388
9438
  return {
9389
9439
  name: "baidu",
9390
9440
  async translate(text, opts) {
9391
- const { to, from, domain = "it" } = opts;
9441
+ const { to, from = "auto", domain = "it" } = opts;
9392
9442
  if (!Array.isArray(text)) {
9393
9443
  text = [text];
9394
9444
  }
@@ -9619,13 +9669,255 @@ var iso = {
9619
9669
  zul: "zu",
9620
9670
  };
9621
9671
 
9622
- const isoKeys = Object.values(iso).sort();
9623
- function language(name) {
9672
+ var languageNames = {
9673
+ afar: "aa",
9674
+ abkhazian: "ab",
9675
+ afrikaans: "af",
9676
+ akan: "ak",
9677
+ albanian: "sq",
9678
+ amharic: "am",
9679
+ arabic: "ar",
9680
+ aragonese: "an",
9681
+ armenian: "hy",
9682
+ assamese: "as",
9683
+ avaric: "av",
9684
+ avestan: "ae",
9685
+ aymara: "ay",
9686
+ azerbaijani: "az",
9687
+ bashkir: "ba",
9688
+ bambara: "bm",
9689
+ basque: "eu",
9690
+ belarusian: "be",
9691
+ bengali: "bn",
9692
+ "bihari languages": "bh",
9693
+ bislama: "bi",
9694
+ tibetan: "bo",
9695
+ bosnian: "bs",
9696
+ breton: "br",
9697
+ bulgarian: "bg",
9698
+ burmese: "my",
9699
+ catalan: "ca",
9700
+ valencian: "ca",
9701
+ czech: "cs",
9702
+ chamorro: "ch",
9703
+ chechen: "ce",
9704
+ chinese: "zh",
9705
+ "church slavic": "cu",
9706
+ "old slavonic": "cu",
9707
+ "church slavonic": "cu",
9708
+ "old bulgarian": "cu",
9709
+ "old church slavonic": "cu",
9710
+ chuvash: "cv",
9711
+ cornish: "kw",
9712
+ corsican: "co",
9713
+ cree: "cr",
9714
+ welsh: "cy",
9715
+ danish: "da",
9716
+ german: "de",
9717
+ divehi: "dv",
9718
+ dhivehi: "dv",
9719
+ maldivian: "dv",
9720
+ dutch: "nl",
9721
+ flemish: "nl",
9722
+ dzongkha: "dz",
9723
+ greek: "el",
9724
+ english: "en",
9725
+ esperanto: "eo",
9726
+ estonian: "et",
9727
+ ewe: "ee",
9728
+ faroese: "fo",
9729
+ persian: "fa",
9730
+ fijian: "fj",
9731
+ finnish: "fi",
9732
+ french: "fr",
9733
+ "western frisian": "fy",
9734
+ fulah: "ff",
9735
+ georgian: "ka",
9736
+ gaelic: "gd",
9737
+ "scottish gaelic": "gd",
9738
+ irish: "ga",
9739
+ galician: "gl",
9740
+ manx: "gv",
9741
+ guarani: "gn",
9742
+ gujarati: "gu",
9743
+ haitian: "ht",
9744
+ "haitian creole": "ht",
9745
+ hausa: "ha",
9746
+ hebrew: "he",
9747
+ herero: "hz",
9748
+ hindi: "hi",
9749
+ "hiri motu": "ho",
9750
+ croatian: "hr",
9751
+ hungarian: "hu",
9752
+ igbo: "ig",
9753
+ icelandic: "is",
9754
+ ido: "io",
9755
+ "sichuan yi": "ii",
9756
+ nuosu: "ii",
9757
+ inuktitut: "iu",
9758
+ interlingue: "ie",
9759
+ occidental: "ie",
9760
+ interlingua: "ia",
9761
+ indonesian: "id",
9762
+ inupiaq: "ik",
9763
+ italian: "it",
9764
+ javanese: "jv",
9765
+ japanese: "ja",
9766
+ kalaallisut: "kl",
9767
+ greenlandic: "kl",
9768
+ kannada: "kn",
9769
+ kashmiri: "ks",
9770
+ kanuri: "kr",
9771
+ kazakh: "kk",
9772
+ "central khmer": "km",
9773
+ kikuyu: "ki",
9774
+ gikuyu: "ki",
9775
+ kinyarwanda: "rw",
9776
+ kirghiz: "ky",
9777
+ kyrgyz: "ky",
9778
+ komi: "kv",
9779
+ kongo: "kg",
9780
+ korean: "ko",
9781
+ kuanyama: "kj",
9782
+ kwanyama: "kj",
9783
+ kurdish: "ku",
9784
+ lao: "lo",
9785
+ latin: "la",
9786
+ latvian: "lv",
9787
+ limburgan: "li",
9788
+ limburger: "li",
9789
+ limburgish: "li",
9790
+ lingala: "ln",
9791
+ lithuanian: "lt",
9792
+ luxembourgish: "lb",
9793
+ letzeburgesch: "lb",
9794
+ "luba-katanga": "lu",
9795
+ ganda: "lg",
9796
+ macedonian: "mk",
9797
+ marshallese: "mh",
9798
+ malayalam: "ml",
9799
+ maori: "mi",
9800
+ marathi: "mr",
9801
+ malay: "ms",
9802
+ malagasy: "mg",
9803
+ maltese: "mt",
9804
+ mongolian: "mn",
9805
+ nauru: "na",
9806
+ navajo: "nv",
9807
+ navaho: "nv",
9808
+ "ndebele, south": "nr",
9809
+ "south ndebele": "nr",
9810
+ "ndebele, north": "nd",
9811
+ "north ndebele": "nd",
9812
+ ndonga: "ng",
9813
+ nepali: "ne",
9814
+ "norwegian nynorsk": "nn",
9815
+ "nynorsk, norwegian": "nn",
9816
+ "norwegian bokmål": "nb",
9817
+ "bokmål, norwegian": "nb",
9818
+ norwegian: "no",
9819
+ chichewa: "ny",
9820
+ chewa: "ny",
9821
+ nyanja: "ny",
9822
+ occitan: "oc",
9823
+ ojibwa: "oj",
9824
+ oriya: "or",
9825
+ oromo: "om",
9826
+ ossetian: "os",
9827
+ ossetic: "os",
9828
+ panjabi: "pa",
9829
+ punjabi: "pa",
9830
+ pali: "pi",
9831
+ polish: "pl",
9832
+ portuguese: "pt",
9833
+ pushto: "ps",
9834
+ pashto: "ps",
9835
+ quechua: "qu",
9836
+ romansh: "rm",
9837
+ romanian: "ro",
9838
+ moldavian: "ro",
9839
+ moldovan: "ro",
9840
+ rundi: "rn",
9841
+ russian: "ru",
9842
+ sango: "sg",
9843
+ sanskrit: "sa",
9844
+ sinhala: "si",
9845
+ sinhalese: "si",
9846
+ slovak: "sk",
9847
+ slovenian: "sl",
9848
+ "northern sami": "se",
9849
+ samoan: "sm",
9850
+ shona: "sn",
9851
+ sindhi: "sd",
9852
+ somali: "so",
9853
+ "sotho, southern": "st",
9854
+ spanish: "es",
9855
+ castilian: "es",
9856
+ sardinian: "sc",
9857
+ serbian: "sr",
9858
+ swati: "ss",
9859
+ sundanese: "su",
9860
+ swahili: "sw",
9861
+ swedish: "sv",
9862
+ tahitian: "ty",
9863
+ tamil: "ta",
9864
+ tatar: "tt",
9865
+ telugu: "te",
9866
+ tajik: "tg",
9867
+ tagalog: "tl",
9868
+ thai: "th",
9869
+ tigrinya: "ti",
9870
+ tonga: "to",
9871
+ tswana: "tn",
9872
+ tsonga: "ts",
9873
+ turkmen: "tk",
9874
+ turkish: "tr",
9875
+ twi: "tw",
9876
+ uighur: "ug",
9877
+ uyghur: "ug",
9878
+ ukrainian: "uk",
9879
+ urdu: "ur",
9880
+ uzbek: "uz",
9881
+ venda: "ve",
9882
+ vietnamese: "vi",
9883
+ volapük: "vo",
9884
+ walloon: "wa",
9885
+ wolof: "wo",
9886
+ xhosa: "xh",
9887
+ yiddish: "yi",
9888
+ yoruba: "yo",
9889
+ zhuang: "za",
9890
+ chuang: "za",
9891
+ zulu: "zu",
9892
+ };
9893
+
9894
+ const nameKeys = Object.keys(languageNames).sort();
9895
+ const isoKeys = Object.keys(iso).sort();
9896
+ const iosValues = Object.values(iso);
9897
+ function isValidLanguage(name) {
9898
+ if (!name) {
9899
+ return false;
9900
+ }
9901
+ if (name === "auto") {
9902
+ return true;
9903
+ }
9624
9904
  if (name.length > 100) {
9625
9905
  throw new Error(`The "language" is too long at ${name.length} characters`);
9626
9906
  }
9627
- if (!isoKeys.includes(name)) {
9628
- throw new Error(`The language "${name}" is not part of the ISO 639-1`);
9907
+ return isoKeys.includes(name) || nameKeys.includes(name) || iosValues.includes(name);
9908
+ }
9909
+ function getISO(name) {
9910
+ if (name === "auto") {
9911
+ return name;
9912
+ }
9913
+ if (nameKeys.includes(name)) {
9914
+ return languageNames[name];
9915
+ }
9916
+ if (isoKeys.includes(name)) {
9917
+ return iso[name];
9918
+ }
9919
+ if (iosValues.includes(name)) {
9920
+ return name;
9629
9921
  }
9630
9922
  return name;
9631
9923
  }
@@ -9708,7 +10000,7 @@ function useLogger(name = "") {
9708
10000
  }
9709
10001
 
9710
10002
  const logger = useLogger();
9711
- const cache = new Cache();
10003
+ const cache$2 = new Cache();
9712
10004
  class Translator {
9713
10005
  engines;
9714
10006
  constructor() {
@@ -9722,29 +10014,32 @@ class Translator {
9722
10014
  this.engines.set(engine.name, engine);
9723
10015
  }
9724
10016
  translate(text, options) {
9725
- const { from, to, engine = "google", cache_time = 60 * 1000 } = options;
10017
+ const { engine = "google", cache_time = 60 * 1000 } = options;
10018
+ let { from = "auto", to } = options;
10019
+ from = options.from = getISO(from);
10020
+ to = options.to = getISO(to);
9726
10021
  //1. Check if engine exists
9727
10022
  if (!this.engines.has(engine)) {
9728
10023
  throw new Error(`Engine ${engine} not found`);
9729
10024
  }
9730
10025
  //2. Check if language exists
9731
- if (!language(from)) {
9732
- throw new Error(`Language ${from} not found`);
10026
+ if (!isValidLanguage(to)) {
10027
+ throw new Error(`The language "${to}" is not part of the ISO 639-1 or is not part of the language names`);
9733
10028
  }
9734
- if (!language(to)) {
9735
- throw new Error(`Language ${to} not found`);
10029
+ if (!isValidLanguage(from)) {
10030
+ throw new Error(`The language "${from}" is not part of the ISO 639-1 or is not part of the language names`);
9736
10031
  }
9737
10032
  const key = `${from}:${to}:${engine}:${text}`;
9738
10033
  //3. If the cache is matched, the cache is used directly
9739
- if (cache.get(key)) {
9740
- return cache.get(key)?.value;
10034
+ if (cache$2.get(key)) {
10035
+ return cache$2.get(key)?.value;
9741
10036
  }
9742
10037
  const engineInstance = this.engines.get(engine);
9743
10038
  if (!engineInstance) {
9744
10039
  throw new Error(`Engine ${engine} not found`);
9745
10040
  }
9746
10041
  return engineInstance.translate(text, options).then((translated) => {
9747
- cache.set(key, translated, cache_time);
10042
+ cache$2.set(key, translated, cache_time);
9748
10043
  return translated;
9749
10044
  });
9750
10045
  }
@@ -9753,6 +10048,8 @@ const translator = new Translator();
9753
10048
  var index$8 = {
9754
10049
  engines: engines$3,
9755
10050
  translator,
10051
+ Cache,
10052
+ languageNames,
9756
10053
  };
9757
10054
 
9758
10055
  function httpRequest(options) {
@@ -10941,7 +11238,7 @@ const commonParams$2 = {
10941
11238
 
10942
11239
  var name$2 = "@aws-sdk/client-sso-oidc";
10943
11240
  var description$2 = "AWS SDK for JavaScript Sso Oidc Client for Node.js, Browser and React Native";
10944
- var version$2 = "3.645.0";
11241
+ var version$2 = "3.649.0";
10945
11242
  var scripts$2 = {
10946
11243
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
10947
11244
  "build:cjs": "node ../../scripts/compilation/inline client-sso-oidc",
@@ -10960,41 +11257,41 @@ var sideEffects$2 = false;
10960
11257
  var dependencies$2 = {
10961
11258
  "@aws-crypto/sha256-browser": "5.2.0",
10962
11259
  "@aws-crypto/sha256-js": "5.2.0",
10963
- "@aws-sdk/core": "3.635.0",
10964
- "@aws-sdk/credential-provider-node": "3.645.0",
10965
- "@aws-sdk/middleware-host-header": "3.620.0",
10966
- "@aws-sdk/middleware-logger": "3.609.0",
10967
- "@aws-sdk/middleware-recursion-detection": "3.620.0",
10968
- "@aws-sdk/middleware-user-agent": "3.645.0",
10969
- "@aws-sdk/region-config-resolver": "3.614.0",
10970
- "@aws-sdk/types": "3.609.0",
10971
- "@aws-sdk/util-endpoints": "3.645.0",
10972
- "@aws-sdk/util-user-agent-browser": "3.609.0",
10973
- "@aws-sdk/util-user-agent-node": "3.614.0",
10974
- "@smithy/config-resolver": "^3.0.5",
10975
- "@smithy/core": "^2.4.0",
10976
- "@smithy/fetch-http-handler": "^3.2.4",
10977
- "@smithy/hash-node": "^3.0.3",
10978
- "@smithy/invalid-dependency": "^3.0.3",
10979
- "@smithy/middleware-content-length": "^3.0.5",
10980
- "@smithy/middleware-endpoint": "^3.1.0",
10981
- "@smithy/middleware-retry": "^3.0.15",
10982
- "@smithy/middleware-serde": "^3.0.3",
10983
- "@smithy/middleware-stack": "^3.0.3",
10984
- "@smithy/node-config-provider": "^3.1.4",
10985
- "@smithy/node-http-handler": "^3.1.4",
10986
- "@smithy/protocol-http": "^4.1.0",
10987
- "@smithy/smithy-client": "^3.2.0",
10988
- "@smithy/types": "^3.3.0",
10989
- "@smithy/url-parser": "^3.0.3",
11260
+ "@aws-sdk/core": "3.649.0",
11261
+ "@aws-sdk/credential-provider-node": "3.649.0",
11262
+ "@aws-sdk/middleware-host-header": "3.649.0",
11263
+ "@aws-sdk/middleware-logger": "3.649.0",
11264
+ "@aws-sdk/middleware-recursion-detection": "3.649.0",
11265
+ "@aws-sdk/middleware-user-agent": "3.649.0",
11266
+ "@aws-sdk/region-config-resolver": "3.649.0",
11267
+ "@aws-sdk/types": "3.649.0",
11268
+ "@aws-sdk/util-endpoints": "3.649.0",
11269
+ "@aws-sdk/util-user-agent-browser": "3.649.0",
11270
+ "@aws-sdk/util-user-agent-node": "3.649.0",
11271
+ "@smithy/config-resolver": "^3.0.6",
11272
+ "@smithy/core": "^2.4.1",
11273
+ "@smithy/fetch-http-handler": "^3.2.5",
11274
+ "@smithy/hash-node": "^3.0.4",
11275
+ "@smithy/invalid-dependency": "^3.0.4",
11276
+ "@smithy/middleware-content-length": "^3.0.6",
11277
+ "@smithy/middleware-endpoint": "^3.1.1",
11278
+ "@smithy/middleware-retry": "^3.0.16",
11279
+ "@smithy/middleware-serde": "^3.0.4",
11280
+ "@smithy/middleware-stack": "^3.0.4",
11281
+ "@smithy/node-config-provider": "^3.1.5",
11282
+ "@smithy/node-http-handler": "^3.2.0",
11283
+ "@smithy/protocol-http": "^4.1.1",
11284
+ "@smithy/smithy-client": "^3.3.0",
11285
+ "@smithy/types": "^3.4.0",
11286
+ "@smithy/url-parser": "^3.0.4",
10990
11287
  "@smithy/util-base64": "^3.0.0",
10991
11288
  "@smithy/util-body-length-browser": "^3.0.0",
10992
11289
  "@smithy/util-body-length-node": "^3.0.0",
10993
- "@smithy/util-defaults-mode-browser": "^3.0.15",
10994
- "@smithy/util-defaults-mode-node": "^3.0.15",
10995
- "@smithy/util-endpoints": "^2.0.5",
10996
- "@smithy/util-middleware": "^3.0.3",
10997
- "@smithy/util-retry": "^3.0.3",
11290
+ "@smithy/util-defaults-mode-browser": "^3.0.16",
11291
+ "@smithy/util-defaults-mode-node": "^3.0.16",
11292
+ "@smithy/util-endpoints": "^2.1.0",
11293
+ "@smithy/util-middleware": "^3.0.4",
11294
+ "@smithy/util-retry": "^3.0.4",
10998
11295
  "@smithy/util-utf8": "^3.0.0",
10999
11296
  tslib: "^2.6.2"
11000
11297
  };
@@ -11025,7 +11322,7 @@ var author$2 = {
11025
11322
  };
11026
11323
  var license$2 = "Apache-2.0";
11027
11324
  var peerDependencies = {
11028
- "@aws-sdk/client-sts": "^3.645.0"
11325
+ "@aws-sdk/client-sts": "^3.649.0"
11029
11326
  };
11030
11327
  var browser$2 = {
11031
11328
  "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser"
@@ -11865,7 +12162,7 @@ const commonParams$1 = {
11865
12162
 
11866
12163
  var name$1 = "@aws-sdk/client-sso";
11867
12164
  var description$1 = "AWS SDK for JavaScript Sso Client for Node.js, Browser and React Native";
11868
- var version$1 = "3.645.0";
12165
+ var version$1 = "3.649.0";
11869
12166
  var scripts$1 = {
11870
12167
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
11871
12168
  "build:cjs": "node ../../scripts/compilation/inline client-sso",
@@ -11884,40 +12181,40 @@ var sideEffects$1 = false;
11884
12181
  var dependencies$1 = {
11885
12182
  "@aws-crypto/sha256-browser": "5.2.0",
11886
12183
  "@aws-crypto/sha256-js": "5.2.0",
11887
- "@aws-sdk/core": "3.635.0",
11888
- "@aws-sdk/middleware-host-header": "3.620.0",
11889
- "@aws-sdk/middleware-logger": "3.609.0",
11890
- "@aws-sdk/middleware-recursion-detection": "3.620.0",
11891
- "@aws-sdk/middleware-user-agent": "3.645.0",
11892
- "@aws-sdk/region-config-resolver": "3.614.0",
11893
- "@aws-sdk/types": "3.609.0",
11894
- "@aws-sdk/util-endpoints": "3.645.0",
11895
- "@aws-sdk/util-user-agent-browser": "3.609.0",
11896
- "@aws-sdk/util-user-agent-node": "3.614.0",
11897
- "@smithy/config-resolver": "^3.0.5",
11898
- "@smithy/core": "^2.4.0",
11899
- "@smithy/fetch-http-handler": "^3.2.4",
11900
- "@smithy/hash-node": "^3.0.3",
11901
- "@smithy/invalid-dependency": "^3.0.3",
11902
- "@smithy/middleware-content-length": "^3.0.5",
11903
- "@smithy/middleware-endpoint": "^3.1.0",
11904
- "@smithy/middleware-retry": "^3.0.15",
11905
- "@smithy/middleware-serde": "^3.0.3",
11906
- "@smithy/middleware-stack": "^3.0.3",
11907
- "@smithy/node-config-provider": "^3.1.4",
11908
- "@smithy/node-http-handler": "^3.1.4",
11909
- "@smithy/protocol-http": "^4.1.0",
11910
- "@smithy/smithy-client": "^3.2.0",
11911
- "@smithy/types": "^3.3.0",
11912
- "@smithy/url-parser": "^3.0.3",
12184
+ "@aws-sdk/core": "3.649.0",
12185
+ "@aws-sdk/middleware-host-header": "3.649.0",
12186
+ "@aws-sdk/middleware-logger": "3.649.0",
12187
+ "@aws-sdk/middleware-recursion-detection": "3.649.0",
12188
+ "@aws-sdk/middleware-user-agent": "3.649.0",
12189
+ "@aws-sdk/region-config-resolver": "3.649.0",
12190
+ "@aws-sdk/types": "3.649.0",
12191
+ "@aws-sdk/util-endpoints": "3.649.0",
12192
+ "@aws-sdk/util-user-agent-browser": "3.649.0",
12193
+ "@aws-sdk/util-user-agent-node": "3.649.0",
12194
+ "@smithy/config-resolver": "^3.0.6",
12195
+ "@smithy/core": "^2.4.1",
12196
+ "@smithy/fetch-http-handler": "^3.2.5",
12197
+ "@smithy/hash-node": "^3.0.4",
12198
+ "@smithy/invalid-dependency": "^3.0.4",
12199
+ "@smithy/middleware-content-length": "^3.0.6",
12200
+ "@smithy/middleware-endpoint": "^3.1.1",
12201
+ "@smithy/middleware-retry": "^3.0.16",
12202
+ "@smithy/middleware-serde": "^3.0.4",
12203
+ "@smithy/middleware-stack": "^3.0.4",
12204
+ "@smithy/node-config-provider": "^3.1.5",
12205
+ "@smithy/node-http-handler": "^3.2.0",
12206
+ "@smithy/protocol-http": "^4.1.1",
12207
+ "@smithy/smithy-client": "^3.3.0",
12208
+ "@smithy/types": "^3.4.0",
12209
+ "@smithy/url-parser": "^3.0.4",
11913
12210
  "@smithy/util-base64": "^3.0.0",
11914
12211
  "@smithy/util-body-length-browser": "^3.0.0",
11915
12212
  "@smithy/util-body-length-node": "^3.0.0",
11916
- "@smithy/util-defaults-mode-browser": "^3.0.15",
11917
- "@smithy/util-defaults-mode-node": "^3.0.15",
11918
- "@smithy/util-endpoints": "^2.0.5",
11919
- "@smithy/util-middleware": "^3.0.3",
11920
- "@smithy/util-retry": "^3.0.3",
12213
+ "@smithy/util-defaults-mode-browser": "^3.0.16",
12214
+ "@smithy/util-defaults-mode-node": "^3.0.16",
12215
+ "@smithy/util-endpoints": "^2.1.0",
12216
+ "@smithy/util-middleware": "^3.0.4",
12217
+ "@smithy/util-retry": "^3.0.4",
11921
12218
  "@smithy/util-utf8": "^3.0.0",
11922
12219
  tslib: "^2.6.2"
11923
12220
  };
@@ -11985,11 +12282,15 @@ const a$1 = true, b$1 = "isSet", c$1 = "booleanEquals", d$1 = "error", e$1 = "en
11985
12282
  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 }] };
11986
12283
  const ruleSet$1 = _data$1;
11987
12284
 
12285
+ const cache$1 = new EndpointCache({
12286
+ size: 50,
12287
+ params: ["Endpoint", "Region", "UseDualStack", "UseFIPS"],
12288
+ });
11988
12289
  const defaultEndpointResolver$1 = (endpointParams, context = {}) => {
11989
- return resolveEndpoint(ruleSet$1, {
12290
+ return cache$1.get(endpointParams, () => resolveEndpoint(ruleSet$1, {
11990
12291
  endpointParams: endpointParams,
11991
12292
  logger: context.logger,
11992
- });
12293
+ }));
11993
12294
  };
11994
12295
  customEndpointFunctions.aws = awsEndpointFunctions;
11995
12296
 
@@ -12438,7 +12739,7 @@ const commonParams = {
12438
12739
 
12439
12740
  var name = "@aws-sdk/client-sts";
12440
12741
  var description = "AWS SDK for JavaScript Sts Client for Node.js, Browser and React Native";
12441
- var version = "3.645.0";
12742
+ var version = "3.649.0";
12442
12743
  var scripts = {
12443
12744
  build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
12444
12745
  "build:cjs": "node ../../scripts/compilation/inline client-sts",
@@ -12459,42 +12760,42 @@ var sideEffects = false;
12459
12760
  var dependencies = {
12460
12761
  "@aws-crypto/sha256-browser": "5.2.0",
12461
12762
  "@aws-crypto/sha256-js": "5.2.0",
12462
- "@aws-sdk/client-sso-oidc": "3.645.0",
12463
- "@aws-sdk/core": "3.635.0",
12464
- "@aws-sdk/credential-provider-node": "3.645.0",
12465
- "@aws-sdk/middleware-host-header": "3.620.0",
12466
- "@aws-sdk/middleware-logger": "3.609.0",
12467
- "@aws-sdk/middleware-recursion-detection": "3.620.0",
12468
- "@aws-sdk/middleware-user-agent": "3.645.0",
12469
- "@aws-sdk/region-config-resolver": "3.614.0",
12470
- "@aws-sdk/types": "3.609.0",
12471
- "@aws-sdk/util-endpoints": "3.645.0",
12472
- "@aws-sdk/util-user-agent-browser": "3.609.0",
12473
- "@aws-sdk/util-user-agent-node": "3.614.0",
12474
- "@smithy/config-resolver": "^3.0.5",
12475
- "@smithy/core": "^2.4.0",
12476
- "@smithy/fetch-http-handler": "^3.2.4",
12477
- "@smithy/hash-node": "^3.0.3",
12478
- "@smithy/invalid-dependency": "^3.0.3",
12479
- "@smithy/middleware-content-length": "^3.0.5",
12480
- "@smithy/middleware-endpoint": "^3.1.0",
12481
- "@smithy/middleware-retry": "^3.0.15",
12482
- "@smithy/middleware-serde": "^3.0.3",
12483
- "@smithy/middleware-stack": "^3.0.3",
12484
- "@smithy/node-config-provider": "^3.1.4",
12485
- "@smithy/node-http-handler": "^3.1.4",
12486
- "@smithy/protocol-http": "^4.1.0",
12487
- "@smithy/smithy-client": "^3.2.0",
12488
- "@smithy/types": "^3.3.0",
12489
- "@smithy/url-parser": "^3.0.3",
12763
+ "@aws-sdk/client-sso-oidc": "3.649.0",
12764
+ "@aws-sdk/core": "3.649.0",
12765
+ "@aws-sdk/credential-provider-node": "3.649.0",
12766
+ "@aws-sdk/middleware-host-header": "3.649.0",
12767
+ "@aws-sdk/middleware-logger": "3.649.0",
12768
+ "@aws-sdk/middleware-recursion-detection": "3.649.0",
12769
+ "@aws-sdk/middleware-user-agent": "3.649.0",
12770
+ "@aws-sdk/region-config-resolver": "3.649.0",
12771
+ "@aws-sdk/types": "3.649.0",
12772
+ "@aws-sdk/util-endpoints": "3.649.0",
12773
+ "@aws-sdk/util-user-agent-browser": "3.649.0",
12774
+ "@aws-sdk/util-user-agent-node": "3.649.0",
12775
+ "@smithy/config-resolver": "^3.0.6",
12776
+ "@smithy/core": "^2.4.1",
12777
+ "@smithy/fetch-http-handler": "^3.2.5",
12778
+ "@smithy/hash-node": "^3.0.4",
12779
+ "@smithy/invalid-dependency": "^3.0.4",
12780
+ "@smithy/middleware-content-length": "^3.0.6",
12781
+ "@smithy/middleware-endpoint": "^3.1.1",
12782
+ "@smithy/middleware-retry": "^3.0.16",
12783
+ "@smithy/middleware-serde": "^3.0.4",
12784
+ "@smithy/middleware-stack": "^3.0.4",
12785
+ "@smithy/node-config-provider": "^3.1.5",
12786
+ "@smithy/node-http-handler": "^3.2.0",
12787
+ "@smithy/protocol-http": "^4.1.1",
12788
+ "@smithy/smithy-client": "^3.3.0",
12789
+ "@smithy/types": "^3.4.0",
12790
+ "@smithy/url-parser": "^3.0.4",
12490
12791
  "@smithy/util-base64": "^3.0.0",
12491
12792
  "@smithy/util-body-length-browser": "^3.0.0",
12492
12793
  "@smithy/util-body-length-node": "^3.0.0",
12493
- "@smithy/util-defaults-mode-browser": "^3.0.15",
12494
- "@smithy/util-defaults-mode-node": "^3.0.15",
12495
- "@smithy/util-endpoints": "^2.0.5",
12496
- "@smithy/util-middleware": "^3.0.3",
12497
- "@smithy/util-retry": "^3.0.3",
12794
+ "@smithy/util-defaults-mode-browser": "^3.0.16",
12795
+ "@smithy/util-defaults-mode-node": "^3.0.16",
12796
+ "@smithy/util-endpoints": "^2.1.0",
12797
+ "@smithy/util-middleware": "^3.0.4",
12798
+ "@smithy/util-retry": "^3.0.4",
12498
12799
  "@smithy/util-utf8": "^3.0.0",
12499
12800
  tslib: "^2.6.2"
12500
12801
  };
@@ -12562,11 +12863,15 @@ const a = false, b = true, c = "booleanEquals", d = "stringEquals", e = "sigv4",
12562
12863
  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 }] };
12563
12864
  const ruleSet = _data;
12564
12865
 
12866
+ const cache = new EndpointCache({
12867
+ size: 50,
12868
+ params: ["Endpoint", "Region", "UseDualStack", "UseFIPS", "UseGlobalEndpoint"],
12869
+ });
12565
12870
  const defaultEndpointResolver = (endpointParams, context = {}) => {
12566
- return resolveEndpoint(ruleSet, {
12871
+ return cache.get(endpointParams, () => resolveEndpoint(ruleSet, {
12567
12872
  endpointParams: endpointParams,
12568
12873
  logger: context.logger,
12569
- });
12874
+ }));
12570
12875
  };
12571
12876
  customEndpointFunctions.aws = awsEndpointFunctions;
12572
12877
 
@@ -13550,5 +13855,6 @@ var index = /*#__PURE__*/Object.freeze({
13550
13855
  exports.Cache = Cache;
13551
13856
  exports.default = index$8;
13552
13857
  exports.engines = engines$3;
13858
+ exports.languageNames = languageNames;
13553
13859
  exports.translator = translator;
13554
13860
  //# sourceMappingURL=index.cjs.map