@oneuptime/cli 14.0.86 → 14.0.87

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/build/dist/Index.js +332 -3
  2. package/package.json +1 -1
@@ -117379,6 +117379,7 @@ var ObjectType = /* @__PURE__ */ ((ObjectType2) => {
117379
117379
  ObjectType2["NotContains"] = "NotContains";
117380
117380
  ObjectType2["Wildcard"] = "Wildcard";
117381
117381
  ObjectType2["NotWildcard"] = "NotWildcard";
117382
+ ObjectType2["OwnedBy"] = "OwnedBy";
117382
117383
  ObjectType2["DashboardComponent"] = "DashboardComponent";
117383
117384
  ObjectType2["DashboardViewConfig"] = "DashboardViewConfig";
117384
117385
  return ObjectType2;
@@ -127761,6 +127762,140 @@ var NotWildcard = class _NotWildcard extends QueryOperator {
127761
127762
  }
127762
127763
  };
127763
127764
 
127765
+ // ../Common/Types/BaseDatabase/OwnedBy.ts
127766
+ var OwnedByMatch = /* @__PURE__ */ ((OwnedByMatch2) => {
127767
+ OwnedByMatch2["AnyOf"] = "AnyOf";
127768
+ OwnedByMatch2["NoneOf"] = "NoneOf";
127769
+ OwnedByMatch2["AnyOwner"] = "AnyOwner";
127770
+ OwnedByMatch2["NoOwner"] = "NoOwner";
127771
+ return OwnedByMatch2;
127772
+ })(OwnedByMatch || {});
127773
+ var MAX_OWNED_BY_IDS = 1e3;
127774
+ var OWNED_BY_QUERY_KEY = "owners";
127775
+ var EXAMPLE_UUID = "550e8400-e29b-41d4-a716-446655440000";
127776
+ var OwnedBy = class _OwnedBy extends QueryOperator {
127777
+ static {
127778
+ __name(this, "OwnedBy");
127779
+ }
127780
+ constructor(data) {
127781
+ super();
127782
+ const match = data.match || "AnyOf" /* AnyOf */;
127783
+ if (!Object.values(OwnedByMatch).includes(match)) {
127784
+ throw new BadDataException(
127785
+ `Invalid match for "${OWNED_BY_QUERY_KEY}" in the query: ${JSON.stringify(
127786
+ refusedValue(match)
127787
+ )}. It is one of ${Object.values(OwnedByMatch).join(", ")}.`
127788
+ );
127789
+ }
127790
+ const userIds = _OwnedBy.toIds(data.userIds, "userIds");
127791
+ const teamIds = _OwnedBy.toIds(data.teamIds, "teamIds");
127792
+ const namesOwners = match === "AnyOf" /* AnyOf */ || match === "NoneOf" /* NoneOf */;
127793
+ if (namesOwners && userIds.length === 0 && teamIds.length === 0) {
127794
+ throw new BadDataException(
127795
+ `"${OWNED_BY_QUERY_KEY}" with match ${match} names at least one person (userIds) or team (teamIds).`
127796
+ );
127797
+ }
127798
+ if (!namesOwners && (userIds.length > 0 || teamIds.length > 0)) {
127799
+ throw new BadDataException(
127800
+ `"${OWNED_BY_QUERY_KEY}" with match ${match} asks whether a record has owners at all, so it names no people or teams.`
127801
+ );
127802
+ }
127803
+ if (userIds.length + teamIds.length > MAX_OWNED_BY_IDS) {
127804
+ throw new BadDataException(
127805
+ `"${OWNED_BY_QUERY_KEY}" names at most ${MAX_OWNED_BY_IDS} people and teams together.`
127806
+ );
127807
+ }
127808
+ this._userIds = userIds;
127809
+ this._teamIds = teamIds;
127810
+ this._match = match;
127811
+ }
127812
+ // The people named, as ids (each once).
127813
+ get userIds() {
127814
+ return [...this._userIds];
127815
+ }
127816
+ // The teams named, as ids (each once).
127817
+ get teamIds() {
127818
+ return [...this._teamIds];
127819
+ }
127820
+ get match() {
127821
+ return this._match;
127822
+ }
127823
+ toString() {
127824
+ return JSON.stringify(this.toJSON());
127825
+ }
127826
+ toJSON() {
127827
+ return {
127828
+ _type: "OwnedBy" /* OwnedBy */,
127829
+ match: this._match,
127830
+ userIds: [...this._userIds],
127831
+ teamIds: [...this._teamIds]
127832
+ };
127833
+ }
127834
+ static fromJSON(json) {
127835
+ if (json["_type"] !== "OwnedBy" /* OwnedBy */) {
127836
+ throw new BadDataException("Invalid JSON: " + JSON.stringify(json));
127837
+ }
127838
+ return new _OwnedBy({
127839
+ match: json["match"] || void 0,
127840
+ userIds: _OwnedBy.readIds(json["userIds"], "userIds"),
127841
+ teamIds: _OwnedBy.readIds(json["teamIds"], "teamIds")
127842
+ });
127843
+ }
127844
+ /*
127845
+ * The ids a JSON array holds: text, or an ObjectID as it is serialized
127846
+ * ({"_type": "ObjectID", "value": "..."}). Anything but an array is refused.
127847
+ */
127848
+ static readIds(value, field) {
127849
+ if (value === void 0 || value === null) {
127850
+ return void 0;
127851
+ }
127852
+ if (!Array.isArray(value)) {
127853
+ throw new BadDataException(
127854
+ `"${field}" of "${OWNED_BY_QUERY_KEY}" in the query is a list of IDs.`
127855
+ );
127856
+ }
127857
+ return value.map((item) => {
127858
+ if (item && typeof item === "object" && item["_type"] === "ObjectID" /* ObjectID */) {
127859
+ return new ObjectID(item);
127860
+ }
127861
+ return item;
127862
+ });
127863
+ }
127864
+ /*
127865
+ * Every id as text Postgres reads as a uuid, each once, or the filter is
127866
+ * refused with the words every ID filter uses.
127867
+ */
127868
+ static toIds(ids, field) {
127869
+ if (ids === void 0 || ids === null) {
127870
+ return [];
127871
+ }
127872
+ if (!Array.isArray(ids)) {
127873
+ throw new BadDataException(
127874
+ `"${field}" of "${OWNED_BY_QUERY_KEY}" in the query is a list of IDs.`
127875
+ );
127876
+ }
127877
+ const seen = /* @__PURE__ */ new Set();
127878
+ const result = [];
127879
+ for (const id of ids) {
127880
+ const text = id instanceof ObjectID ? id.toString() : typeof id === "string" ? id : null;
127881
+ if (text === null || !ObjectID.isValidUUID(text)) {
127882
+ throw new BadDataException(
127883
+ `Invalid ID for "${OWNED_BY_QUERY_KEY}.${field}" in the query: ${JSON.stringify(
127884
+ refusedValue(text === null ? JSON.stringify(id) : text)
127885
+ )}. An ID is a UUID, such as "${EXAMPLE_UUID}".`
127886
+ );
127887
+ }
127888
+ const key = text.toLowerCase();
127889
+ if (seen.has(key)) {
127890
+ continue;
127891
+ }
127892
+ seen.add(key);
127893
+ result.push(key);
127894
+ }
127895
+ return result;
127896
+ }
127897
+ };
127898
+
127764
127899
  // ../Common/Types/BaseDatabase/IsNull.ts
127765
127900
  var IsNull2 = class _IsNull extends QueryOperator {
127766
127901
  static {
@@ -134919,6 +135054,7 @@ var MonitorStepDatabaseMonitorUtil = class {
134919
135054
  var ExternalStatusPageProviderType = /* @__PURE__ */ ((ExternalStatusPageProviderType2) => {
134920
135055
  ExternalStatusPageProviderType2["AtlassianStatuspage"] = "Atlassian Statuspage";
134921
135056
  ExternalStatusPageProviderType2["IncidentIo"] = "incident.io";
135057
+ ExternalStatusPageProviderType2["OneUptime"] = "OneUptime Status Page";
134922
135058
  ExternalStatusPageProviderType2["RSS"] = "RSS";
134923
135059
  ExternalStatusPageProviderType2["Atom"] = "Atom";
134924
135060
  ExternalStatusPageProviderType2["Auto"] = "Auto";
@@ -137145,6 +137281,9 @@ var SerializableObjectDictionary = {
137145
137281
  get ["NotWildcard" /* NotWildcard */]() {
137146
137282
  return NotWildcard;
137147
137283
  },
137284
+ get ["OwnedBy" /* OwnedBy */]() {
137285
+ return OwnedBy;
137286
+ },
137148
137287
  get ["NotNull" /* NotNull */]() {
137149
137288
  return NotNull;
137150
137289
  },
@@ -152783,6 +152922,7 @@ var Label = class extends AccessControlModel {
152783
152922
  this.projectId = void 0;
152784
152923
  this.name = void 0;
152785
152924
  this.slug = void 0;
152925
+ this.nameSortKey = void 0;
152786
152926
  this.description = void 0;
152787
152927
  this.createdByUser = void 0;
152788
152928
  this.createdByUserId = void 0;
@@ -152941,6 +153081,26 @@ __decorateClass([
152941
153081
  length: ColumnLength_default.Slug
152942
153082
  })
152943
153083
  ], Label.prototype, "slug", 2);
153084
+ __decorateClass([
153085
+ ColumnAccessControl_default({
153086
+ create: [],
153087
+ read: [],
153088
+ update: []
153089
+ }),
153090
+ TableColumn_default({
153091
+ required: false,
153092
+ type: TableColumnType_default.LongText,
153093
+ computed: true,
153094
+ hideColumnInDocumentation: true,
153095
+ description: "The name as OneUptime puts labels in order: numbers by their value, then letters, case and accents aside. Written by OneUptime from the name."
153096
+ }),
153097
+ Column({
153098
+ nullable: true,
153099
+ type: ColumnType_default.LongText,
153100
+ length: ColumnLength_default.LongText,
153101
+ collation: "C"
153102
+ })
153103
+ ], Label.prototype, "nameSortKey", 2);
152944
153104
  __decorateClass([
152945
153105
  ColumnAccessControl_default({
152946
153106
  create: [
@@ -238867,6 +239027,10 @@ ServiceLevelObjective = __decorateClass([
238867
239027
  })
238868
239028
  ], ServiceLevelObjective);
238869
239029
 
239030
+ // ../Common/Types/CallAndSMS/TwilioConfigUse.ts
239031
+ var DEFAULT_TWILIO_CONFIG_USE = "Calls and SMS" /* CallsAndSms */;
239032
+ var USED_FOR_TITLE = "Used For";
239033
+
238870
239034
  // ../Common/Utils/Project/NotificationChannels.ts
238871
239035
  var PROJECT_NOTIFICATION_CHANNEL_UPDATE_PERMISSIONS = [
238872
239036
  Permission_default.ProjectOwner,
@@ -238889,7 +239053,9 @@ var STATUS_PAGE_SMS_SUBSCRIPTIONS_SMS_OFF_MESSAGE = `Visitors can't subscribe by
238889
239053
  var SERVER_TWILIO_SETTINGS_PAGE = "Admin Dashboard > Settings > Call and SMS";
238890
239054
  var PROJECT_TWILIO_SETTINGS_PAGE = PROJECT_NOTIFICATION_CHANNEL_SETTINGS_PAGE;
238891
239055
  var WHO_MAY_ADD_A_PROJECT_TWILIO_ACCOUNT = "a project owner, a project admin or someone with Create Call and SMS";
239056
+ var WHO_MAY_EDIT_A_PROJECT_TWILIO_ACCOUNT = "a project owner, a project admin or someone with Edit Call and SMS";
238892
239057
  var WHO_CAN_ADD_A_TWILIO_ACCOUNT_SENTENCE = `The OneUptime server's administrator can add one in ${SERVER_TWILIO_SETTINGS_PAGE}, or ${WHO_MAY_ADD_A_PROJECT_TWILIO_ACCOUNT} can add this project's own in ${PROJECT_TWILIO_SETTINGS_PAGE}.`;
239058
+ var WHO_CAN_USE_THE_PROJECT_TWILIO_ACCOUNT_FOR_IT_SENTENCE = `The OneUptime server's administrator can add one in ${SERVER_TWILIO_SETTINGS_PAGE}, or ${WHO_MAY_EDIT_A_PROJECT_TWILIO_ACCOUNT} can use this project's config for calls and SMS in ${PROJECT_TWILIO_SETTINGS_PAGE}.`;
238893
239059
  var INCOMING_CALL_NUMBER_NO_TWILIO_ACCOUNT_MESSAGE = `Numbers for incoming calls are verified by SMS, and no Twilio account is set up to send SMS. ${WHO_CAN_ADD_A_TWILIO_ACCOUNT_SENTENCE}`;
238894
239060
 
238895
239061
  // ../Common/Types/CallAndSMS/TwilioPhoneNumbers.ts
@@ -238908,6 +239074,7 @@ var ProjectCallSMSConfig = class extends DatabaseBaseModel {
238908
239074
  this.createdByUserId = void 0;
238909
239075
  this.deletedByUser = void 0;
238910
239076
  this.deletedByUserId = void 0;
239077
+ this.usedFor = void 0;
238911
239078
  this.twilioAccountSID = void 0;
238912
239079
  this.twilioAuthToken = void 0;
238913
239080
  this.twilioPrimaryPhoneNumber = void 0;
@@ -239228,6 +239395,47 @@ __decorateClass([
239228
239395
  transformer: ObjectID.getDatabaseTransformer()
239229
239396
  })
239230
239397
  ], ProjectCallSMSConfig.prototype, "deletedByUserId", 2);
239398
+ __decorateClass([
239399
+ ColumnAccessControl_default({
239400
+ create: [
239401
+ Permission_default.ProjectOwner,
239402
+ Permission_default.ProjectAdmin,
239403
+ Permission_default.CreateProjectCallSMSConfig
239404
+ ],
239405
+ read: [
239406
+ Permission_default.ProjectOwner,
239407
+ Permission_default.ProjectAdmin,
239408
+ Permission_default.ProjectMember,
239409
+ Permission_default.Viewer,
239410
+ Permission_default.SettingsAdmin,
239411
+ Permission_default.SettingsMember,
239412
+ Permission_default.SettingsViewer,
239413
+ Permission_default.ReadProjectCallSMSConfig
239414
+ ],
239415
+ update: [
239416
+ Permission_default.ProjectOwner,
239417
+ Permission_default.ProjectAdmin,
239418
+ Permission_default.EditProjectCallSMSConfig
239419
+ ]
239420
+ }),
239421
+ TableColumn_default({
239422
+ isDefaultValueColumn: true,
239423
+ required: true,
239424
+ type: TableColumnType_default.ShortText,
239425
+ canReadOnRelationQuery: true,
239426
+ title: USED_FOR_TITLE,
239427
+ description: `What this Twilio config is used for: "Calls and SMS" (the default), "SMS only" or "Calls only". Calls and SMS and Calls only need a Twilio Primary Phone Number; SMS only needs Twilio SMS Phone Numbers. A config used for SMS only makes no calls, and one used for calls only sends no SMS: those go through OneUptime's own Twilio account, as for a project without a config.`,
239428
+ defaultValue: DEFAULT_TWILIO_CONFIG_USE,
239429
+ example: "SMS only" /* SmsOnly */
239430
+ }),
239431
+ Column({
239432
+ type: ColumnType_default.ShortText,
239433
+ length: ColumnLength_default.ShortText,
239434
+ nullable: false,
239435
+ unique: false,
239436
+ default: DEFAULT_TWILIO_CONFIG_USE
239437
+ })
239438
+ ], ProjectCallSMSConfig.prototype, "usedFor", 2);
239231
239439
  __decorateClass([
239232
239440
  ColumnAccessControl_default({
239233
239441
  create: [
@@ -265502,6 +265710,7 @@ var GlobalConfig2 = class extends GlobalConfig {
265502
265710
  this.twilioPrimaryPhoneNumber = void 0;
265503
265711
  this.twilioSecondaryPhoneNumbers = void 0;
265504
265712
  this.twilioSmsPhoneNumbers = void 0;
265713
+ this.twilioUsedFor = void 0;
265505
265714
  this.metaWhatsAppAccessToken = void 0;
265506
265715
  this.metaWhatsAppPhoneNumberId = void 0;
265507
265716
  this.metaWhatsAppBusinessAccountId = void 0;
@@ -265980,6 +266189,28 @@ __decorateClass([
265980
266189
  unique: false
265981
266190
  })
265982
266191
  ], GlobalConfig2.prototype, "twilioSmsPhoneNumbers", 2);
266192
+ __decorateClass([
266193
+ ColumnAccessControl_default({
266194
+ create: [],
266195
+ read: [],
266196
+ update: []
266197
+ }),
266198
+ TableColumn_default({
266199
+ isDefaultValueColumn: true,
266200
+ required: true,
266201
+ type: TableColumnType_default.ShortText,
266202
+ title: "Twilio Used For",
266203
+ description: `What the server's Twilio account sends: "Calls and SMS", "SMS only" or "Calls only".`,
266204
+ defaultValue: DEFAULT_TWILIO_CONFIG_USE
266205
+ }),
266206
+ Column({
266207
+ type: ColumnType_default.ShortText,
266208
+ length: ColumnLength_default.ShortText,
266209
+ nullable: false,
266210
+ unique: false,
266211
+ default: DEFAULT_TWILIO_CONFIG_USE
266212
+ })
266213
+ ], GlobalConfig2.prototype, "twilioUsedFor", 2);
265983
266214
  __decorateClass([
265984
266215
  ColumnAccessControl_default({
265985
266216
  create: [],
@@ -280102,15 +280333,15 @@ __decorateClass([
280102
280333
  }),
280103
280334
  TableColumn_default({
280104
280335
  required: true,
280105
- type: TableColumnType_default.Name,
280336
+ type: TableColumnType_default.ShortText,
280106
280337
  canReadOnRelationQuery: true,
280107
280338
  title: "Name",
280108
280339
  description: "Friendly name for this detection rule."
280109
280340
  }),
280110
280341
  Column({
280111
280342
  nullable: false,
280112
- type: ColumnType_default.Name,
280113
- length: ColumnLength_default.Name
280343
+ type: ColumnType_default.ShortText,
280344
+ length: ColumnLength_default.ShortText
280114
280345
  })
280115
280346
  ], DetectionRule.prototype, "name", 2);
280116
280347
  __decorateClass([
@@ -399021,6 +399252,7 @@ var AlertOwnerRule = class extends RuleBaseModel {
399021
399252
  this.monitorDescriptionPattern = void 0;
399022
399253
  this.ownerUsers = void 0;
399023
399254
  this.ownerTeams = void 0;
399255
+ this.creatorTeams = void 0;
399024
399256
  this.inheritOwnersFromMonitors = void 0;
399025
399257
  this.inheritOwnersFromHosts = void 0;
399026
399258
  this.inheritOwnersFromKubernetesClusters = void 0;
@@ -399681,6 +399913,54 @@ __decorateClass([
399681
399913
  }
399682
399914
  })
399683
399915
  ], AlertOwnerRule.prototype, "ownerTeams", 2);
399916
+ __decorateClass([
399917
+ ColumnAccessControl_default({
399918
+ create: [
399919
+ Permission_default.ProjectOwner,
399920
+ Permission_default.ProjectAdmin,
399921
+ Permission_default.CreateAlertOwnerRule
399922
+ ],
399923
+ read: [
399924
+ Permission_default.ProjectOwner,
399925
+ Permission_default.ProjectAdmin,
399926
+ Permission_default.ProjectMember,
399927
+ Permission_default.Viewer,
399928
+ Permission_default.AlertAdmin,
399929
+ Permission_default.AlertMember,
399930
+ Permission_default.AlertViewer,
399931
+ Permission_default.ReadAlertOwnerRule
399932
+ ],
399933
+ update: [
399934
+ Permission_default.ProjectOwner,
399935
+ Permission_default.ProjectAdmin,
399936
+ Permission_default.EditAlertOwnerRule
399937
+ ]
399938
+ }),
399939
+ TableColumn_default({
399940
+ required: false,
399941
+ type: TableColumnType_default.EntityArray,
399942
+ modelType: Team,
399943
+ title: "Creator's Teams",
399944
+ description: "Teams added as owners when the person who creates a matching alert is a member of them. Alerts with no creator get none."
399945
+ }),
399946
+ ManyToMany(
399947
+ () => {
399948
+ return Team;
399949
+ },
399950
+ { eager: false }
399951
+ ),
399952
+ JoinTable({
399953
+ name: "AlertOwnerRuleCreatorTeam",
399954
+ inverseJoinColumn: {
399955
+ name: "teamId",
399956
+ referencedColumnName: "_id"
399957
+ },
399958
+ joinColumn: {
399959
+ name: "alertOwnerRuleId",
399960
+ referencedColumnName: "_id"
399961
+ }
399962
+ })
399963
+ ], AlertOwnerRule.prototype, "creatorTeams", 2);
399684
399964
  __decorateClass([
399685
399965
  ColumnAccessControl_default({
399686
399966
  create: [
@@ -410363,6 +410643,7 @@ var IncidentOwnerRule = class extends RuleBaseModel {
410363
410643
  this.monitorDescriptionPattern = void 0;
410364
410644
  this.ownerUsers = void 0;
410365
410645
  this.ownerTeams = void 0;
410646
+ this.creatorTeams = void 0;
410366
410647
  this.inheritOwnersFromMonitors = void 0;
410367
410648
  this.inheritOwnersFromHosts = void 0;
410368
410649
  this.inheritOwnersFromKubernetesClusters = void 0;
@@ -411023,6 +411304,54 @@ __decorateClass([
411023
411304
  }
411024
411305
  })
411025
411306
  ], IncidentOwnerRule.prototype, "ownerTeams", 2);
411307
+ __decorateClass([
411308
+ ColumnAccessControl_default({
411309
+ create: [
411310
+ Permission_default.ProjectOwner,
411311
+ Permission_default.ProjectAdmin,
411312
+ Permission_default.CreateIncidentOwnerRule
411313
+ ],
411314
+ read: [
411315
+ Permission_default.ProjectOwner,
411316
+ Permission_default.ProjectAdmin,
411317
+ Permission_default.ProjectMember,
411318
+ Permission_default.Viewer,
411319
+ Permission_default.IncidentAdmin,
411320
+ Permission_default.IncidentMember,
411321
+ Permission_default.IncidentViewer,
411322
+ Permission_default.ReadIncidentOwnerRule
411323
+ ],
411324
+ update: [
411325
+ Permission_default.ProjectOwner,
411326
+ Permission_default.ProjectAdmin,
411327
+ Permission_default.EditIncidentOwnerRule
411328
+ ]
411329
+ }),
411330
+ TableColumn_default({
411331
+ required: false,
411332
+ type: TableColumnType_default.EntityArray,
411333
+ modelType: Team,
411334
+ title: "Creator's Teams",
411335
+ description: "Teams added as owners when the person who declares a matching incident is a member of them. Incidents with no creator get none."
411336
+ }),
411337
+ ManyToMany(
411338
+ () => {
411339
+ return Team;
411340
+ },
411341
+ { eager: false }
411342
+ ),
411343
+ JoinTable({
411344
+ name: "IncidentOwnerRuleCreatorTeam",
411345
+ inverseJoinColumn: {
411346
+ name: "teamId",
411347
+ referencedColumnName: "_id"
411348
+ },
411349
+ joinColumn: {
411350
+ name: "incidentOwnerRuleId",
411351
+ referencedColumnName: "_id"
411352
+ }
411353
+ })
411354
+ ], IncidentOwnerRule.prototype, "creatorTeams", 2);
411026
411355
  __decorateClass([
411027
411356
  ColumnAccessControl_default({
411028
411357
  create: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oneuptime/cli",
3
- "version": "14.0.86",
3
+ "version": "14.0.87",
4
4
  "description": "OneUptime CLI - Command-line interface for managing OneUptime resources",
5
5
  "repository": {
6
6
  "type": "git",