nosible 0.2.10 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -970,18 +970,9 @@ class TopicTrend {
970
970
  // src/utils/userPlan.ts
971
971
  var import_bottleneck = __toESM(require("bottleneck"));
972
972
  var planLimits = [
973
- {
974
- key: "test",
975
- name: "Test",
976
- rateLimits: {
977
- scrapeUrl: { minute: 60, month: 300 },
978
- bulk: { minute: 60, month: 300 },
979
- fast: { minute: 60, month: 3000 }
980
- }
981
- },
982
973
  {
983
974
  key: "basic",
984
- name: "Basic",
975
+ name: "Legacy",
985
976
  rateLimits: {
986
977
  scrapeUrl: { minute: 60, month: 1400 },
987
978
  bulk: { minute: 60, month: 1400 },
@@ -990,7 +981,7 @@ var planLimits = [
990
981
  },
991
982
  {
992
983
  key: "pro",
993
- name: "Pro",
984
+ name: "Legacy",
994
985
  rateLimits: {
995
986
  scrapeUrl: { minute: 60, month: 6700 },
996
987
  bulk: { minute: 60, month: 6700 },
@@ -999,7 +990,7 @@ var planLimits = [
999
990
  },
1000
991
  {
1001
992
  key: "pro+",
1002
- name: "Pro+",
993
+ name: "Legacy",
1003
994
  rateLimits: {
1004
995
  scrapeUrl: { minute: 60, month: 32000 },
1005
996
  bulk: { minute: 60, month: 32000 },
@@ -1008,7 +999,7 @@ var planLimits = [
1008
999
  },
1009
1000
  {
1010
1001
  key: "bus",
1011
- name: "Business",
1002
+ name: "Legacy",
1012
1003
  rateLimits: {
1013
1004
  scrapeUrl: { minute: 60, month: 200000 },
1014
1005
  bulk: { minute: 60, month: 200000 },
@@ -1017,25 +1008,16 @@ var planLimits = [
1017
1008
  },
1018
1009
  {
1019
1010
  key: "bus+",
1020
- name: "Business+",
1011
+ name: "Legacy",
1021
1012
  rateLimits: {
1022
1013
  scrapeUrl: { minute: 60, month: 500000 },
1023
1014
  bulk: { minute: 60, month: 500000 },
1024
1015
  fast: { minute: 120, month: 5000000 }
1025
1016
  }
1026
1017
  },
1027
- {
1028
- key: "ent",
1029
- name: "Enterprise",
1030
- rateLimits: {
1031
- scrapeUrl: { minute: 60, month: 1500000 },
1032
- bulk: { minute: 60, month: 1500000 },
1033
- fast: { minute: 360, month: 15000000 }
1034
- }
1035
- },
1036
1018
  {
1037
1019
  key: "prod",
1038
- name: "Production",
1020
+ name: "Legacy",
1039
1021
  rateLimits: {
1040
1022
  scrapeUrl: { minute: 60, month: 1500000 },
1041
1023
  bulk: { minute: 60, month: 1500000 },
@@ -1044,7 +1026,7 @@ var planLimits = [
1044
1026
  },
1045
1027
  {
1046
1028
  key: "chat",
1047
- name: "Chat",
1029
+ name: "Legacy",
1048
1030
  rateLimits: {
1049
1031
  scrapeUrl: { minute: 60, month: 1500000 },
1050
1032
  bulk: { minute: 60, month: 1500000 },
@@ -1053,13 +1035,22 @@ var planLimits = [
1053
1035
  },
1054
1036
  {
1055
1037
  key: "self",
1056
- name: "Self",
1038
+ name: "Legacy",
1057
1039
  rateLimits: {
1058
1040
  scrapeUrl: { minute: 6000, month: 1500000 },
1059
1041
  bulk: { minute: 6000, month: 1500000 },
1060
1042
  fast: { minute: 36000, month: 15000000 }
1061
1043
  }
1062
1044
  },
1045
+ {
1046
+ key: "test",
1047
+ name: "Free",
1048
+ rateLimits: {
1049
+ scrapeUrl: { minute: 60, month: 300 },
1050
+ bulk: { minute: 60, month: 300 },
1051
+ fast: { minute: 60, month: 3000 }
1052
+ }
1053
+ },
1063
1054
  {
1064
1055
  key: "cons",
1065
1056
  name: "Consumer",
@@ -1080,15 +1071,27 @@ var planLimits = [
1080
1071
  },
1081
1072
  {
1082
1073
  key: "busn",
1083
- name: "Business Network",
1074
+ name: "Business",
1084
1075
  rateLimits: {
1085
1076
  scrapeUrl: { minute: 60, month: 300000 },
1086
1077
  bulk: { minute: 60, month: 300000 },
1087
1078
  fast: { minute: 360, month: 3000000 }
1088
1079
  }
1080
+ },
1081
+ {
1082
+ key: "ent",
1083
+ name: "Enterprise",
1084
+ rateLimits: {
1085
+ scrapeUrl: { minute: 60, month: 1500000 },
1086
+ bulk: { minute: 60, month: 1500000 },
1087
+ fast: { minute: 360, month: 15000000 }
1088
+ }
1089
1089
  }
1090
1090
  ];
1091
1091
  var getUserPlan = (apiKey) => {
1092
+ if (apiKey.split("|").length > 2) {
1093
+ throw new Error("Invalid API key");
1094
+ }
1092
1095
  const planKey = apiKey.split("|")[0];
1093
1096
  const plan = planLimits.find((p) => p.key === planKey);
1094
1097
  if (!plan) {
@@ -1395,8 +1398,10 @@ var analyzeDateByMonth = (arr) => {
1395
1398
  // src/search/resultSet.ts
1396
1399
  class ResultSet {
1397
1400
  results;
1401
+ length;
1398
1402
  constructor(results) {
1399
1403
  this.results = results;
1404
+ this.length = results.length;
1400
1405
  }
1401
1406
  static async fromFilePath(filePath, client) {
1402
1407
  if (filePath.endsWith(".json")) {
@@ -1691,7 +1696,7 @@ var fastSearchesParamsSchema = import_zod7.default.union([
1691
1696
  var nosibleClientParams = import_zod7.default.union([
1692
1697
  import_zod7.default.string(),
1693
1698
  import_zod7.default.object({
1694
- apiKey: import_zod7.default.string(),
1699
+ apiKey: import_zod7.default.string().optional(),
1695
1700
  llmApiKey: import_zod7.default.string().optional(),
1696
1701
  openAiBaseURL: import_zod7.default.string().optional(),
1697
1702
  sentimentModel: import_zod7.default.string().optional(),
@@ -1716,8 +1721,8 @@ class NosibleClient {
1716
1721
  if (typeof params === "string") {
1717
1722
  apiKeyToUse = params;
1718
1723
  } else if (params) {
1719
- apiKeyToUse = params.apiKey;
1720
- llmApiKeyToUse = params.llmApiKey;
1724
+ apiKeyToUse = params.apiKey || process.env.NOSIBLE_API_KEY;
1725
+ llmApiKeyToUse = params.llmApiKey || process.env.LLM_API_KEY;
1721
1726
  openAiBaseURL = params.openAiBaseURL;
1722
1727
  searchDefaultsToUse = params.searchDefaults;
1723
1728
  } else {
@@ -1857,4 +1862,4 @@ class NosibleClient {
1857
1862
  }
1858
1863
  }
1859
1864
 
1860
- //# debugId=2A981BDEE1C9373964756E2164756E21
1865
+ //# debugId=88064A0B7CBC67C664756E2164756E21