@outlit/cli 3.2.4 → 3.2.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.
Files changed (2) hide show
  1. package/dist/cli.js +260 -6
  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: "3.2.4",
107
+ version: "3.2.5",
108
108
  description: "CLI for querying Outlit customer context and installing agent skills",
109
109
  license: "Apache-2.0",
110
110
  repository: {
@@ -147,7 +147,7 @@ var init_package = __esm(() => {
147
147
  },
148
148
  dependencies: {
149
149
  "@clack/prompts": "^1.0.1",
150
- "@outlit/tools": "^2.2.3",
150
+ "@outlit/tools": "^2.2.4",
151
151
  citty: "^0.2.1"
152
152
  },
153
153
  devDependencies: {
@@ -1715,7 +1715,7 @@ function matchesNumberBounds(value, schema, integer) {
1715
1715
  return false;
1716
1716
  return true;
1717
1717
  }
1718
- var publicToolNames, publicToolContracts, consumerToolPolicies, toolGatewayTransport, apiKeyValidationTransport, apiKeyValidationSuccessSchema, apiKeyValidationFailureSchema, toolGatewayErrorSchema, customerBillingStatuses, customerFactStatuses, customerFactTypes, unsupportedCustomerFactTypes, customerFactCategories, customerIncludeSections, customerSourceTypes, customerSourceTypeAliasMap, customerSourceTypeAliases, customerSourceTypeInputs, customerTimeframes, timelineChannels, timelineTimeframes, userJourneyStages, workspaceUserListOrderFields, publicToolNameSet, customerSourceTypeSet, iso8601UtcDateTimeRegex, DEFAULT_OUTLIT_API_URL = "https://app.outlit.ai", OutlitToolsApiError, defaultToolNames, analyticalToolNames, piToolNames, cliToolNames, defaultToolNameSet, sqlToolNames;
1718
+ var publicToolNames, publicToolContracts, consumerToolPolicies, toolGatewayTransport, apiKeyValidationTransport, apiKeyValidationSuccessSchema, apiKeyValidationFailureSchema, apiKeyContractHeader = "Outlit-Api-Key-Contract", apiKeyValidationSuccessSchemaV2, toolGatewayErrorSchema, customerBillingStatuses, customerFactStatuses, customerFactTypes, unsupportedCustomerFactTypes, customerFactCategories, customerIncludeSections, customerSourceTypes, customerSourceTypeAliasMap, customerSourceTypeAliases, customerSourceTypeInputs, customerTimeframes, timelineChannels, timelineTimeframes, userJourneyStages, workspaceUserListOrderFields, publicToolNameSet, customerSourceTypeSet, iso8601UtcDateTimeRegex, DEFAULT_OUTLIT_API_URL = "https://app.outlit.ai", OutlitToolsApiError, defaultToolNames, analyticalToolNames, piToolNames, cliToolNames, defaultToolNameSet, sqlToolNames;
1719
1719
  var init_dist4 = __esm(() => {
1720
1720
  publicToolNames = [
1721
1721
  "outlit_list_customers",
@@ -17774,6 +17774,226 @@ Returns column definitions and example queries for each view.`,
17774
17774
  ],
17775
17775
  additionalProperties: false
17776
17776
  };
17777
+ apiKeyValidationSuccessSchemaV2 = {
17778
+ $schema: "https://json-schema.org/draft/2020-12/schema",
17779
+ type: "object",
17780
+ properties: {
17781
+ valid: {
17782
+ type: "boolean",
17783
+ const: true
17784
+ },
17785
+ organizationId: {
17786
+ type: "string"
17787
+ },
17788
+ createdById: {
17789
+ anyOf: [
17790
+ {
17791
+ type: "string"
17792
+ },
17793
+ {
17794
+ type: "null"
17795
+ }
17796
+ ]
17797
+ },
17798
+ organization: {
17799
+ type: "object",
17800
+ properties: {
17801
+ id: {
17802
+ type: "string"
17803
+ },
17804
+ name: {
17805
+ anyOf: [
17806
+ {
17807
+ type: "string"
17808
+ },
17809
+ {
17810
+ type: "null"
17811
+ }
17812
+ ]
17813
+ },
17814
+ slug: {
17815
+ anyOf: [
17816
+ {
17817
+ type: "string"
17818
+ },
17819
+ {
17820
+ type: "null"
17821
+ }
17822
+ ]
17823
+ }
17824
+ },
17825
+ required: [
17826
+ "id",
17827
+ "name",
17828
+ "slug"
17829
+ ],
17830
+ additionalProperties: false
17831
+ },
17832
+ createdBy: {
17833
+ anyOf: [
17834
+ {
17835
+ type: "object",
17836
+ properties: {
17837
+ id: {
17838
+ type: "string"
17839
+ },
17840
+ email: {
17841
+ type: "string"
17842
+ },
17843
+ name: {
17844
+ anyOf: [
17845
+ {
17846
+ type: "string"
17847
+ },
17848
+ {
17849
+ type: "null"
17850
+ }
17851
+ ]
17852
+ }
17853
+ },
17854
+ required: [
17855
+ "id",
17856
+ "email",
17857
+ "name"
17858
+ ],
17859
+ additionalProperties: false
17860
+ },
17861
+ {
17862
+ type: "null"
17863
+ }
17864
+ ]
17865
+ },
17866
+ apiKey: {
17867
+ type: "object",
17868
+ properties: {
17869
+ id: {
17870
+ type: "string"
17871
+ },
17872
+ name: {
17873
+ type: "string"
17874
+ },
17875
+ prefix: {
17876
+ type: "string"
17877
+ },
17878
+ keyType: {
17879
+ type: "string",
17880
+ enum: [
17881
+ "api",
17882
+ "cli",
17883
+ "mcp",
17884
+ "ci"
17885
+ ]
17886
+ },
17887
+ grants: {
17888
+ type: "array",
17889
+ items: {
17890
+ type: "string",
17891
+ enum: [
17892
+ "customer_intelligence:read",
17893
+ "workspace_members:read",
17894
+ "analytics:read",
17895
+ "destinations:manage",
17896
+ "behavior_metrics:manage",
17897
+ "integrations:connect_own",
17898
+ "integrations:manage",
17899
+ "activation:read",
17900
+ "activation:manage",
17901
+ "workspace_settings:read",
17902
+ "workspace_settings:manage",
17903
+ "customer_access:manage",
17904
+ "customer_identity:review",
17905
+ "customer_identity:merge"
17906
+ ]
17907
+ }
17908
+ },
17909
+ createdAt: {
17910
+ type: "string",
17911
+ format: "date-time",
17912
+ pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
17913
+ },
17914
+ lastUsedAt: {
17915
+ anyOf: [
17916
+ {
17917
+ type: "string",
17918
+ format: "date-time",
17919
+ pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
17920
+ },
17921
+ {
17922
+ type: "null"
17923
+ }
17924
+ ]
17925
+ },
17926
+ totalRequests: {
17927
+ type: "integer",
17928
+ minimum: 0,
17929
+ maximum: 9007199254740991
17930
+ },
17931
+ expiresAt: {
17932
+ anyOf: [
17933
+ {
17934
+ type: "string",
17935
+ format: "date-time",
17936
+ pattern: "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
17937
+ },
17938
+ {
17939
+ type: "null"
17940
+ }
17941
+ ]
17942
+ }
17943
+ },
17944
+ required: [
17945
+ "id",
17946
+ "name",
17947
+ "prefix",
17948
+ "keyType",
17949
+ "grants",
17950
+ "createdAt",
17951
+ "lastUsedAt",
17952
+ "totalRequests",
17953
+ "expiresAt"
17954
+ ],
17955
+ additionalProperties: false
17956
+ },
17957
+ authorization: {
17958
+ type: "object",
17959
+ properties: {
17960
+ grants: {
17961
+ type: "array",
17962
+ items: {
17963
+ type: "string",
17964
+ enum: [
17965
+ "customer_intelligence:read",
17966
+ "workspace_members:read",
17967
+ "analytics:read",
17968
+ "destinations:manage",
17969
+ "behavior_metrics:manage",
17970
+ "integrations:connect_own",
17971
+ "integrations:manage",
17972
+ "activation:read",
17973
+ "activation:manage",
17974
+ "workspace_settings:read",
17975
+ "workspace_settings:manage",
17976
+ "customer_access:manage",
17977
+ "customer_identity:review",
17978
+ "customer_identity:merge"
17979
+ ]
17980
+ }
17981
+ }
17982
+ },
17983
+ required: [
17984
+ "grants"
17985
+ ],
17986
+ additionalProperties: false
17987
+ }
17988
+ },
17989
+ required: [
17990
+ "valid",
17991
+ "organizationId",
17992
+ "createdById",
17993
+ "authorization"
17994
+ ],
17995
+ additionalProperties: false
17996
+ };
17777
17997
  toolGatewayErrorSchema = {
17778
17998
  $schema: "https://json-schema.org/draft/2020-12/schema",
17779
17999
  type: "object",
@@ -18060,6 +18280,33 @@ var init_client = __esm(() => {
18060
18280
  cliToolNameSet = new Set(cliToolNames);
18061
18281
  });
18062
18282
 
18283
+ // src/lib/key-expiry.ts
18284
+ function keyExpiryWarning(expiresAt, now = new Date) {
18285
+ if (!expiresAt)
18286
+ return null;
18287
+ const remainingMs = Date.parse(expiresAt) - now.getTime();
18288
+ if (Number.isNaN(remainingMs) || remainingMs <= 0)
18289
+ return null;
18290
+ if (remainingMs > KEY_EXPIRY_WARNING_DAYS * DAY_MS)
18291
+ return null;
18292
+ const days = Math.max(1, Math.ceil(remainingMs / DAY_MS));
18293
+ return `Warning: your Outlit API key expires in ${days} day${days === 1 ? "" : "s"}. Run \`outlit login\` to get a new one.
18294
+ `;
18295
+ }
18296
+ function warnIfKeyExpiresSoon(expiresAt) {
18297
+ if (warned)
18298
+ return;
18299
+ const warning = keyExpiryWarning(expiresAt);
18300
+ if (!warning)
18301
+ return;
18302
+ warned = true;
18303
+ process.stderr.write(warning);
18304
+ }
18305
+ var KEY_EXPIRY_WARNING_DAYS = 14, DAY_MS, warned = false;
18306
+ var init_key_expiry = __esm(() => {
18307
+ DAY_MS = 24 * 60 * 60 * 1000;
18308
+ });
18309
+
18063
18310
  // src/lib/spinner.ts
18064
18311
  function createSpinner(message) {
18065
18312
  if (!isInteractive()) {
@@ -18194,7 +18441,8 @@ async function pingApiKey(apiKey) {
18194
18441
  const response = await globalThis.fetch(url, {
18195
18442
  method: apiKeyValidationTransport.method,
18196
18443
  headers: {
18197
- Authorization: `Bearer ${apiKey}`
18444
+ Authorization: `Bearer ${apiKey}`,
18445
+ [apiKeyContractHeader]: "2"
18198
18446
  }
18199
18447
  });
18200
18448
  const text = await response.text();
@@ -18209,8 +18457,13 @@ async function pingApiKey(apiKey) {
18209
18457
  const message2 = matchesGeneratedJsonSchema(payload, apiKeyValidationFailureSchema) ? payload.error : undefined;
18210
18458
  throw new ApiKeyValidationUnavailableError(message2);
18211
18459
  }
18212
- if (response.status === apiKeyValidationTransport.responseStatuses.success && matchesGeneratedJsonSchema(payload, apiKeyValidationSuccessSchema)) {
18213
- return payload;
18460
+ if (response.status === apiKeyValidationTransport.responseStatuses.success) {
18461
+ if (matchesGeneratedJsonSchema(payload, apiKeyValidationSuccessSchemaV2)) {
18462
+ warnIfKeyExpiresSoon(payload.apiKey?.expiresAt);
18463
+ return payload;
18464
+ }
18465
+ if (matchesGeneratedJsonSchema(payload, apiKeyValidationSuccessSchema))
18466
+ return payload;
18214
18467
  }
18215
18468
  const message = matchesGeneratedJsonSchema(payload, apiKeyValidationFailureSchema) ? payload.error : text.length > 0 ? text : `API error (${response.status})`;
18216
18469
  if (!response.ok || response.status === apiKeyValidationTransport.responseStatuses.invalid) {
@@ -18302,6 +18555,7 @@ var init_api = __esm(() => {
18302
18555
  init_dist4();
18303
18556
  init_client();
18304
18557
  init_config();
18558
+ init_key_expiry();
18305
18559
  init_output();
18306
18560
  init_spinner();
18307
18561
  init_table();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outlit/cli",
3
- "version": "3.2.4",
3
+ "version": "3.2.5",
4
4
  "description": "CLI for querying Outlit customer context and installing agent skills",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "@clack/prompts": "^1.0.1",
46
- "@outlit/tools": "^2.2.3",
46
+ "@outlit/tools": "^2.2.4",
47
47
  "citty": "^0.2.1"
48
48
  },
49
49
  "devDependencies": {