@outlit/cli 1.6.3 → 1.6.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/cli.js +136 -16
  2. package/package.json +2 -2
package/dist/cli.js CHANGED
@@ -104,7 +104,7 @@ var package_default;
104
104
  var init_package = __esm(() => {
105
105
  package_default = {
106
106
  name: "@outlit/cli",
107
- version: "1.6.3",
107
+ version: "1.6.4",
108
108
  description: "CLI for Outlit customer intelligence platform",
109
109
  license: "Apache-2.0",
110
110
  repository: {
@@ -135,7 +135,7 @@ var init_package = __esm(() => {
135
135
  },
136
136
  dependencies: {
137
137
  "@clack/prompts": "^1.0.1",
138
- "@outlit/tools": "^0.1.2",
138
+ "@outlit/tools": "^0.1.3",
139
139
  citty: "^0.2.1"
140
140
  },
141
141
  devDependencies: {
@@ -1494,10 +1494,11 @@ function isCustomerToolName(value) {
1494
1494
  return customerToolNameSet.has(value);
1495
1495
  }
1496
1496
  function normalizeCustomerSourceType(value) {
1497
- if (customerSourceTypeSet.has(value)) {
1498
- return value;
1497
+ const normalizedValue = value.trim().toUpperCase();
1498
+ if (customerSourceTypeSet.has(normalizedValue)) {
1499
+ return normalizedValue;
1499
1500
  }
1500
- return customerSourceTypeAliasMap.get(value) ?? null;
1501
+ return customerSourceTypeAliasMap.get(normalizedValue) ?? null;
1501
1502
  }
1502
1503
  function resolveCustomerContextSearchInput(value) {
1503
1504
  if (!value.query) {
@@ -2629,7 +2630,8 @@ ${hint}`);
2629
2630
  async function runTool(client, toolName, params, json, opts) {
2630
2631
  const spinner = opts?.spinnerMessage ? createSpinner(opts.spinnerMessage) : null;
2631
2632
  try {
2632
- const data = await client.callTool(toolName, params);
2633
+ const rawData = await client.callTool(toolName, params);
2634
+ const data = opts?.transform ? opts.transform(rawData) : rawData;
2633
2635
  spinner?.stop("Done");
2634
2636
  const table = opts?.table;
2635
2637
  if (isJsonMode(json) || !table) {
@@ -2965,6 +2967,35 @@ var init_auth2 = __esm(() => {
2965
2967
  });
2966
2968
 
2967
2969
  // src/args/filters.ts
2970
+ function findRawStringFlagValue(rawArgs, flagName) {
2971
+ if (!rawArgs)
2972
+ return;
2973
+ const flag = `--${flagName}`;
2974
+ let found;
2975
+ for (let i = 0;i < rawArgs.length; i++) {
2976
+ const arg = rawArgs[i];
2977
+ if (!arg)
2978
+ continue;
2979
+ if (arg.startsWith(`${flag}=`)) {
2980
+ const value = arg.slice(flag.length + 1);
2981
+ if (value.length > 0)
2982
+ found = value;
2983
+ continue;
2984
+ }
2985
+ if (arg === flag) {
2986
+ const value = rawArgs[i + 1];
2987
+ if (value && !value.startsWith("-"))
2988
+ found = value;
2989
+ }
2990
+ }
2991
+ return found;
2992
+ }
2993
+ function readStringArg(args, flagName, rawArgs) {
2994
+ const value = args[flagName];
2995
+ if (typeof value === "string" && value.length > 0)
2996
+ return value;
2997
+ return findRawStringFlagValue(rawArgs, flagName);
2998
+ }
2968
2999
  function parseTraitFilterValue(value) {
2969
3000
  if (value === "true")
2970
3001
  return true;
@@ -2997,11 +3028,14 @@ function parseTraitFilters(input) {
2997
3028
  }
2998
3029
  return filters;
2999
3030
  }
3000
- function applyListFilters(params, args) {
3001
- if (args["no-activity-in"])
3002
- params.noActivityInLast = args["no-activity-in"];
3003
- if (args["has-activity-in"])
3004
- params.hasActivityInLast = args["has-activity-in"];
3031
+ function applyListFilters(params, args, rawArgs) {
3032
+ const argsRecord = args;
3033
+ const noActivityIn = readStringArg(argsRecord, "no-activity-in", rawArgs);
3034
+ const hasActivityIn = readStringArg(argsRecord, "has-activity-in", rawArgs);
3035
+ if (noActivityIn)
3036
+ params.noActivityInLast = noActivityIn;
3037
+ if (hasActivityIn)
3038
+ params.hasActivityInLast = hasActivityIn;
3005
3039
  if (args.search)
3006
3040
  params.search = args.search;
3007
3041
  if (args["order-by"])
@@ -3130,6 +3164,33 @@ var exports_list = {};
3130
3164
  __export(exports_list, {
3131
3165
  default: () => list_default
3132
3166
  });
3167
+ function normalizeCustomerListResult(data) {
3168
+ if (typeof data !== "object" || data === null || Array.isArray(data)) {
3169
+ return data;
3170
+ }
3171
+ const record = data;
3172
+ if (!Array.isArray(record.items)) {
3173
+ return data;
3174
+ }
3175
+ return {
3176
+ ...record,
3177
+ items: record.items.map((item) => {
3178
+ if (typeof item !== "object" || item === null || Array.isArray(item)) {
3179
+ return item;
3180
+ }
3181
+ const customer = item;
3182
+ const daysSinceActivity = customer.daysSinceActivity;
3183
+ if (typeof daysSinceActivity !== "number" || daysSinceActivity >= 0) {
3184
+ return item;
3185
+ }
3186
+ return {
3187
+ ...customer,
3188
+ lastActivityAt: null,
3189
+ daysSinceActivity: null
3190
+ };
3191
+ })
3192
+ };
3193
+ }
3133
3194
  var list_default;
3134
3195
  var init_list = __esm(() => {
3135
3196
  init_dist4();
@@ -3187,7 +3248,7 @@ var init_list = __esm(() => {
3187
3248
  description: "Search by customer name or domain"
3188
3249
  }
3189
3250
  },
3190
- async run({ args }) {
3251
+ async run({ args, rawArgs }) {
3191
3252
  const json = !!args.json;
3192
3253
  const client = await getClientOrExit(args["api-key"], json);
3193
3254
  const params = {};
@@ -3220,10 +3281,11 @@ var init_list = __esm(() => {
3220
3281
  }, json);
3221
3282
  }
3222
3283
  }
3223
- applyListFilters(params, args);
3284
+ applyListFilters(params, args, rawArgs);
3224
3285
  applyPagination(params, args, json);
3225
3286
  return runTool(client, customerToolContracts.outlit_list_customers.toolName, params, json, {
3226
3287
  spinnerMessage: "Fetching customers...",
3288
+ transform: normalizeCustomerListResult,
3227
3289
  table: {
3228
3290
  columns: [
3229
3291
  { header: "Name", key: "name", format: (v) => truncate(v, 24) },
@@ -3499,7 +3561,7 @@ var init_list2 = __esm(() => {
3499
3561
  description: "Search by user name or email"
3500
3562
  }
3501
3563
  },
3502
- async run({ args }) {
3564
+ async run({ args, rawArgs }) {
3503
3565
  const json = !!args.json;
3504
3566
  const client = await getClientOrExit(args["api-key"], json);
3505
3567
  const params = {};
@@ -3520,7 +3582,7 @@ var init_list2 = __esm(() => {
3520
3582
  }, json);
3521
3583
  }
3522
3584
  }
3523
- applyListFilters(params, args);
3585
+ applyListFilters(params, args, rawArgs);
3524
3586
  applyPagination(params, args, json);
3525
3587
  return runTool(client, customerToolContracts.outlit_list_users.toolName, params, json, {
3526
3588
  spinnerMessage: "Fetching users...",
@@ -4531,6 +4593,34 @@ function normalizeSourceTypes(values) {
4531
4593
  return;
4532
4594
  return Array.from(new Set(values.map((value) => normalizeCustomerSourceType(value)))).filter((sourceType) => sourceType !== null);
4533
4595
  }
4596
+ function isOneOf(values, value) {
4597
+ return typeof value === "string" && values.includes(value);
4598
+ }
4599
+ function annotateFactFilterability(data) {
4600
+ if (typeof data !== "object" || data === null || Array.isArray(data)) {
4601
+ return data;
4602
+ }
4603
+ const record = data;
4604
+ if (!Array.isArray(record.facts)) {
4605
+ return data;
4606
+ }
4607
+ return {
4608
+ ...record,
4609
+ facts: record.facts.map((fact) => {
4610
+ if (typeof fact !== "object" || fact === null || Array.isArray(fact)) {
4611
+ return fact;
4612
+ }
4613
+ const factRecord = fact;
4614
+ return {
4615
+ ...factRecord,
4616
+ filterability: {
4617
+ factType: isOneOf(customerFactTypes, factRecord.factType) ? "public" : "internal",
4618
+ factCategory: isOneOf(customerFactCategories, factRecord.factCategory) ? "public" : "internal"
4619
+ }
4620
+ };
4621
+ })
4622
+ };
4623
+ }
4534
4624
  var sourceTypeDescription, list_default3;
4535
4625
  var init_list3 = __esm(() => {
4536
4626
  init_dist4();
@@ -4680,7 +4770,9 @@ var init_list3 = __esm(() => {
4680
4770
  if (args.before)
4681
4771
  params.before = args.before;
4682
4772
  applyPagination(params, args, json);
4683
- return runTool(client, customerToolContracts.outlit_list_facts.toolName, params, json);
4773
+ return runTool(client, customerToolContracts.outlit_list_facts.toolName, params, json, {
4774
+ transform: annotateFactFilterability
4775
+ });
4684
4776
  }
4685
4777
  });
4686
4778
  });
@@ -5301,14 +5393,22 @@ var INTEGRATION_PROVIDERS, PROVIDER_NAMES;
5301
5393
  var init_providers = __esm(() => {
5302
5394
  init_output();
5303
5395
  INTEGRATION_PROVIDERS = {
5396
+ hubspot: { id: "hubspot", name: "HubSpot", category: "crm", authType: "oauth" },
5304
5397
  slack: { id: "slack", name: "Slack", category: "communication", authType: "oauth" },
5305
5398
  gmail: { id: "google-mail", name: "Gmail", category: "communication", authType: "oauth" },
5399
+ "google-mail": {
5400
+ id: "google-mail",
5401
+ name: "Gmail",
5402
+ category: "communication",
5403
+ authType: "oauth"
5404
+ },
5306
5405
  "google-calendar": {
5307
5406
  id: "google-calendar",
5308
5407
  name: "Google Calendar",
5309
5408
  category: "calendar",
5310
5409
  authType: "oauth"
5311
5410
  },
5411
+ granola: { id: "granola", name: "Granola", category: "calls", authType: "oauth" },
5312
5412
  pylon: {
5313
5413
  id: "pylon",
5314
5414
  name: "Pylon",
@@ -5732,6 +5832,25 @@ var exports_status2 = {};
5732
5832
  __export(exports_status2, {
5733
5833
  default: () => status_default2
5734
5834
  });
5835
+ function hideBlankModelSyncs(data) {
5836
+ if (typeof data !== "object" || data === null || Array.isArray(data)) {
5837
+ return data;
5838
+ }
5839
+ const record = data;
5840
+ if (!Array.isArray(record.syncs)) {
5841
+ return data;
5842
+ }
5843
+ return {
5844
+ ...record,
5845
+ syncs: record.syncs.filter((sync) => {
5846
+ if (typeof sync !== "object" || sync === null || Array.isArray(sync)) {
5847
+ return false;
5848
+ }
5849
+ const model = sync.model;
5850
+ return typeof model === "string" && model.trim().length > 0;
5851
+ })
5852
+ };
5853
+ }
5735
5854
  var status_default2;
5736
5855
  var init_status2 = __esm(() => {
5737
5856
  init_dist();
@@ -5772,6 +5891,7 @@ var init_status2 = __esm(() => {
5772
5891
  const { provider } = resolveProviderOrExit(args.provider, json);
5773
5892
  return runTool(client, "outlit_integration_sync_status", { provider: provider.id }, json, {
5774
5893
  spinnerMessage: "Fetching sync status...",
5894
+ transform: hideBlankModelSyncs,
5775
5895
  table: {
5776
5896
  columns: [
5777
5897
  { header: "Model", key: "model" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outlit/cli",
3
- "version": "1.6.3",
3
+ "version": "1.6.4",
4
4
  "description": "CLI for Outlit customer intelligence platform",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@clack/prompts": "^1.0.1",
34
- "@outlit/tools": "^0.1.2",
34
+ "@outlit/tools": "^0.1.3",
35
35
  "citty": "^0.2.1"
36
36
  },
37
37
  "devDependencies": {