@shieldiot/pulse-lib 1.0.9 → 1.0.10
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/LICENSE +18 -4
- package/README.md +31 -38
- package/dist/cjs/Num.js +174 -0
- package/dist/cjs/index.js +5 -0
- package/dist/esm/Num.js +171 -0
- package/dist/esm/index.js +2 -0
- package/dist/types/Num.d.ts +15 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/umd/index.js +1 -0
- package/package.json +64 -19
- package/dist/config.d.ts +0 -5
- package/dist/config.js +0 -6
- package/dist/config.js.map +0 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -5
- package/dist/index.js.map +0 -1
- package/dist/lib/base/BaseEntity.d.ts +0 -6
- package/dist/lib/base/BaseEntity.js +0 -21
- package/dist/lib/base/BaseEntity.js.map +0 -1
- package/dist/lib/base/index.d.ts +0 -1
- package/dist/lib/base/index.js +0 -2
- package/dist/lib/base/index.js.map +0 -1
- package/dist/lib/common/AccountRole.d.ts +0 -7
- package/dist/lib/common/AccountRole.js +0 -21
- package/dist/lib/common/AccountRole.js.map +0 -1
- package/dist/lib/common/ConsumptionData.d.ts +0 -6
- package/dist/lib/common/ConsumptionData.js +0 -21
- package/dist/lib/common/ConsumptionData.js.map +0 -1
- package/dist/lib/common/ConsumptionTimeDataPoint.d.ts +0 -6
- package/dist/lib/common/ConsumptionTimeDataPoint.js +0 -16
- package/dist/lib/common/ConsumptionTimeDataPoint.js.map +0 -1
- package/dist/lib/common/DeviceConfig.d.ts +0 -7
- package/dist/lib/common/DeviceConfig.js +0 -16
- package/dist/lib/common/DeviceConfig.js.map +0 -1
- package/dist/lib/common/DeviceScoreConfig.d.ts +0 -6
- package/dist/lib/common/DeviceScoreConfig.js +0 -21
- package/dist/lib/common/DeviceScoreConfig.js.map +0 -1
- package/dist/lib/common/DevicesAtRiskConfig.d.ts +0 -4
- package/dist/lib/common/DevicesAtRiskConfig.js +0 -11
- package/dist/lib/common/DevicesAtRiskConfig.js.map +0 -1
- package/dist/lib/common/EventSeverityConfig.d.ts +0 -5
- package/dist/lib/common/EventSeverityConfig.js +0 -11
- package/dist/lib/common/EventSeverityConfig.js.map +0 -1
- package/dist/lib/common/FloatKeyValue.d.ts +0 -5
- package/dist/lib/common/FloatKeyValue.js +0 -16
- package/dist/lib/common/FloatKeyValue.js.map +0 -1
- package/dist/lib/common/GeoData.d.ts +0 -10
- package/dist/lib/common/GeoData.js +0 -37
- package/dist/lib/common/GeoData.js.map +0 -1
- package/dist/lib/common/GraphSeries.d.ts +0 -6
- package/dist/lib/common/GraphSeries.js +0 -16
- package/dist/lib/common/GraphSeries.js.map +0 -1
- package/dist/lib/common/Indicator.d.ts +0 -8
- package/dist/lib/common/Indicator.js +0 -31
- package/dist/lib/common/Indicator.js.map +0 -1
- package/dist/lib/common/IntKeySeriesDataValue.d.ts +0 -6
- package/dist/lib/common/IntKeySeriesDataValue.js +0 -16
- package/dist/lib/common/IntKeySeriesDataValue.js.map +0 -1
- package/dist/lib/common/IntKeyValue.d.ts +0 -5
- package/dist/lib/common/IntKeyValue.js +0 -16
- package/dist/lib/common/IntKeyValue.js.map +0 -1
- package/dist/lib/common/Interval.d.ts +0 -5
- package/dist/lib/common/Interval.js +0 -16
- package/dist/lib/common/Interval.js.map +0 -1
- package/dist/lib/common/Link.d.ts +0 -11
- package/dist/lib/common/Link.js +0 -41
- package/dist/lib/common/Link.js.map +0 -1
- package/dist/lib/common/Location.d.ts +0 -5
- package/dist/lib/common/Location.js +0 -16
- package/dist/lib/common/Location.js.map +0 -1
- package/dist/lib/common/LoginParams.d.ts +0 -6
- package/dist/lib/common/LoginParams.js +0 -21
- package/dist/lib/common/LoginParams.js.map +0 -1
- package/dist/lib/common/MaliciousIPCard.d.ts +0 -12
- package/dist/lib/common/MaliciousIPCard.js +0 -46
- package/dist/lib/common/MaliciousIPCard.js.map +0 -1
- package/dist/lib/common/MaliciousIPData.d.ts +0 -7
- package/dist/lib/common/MaliciousIPData.js +0 -26
- package/dist/lib/common/MaliciousIPData.js.map +0 -1
- package/dist/lib/common/NetworkMap.d.ts +0 -7
- package/dist/lib/common/NetworkMap.js +0 -16
- package/dist/lib/common/NetworkMap.js.map +0 -1
- package/dist/lib/common/Node.d.ts +0 -15
- package/dist/lib/common/Node.js +0 -56
- package/dist/lib/common/Node.js.map +0 -1
- package/dist/lib/common/SeriesData.d.ts +0 -7
- package/dist/lib/common/SeriesData.js +0 -16
- package/dist/lib/common/SeriesData.js.map +0 -1
- package/dist/lib/common/SessionTransform.d.ts +0 -8
- package/dist/lib/common/SessionTransform.js +0 -26
- package/dist/lib/common/SessionTransform.js.map +0 -1
- package/dist/lib/common/SeverityIntervalTuple.d.ts +0 -7
- package/dist/lib/common/SeverityIntervalTuple.js +0 -16
- package/dist/lib/common/SeverityIntervalTuple.js.map +0 -1
- package/dist/lib/common/ShieldexConfig.d.ts +0 -9
- package/dist/lib/common/ShieldexConfig.js +0 -36
- package/dist/lib/common/ShieldexConfig.js.map +0 -1
- package/dist/lib/common/StringIntValue.d.ts +0 -5
- package/dist/lib/common/StringIntValue.js +0 -16
- package/dist/lib/common/StringIntValue.js.map +0 -1
- package/dist/lib/common/StringKeyIntValue.d.ts +0 -5
- package/dist/lib/common/StringKeyIntValue.js +0 -16
- package/dist/lib/common/StringKeyIntValue.js.map +0 -1
- package/dist/lib/common/StringKeyValue.d.ts +0 -5
- package/dist/lib/common/StringKeyValue.js +0 -16
- package/dist/lib/common/StringKeyValue.js.map +0 -1
- package/dist/lib/common/Thresholds.d.ts +0 -4
- package/dist/lib/common/Thresholds.js +0 -11
- package/dist/lib/common/Thresholds.js.map +0 -1
- package/dist/lib/common/TimeDataPoint.d.ts +0 -5
- package/dist/lib/common/TimeDataPoint.js +0 -16
- package/dist/lib/common/TimeDataPoint.js.map +0 -1
- package/dist/lib/common/TimeDataPoint2D.d.ts +0 -6
- package/dist/lib/common/TimeDataPoint2D.js +0 -16
- package/dist/lib/common/TimeDataPoint2D.js.map +0 -1
- package/dist/lib/common/TimeDataPointFloat.d.ts +0 -5
- package/dist/lib/common/TimeDataPointFloat.js +0 -16
- package/dist/lib/common/TimeDataPointFloat.js.map +0 -1
- package/dist/lib/common/TimeFrame.d.ts +0 -5
- package/dist/lib/common/TimeFrame.js +0 -16
- package/dist/lib/common/TimeFrame.js.map +0 -1
- package/dist/lib/common/TimeSeries.d.ts +0 -8
- package/dist/lib/common/TimeSeries.js +0 -21
- package/dist/lib/common/TimeSeries.js.map +0 -1
- package/dist/lib/common/TimeSeriesOf2D.d.ts +0 -8
- package/dist/lib/common/TimeSeriesOf2D.js +0 -21
- package/dist/lib/common/TimeSeriesOf2D.js.map +0 -1
- package/dist/lib/common/TimeSeriesOfDataConsumption.d.ts +0 -8
- package/dist/lib/common/TimeSeriesOfDataConsumption.js +0 -21
- package/dist/lib/common/TimeSeriesOfDataConsumption.js.map +0 -1
- package/dist/lib/common/TimeSeriesOfFloat.d.ts +0 -8
- package/dist/lib/common/TimeSeriesOfFloat.js +0 -21
- package/dist/lib/common/TimeSeriesOfFloat.js.map +0 -1
- package/dist/lib/common/TokenData.d.ts +0 -12
- package/dist/lib/common/TokenData.js +0 -36
- package/dist/lib/common/TokenData.js.map +0 -1
- package/dist/lib/common/Tuple.d.ts +0 -5
- package/dist/lib/common/Tuple.js +0 -16
- package/dist/lib/common/Tuple.js.map +0 -1
- package/dist/lib/common/UsageTransform.d.ts +0 -10
- package/dist/lib/common/UsageTransform.js +0 -36
- package/dist/lib/common/UsageTransform.js.map +0 -1
- package/dist/lib/common/ZScore.d.ts +0 -5
- package/dist/lib/common/ZScore.js +0 -16
- package/dist/lib/common/ZScore.js.map +0 -1
- package/dist/lib/common/index.d.ts +0 -41
- package/dist/lib/common/index.js +0 -42
- package/dist/lib/common/index.js.map +0 -1
- package/dist/lib/entities/Account.d.ts +0 -17
- package/dist/lib/entities/Account.js +0 -25
- package/dist/lib/entities/Account.js.map +0 -1
- package/dist/lib/entities/AccountDTO.d.ts +0 -19
- package/dist/lib/entities/AccountDTO.js +0 -27
- package/dist/lib/entities/AccountDTO.js.map +0 -1
- package/dist/lib/entities/AccountSettings.d.ts +0 -10
- package/dist/lib/entities/AccountSettings.js +0 -26
- package/dist/lib/entities/AccountSettings.js.map +0 -1
- package/dist/lib/entities/Action.d.ts +0 -10
- package/dist/lib/entities/Action.js +0 -17
- package/dist/lib/entities/Action.js.map +0 -1
- package/dist/lib/entities/Alert.d.ts +0 -34
- package/dist/lib/entities/Alert.js +0 -54
- package/dist/lib/entities/Alert.js.map +0 -1
- package/dist/lib/entities/AlertWithDevice.d.ts +0 -36
- package/dist/lib/entities/AlertWithDevice.js +0 -53
- package/dist/lib/entities/AlertWithDevice.js.map +0 -1
- package/dist/lib/entities/ApiKey.d.ts +0 -11
- package/dist/lib/entities/ApiKey.js +0 -19
- package/dist/lib/entities/ApiKey.js.map +0 -1
- package/dist/lib/entities/AuditLog.d.ts +0 -13
- package/dist/lib/entities/AuditLog.js +0 -23
- package/dist/lib/entities/AuditLog.js.map +0 -1
- package/dist/lib/entities/BulkDevices.d.ts +0 -5
- package/dist/lib/entities/BulkDevices.js +0 -11
- package/dist/lib/entities/BulkDevices.js.map +0 -1
- package/dist/lib/entities/Checkpoint.d.ts +0 -23
- package/dist/lib/entities/Checkpoint.js +0 -45
- package/dist/lib/entities/Checkpoint.js.map +0 -1
- package/dist/lib/entities/ComplianceReportSettings.d.ts +0 -7
- package/dist/lib/entities/ComplianceReportSettings.js +0 -26
- package/dist/lib/entities/ComplianceReportSettings.js.map +0 -1
- package/dist/lib/entities/Condition.d.ts +0 -8
- package/dist/lib/entities/Condition.js +0 -25
- package/dist/lib/entities/Condition.js.map +0 -1
- package/dist/lib/entities/ConfigParam.d.ts +0 -4
- package/dist/lib/entities/ConfigParam.js +0 -8
- package/dist/lib/entities/ConfigParam.js.map +0 -1
- package/dist/lib/entities/DNSRecord.d.ts +0 -12
- package/dist/lib/entities/DNSRecord.js +0 -25
- package/dist/lib/entities/DNSRecord.js.map +0 -1
- package/dist/lib/entities/DataIngestion.d.ts +0 -18
- package/dist/lib/entities/DataIngestion.js +0 -66
- package/dist/lib/entities/DataIngestion.js.map +0 -1
- package/dist/lib/entities/DataPointOfDeviceReport.d.ts +0 -6
- package/dist/lib/entities/DataPointOfDeviceReport.js +0 -16
- package/dist/lib/entities/DataPointOfDeviceReport.js.map +0 -1
- package/dist/lib/entities/Device.d.ts +0 -30
- package/dist/lib/entities/Device.js +0 -49
- package/dist/lib/entities/Device.js.map +0 -1
- package/dist/lib/entities/DeviceReport.d.ts +0 -9
- package/dist/lib/entities/DeviceReport.js +0 -17
- package/dist/lib/entities/DeviceReport.js.map +0 -1
- package/dist/lib/entities/DeviceWithEvents.d.ts +0 -32
- package/dist/lib/entities/DeviceWithEvents.js +0 -51
- package/dist/lib/entities/DeviceWithEvents.js.map +0 -1
- package/dist/lib/entities/Distribution.d.ts +0 -7
- package/dist/lib/entities/Distribution.js +0 -21
- package/dist/lib/entities/Distribution.js.map +0 -1
- package/dist/lib/entities/Event.d.ts +0 -38
- package/dist/lib/entities/Event.js +0 -57
- package/dist/lib/entities/Event.js.map +0 -1
- package/dist/lib/entities/EventOccurrence.d.ts +0 -10
- package/dist/lib/entities/EventOccurrence.js +0 -31
- package/dist/lib/entities/EventOccurrence.js.map +0 -1
- package/dist/lib/entities/EventWithDevice.d.ts +0 -39
- package/dist/lib/entities/EventWithDevice.js +0 -55
- package/dist/lib/entities/EventWithDevice.js.map +0 -1
- package/dist/lib/entities/Feature.d.ts +0 -6
- package/dist/lib/entities/Feature.js +0 -9
- package/dist/lib/entities/Feature.js.map +0 -1
- package/dist/lib/entities/FeaturesGroup.d.ts +0 -6
- package/dist/lib/entities/FeaturesGroup.js +0 -9
- package/dist/lib/entities/FeaturesGroup.js.map +0 -1
- package/dist/lib/entities/Group.d.ts +0 -8
- package/dist/lib/entities/Group.js +0 -13
- package/dist/lib/entities/Group.js.map +0 -1
- package/dist/lib/entities/Image.d.ts +0 -5
- package/dist/lib/entities/Image.js +0 -10
- package/dist/lib/entities/Image.js.map +0 -1
- package/dist/lib/entities/Insight.d.ts +0 -18
- package/dist/lib/entities/Insight.js +0 -28
- package/dist/lib/entities/Insight.js.map +0 -1
- package/dist/lib/entities/InsightQuery.d.ts +0 -10
- package/dist/lib/entities/InsightQuery.js +0 -16
- package/dist/lib/entities/InsightQuery.js.map +0 -1
- package/dist/lib/entities/InsightSpec.d.ts +0 -9
- package/dist/lib/entities/InsightSpec.js +0 -16
- package/dist/lib/entities/InsightSpec.js.map +0 -1
- package/dist/lib/entities/IntDistribution.d.ts +0 -7
- package/dist/lib/entities/IntDistribution.js +0 -21
- package/dist/lib/entities/IntDistribution.js.map +0 -1
- package/dist/lib/entities/Integration.d.ts +0 -31
- package/dist/lib/entities/Integration.js +0 -47
- package/dist/lib/entities/Integration.js.map +0 -1
- package/dist/lib/entities/Member.d.ts +0 -7
- package/dist/lib/entities/Member.js +0 -12
- package/dist/lib/entities/Member.js.map +0 -1
- package/dist/lib/entities/Radius.d.ts +0 -15
- package/dist/lib/entities/Radius.js +0 -27
- package/dist/lib/entities/Radius.js.map +0 -1
- package/dist/lib/entities/Report.d.ts +0 -13
- package/dist/lib/entities/Report.js +0 -21
- package/dist/lib/entities/Report.js.map +0 -1
- package/dist/lib/entities/Rule.d.ts +0 -25
- package/dist/lib/entities/Rule.js +0 -37
- package/dist/lib/entities/Rule.js.map +0 -1
- package/dist/lib/entities/RuleTemplate.d.ts +0 -14
- package/dist/lib/entities/RuleTemplate.js +0 -21
- package/dist/lib/entities/RuleTemplate.js.map +0 -1
- package/dist/lib/entities/SIM.d.ts +0 -8
- package/dist/lib/entities/SIM.js +0 -31
- package/dist/lib/entities/SIM.js.map +0 -1
- package/dist/lib/entities/ServiceStatus.d.ts +0 -8
- package/dist/lib/entities/ServiceStatus.js +0 -15
- package/dist/lib/entities/ServiceStatus.js.map +0 -1
- package/dist/lib/entities/SessionRecord.d.ts +0 -22
- package/dist/lib/entities/SessionRecord.js +0 -46
- package/dist/lib/entities/SessionRecord.js.map +0 -1
- package/dist/lib/entities/Shieldex.d.ts +0 -7
- package/dist/lib/entities/Shieldex.js +0 -13
- package/dist/lib/entities/Shieldex.js.map +0 -1
- package/dist/lib/entities/Stream.d.ts +0 -11
- package/dist/lib/entities/Stream.js +0 -17
- package/dist/lib/entities/Stream.js.map +0 -1
- package/dist/lib/entities/StreamAnalyticsConfig.d.ts +0 -12
- package/dist/lib/entities/StreamAnalyticsConfig.js +0 -15
- package/dist/lib/entities/StreamAnalyticsConfig.js.map +0 -1
- package/dist/lib/entities/StreamConfig.d.ts +0 -19
- package/dist/lib/entities/StreamConfig.js +0 -46
- package/dist/lib/entities/StreamConfig.js.map +0 -1
- package/dist/lib/entities/TeaserPopUpSettings.d.ts +0 -6
- package/dist/lib/entities/TeaserPopUpSettings.js +0 -21
- package/dist/lib/entities/TeaserPopUpSettings.js.map +0 -1
- package/dist/lib/entities/TimeSeriesOfDeviceReport.d.ts +0 -8
- package/dist/lib/entities/TimeSeriesOfDeviceReport.js +0 -21
- package/dist/lib/entities/TimeSeriesOfDeviceReport.js.map +0 -1
- package/dist/lib/entities/UsageRecord.d.ts +0 -32
- package/dist/lib/entities/UsageRecord.js +0 -66
- package/dist/lib/entities/UsageRecord.js.map +0 -1
- package/dist/lib/entities/User.d.ts +0 -16
- package/dist/lib/entities/User.js +0 -26
- package/dist/lib/entities/User.js.map +0 -1
- package/dist/lib/entities/UserMembership.d.ts +0 -14
- package/dist/lib/entities/UserMembership.js +0 -21
- package/dist/lib/entities/UserMembership.js.map +0 -1
- package/dist/lib/entities/UserMemberships.d.ts +0 -14
- package/dist/lib/entities/UserMemberships.js +0 -21
- package/dist/lib/entities/UserMemberships.js.map +0 -1
- package/dist/lib/entities/index.d.ts +0 -50
- package/dist/lib/entities/index.js +0 -51
- package/dist/lib/entities/index.js.map +0 -1
- package/dist/lib/enums/AccountStatusCode.d.ts +0 -7
- package/dist/lib/enums/AccountStatusCode.js +0 -22
- package/dist/lib/enums/AccountStatusCode.js.map +0 -1
- package/dist/lib/enums/AccountTypeCode.d.ts +0 -8
- package/dist/lib/enums/AccountTypeCode.js +0 -25
- package/dist/lib/enums/AccountTypeCode.js.map +0 -1
- package/dist/lib/enums/DataSourceCode.d.ts +0 -7
- package/dist/lib/enums/DataSourceCode.js +0 -22
- package/dist/lib/enums/DataSourceCode.js.map +0 -1
- package/dist/lib/enums/DeviceActionCode.d.ts +0 -8
- package/dist/lib/enums/DeviceActionCode.js +0 -25
- package/dist/lib/enums/DeviceActionCode.js.map +0 -1
- package/dist/lib/enums/DeviceCreationCode.d.ts +0 -8
- package/dist/lib/enums/DeviceCreationCode.js +0 -25
- package/dist/lib/enums/DeviceCreationCode.js.map +0 -1
- package/dist/lib/enums/DeviceIdentityCode.d.ts +0 -11
- package/dist/lib/enums/DeviceIdentityCode.js +0 -34
- package/dist/lib/enums/DeviceIdentityCode.js.map +0 -1
- package/dist/lib/enums/DeviceStatusCode.d.ts +0 -8
- package/dist/lib/enums/DeviceStatusCode.js +0 -25
- package/dist/lib/enums/DeviceStatusCode.js.map +0 -1
- package/dist/lib/enums/DeviceTypeCode.d.ts +0 -18
- package/dist/lib/enums/DeviceTypeCode.js +0 -55
- package/dist/lib/enums/DeviceTypeCode.js.map +0 -1
- package/dist/lib/enums/DirectionContextCode.d.ts +0 -8
- package/dist/lib/enums/DirectionContextCode.js +0 -25
- package/dist/lib/enums/DirectionContextCode.js.map +0 -1
- package/dist/lib/enums/EventCategoryCode.d.ts +0 -6
- package/dist/lib/enums/EventCategoryCode.js +0 -19
- package/dist/lib/enums/EventCategoryCode.js.map +0 -1
- package/dist/lib/enums/EventStatusCode.d.ts +0 -8
- package/dist/lib/enums/EventStatusCode.js +0 -25
- package/dist/lib/enums/EventStatusCode.js.map +0 -1
- package/dist/lib/enums/EventTypeCode.d.ts +0 -23
- package/dist/lib/enums/EventTypeCode.js +0 -70
- package/dist/lib/enums/EventTypeCode.js.map +0 -1
- package/dist/lib/enums/FeatureCode.d.ts +0 -14
- package/dist/lib/enums/FeatureCode.js +0 -43
- package/dist/lib/enums/FeatureCode.js.map +0 -1
- package/dist/lib/enums/HomePageViewCode.d.ts +0 -7
- package/dist/lib/enums/HomePageViewCode.js +0 -22
- package/dist/lib/enums/HomePageViewCode.js.map +0 -1
- package/dist/lib/enums/HttpMethodCode.d.ts +0 -9
- package/dist/lib/enums/HttpMethodCode.js +0 -28
- package/dist/lib/enums/HttpMethodCode.js.map +0 -1
- package/dist/lib/enums/InsightStatusCode.d.ts +0 -7
- package/dist/lib/enums/InsightStatusCode.js +0 -22
- package/dist/lib/enums/InsightStatusCode.js.map +0 -1
- package/dist/lib/enums/InsightTypeCode.d.ts +0 -6
- package/dist/lib/enums/InsightTypeCode.js +0 -19
- package/dist/lib/enums/InsightTypeCode.js.map +0 -1
- package/dist/lib/enums/IntegrationTriggerCode.d.ts +0 -6
- package/dist/lib/enums/IntegrationTriggerCode.js +0 -19
- package/dist/lib/enums/IntegrationTriggerCode.js.map +0 -1
- package/dist/lib/enums/IntegrationTypeCode.d.ts +0 -8
- package/dist/lib/enums/IntegrationTypeCode.js +0 -25
- package/dist/lib/enums/IntegrationTypeCode.js.map +0 -1
- package/dist/lib/enums/MemberRoleCode.d.ts +0 -8
- package/dist/lib/enums/MemberRoleCode.js +0 -25
- package/dist/lib/enums/MemberRoleCode.js.map +0 -1
- package/dist/lib/enums/NetworkMapTypeCode.d.ts +0 -7
- package/dist/lib/enums/NetworkMapTypeCode.js +0 -22
- package/dist/lib/enums/NetworkMapTypeCode.js.map +0 -1
- package/dist/lib/enums/OperatorCode.d.ts +0 -15
- package/dist/lib/enums/OperatorCode.js +0 -46
- package/dist/lib/enums/OperatorCode.js.map +0 -1
- package/dist/lib/enums/PermissionCode.d.ts +0 -9
- package/dist/lib/enums/PermissionCode.js +0 -28
- package/dist/lib/enums/PermissionCode.js.map +0 -1
- package/dist/lib/enums/ReportTypeCode.d.ts +0 -7
- package/dist/lib/enums/ReportTypeCode.js +0 -22
- package/dist/lib/enums/ReportTypeCode.js.map +0 -1
- package/dist/lib/enums/RuleTypeCode.d.ts +0 -7
- package/dist/lib/enums/RuleTypeCode.js +0 -22
- package/dist/lib/enums/RuleTypeCode.js.map +0 -1
- package/dist/lib/enums/SeverityTypeCode.d.ts +0 -8
- package/dist/lib/enums/SeverityTypeCode.js +0 -25
- package/dist/lib/enums/SeverityTypeCode.js.map +0 -1
- package/dist/lib/enums/TrafficDirectionCode.d.ts +0 -7
- package/dist/lib/enums/TrafficDirectionCode.js +0 -22
- package/dist/lib/enums/TrafficDirectionCode.js.map +0 -1
- package/dist/lib/enums/UserStatusCode.d.ts +0 -8
- package/dist/lib/enums/UserStatusCode.js +0 -25
- package/dist/lib/enums/UserStatusCode.js.map +0 -1
- package/dist/lib/enums/UserTypeCode.d.ts +0 -8
- package/dist/lib/enums/UserTypeCode.js +0 -25
- package/dist/lib/enums/UserTypeCode.js.map +0 -1
- package/dist/lib/enums/index.d.ts +0 -29
- package/dist/lib/enums/index.js +0 -30
- package/dist/lib/enums/index.js.map +0 -1
- package/dist/lib/index.d.ts +0 -5
- package/dist/lib/index.js +0 -6
- package/dist/lib/index.js.map +0 -1
- package/dist/lib/pulse-client.d.ts +0 -59
- package/dist/lib/pulse-client.js +0 -156
- package/dist/lib/pulse-client.js.map +0 -1
- package/dist/lib/services/index.d.ts +0 -26
- package/dist/lib/services/index.js +0 -27
- package/dist/lib/services/index.js.map +0 -1
- package/dist/lib/services/services.export.d.ts +0 -26
- package/dist/lib/services/services.export.js +0 -53
- package/dist/lib/services/services.export.js.map +0 -1
- package/dist/lib/services/supportStreamAnalyticsConfig.d.ts +0 -29
- package/dist/lib/services/supportStreamAnalyticsConfig.js +0 -59
- package/dist/lib/services/supportStreamAnalyticsConfig.js.map +0 -1
- package/dist/lib/services/sysAccountsService.d.ts +0 -45
- package/dist/lib/services/sysAccountsService.js +0 -83
- package/dist/lib/services/sysAccountsService.js.map +0 -1
- package/dist/lib/services/sysAuditLogService.d.ts +0 -22
- package/dist/lib/services/sysAuditLogService.js +0 -108
- package/dist/lib/services/sysAuditLogService.js.map +0 -1
- package/dist/lib/services/sysCheckpointsService.d.ts +0 -22
- package/dist/lib/services/sysCheckpointsService.js +0 -78
- package/dist/lib/services/sysCheckpointsService.js.map +0 -1
- package/dist/lib/services/sysConfigService.d.ts +0 -29
- package/dist/lib/services/sysConfigService.js +0 -59
- package/dist/lib/services/sysConfigService.js.map +0 -1
- package/dist/lib/services/sysFeaturesService.d.ts +0 -34
- package/dist/lib/services/sysFeaturesService.js +0 -78
- package/dist/lib/services/sysFeaturesService.js.map +0 -1
- package/dist/lib/services/sysGroupsService.d.ts +0 -42
- package/dist/lib/services/sysGroupsService.js +0 -77
- package/dist/lib/services/sysGroupsService.js.map +0 -1
- package/dist/lib/services/sysInsightsService.d.ts +0 -54
- package/dist/lib/services/sysInsightsService.js +0 -133
- package/dist/lib/services/sysInsightsService.js.map +0 -1
- package/dist/lib/services/sysKeysService.d.ts +0 -34
- package/dist/lib/services/sysKeysService.js +0 -65
- package/dist/lib/services/sysKeysService.js.map +0 -1
- package/dist/lib/services/sysMembersService.d.ts +0 -30
- package/dist/lib/services/sysMembersService.js +0 -65
- package/dist/lib/services/sysMembersService.js.map +0 -1
- package/dist/lib/services/sysRuleTemplatesService.d.ts +0 -29
- package/dist/lib/services/sysRuleTemplatesService.js +0 -59
- package/dist/lib/services/sysRuleTemplatesService.js.map +0 -1
- package/dist/lib/services/sysRulesService.d.ts +0 -34
- package/dist/lib/services/sysRulesService.js +0 -84
- package/dist/lib/services/sysRulesService.js.map +0 -1
- package/dist/lib/services/sysStatisticsService.d.ts +0 -25
- package/dist/lib/services/sysStatisticsService.js +0 -40
- package/dist/lib/services/sysStatisticsService.js.map +0 -1
- package/dist/lib/services/sysStreamsService.d.ts +0 -29
- package/dist/lib/services/sysStreamsService.js +0 -62
- package/dist/lib/services/sysStreamsService.js.map +0 -1
- package/dist/lib/services/sysUsersService.d.ts +0 -44
- package/dist/lib/services/sysUsersService.js +0 -83
- package/dist/lib/services/sysUsersService.js.map +0 -1
- package/dist/lib/services/usrAlertsService.d.ts +0 -110
- package/dist/lib/services/usrAlertsService.js +0 -657
- package/dist/lib/services/usrAlertsService.js.map +0 -1
- package/dist/lib/services/usrDevicesService.d.ts +0 -109
- package/dist/lib/services/usrDevicesService.js +0 -433
- package/dist/lib/services/usrDevicesService.js.map +0 -1
- package/dist/lib/services/usrEventsService.d.ts +0 -93
- package/dist/lib/services/usrEventsService.js +0 -639
- package/dist/lib/services/usrEventsService.js.map +0 -1
- package/dist/lib/services/usrInsightsService.d.ts +0 -13
- package/dist/lib/services/usrInsightsService.js +0 -22
- package/dist/lib/services/usrInsightsService.js.map +0 -1
- package/dist/lib/services/usrIntegrationsService.d.ts +0 -37
- package/dist/lib/services/usrIntegrationsService.js +0 -77
- package/dist/lib/services/usrIntegrationsService.js.map +0 -1
- package/dist/lib/services/usrMembersService.d.ts +0 -34
- package/dist/lib/services/usrMembersService.js +0 -78
- package/dist/lib/services/usrMembersService.js.map +0 -1
- package/dist/lib/services/usrNetworkService.d.ts +0 -18
- package/dist/lib/services/usrNetworkService.js +0 -84
- package/dist/lib/services/usrNetworkService.js.map +0 -1
- package/dist/lib/services/usrReportsService.d.ts +0 -47
- package/dist/lib/services/usrReportsService.js +0 -126
- package/dist/lib/services/usrReportsService.js.map +0 -1
- package/dist/lib/services/usrRulesService.d.ts +0 -34
- package/dist/lib/services/usrRulesService.js +0 -81
- package/dist/lib/services/usrRulesService.js.map +0 -1
- package/dist/lib/services/usrUserService.d.ts +0 -65
- package/dist/lib/services/usrUserService.js +0 -90
- package/dist/lib/services/usrUserService.js.map +0 -1
- package/dist/utils/ActionResponse.d.ts +0 -5
- package/dist/utils/ActionResponse.js +0 -9
- package/dist/utils/ActionResponse.js.map +0 -1
- package/dist/utils/BaseRestResponse.d.ts +0 -4
- package/dist/utils/BaseRestResponse.js +0 -8
- package/dist/utils/BaseRestResponse.js.map +0 -1
- package/dist/utils/EntitiesResponse.d.ts +0 -8
- package/dist/utils/EntitiesResponse.js +0 -15
- package/dist/utils/EntitiesResponse.js.map +0 -1
- package/dist/utils/EntityResponse.d.ts +0 -8
- package/dist/utils/EntityResponse.js +0 -15
- package/dist/utils/EntityResponse.js.map +0 -1
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.js +0 -6
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/rest-axios-setup.d.ts +0 -3
- package/dist/utils/rest-axios-setup.js +0 -8
- package/dist/utils/rest-axios-setup.js.map +0 -1
- package/dist/utils/rest-util.d.ts +0 -15
- package/dist/utils/rest-util.js +0 -101
- package/dist/utils/rest-util.js.map +0 -1
- package/src/config.ts +0 -6
- package/src/index.ts +0 -4
- package/src/utils/ActionResponse.ts +0 -13
- package/src/utils/BaseRestResponse.ts +0 -10
- package/src/utils/EntitiesResponse.ts +0 -21
- package/src/utils/EntityResponse.ts +0 -20
- package/src/utils/index.ts +0 -5
- package/src/utils/rest-axios-setup.ts +0 -10
- package/src/utils/rest-util.ts +0 -113
- package/tsconfig.json +0 -77
package/LICENSE
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright
|
|
3
|
+
Copyright (c) 2021 Tom Chen (tomchen.org)
|
|
4
4
|
|
|
5
|
-
Permission
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,51 +1,44 @@
|
|
|
1
|
-
#
|
|
2
|
-
This folder includes the skeleton cod of the TypeScript library for the pulse-api service.
|
|
3
|
-
The actual code (domain model and services) is generated by the processor.
|
|
4
|
-
This is a native typescript with no Angular dependency
|
|
1
|
+
# Step by Step manual install
|
|
5
2
|
|
|
6
|
-
# pulse-lib
|
|
7
|
-
TypeScript Client Library for pulse-api based on pure TypeScript and [axios](https://axios-http.com/)
|
|
8
3
|
|
|
9
|
-
|
|
10
|
-
Install package using npm
|
|
4
|
+
##### Install dependencies with npm:
|
|
11
5
|
|
|
12
|
-
|
|
13
|
-
npm
|
|
14
|
-
|
|
6
|
+
Install dependencies:
|
|
7
|
+
`npm i`
|
|
8
|
+
|
|
9
|
+
Build package:
|
|
10
|
+
`npm run build`
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
##### Test localy:
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
To use this library, one must add the following HTTP headers to any request:
|
|
19
|
-
* X-API-KEY - API provided by ShieldIoT to identify the integrated system
|
|
20
|
-
* X-ACCESS-TOKEN - Security token to identify the user/service
|
|
15
|
+
Create a symlink in the global folder:
|
|
16
|
+
`npm link`
|
|
21
17
|
|
|
22
|
-
|
|
18
|
+
Go to another folder (the consumer project) and run:
|
|
19
|
+
`npm link pulse-lib`
|
|
20
|
+
|
|
21
|
+
Create sample code in the consumer folder:
|
|
23
22
|
|
|
24
|
-
#### Example: create client and service instance
|
|
25
|
-
Create a client library instance, inject the backend API URL, API key and access token
|
|
26
|
-
From the client library instance, create a service using the factory method
|
|
27
23
|
```javascript
|
|
28
|
-
import {
|
|
24
|
+
import { Num } from 'pulse-lib'
|
|
25
|
+
console.log(new Num(5).add(new Num(6)).val() === 11)
|
|
26
|
+
```
|
|
29
27
|
|
|
30
|
-
|
|
28
|
+
Build and run the project to test the library
|
|
31
29
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
let client = new PulseClient("https://api.pulseiot.io/v1", apiKey, token);
|
|
30
|
+
Uninstall the globally-installed package:
|
|
31
|
+
`npm uninstall pulse-lib -g`
|
|
35
32
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// Create UserServices
|
|
39
|
-
let service = client.CreateUsrUserService();
|
|
33
|
+
# Step by Step CI/CD install (repeat git actions workflow)
|
|
40
34
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
35
|
+
Set env variable:
|
|
36
|
+
`export NODE_AUTH_TOKEN="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"`
|
|
37
|
+
|
|
38
|
+
Add Scope:
|
|
39
|
+
`node tools/packagejson name pulse-lib`
|
|
40
|
+
|
|
41
|
+
Publish to NPM
|
|
42
|
+
`npm publish`
|
|
48
43
|
|
|
49
|
-
test();
|
|
50
|
-
```
|
|
51
44
|
|
package/dist/cjs/Num.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Num = void 0;
|
|
4
|
+
var Num = /** @class */ (function () {
|
|
5
|
+
function Num(n) {
|
|
6
|
+
this.value = n;
|
|
7
|
+
}
|
|
8
|
+
Num.prototype.val = function () {
|
|
9
|
+
return this.value;
|
|
10
|
+
};
|
|
11
|
+
Num.prototype.add = function (n2) {
|
|
12
|
+
this.value += n2.val();
|
|
13
|
+
return this;
|
|
14
|
+
};
|
|
15
|
+
Num.prototype.toString = function () {
|
|
16
|
+
return this.val().toString();
|
|
17
|
+
};
|
|
18
|
+
Num.addAll = function (numArr) {
|
|
19
|
+
return new Num(numArr.map(function (n) { return n.val(); }).reduce(function (a, b) { return a + b; }, 0));
|
|
20
|
+
};
|
|
21
|
+
return Num;
|
|
22
|
+
}());
|
|
23
|
+
exports.Num = Num;
|
|
24
|
+
/***
|
|
25
|
+
* Go to TypeScript's official website https://www.typescriptlang.org/docs/handbook/typescript-from-scratch.html to read more.
|
|
26
|
+
*
|
|
27
|
+
* The following text is copied from
|
|
28
|
+
* https://github.com/microsoft/TypeScript-New-Handbook/blob/master/intros/TypeScript%20for%20the%20New%20Programmer.md
|
|
29
|
+
* and is under the MIT License
|
|
30
|
+
*/
|
|
31
|
+
/*
|
|
32
|
+
|
|
33
|
+
* TypeScript for the New Programmer
|
|
34
|
+
* What is JavaScript?
|
|
35
|
+
* Runs everywhere
|
|
36
|
+
* Untyped, error-prone language
|
|
37
|
+
* Super common
|
|
38
|
+
|
|
39
|
+
# TypeScript for the New Programmer
|
|
40
|
+
|
|
41
|
+
Congratulations choosing TypeScript as one of your first languages - you're already making good decisions.
|
|
42
|
+
|
|
43
|
+
You've probably already heard that TypeScript is a "flavor" or "variant" of JavaScript.
|
|
44
|
+
The relationship between TypeScript and JavaScript is rather unique among modern programming languages, so learning more about this relationship will help you understand how TypeScript adds to JavaScript.
|
|
45
|
+
|
|
46
|
+
## What is JavaScript? A Brief History
|
|
47
|
+
|
|
48
|
+
JavaScript started as a simple scripting language available in browers.
|
|
49
|
+
When the language was first invented, writing more than a few dozen lines of JavaScript (JS) in a webpage would have been somewhat unusual.
|
|
50
|
+
Over time, though, JS became more common and web developers used more and more JS in their webpages to create interactive experiences.
|
|
51
|
+
Early web browsers executed JS very slowly and this sometimes led to laggy, unresponsive pages.
|
|
52
|
+
|
|
53
|
+
Web browser developers saw the increased use of JS and started to optimize their browsers to run JS more quickly.
|
|
54
|
+
Web developers responded by using JS even more to increase the interactivity of their pages.
|
|
55
|
+
On modern websites, you might be running tens or even hundreds of thousands of lines of JS code.
|
|
56
|
+
The web, which started as a simple network of static pages, has evolved into a platform for rich *applications* of all kinds.
|
|
57
|
+
|
|
58
|
+
Lately, JS has also become a popular choice for non-browser scenarios, such as running servers using node.js.
|
|
59
|
+
The "run anywhere" nature of JS makes it an attractive choice for cross-platform development.
|
|
60
|
+
Many developers these days use *only* JavaScript to program their entire stack!
|
|
61
|
+
|
|
62
|
+
The net result is that a very simple language designed to provide basic webpage interactivity is now being used to write applications with millions of lines of code.
|
|
63
|
+
|
|
64
|
+
JavaScript's humble beginnings are still visible in its many *quirks* - oddities or surprises that are not typical for other programming languages.
|
|
65
|
+
For example, JavaScript's equality operator `==` *coerces* its arguments, leading to unexpected behavior:
|
|
66
|
+
```js
|
|
67
|
+
if ("" == 0) {
|
|
68
|
+
// It is! But why??
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
JavaScript also allows accessing properties which aren't present:
|
|
73
|
+
```js
|
|
74
|
+
const obj = { width: 10, height: 15 };
|
|
75
|
+
// Why is this NaN? Spelling is hard!
|
|
76
|
+
const area = obj.width * obj.heigth;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Other programming languages would usually cause these programs to either fail to start at all, or terminate the program mid-execution, if these sorts of errors occur.
|
|
80
|
+
When writing small programs, these quirks are annoying but manageable; when writing applications with hundreds or thousands of lines of code, these constant surprises make development slow and frustrating.
|
|
81
|
+
|
|
82
|
+
## TypeScript: A Static Type Checker
|
|
83
|
+
|
|
84
|
+
We said earlier that other programming languages wouldn't allow those buggy programs to run at all.
|
|
85
|
+
Detecting errors in code without running it is referred to as *static* checking.
|
|
86
|
+
Determining what's an error and what's not based on the kinds of values being operated on is known as *type* checking.
|
|
87
|
+
|
|
88
|
+
Because TypeScript checks a program for errors before it's run, and does so based on the *kinds of values*, it's a *static type checker*.
|
|
89
|
+
For example, the snippet from earlier has an error because of the *type* of `obj`.
|
|
90
|
+
Here's the error TypeScript found:
|
|
91
|
+
|
|
92
|
+
```ts
|
|
93
|
+
const obj = { width: 10, height: 15 };
|
|
94
|
+
const area = obj.width * obj.heigth;
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### A Typed Superset of JavaScript
|
|
98
|
+
|
|
99
|
+
How does TypeScript relate to JavaScript, though?
|
|
100
|
+
|
|
101
|
+
#### Syntax
|
|
102
|
+
|
|
103
|
+
TypeScript is a programming language where all JavaScript syntax is legal.
|
|
104
|
+
Syntax refers to the way we arrange characters to form a program.
|
|
105
|
+
For example, this code has a *syntax* error because it's missing a `)`:
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
let a = (4
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
TypeScript doesn't consider any JavaScript code to be an error because of its syntax.
|
|
112
|
+
This means you can take any working JavaScript code and put it in a TypeScript file without worrying about exactly how it's written.
|
|
113
|
+
|
|
114
|
+
#### Types
|
|
115
|
+
|
|
116
|
+
However, TypeScript is a *typed* superset, meaning that it adds rules about how different kinds of values can be used.
|
|
117
|
+
The earlier error about `obj.heigth` was not an error about the *syntax* of the program, but instead an error about using a kind of value (a *type*) in an incorrect way.
|
|
118
|
+
|
|
119
|
+
As another example, this is JavaScript code you can run in a browser that *will* print a value:
|
|
120
|
+
```js
|
|
121
|
+
console.log(4 / []);
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
This syntactically-legal program prints `NaN`.
|
|
125
|
+
TypeScript, though, considers division of number by an array to be a nonsensical operation, and will issue an error:
|
|
126
|
+
|
|
127
|
+
```ts
|
|
128
|
+
console.log(4 / []);
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
It's entirely possible you really did intend to divide a number by an array, perhaps just to see what would happen.
|
|
132
|
+
The vast majority of the time, though, this code is a mistake on the programmer's part.
|
|
133
|
+
TypeScript's type system rules are designed to allow correct programs through while still catching as many common errors as possible.
|
|
134
|
+
Later, we'll learn about settings you can use to configure how strictly TypeScript checks your code.
|
|
135
|
+
|
|
136
|
+
If you move some code from a JavaScript file to a TypeScript file, you might see *type errors* depending on how the code is written.
|
|
137
|
+
These may be legitimate problems with the code, or TypeScript being overly conservative.
|
|
138
|
+
Throughout this guide we'll demonstrate how to add various TypeScript syntax to make these errors go away.
|
|
139
|
+
|
|
140
|
+
#### Runtime Behavior
|
|
141
|
+
|
|
142
|
+
TypeScript is also a programming language that preserves the *runtime behavior* of JavaScript.
|
|
143
|
+
For example, dividing by zero in JavaScript produces `Infinity` instead of throwing a runtime exception.
|
|
144
|
+
TypeScript **never** changes the runtime behavior of JavaScript code.
|
|
145
|
+
|
|
146
|
+
This means code you move from JavaScript to TypeScript is **guaranteed** to do the same thing, even if TypeScript thinks that code has type errors.
|
|
147
|
+
|
|
148
|
+
Keeping the same runtime behavior as JavaScript is a foundational promise of TypeScript because it means you can easily transition between the two languages without worrying about subtle differences that might make your program stop working.
|
|
149
|
+
|
|
150
|
+
#### Erased Types
|
|
151
|
+
|
|
152
|
+
TypeScript's type system is *erased*, meaning that once your code is compiled, there is no persisted type information in the resulting JavaScript code.
|
|
153
|
+
|
|
154
|
+
TypeScript also never changes the behavior of your program based on the types it inferred.
|
|
155
|
+
While you might see more or fewer type errors, the type system itself has no bearing on how your program works once it's running.
|
|
156
|
+
|
|
157
|
+
Finally, TypeScript doesn't provide any additional runtime libraries.
|
|
158
|
+
Your programs will use the same standard library (or external libraries) as JavaScript programs, so there's no additional TypeScript-specific framework to learn.
|
|
159
|
+
|
|
160
|
+
## Learning JavaScript and TypeScript
|
|
161
|
+
|
|
162
|
+
We frequently see the question "Should I learn JavaScript, or TypeScript instead?".
|
|
163
|
+
|
|
164
|
+
The answer is that you can't do one without doing the other!
|
|
165
|
+
Because TypeScript shares syntax and runtime behavior with JavaScript, anything you learn about JavaScript is helping you learn TypeScript at the same time.
|
|
166
|
+
|
|
167
|
+
There are many, many resources available for programmers learning JavaScript, and you shouldn't ignore these resources if you're writing TypeScript.
|
|
168
|
+
For example, there about 20 times more StackOverflow questions tagged `javascript` than `typescript`, but *all* of the `javascript` questions also apply to TypeScript.
|
|
169
|
+
|
|
170
|
+
If you find yourself searching for something like "how to sort a list in TypeScript", remember, **TypeScript is JavaScript's runtime with a build-time type system**.
|
|
171
|
+
The way you sort a list in TypeScript is the same way you sort a list in JavaScript.
|
|
172
|
+
If you find a resource that does use TypeScript, that's great too, but don't limit yourself to thinking you need TypeScript-specific answers for everyday questions about how to accomplish runtime tasks.
|
|
173
|
+
|
|
174
|
+
*/
|
package/dist/esm/Num.js
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
var Num = /** @class */ (function () {
|
|
2
|
+
function Num(n) {
|
|
3
|
+
this.value = n;
|
|
4
|
+
}
|
|
5
|
+
Num.prototype.val = function () {
|
|
6
|
+
return this.value;
|
|
7
|
+
};
|
|
8
|
+
Num.prototype.add = function (n2) {
|
|
9
|
+
this.value += n2.val();
|
|
10
|
+
return this;
|
|
11
|
+
};
|
|
12
|
+
Num.prototype.toString = function () {
|
|
13
|
+
return this.val().toString();
|
|
14
|
+
};
|
|
15
|
+
Num.addAll = function (numArr) {
|
|
16
|
+
return new Num(numArr.map(function (n) { return n.val(); }).reduce(function (a, b) { return a + b; }, 0));
|
|
17
|
+
};
|
|
18
|
+
return Num;
|
|
19
|
+
}());
|
|
20
|
+
export { Num };
|
|
21
|
+
/***
|
|
22
|
+
* Go to TypeScript's official website https://www.typescriptlang.org/docs/handbook/typescript-from-scratch.html to read more.
|
|
23
|
+
*
|
|
24
|
+
* The following text is copied from
|
|
25
|
+
* https://github.com/microsoft/TypeScript-New-Handbook/blob/master/intros/TypeScript%20for%20the%20New%20Programmer.md
|
|
26
|
+
* and is under the MIT License
|
|
27
|
+
*/
|
|
28
|
+
/*
|
|
29
|
+
|
|
30
|
+
* TypeScript for the New Programmer
|
|
31
|
+
* What is JavaScript?
|
|
32
|
+
* Runs everywhere
|
|
33
|
+
* Untyped, error-prone language
|
|
34
|
+
* Super common
|
|
35
|
+
|
|
36
|
+
# TypeScript for the New Programmer
|
|
37
|
+
|
|
38
|
+
Congratulations choosing TypeScript as one of your first languages - you're already making good decisions.
|
|
39
|
+
|
|
40
|
+
You've probably already heard that TypeScript is a "flavor" or "variant" of JavaScript.
|
|
41
|
+
The relationship between TypeScript and JavaScript is rather unique among modern programming languages, so learning more about this relationship will help you understand how TypeScript adds to JavaScript.
|
|
42
|
+
|
|
43
|
+
## What is JavaScript? A Brief History
|
|
44
|
+
|
|
45
|
+
JavaScript started as a simple scripting language available in browers.
|
|
46
|
+
When the language was first invented, writing more than a few dozen lines of JavaScript (JS) in a webpage would have been somewhat unusual.
|
|
47
|
+
Over time, though, JS became more common and web developers used more and more JS in their webpages to create interactive experiences.
|
|
48
|
+
Early web browsers executed JS very slowly and this sometimes led to laggy, unresponsive pages.
|
|
49
|
+
|
|
50
|
+
Web browser developers saw the increased use of JS and started to optimize their browsers to run JS more quickly.
|
|
51
|
+
Web developers responded by using JS even more to increase the interactivity of their pages.
|
|
52
|
+
On modern websites, you might be running tens or even hundreds of thousands of lines of JS code.
|
|
53
|
+
The web, which started as a simple network of static pages, has evolved into a platform for rich *applications* of all kinds.
|
|
54
|
+
|
|
55
|
+
Lately, JS has also become a popular choice for non-browser scenarios, such as running servers using node.js.
|
|
56
|
+
The "run anywhere" nature of JS makes it an attractive choice for cross-platform development.
|
|
57
|
+
Many developers these days use *only* JavaScript to program their entire stack!
|
|
58
|
+
|
|
59
|
+
The net result is that a very simple language designed to provide basic webpage interactivity is now being used to write applications with millions of lines of code.
|
|
60
|
+
|
|
61
|
+
JavaScript's humble beginnings are still visible in its many *quirks* - oddities or surprises that are not typical for other programming languages.
|
|
62
|
+
For example, JavaScript's equality operator `==` *coerces* its arguments, leading to unexpected behavior:
|
|
63
|
+
```js
|
|
64
|
+
if ("" == 0) {
|
|
65
|
+
// It is! But why??
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
JavaScript also allows accessing properties which aren't present:
|
|
70
|
+
```js
|
|
71
|
+
const obj = { width: 10, height: 15 };
|
|
72
|
+
// Why is this NaN? Spelling is hard!
|
|
73
|
+
const area = obj.width * obj.heigth;
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Other programming languages would usually cause these programs to either fail to start at all, or terminate the program mid-execution, if these sorts of errors occur.
|
|
77
|
+
When writing small programs, these quirks are annoying but manageable; when writing applications with hundreds or thousands of lines of code, these constant surprises make development slow and frustrating.
|
|
78
|
+
|
|
79
|
+
## TypeScript: A Static Type Checker
|
|
80
|
+
|
|
81
|
+
We said earlier that other programming languages wouldn't allow those buggy programs to run at all.
|
|
82
|
+
Detecting errors in code without running it is referred to as *static* checking.
|
|
83
|
+
Determining what's an error and what's not based on the kinds of values being operated on is known as *type* checking.
|
|
84
|
+
|
|
85
|
+
Because TypeScript checks a program for errors before it's run, and does so based on the *kinds of values*, it's a *static type checker*.
|
|
86
|
+
For example, the snippet from earlier has an error because of the *type* of `obj`.
|
|
87
|
+
Here's the error TypeScript found:
|
|
88
|
+
|
|
89
|
+
```ts
|
|
90
|
+
const obj = { width: 10, height: 15 };
|
|
91
|
+
const area = obj.width * obj.heigth;
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### A Typed Superset of JavaScript
|
|
95
|
+
|
|
96
|
+
How does TypeScript relate to JavaScript, though?
|
|
97
|
+
|
|
98
|
+
#### Syntax
|
|
99
|
+
|
|
100
|
+
TypeScript is a programming language where all JavaScript syntax is legal.
|
|
101
|
+
Syntax refers to the way we arrange characters to form a program.
|
|
102
|
+
For example, this code has a *syntax* error because it's missing a `)`:
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
let a = (4
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
TypeScript doesn't consider any JavaScript code to be an error because of its syntax.
|
|
109
|
+
This means you can take any working JavaScript code and put it in a TypeScript file without worrying about exactly how it's written.
|
|
110
|
+
|
|
111
|
+
#### Types
|
|
112
|
+
|
|
113
|
+
However, TypeScript is a *typed* superset, meaning that it adds rules about how different kinds of values can be used.
|
|
114
|
+
The earlier error about `obj.heigth` was not an error about the *syntax* of the program, but instead an error about using a kind of value (a *type*) in an incorrect way.
|
|
115
|
+
|
|
116
|
+
As another example, this is JavaScript code you can run in a browser that *will* print a value:
|
|
117
|
+
```js
|
|
118
|
+
console.log(4 / []);
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
This syntactically-legal program prints `NaN`.
|
|
122
|
+
TypeScript, though, considers division of number by an array to be a nonsensical operation, and will issue an error:
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
console.log(4 / []);
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
It's entirely possible you really did intend to divide a number by an array, perhaps just to see what would happen.
|
|
129
|
+
The vast majority of the time, though, this code is a mistake on the programmer's part.
|
|
130
|
+
TypeScript's type system rules are designed to allow correct programs through while still catching as many common errors as possible.
|
|
131
|
+
Later, we'll learn about settings you can use to configure how strictly TypeScript checks your code.
|
|
132
|
+
|
|
133
|
+
If you move some code from a JavaScript file to a TypeScript file, you might see *type errors* depending on how the code is written.
|
|
134
|
+
These may be legitimate problems with the code, or TypeScript being overly conservative.
|
|
135
|
+
Throughout this guide we'll demonstrate how to add various TypeScript syntax to make these errors go away.
|
|
136
|
+
|
|
137
|
+
#### Runtime Behavior
|
|
138
|
+
|
|
139
|
+
TypeScript is also a programming language that preserves the *runtime behavior* of JavaScript.
|
|
140
|
+
For example, dividing by zero in JavaScript produces `Infinity` instead of throwing a runtime exception.
|
|
141
|
+
TypeScript **never** changes the runtime behavior of JavaScript code.
|
|
142
|
+
|
|
143
|
+
This means code you move from JavaScript to TypeScript is **guaranteed** to do the same thing, even if TypeScript thinks that code has type errors.
|
|
144
|
+
|
|
145
|
+
Keeping the same runtime behavior as JavaScript is a foundational promise of TypeScript because it means you can easily transition between the two languages without worrying about subtle differences that might make your program stop working.
|
|
146
|
+
|
|
147
|
+
#### Erased Types
|
|
148
|
+
|
|
149
|
+
TypeScript's type system is *erased*, meaning that once your code is compiled, there is no persisted type information in the resulting JavaScript code.
|
|
150
|
+
|
|
151
|
+
TypeScript also never changes the behavior of your program based on the types it inferred.
|
|
152
|
+
While you might see more or fewer type errors, the type system itself has no bearing on how your program works once it's running.
|
|
153
|
+
|
|
154
|
+
Finally, TypeScript doesn't provide any additional runtime libraries.
|
|
155
|
+
Your programs will use the same standard library (or external libraries) as JavaScript programs, so there's no additional TypeScript-specific framework to learn.
|
|
156
|
+
|
|
157
|
+
## Learning JavaScript and TypeScript
|
|
158
|
+
|
|
159
|
+
We frequently see the question "Should I learn JavaScript, or TypeScript instead?".
|
|
160
|
+
|
|
161
|
+
The answer is that you can't do one without doing the other!
|
|
162
|
+
Because TypeScript shares syntax and runtime behavior with JavaScript, anything you learn about JavaScript is helping you learn TypeScript at the same time.
|
|
163
|
+
|
|
164
|
+
There are many, many resources available for programmers learning JavaScript, and you shouldn't ignore these resources if you're writing TypeScript.
|
|
165
|
+
For example, there about 20 times more StackOverflow questions tagged `javascript` than `typescript`, but *all* of the `javascript` questions also apply to TypeScript.
|
|
166
|
+
|
|
167
|
+
If you find yourself searching for something like "how to sort a list in TypeScript", remember, **TypeScript is JavaScript's runtime with a build-time type system**.
|
|
168
|
+
The way you sort a list in TypeScript is the same way you sort a list in JavaScript.
|
|
169
|
+
If you find a resource that does use TypeScript, that's great too, but don't limit yourself to thinking you need TypeScript-specific answers for everyday questions about how to accomplish runtime tasks.
|
|
170
|
+
|
|
171
|
+
*/
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare class Num {
|
|
2
|
+
value: number;
|
|
3
|
+
constructor(n: number);
|
|
4
|
+
val(): number;
|
|
5
|
+
add(n2: Num): Num;
|
|
6
|
+
toString(): string;
|
|
7
|
+
static addAll(numArr: Array<Num>): Num;
|
|
8
|
+
}
|
|
9
|
+
/***
|
|
10
|
+
* Go to TypeScript's official website https://www.typescriptlang.org/docs/handbook/typescript-from-scratch.html to read more.
|
|
11
|
+
*
|
|
12
|
+
* The following text is copied from
|
|
13
|
+
* https://github.com/microsoft/TypeScript-New-Handbook/blob/master/intros/TypeScript%20for%20the%20New%20Programmer.md
|
|
14
|
+
* and is under the MIT License
|
|
15
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.exampleTypescriptPackage=t():e.exampleTypescriptPackage=t()}(this,(()=>(()=>{"use strict";var e={49:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Num=void 0;var r=function(){function e(e){this.value=e}return e.prototype.val=function(){return this.value},e.prototype.add=function(e){return this.value+=e.val(),this},e.prototype.toString=function(){return this.val().toString()},e.addAll=function(t){return new e(t.map((function(e){return e.val()})).reduce((function(e,t){return e+t}),0))},e}();t.Num=r}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var u=t[n]={exports:{}};return e[n](u,u.exports,r),u.exports}var n={};return(()=>{var e=n;Object.defineProperty(e,"__esModule",{value:!0}),e.Num=void 0;var t=r(49);Object.defineProperty(e,"Num",{enumerable:!0,get:function(){return t.Num}})})(),n})()));
|
package/package.json
CHANGED
|
@@ -1,28 +1,73 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shieldiot/pulse-lib",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
3
|
+
"version": "1.0.10",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"umd:main": "dist/umd/index.js",
|
|
8
|
+
"types": "dist/types/index.d.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"_postinstall": "husky install",
|
|
11
|
+
"prepublishOnly": "pinst --disable",
|
|
12
|
+
"postpublish": "pinst --enable",
|
|
13
|
+
"build": "npm run build:cjs && npm run build:esm && npm run build:umd && npm run build:types",
|
|
14
|
+
"build:cjs": "node tools/cleanup cjs && tsc -p config/tsconfig.cjs.json",
|
|
15
|
+
"build:esm": "node tools/cleanup esm && tsc -p config/tsconfig.esm.json",
|
|
16
|
+
"build:umd": "node tools/cleanup umd && webpack --config config/webpack.config.js",
|
|
17
|
+
"build:types": "node tools/cleanup types && tsc -p config/tsconfig.types.json",
|
|
18
|
+
"clean": "node tools/cleanup",
|
|
19
|
+
"package": "npm run build && npm pack",
|
|
20
|
+
"test": "jest --no-cache --runInBand",
|
|
21
|
+
"test:cov": "jest --coverage --no-cache --runInBand",
|
|
22
|
+
"addscope": "node tools/packagejson name @pulseiot/pulse-lib-example"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist"
|
|
29
|
+
],
|
|
7
30
|
"keywords": [
|
|
8
|
-
"
|
|
9
|
-
"
|
|
31
|
+
"example",
|
|
32
|
+
"typescript",
|
|
33
|
+
"npm",
|
|
34
|
+
"package",
|
|
35
|
+
"sample",
|
|
36
|
+
"boilerplate",
|
|
37
|
+
"starter",
|
|
38
|
+
"demo",
|
|
39
|
+
"cjs",
|
|
40
|
+
"esm",
|
|
41
|
+
"umd"
|
|
10
42
|
],
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"
|
|
43
|
+
"author": "Motty Cohen <motty.cohen@shieldiot.io>",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"homepage": "https://github.com/shieldiot/pulse-lib-example",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git@github.com:shieldiot/pulse-lib-example.git"
|
|
17
49
|
},
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
"rxjs": "^7.4.0"
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/shieldiot/pulse-lib-example/issues"
|
|
21
52
|
},
|
|
53
|
+
"dependencies": {},
|
|
22
54
|
"devDependencies": {
|
|
23
|
-
"@
|
|
24
|
-
"@
|
|
25
|
-
"
|
|
26
|
-
"typescript": "^
|
|
55
|
+
"@commitlint/cli": "^19.5.0",
|
|
56
|
+
"@commitlint/config-conventional": "^19.5.0",
|
|
57
|
+
"@types/jest": "^29.5.13",
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "^8.8.1",
|
|
59
|
+
"@typescript-eslint/parser": "^8.8.1",
|
|
60
|
+
"eslint": "^9.12.0",
|
|
61
|
+
"eslint-config-prettier": "^9.1.0",
|
|
62
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
63
|
+
"husky": "^9.1.6",
|
|
64
|
+
"jest": "^29.7.0",
|
|
65
|
+
"pinst": "^3.0.0",
|
|
66
|
+
"prettier": "^3.3.3",
|
|
67
|
+
"ts-jest": "^29.2.5",
|
|
68
|
+
"ts-loader": "^9.5.1",
|
|
69
|
+
"typescript": "~5.5.3",
|
|
70
|
+
"webpack": "^5.95.0",
|
|
71
|
+
"webpack-cli": "^5.1.4"
|
|
27
72
|
}
|
|
28
73
|
}
|
package/dist/config.d.ts
DELETED
package/dist/config.js
DELETED
package/dist/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,MAAM,OAAO,WAAW;IACpB,GAAG,GAAW,EAAE,CAAC;IACjB,MAAM,GAAW,EAAE,CAAC;IACpB,WAAW,GAAW,EAAE,CAAC;CAC5B"}
|
package/dist/index.d.ts
DELETED
package/dist/index.js
DELETED
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,oBAAoB,CAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
// Base entity includes common fields for all entities (persistence objects) in the system
|
|
2
|
-
export class BaseEntity {
|
|
3
|
-
// Entity Id
|
|
4
|
-
id;
|
|
5
|
-
// When the entity was created [Epoch milliseconds Timestamp]
|
|
6
|
-
createdOn;
|
|
7
|
-
// When the entity was updated [Epoch milliseconds Timestamp]
|
|
8
|
-
updatedOn;
|
|
9
|
-
constructor(id, createdOn, updatedOn) {
|
|
10
|
-
if (id !== undefined) {
|
|
11
|
-
this.id = id;
|
|
12
|
-
}
|
|
13
|
-
if (createdOn !== undefined) {
|
|
14
|
-
this.createdOn = createdOn;
|
|
15
|
-
}
|
|
16
|
-
if (updatedOn !== undefined) {
|
|
17
|
-
this.updatedOn = updatedOn;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=BaseEntity.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseEntity.js","sourceRoot":"","sources":["../../../src/lib/base/BaseEntity.ts"],"names":[],"mappings":"AAGA,0FAA0F;AAC1F,MAAM,OAAO,UAAU;IAEnB,aAAa;IACN,EAAE,CAAS;IAElB,8DAA8D;IACvD,SAAS,CAAS;IAEzB,8DAA8D;IACvD,SAAS,CAAS;IAExB,YAAY,EAAW,EAAE,SAAkB,EAAE,SAAkB;QAC5D,IAAI,EAAE,KAAK,SAAS,EAAE,CAAC;YAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QAAC,CAAC;QACvC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAAC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAAC,CAAC;QAC5D,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;YAAC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAAC,CAAC;IAChE,CAAC;CAEJ"}
|