polarity-integration-utils 2.0.8 → 3.1.3

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 (139) hide show
  1. package/dist/dts/context/cache.d.ts +149 -0
  2. package/dist/dts/context/cache.d.ts.map +1 -0
  3. package/dist/dts/context/index.d.ts +3 -0
  4. package/dist/dts/context/index.d.ts.map +1 -0
  5. package/dist/dts/context/integration-context.d.ts +16 -0
  6. package/dist/dts/context/integration-context.d.ts.map +1 -0
  7. package/dist/dts/index.d.ts +4 -1
  8. package/dist/dts/index.d.ts.map +1 -1
  9. package/dist/dts/index.docs.d.ts +1 -0
  10. package/dist/dts/index.docs.d.ts.map +1 -1
  11. package/dist/dts/lib/context/cache.d.ts +149 -0
  12. package/dist/dts/lib/context/cache.d.ts.map +1 -0
  13. package/dist/dts/lib/context/index.d.ts +3 -0
  14. package/dist/dts/lib/context/index.d.ts.map +1 -0
  15. package/dist/dts/lib/context/integration-context.d.ts +16 -0
  16. package/dist/dts/lib/context/integration-context.d.ts.map +1 -0
  17. package/dist/dts/lib/errors/api-request-error.d.ts +10 -0
  18. package/dist/dts/lib/errors/api-request-error.d.ts.map +1 -0
  19. package/dist/dts/lib/errors/auth-request-error.d.ts +10 -0
  20. package/dist/dts/lib/errors/auth-request-error.d.ts.map +1 -0
  21. package/dist/dts/lib/errors/index.d.ts +8 -0
  22. package/dist/dts/lib/errors/index.d.ts.map +1 -0
  23. package/dist/dts/lib/errors/integration-error.d.ts +189 -0
  24. package/dist/dts/lib/errors/integration-error.d.ts.map +1 -0
  25. package/dist/dts/lib/errors/library-usage-error.d.ts +12 -0
  26. package/dist/dts/lib/errors/library-usage-error.d.ts.map +1 -0
  27. package/dist/dts/lib/errors/network-error.d.ts +11 -0
  28. package/dist/dts/lib/errors/network-error.d.ts.map +1 -0
  29. package/dist/dts/lib/errors/parse-error-to-readable-json.d.ts +7 -0
  30. package/dist/dts/lib/errors/parse-error-to-readable-json.d.ts.map +1 -0
  31. package/dist/dts/lib/errors/retry-request-error.d.ts +11 -0
  32. package/dist/dts/lib/errors/retry-request-error.d.ts.map +1 -0
  33. package/dist/dts/lib/index.d.ts +8 -0
  34. package/dist/dts/lib/index.d.ts.map +1 -0
  35. package/dist/dts/lib/index.docs.d.ts +10 -0
  36. package/dist/dts/lib/index.docs.d.ts.map +1 -0
  37. package/dist/dts/lib/internal/helpers/parallel-limit.d.ts +9 -0
  38. package/dist/dts/lib/internal/helpers/parallel-limit.d.ts.map +1 -0
  39. package/dist/dts/lib/internal/helpers/sanitize-object.d.ts +11 -0
  40. package/dist/dts/lib/internal/helpers/sanitize-object.d.ts.map +1 -0
  41. package/dist/dts/lib/logging/index.d.ts +2 -0
  42. package/dist/dts/lib/logging/index.d.ts.map +1 -0
  43. package/dist/dts/lib/logging/logger.d.ts +49 -0
  44. package/dist/dts/lib/logging/logger.d.ts.map +1 -0
  45. package/dist/dts/lib/requests/index.d.ts +3 -0
  46. package/dist/dts/lib/requests/index.d.ts.map +1 -0
  47. package/dist/dts/lib/requests/polarity-request.d.ts +411 -0
  48. package/dist/dts/lib/requests/polarity-request.d.ts.map +1 -0
  49. package/dist/dts/lib/requests/sanitize-request-options.d.ts +20 -0
  50. package/dist/dts/lib/requests/sanitize-request-options.d.ts.map +1 -0
  51. package/dist/dts/lib/testing/enhanced-utils/create-entity.d.ts +3 -0
  52. package/dist/dts/lib/testing/enhanced-utils/create-entity.d.ts.map +1 -0
  53. package/dist/dts/lib/testing/enhanced-utils/create-mock-integration-context.d.ts +3 -0
  54. package/dist/dts/lib/testing/enhanced-utils/create-mock-integration-context.d.ts.map +1 -0
  55. package/dist/dts/lib/testing/enhanced-utils/mock-request.d.ts +14 -0
  56. package/dist/dts/lib/testing/enhanced-utils/mock-request.d.ts.map +1 -0
  57. package/dist/dts/lib/testing/enhanced-utils/validate-integration.d.ts +8 -0
  58. package/dist/dts/lib/testing/enhanced-utils/validate-integration.d.ts.map +1 -0
  59. package/dist/dts/lib/testing/index.d.ts +6 -0
  60. package/dist/dts/lib/testing/index.d.ts.map +1 -0
  61. package/dist/dts/lib/testing/test-factory/create-integration-tests.d.ts +6 -0
  62. package/dist/dts/lib/testing/test-factory/create-integration-tests.d.ts.map +1 -0
  63. package/dist/dts/lib/testing/test-factory/test-do-lookup.d.ts +7 -0
  64. package/dist/dts/lib/testing/test-factory/test-do-lookup.d.ts.map +1 -0
  65. package/dist/dts/lib/testing/test-factory/test-on-message.d.ts +8 -0
  66. package/dist/dts/lib/testing/test-factory/test-on-message.d.ts.map +1 -0
  67. package/dist/dts/lib/types.d.ts +101 -0
  68. package/dist/dts/lib/types.d.ts.map +1 -0
  69. package/dist/dts/lib/zod-types.d.ts +278 -0
  70. package/dist/dts/lib/zod-types.d.ts.map +1 -0
  71. package/dist/dts/testing/enhanced-utils/create-entity.d.ts +3 -0
  72. package/dist/dts/testing/enhanced-utils/create-entity.d.ts.map +1 -0
  73. package/dist/dts/testing/enhanced-utils/create-mock-integration-context.d.ts +3 -0
  74. package/dist/dts/testing/enhanced-utils/create-mock-integration-context.d.ts.map +1 -0
  75. package/dist/dts/testing/enhanced-utils/mock-request.d.ts +14 -0
  76. package/dist/dts/testing/enhanced-utils/mock-request.d.ts.map +1 -0
  77. package/dist/dts/testing/enhanced-utils/validate-integration.d.ts +8 -0
  78. package/dist/dts/testing/enhanced-utils/validate-integration.d.ts.map +1 -0
  79. package/dist/dts/testing/index.d.ts +6 -0
  80. package/dist/dts/testing/index.d.ts.map +1 -0
  81. package/dist/dts/testing/test-factory/create-integration-tests.d.ts +6 -0
  82. package/dist/dts/testing/test-factory/create-integration-tests.d.ts.map +1 -0
  83. package/dist/dts/testing/test-factory/test-do-lookup.d.ts +7 -0
  84. package/dist/dts/testing/test-factory/test-do-lookup.d.ts.map +1 -0
  85. package/dist/dts/testing/test-factory/test-on-message.d.ts +8 -0
  86. package/dist/dts/testing/test-factory/test-on-message.d.ts.map +1 -0
  87. package/dist/{tsdoc-metadata.json → dts/tsdoc-metadata.json} +1 -1
  88. package/dist/dts/types.d.ts +50 -53
  89. package/dist/dts/types.d.ts.map +1 -1
  90. package/dist/dts/zod-types.d.ts +278 -0
  91. package/dist/dts/zod-types.d.ts.map +1 -0
  92. package/dist/es/lib/context/index.js +18 -0
  93. package/dist/es/lib/context/integration-context.js +2 -0
  94. package/dist/es/{errors → lib/errors}/network-error.js +1 -1
  95. package/dist/es/{index.docs.js → lib/index.docs.js} +1 -0
  96. package/dist/es/{index.js → lib/index.js} +9 -1
  97. package/dist/es/lib/testing/enhanced-utils/create-entity.js +37 -0
  98. package/dist/es/lib/testing/enhanced-utils/create-mock-integration-context.js +36 -0
  99. package/dist/es/lib/testing/enhanced-utils/mock-request.js +22 -0
  100. package/dist/es/lib/testing/enhanced-utils/validate-integration.js +159 -0
  101. package/dist/es/lib/testing/index.js +21 -0
  102. package/dist/es/lib/testing/test-factory/create-integration-tests.js +53 -0
  103. package/dist/es/lib/testing/test-factory/test-do-lookup.js +24 -0
  104. package/dist/es/lib/testing/test-factory/test-on-message.js +24 -0
  105. package/dist/es/lib/types.js +5 -0
  106. package/dist/es/lib/zod-types.js +206 -0
  107. package/dist/lib/context/cache.js +2 -0
  108. package/dist/lib/context/index.js +18 -0
  109. package/dist/lib/context/integration-context.js +2 -0
  110. package/dist/lib/errors/network-error.js +1 -1
  111. package/dist/lib/index.docs.js +1 -0
  112. package/dist/lib/index.js +9 -1
  113. package/dist/lib/testing/enhanced-utils/create-entity.js +37 -0
  114. package/dist/lib/testing/enhanced-utils/create-mock-integration-context.js +36 -0
  115. package/dist/lib/testing/enhanced-utils/mock-request.js +22 -0
  116. package/dist/lib/testing/enhanced-utils/validate-integration.js +159 -0
  117. package/dist/lib/testing/index.js +21 -0
  118. package/dist/lib/testing/test-factory/create-integration-tests.js +53 -0
  119. package/dist/lib/testing/test-factory/test-do-lookup.js +24 -0
  120. package/dist/lib/testing/test-factory/test-on-message.js +24 -0
  121. package/dist/lib/types.js +3 -0
  122. package/dist/lib/zod-types.js +206 -0
  123. package/dist/polarity-integration-utils.d.ts +461 -54
  124. package/package.json +30 -9
  125. /package/dist/es/{types.js → lib/context/cache.js} +0 -0
  126. /package/dist/es/{errors → lib/errors}/api-request-error.js +0 -0
  127. /package/dist/es/{errors → lib/errors}/auth-request-error.js +0 -0
  128. /package/dist/es/{errors → lib/errors}/index.js +0 -0
  129. /package/dist/es/{errors → lib/errors}/integration-error.js +0 -0
  130. /package/dist/es/{errors → lib/errors}/library-usage-error.js +0 -0
  131. /package/dist/es/{errors → lib/errors}/parse-error-to-readable-json.js +0 -0
  132. /package/dist/es/{errors → lib/errors}/retry-request-error.js +0 -0
  133. /package/dist/es/{internal → lib/internal}/helpers/parallel-limit.js +0 -0
  134. /package/dist/es/{internal → lib/internal}/helpers/sanitize-object.js +0 -0
  135. /package/dist/es/{logging → lib/logging}/index.js +0 -0
  136. /package/dist/es/{logging → lib/logging}/logger.js +0 -0
  137. /package/dist/es/{requests → lib/requests}/index.js +0 -0
  138. /package/dist/es/{requests → lib/requests}/polarity-request.js +0 -0
  139. /package/dist/es/{requests → lib/requests}/sanitize-request-options.js +0 -0
@@ -1,10 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { Logger as PolarityLogger } from './logging';
3
+ import { ValidationErrorSchema, DoLookupUserOptionsSchema, ValidateOptionsUserOptionsSchema, ValidateOptionsUserOptionSchema, PossibleUserOptionValueSchema, DropdownUserOptionValueSchema, EntitySchema, EntityTypeSchema, StandardEntityTypeSchema, ChannelSchema, ResultSchema, IntegrationConfigSchema } from './zod-types';
1
4
  /**
2
5
  * @public
3
6
  */
4
- export type ValidationError = {
5
- key: string;
6
- message: string;
7
- };
7
+ export type ValidationError = z.infer<typeof ValidationErrorSchema>;
8
8
  /**
9
9
  * User options object passed into the integration's `doLookup` method.
10
10
  *
@@ -26,79 +26,76 @@ export type ValidationError = {
26
26
  * ```
27
27
  * @public
28
28
  */
29
- export type DoLookupUserOptions = {
30
- [key: string]: PossibleUserOptionValue;
31
- };
29
+ export type DoLookupUserOptions = z.infer<typeof DoLookupUserOptionsSchema>;
32
30
  /**
33
31
  * @public
34
32
  */
35
- export type ValidateOptionsUserOptions = {
36
- [key: string]: ValidateOptionsUserOption;
37
- };
33
+ export type ValidateOptionsUserOptions = z.infer<typeof ValidateOptionsUserOptionsSchema>;
38
34
  /**
39
35
  * @public
40
36
  */
41
- export type ValidateOptionsUserOption = {
42
- integration_id?: string;
43
- key: string;
44
- value: PossibleUserOptionValue;
45
- user_can_edit?: boolean;
46
- admin_only?: boolean;
47
- };
37
+ export type ValidateOptionsUserOption = z.infer<typeof ValidateOptionsUserOptionSchema>;
48
38
  /**
49
39
  * @public
50
40
  */
51
- export type PossibleUserOptionValue = undefined | string | number | boolean | DropdownUserOptionValue | DropdownUserOptionValue[];
41
+ export type PossibleUserOptionValue = z.infer<typeof PossibleUserOptionValueSchema>;
52
42
  /**
53
43
  * @public
54
44
  */
55
- export type DropdownUserOptionValue = {
56
- display: string;
57
- value: string;
58
- };
45
+ export type DropdownUserOptionValue = z.infer<typeof DropdownUserOptionValueSchema>;
59
46
  /**
60
47
  * Represents a Polarity Entity object which is passed to an integration's
61
48
  * doLookup method.
62
49
  *
63
50
  * @public
64
51
  */
65
- export type Entity = {
66
- value: string;
67
- types: EntityType[];
68
- type: EntityType;
69
- requestContext: {
70
- requestType: 'onDemand';
71
- isUserInitiated: boolean;
72
- };
73
- longitude: number;
74
- latitude: number;
75
- isURL: boolean;
76
- isSHA512: boolean;
77
- isSHA256: boolean;
78
- isSHA1: boolean;
79
- isPrivateIP: boolean;
80
- isMD5: boolean;
81
- isIPv6: boolean;
82
- isIPv4: boolean;
83
- isIP: boolean;
84
- isHex: boolean;
85
- isHash: boolean;
86
- isHTMLTag: boolean;
87
- isEmail: boolean;
88
- isDomain: boolean;
89
- hashType: string;
90
- displayValue: string;
91
- channels: string[];
92
- IPType: string;
93
- };
52
+ export type Entity = z.infer<typeof EntitySchema>;
53
+ /**
54
+ * @public
55
+ */
56
+ export type Channel = z.infer<typeof ChannelSchema>;
94
57
  /**
95
58
  * Entity Types including custom types
96
59
  * @public
97
60
  */
98
- export type EntityType = StandardEntityType | '*' | 'custom' | `custom.${string}`;
61
+ export type EntityType = z.infer<typeof EntityTypeSchema>;
99
62
  /**
100
63
  * List of supported entity type values
101
64
  * @public
102
65
  */
103
- export type StandardEntityType = 'IP' | 'IPv4' | 'IPv4CIDR' | 'IPv6' | 'MAC' | 'MD5' | 'SHA1' | 'SHA256' | 'cve' | 'domain' | 'email' | 'hash' | 'string' | 'url';
66
+ export type StandardEntityType = z.infer<typeof StandardEntityTypeSchema>;
67
+ /**
68
+ * @public
69
+ */
70
+ export type Result<TDetails = unknown> = Omit<z.infer<typeof ResultSchema>, 'data'> & {
71
+ data: {
72
+ summary: string[];
73
+ details: TDetails;
74
+ };
75
+ };
76
+ /**
77
+ * @public
78
+ */
79
+ export type DoLookupResult<TDetails = unknown> = Result<TDetails>[];
80
+ /**
81
+ * @public
82
+ */
83
+ export type IntegrationConfig = z.infer<typeof IntegrationConfigSchema>;
84
+ /**
85
+ * @public
86
+ */
87
+ export { PolarityLogger };
88
+ /**
89
+ * @public
90
+ */
91
+ import { IntegrationContext } from './context';
92
+ import { IntegrationError } from './errors';
93
+ export { IntegrationContext, IntegrationError };
94
+ export interface Integration<TStartupResult = unknown, TDetails = unknown> {
95
+ startup: (logger: PolarityLogger) => Promise<TStartupResult>;
96
+ doLookup: (entities: Entity[], options: DoLookupUserOptions, context: IntegrationContext) => Promise<DoLookupResult<TDetails> | IntegrationError | null | void>;
97
+ onMessage?: (payload: unknown, options: DoLookupUserOptions, context: IntegrationContext) => Promise<unknown>;
98
+ onDetails?: (lookupObject: Result<TDetails>, options: DoLookupUserOptions, context: IntegrationContext) => Promise<unknown>;
99
+ validateOptions: (options: ValidateOptionsUserOptions, context: IntegrationContext) => IntegrationError[];
100
+ }
104
101
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","source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
6
+ export declare const DropdownUserOptionValueSchema: z.ZodObject<{
7
+ display: z.ZodString;
8
+ value: z.ZodString;
9
+ }, z.core.$strip>;
10
+ export declare const PossibleUserOptionValueSchema: z.ZodUnion<readonly [z.ZodUndefined, z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
11
+ display: z.ZodString;
12
+ value: z.ZodString;
13
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
14
+ display: z.ZodString;
15
+ value: z.ZodString;
16
+ }, z.core.$strip>>]>;
17
+ export declare const DoLookupUserOptionsSchema: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodUndefined, z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
18
+ display: z.ZodString;
19
+ value: z.ZodString;
20
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
21
+ display: z.ZodString;
22
+ value: z.ZodString;
23
+ }, z.core.$strip>>]>>;
24
+ export declare const ValidateOptionsUserOptionSchema: z.ZodObject<{
25
+ integration_id: z.ZodOptional<z.ZodString>;
26
+ key: z.ZodString;
27
+ value: z.ZodUnion<readonly [z.ZodUndefined, z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
28
+ display: z.ZodString;
29
+ value: z.ZodString;
30
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
31
+ display: z.ZodString;
32
+ value: z.ZodString;
33
+ }, z.core.$strip>>]>;
34
+ user_can_edit: z.ZodOptional<z.ZodBoolean>;
35
+ admin_only: z.ZodOptional<z.ZodBoolean>;
36
+ }, z.core.$strip>;
37
+ export declare const ValidateOptionsUserOptionsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
38
+ integration_id: z.ZodOptional<z.ZodString>;
39
+ key: z.ZodString;
40
+ value: z.ZodUnion<readonly [z.ZodUndefined, z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodObject<{
41
+ display: z.ZodString;
42
+ value: z.ZodString;
43
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
44
+ display: z.ZodString;
45
+ value: z.ZodString;
46
+ }, z.core.$strip>>]>;
47
+ user_can_edit: z.ZodOptional<z.ZodBoolean>;
48
+ admin_only: z.ZodOptional<z.ZodBoolean>;
49
+ }, z.core.$strip>>;
50
+ export declare const ChannelSchema: z.ZodObject<{
51
+ channel_name: z.ZodString;
52
+ id: z.ZodNumber;
53
+ }, z.core.$strip>;
54
+ export declare const StandardEntityTypeSchema: z.ZodUnion<readonly [z.ZodLiteral<"IP">, z.ZodLiteral<"IPv4">, z.ZodLiteral<"IPv4CIDR">, z.ZodLiteral<"IPv6">, z.ZodLiteral<"MAC">, z.ZodLiteral<"MD5">, z.ZodLiteral<"SHA1">, z.ZodLiteral<"SHA256">, z.ZodLiteral<"cve">, z.ZodLiteral<"domain">, z.ZodLiteral<"email">, z.ZodLiteral<"hash">, z.ZodLiteral<"string">, z.ZodLiteral<"url">]>;
55
+ export declare const EntityTypeSchema: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"IP">, z.ZodLiteral<"IPv4">, z.ZodLiteral<"IPv4CIDR">, z.ZodLiteral<"IPv6">, z.ZodLiteral<"MAC">, z.ZodLiteral<"MD5">, z.ZodLiteral<"SHA1">, z.ZodLiteral<"SHA256">, z.ZodLiteral<"cve">, z.ZodLiteral<"domain">, z.ZodLiteral<"email">, z.ZodLiteral<"hash">, z.ZodLiteral<"string">, z.ZodLiteral<"url">]>, z.ZodLiteral<"*">, z.ZodLiteral<"custom">, z.ZodCustom<`custom.${string}`, `custom.${string}`>]>;
56
+ export declare const EntitySchema: z.ZodObject<{
57
+ value: z.ZodString;
58
+ types: z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"IP">, z.ZodLiteral<"IPv4">, z.ZodLiteral<"IPv4CIDR">, z.ZodLiteral<"IPv6">, z.ZodLiteral<"MAC">, z.ZodLiteral<"MD5">, z.ZodLiteral<"SHA1">, z.ZodLiteral<"SHA256">, z.ZodLiteral<"cve">, z.ZodLiteral<"domain">, z.ZodLiteral<"email">, z.ZodLiteral<"hash">, z.ZodLiteral<"string">, z.ZodLiteral<"url">]>, z.ZodLiteral<"*">, z.ZodLiteral<"custom">, z.ZodCustom<`custom.${string}`, `custom.${string}`>]>>;
59
+ type: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"IP">, z.ZodLiteral<"IPv4">, z.ZodLiteral<"IPv4CIDR">, z.ZodLiteral<"IPv6">, z.ZodLiteral<"MAC">, z.ZodLiteral<"MD5">, z.ZodLiteral<"SHA1">, z.ZodLiteral<"SHA256">, z.ZodLiteral<"cve">, z.ZodLiteral<"domain">, z.ZodLiteral<"email">, z.ZodLiteral<"hash">, z.ZodLiteral<"string">, z.ZodLiteral<"url">]>, z.ZodLiteral<"*">, z.ZodLiteral<"custom">, z.ZodCustom<`custom.${string}`, `custom.${string}`>]>;
60
+ requestContext: z.ZodObject<{
61
+ requestType: z.ZodLiteral<"onDemand">;
62
+ isUserInitiated: z.ZodBoolean;
63
+ }, z.core.$strip>;
64
+ longitude: z.ZodNumber;
65
+ latitude: z.ZodNumber;
66
+ isURL: z.ZodBoolean;
67
+ isSHA512: z.ZodBoolean;
68
+ isSHA256: z.ZodBoolean;
69
+ isSHA1: z.ZodBoolean;
70
+ isPrivateIP: z.ZodBoolean;
71
+ isMD5: z.ZodBoolean;
72
+ isIPv6: z.ZodBoolean;
73
+ isIPv4: z.ZodBoolean;
74
+ isIP: z.ZodBoolean;
75
+ isHex: z.ZodBoolean;
76
+ isHash: z.ZodBoolean;
77
+ isHTMLTag: z.ZodBoolean;
78
+ isEmail: z.ZodBoolean;
79
+ isDomain: z.ZodBoolean;
80
+ hashType: z.ZodUnion<readonly [z.ZodLiteral<"md5">, z.ZodLiteral<"sha1">, z.ZodLiteral<"sha256">, z.ZodLiteral<"sha512">, z.ZodLiteral<"">]>;
81
+ displayValue: z.ZodString;
82
+ channels: z.ZodArray<z.ZodObject<{
83
+ channel_name: z.ZodString;
84
+ id: z.ZodNumber;
85
+ }, z.core.$strip>>;
86
+ IPType: z.ZodUnion<readonly [z.ZodLiteral<"IPv4">, z.ZodLiteral<"IPv6">, z.ZodLiteral<"">]>;
87
+ }, z.core.$strip>;
88
+ export declare const ResultSchema: z.ZodObject<{
89
+ entity: z.ZodObject<{
90
+ value: z.ZodString;
91
+ types: z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"IP">, z.ZodLiteral<"IPv4">, z.ZodLiteral<"IPv4CIDR">, z.ZodLiteral<"IPv6">, z.ZodLiteral<"MAC">, z.ZodLiteral<"MD5">, z.ZodLiteral<"SHA1">, z.ZodLiteral<"SHA256">, z.ZodLiteral<"cve">, z.ZodLiteral<"domain">, z.ZodLiteral<"email">, z.ZodLiteral<"hash">, z.ZodLiteral<"string">, z.ZodLiteral<"url">]>, z.ZodLiteral<"*">, z.ZodLiteral<"custom">, z.ZodCustom<`custom.${string}`, `custom.${string}`>]>>;
92
+ type: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"IP">, z.ZodLiteral<"IPv4">, z.ZodLiteral<"IPv4CIDR">, z.ZodLiteral<"IPv6">, z.ZodLiteral<"MAC">, z.ZodLiteral<"MD5">, z.ZodLiteral<"SHA1">, z.ZodLiteral<"SHA256">, z.ZodLiteral<"cve">, z.ZodLiteral<"domain">, z.ZodLiteral<"email">, z.ZodLiteral<"hash">, z.ZodLiteral<"string">, z.ZodLiteral<"url">]>, z.ZodLiteral<"*">, z.ZodLiteral<"custom">, z.ZodCustom<`custom.${string}`, `custom.${string}`>]>;
93
+ requestContext: z.ZodObject<{
94
+ requestType: z.ZodLiteral<"onDemand">;
95
+ isUserInitiated: z.ZodBoolean;
96
+ }, z.core.$strip>;
97
+ longitude: z.ZodNumber;
98
+ latitude: z.ZodNumber;
99
+ isURL: z.ZodBoolean;
100
+ isSHA512: z.ZodBoolean;
101
+ isSHA256: z.ZodBoolean;
102
+ isSHA1: z.ZodBoolean;
103
+ isPrivateIP: z.ZodBoolean;
104
+ isMD5: z.ZodBoolean;
105
+ isIPv6: z.ZodBoolean;
106
+ isIPv4: z.ZodBoolean;
107
+ isIP: z.ZodBoolean;
108
+ isHex: z.ZodBoolean;
109
+ isHash: z.ZodBoolean;
110
+ isHTMLTag: z.ZodBoolean;
111
+ isEmail: z.ZodBoolean;
112
+ isDomain: z.ZodBoolean;
113
+ hashType: z.ZodUnion<readonly [z.ZodLiteral<"md5">, z.ZodLiteral<"sha1">, z.ZodLiteral<"sha256">, z.ZodLiteral<"sha512">, z.ZodLiteral<"">]>;
114
+ displayValue: z.ZodString;
115
+ channels: z.ZodArray<z.ZodObject<{
116
+ channel_name: z.ZodString;
117
+ id: z.ZodNumber;
118
+ }, z.core.$strip>>;
119
+ IPType: z.ZodUnion<readonly [z.ZodLiteral<"IPv4">, z.ZodLiteral<"IPv6">, z.ZodLiteral<"">]>;
120
+ }, z.core.$strip>;
121
+ displayValue: z.ZodOptional<z.ZodString>;
122
+ data: z.ZodObject<{
123
+ summary: z.ZodArray<z.ZodString>;
124
+ details: z.ZodUnknown;
125
+ }, z.core.$strip>;
126
+ }, z.core.$strip>;
127
+ export declare const DoLookupResultSchema: z.ZodArray<z.ZodObject<{
128
+ entity: z.ZodObject<{
129
+ value: z.ZodString;
130
+ types: z.ZodArray<z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"IP">, z.ZodLiteral<"IPv4">, z.ZodLiteral<"IPv4CIDR">, z.ZodLiteral<"IPv6">, z.ZodLiteral<"MAC">, z.ZodLiteral<"MD5">, z.ZodLiteral<"SHA1">, z.ZodLiteral<"SHA256">, z.ZodLiteral<"cve">, z.ZodLiteral<"domain">, z.ZodLiteral<"email">, z.ZodLiteral<"hash">, z.ZodLiteral<"string">, z.ZodLiteral<"url">]>, z.ZodLiteral<"*">, z.ZodLiteral<"custom">, z.ZodCustom<`custom.${string}`, `custom.${string}`>]>>;
131
+ type: z.ZodUnion<readonly [z.ZodUnion<readonly [z.ZodLiteral<"IP">, z.ZodLiteral<"IPv4">, z.ZodLiteral<"IPv4CIDR">, z.ZodLiteral<"IPv6">, z.ZodLiteral<"MAC">, z.ZodLiteral<"MD5">, z.ZodLiteral<"SHA1">, z.ZodLiteral<"SHA256">, z.ZodLiteral<"cve">, z.ZodLiteral<"domain">, z.ZodLiteral<"email">, z.ZodLiteral<"hash">, z.ZodLiteral<"string">, z.ZodLiteral<"url">]>, z.ZodLiteral<"*">, z.ZodLiteral<"custom">, z.ZodCustom<`custom.${string}`, `custom.${string}`>]>;
132
+ requestContext: z.ZodObject<{
133
+ requestType: z.ZodLiteral<"onDemand">;
134
+ isUserInitiated: z.ZodBoolean;
135
+ }, z.core.$strip>;
136
+ longitude: z.ZodNumber;
137
+ latitude: z.ZodNumber;
138
+ isURL: z.ZodBoolean;
139
+ isSHA512: z.ZodBoolean;
140
+ isSHA256: z.ZodBoolean;
141
+ isSHA1: z.ZodBoolean;
142
+ isPrivateIP: z.ZodBoolean;
143
+ isMD5: z.ZodBoolean;
144
+ isIPv6: z.ZodBoolean;
145
+ isIPv4: z.ZodBoolean;
146
+ isIP: z.ZodBoolean;
147
+ isHex: z.ZodBoolean;
148
+ isHash: z.ZodBoolean;
149
+ isHTMLTag: z.ZodBoolean;
150
+ isEmail: z.ZodBoolean;
151
+ isDomain: z.ZodBoolean;
152
+ hashType: z.ZodUnion<readonly [z.ZodLiteral<"md5">, z.ZodLiteral<"sha1">, z.ZodLiteral<"sha256">, z.ZodLiteral<"sha512">, z.ZodLiteral<"">]>;
153
+ displayValue: z.ZodString;
154
+ channels: z.ZodArray<z.ZodObject<{
155
+ channel_name: z.ZodString;
156
+ id: z.ZodNumber;
157
+ }, z.core.$strip>>;
158
+ IPType: z.ZodUnion<readonly [z.ZodLiteral<"IPv4">, z.ZodLiteral<"IPv6">, z.ZodLiteral<"">]>;
159
+ }, z.core.$strip>;
160
+ displayValue: z.ZodOptional<z.ZodString>;
161
+ data: z.ZodObject<{
162
+ summary: z.ZodArray<z.ZodString>;
163
+ details: z.ZodUnknown;
164
+ }, z.core.$strip>;
165
+ }, z.core.$strip>>;
166
+ export declare const IntegrationConfigSchema: z.ZodObject<{
167
+ polarityIntegrationUuid: z.ZodUUID;
168
+ name: z.ZodString;
169
+ acronym: z.ZodString;
170
+ description: z.ZodOptional<z.ZodString>;
171
+ defaultColor: z.ZodOptional<z.ZodString>;
172
+ entityTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
173
+ dataTypes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
174
+ type: z.ZodOptional<z.ZodLiteral<"custom">>;
175
+ name: z.ZodOptional<z.ZodString>;
176
+ description: z.ZodOptional<z.ZodString>;
177
+ key: z.ZodString;
178
+ regex: z.ZodString;
179
+ editable: z.ZodOptional<z.ZodBoolean>;
180
+ enabled: z.ZodOptional<z.ZodBoolean>;
181
+ }, z.core.$strip>]>>>;
182
+ customTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
183
+ type: z.ZodOptional<z.ZodLiteral<"custom">>;
184
+ name: z.ZodOptional<z.ZodString>;
185
+ description: z.ZodOptional<z.ZodString>;
186
+ key: z.ZodString;
187
+ regex: z.ZodString;
188
+ editable: z.ZodOptional<z.ZodBoolean>;
189
+ enabled: z.ZodOptional<z.ZodBoolean>;
190
+ }, z.core.$strip>>>;
191
+ supportsAdditionalCustomTypes: z.ZodOptional<z.ZodBoolean>;
192
+ styles: z.ZodOptional<z.ZodArray<z.ZodString>>;
193
+ block: z.ZodObject<{
194
+ component: z.ZodObject<{
195
+ file: z.ZodString;
196
+ }, z.core.$strip>;
197
+ template: z.ZodObject<{
198
+ file: z.ZodString;
199
+ }, z.core.$strip>;
200
+ }, z.core.$strip>;
201
+ summary: z.ZodOptional<z.ZodObject<{
202
+ component: z.ZodObject<{
203
+ file: z.ZodString;
204
+ }, z.core.$strip>;
205
+ template: z.ZodObject<{
206
+ file: z.ZodString;
207
+ }, z.core.$strip>;
208
+ }, z.core.$strip>>;
209
+ onDemandOnly: z.ZodOptional<z.ZodBoolean>;
210
+ copyOnDemand: z.ZodOptional<z.ZodBoolean>;
211
+ logging: z.ZodOptional<z.ZodObject<{
212
+ level: z.ZodEnum<{
213
+ error: "error";
214
+ debug: "debug";
215
+ info: "info";
216
+ trace: "trace";
217
+ warn: "warn";
218
+ fatal: "fatal";
219
+ }>;
220
+ }, z.core.$strip>>;
221
+ request: z.ZodOptional<z.ZodObject<{
222
+ cert: z.ZodOptional<z.ZodString>;
223
+ key: z.ZodOptional<z.ZodString>;
224
+ passphrase: z.ZodOptional<z.ZodString>;
225
+ ca: z.ZodOptional<z.ZodString>;
226
+ proxy: z.ZodOptional<z.ZodString>;
227
+ rejectUnauthorized: z.ZodOptional<z.ZodBoolean>;
228
+ }, z.core.$strip>>;
229
+ options: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
230
+ type: z.ZodEnum<{
231
+ text: "text";
232
+ password: "password";
233
+ }>;
234
+ key: z.ZodString;
235
+ name: z.ZodString;
236
+ description: z.ZodOptional<z.ZodString>;
237
+ default: z.ZodNullable<z.ZodString>;
238
+ userCanEdit: z.ZodOptional<z.ZodBoolean>;
239
+ adminOnly: z.ZodOptional<z.ZodBoolean>;
240
+ }, z.core.$strip>, z.ZodObject<{
241
+ type: z.ZodLiteral<"boolean">;
242
+ key: z.ZodString;
243
+ name: z.ZodString;
244
+ description: z.ZodOptional<z.ZodString>;
245
+ default: z.ZodNullable<z.ZodBoolean>;
246
+ userCanEdit: z.ZodOptional<z.ZodBoolean>;
247
+ adminOnly: z.ZodOptional<z.ZodBoolean>;
248
+ }, z.core.$strip>, z.ZodObject<{
249
+ type: z.ZodLiteral<"number">;
250
+ key: z.ZodString;
251
+ name: z.ZodString;
252
+ description: z.ZodOptional<z.ZodString>;
253
+ default: z.ZodNullable<z.ZodNumber>;
254
+ userCanEdit: z.ZodOptional<z.ZodBoolean>;
255
+ adminOnly: z.ZodOptional<z.ZodBoolean>;
256
+ }, z.core.$strip>, z.ZodObject<{
257
+ type: z.ZodLiteral<"select">;
258
+ key: z.ZodString;
259
+ name: z.ZodString;
260
+ description: z.ZodOptional<z.ZodString>;
261
+ default: z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
262
+ value: z.ZodString;
263
+ display: z.ZodString;
264
+ }, z.core.$strip>, z.ZodArray<z.ZodObject<{
265
+ value: z.ZodString;
266
+ display: z.ZodString;
267
+ }, z.core.$strip>>, z.ZodString]>>;
268
+ options: z.ZodArray<z.ZodObject<{
269
+ value: z.ZodString;
270
+ display: z.ZodString;
271
+ }, z.core.$strip>>;
272
+ multiple: z.ZodOptional<z.ZodBoolean>;
273
+ userCanEdit: z.ZodBoolean;
274
+ adminOnly: z.ZodBoolean;
275
+ }, z.core.$strip>], "type">>>;
276
+ }, z.core.$strip>;
277
+ export type IntegrationConfig = z.infer<typeof IntegrationConfigSchema>;
278
+ //# sourceMappingURL=zod-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zod-types.d.ts","sourceRoot":"","sources":["../../lib/zod-types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,qBAAqB;;;iBAGhC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;iBAGxC,CAAC;AAEH,eAAO,MAAM,6BAA6B;;;;;;oBAOxC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;;;;;qBAGrC,CAAC;AAEF,eAAO,MAAM,+BAA+B;;;;;;;;;;;;iBAM1C,CAAC;AAEH,eAAO,MAAM,gCAAgC;;;;;;;;;;;;kBAG5C,CAAC;AAEF,eAAO,MAAM,aAAa;;;iBAGxB,CAAC;AAEH,eAAO,MAAM,wBAAwB,gVAenC,CAAC;AAEH,eAAO,MAAM,gBAAgB,ucAK3B,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkCvB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAOvB,CAAC;AAEH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAAwB,CAAC;AAyE1D,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoClC,CAAC;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./cache"), exports);
18
+ __exportStar(require("./integration-context"), exports);
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -65,7 +65,7 @@ class NetworkError extends integration_error_1.IntegrationError {
65
65
  'SSL errors are typically caused by an untrusted SSL certificate in the HTTPS request chain (e.g., ' +
66
66
  'an internal server that is being queried directly, or a web proxy for external requests). You can temporarily ' +
67
67
  'ignore SSL validation errors by enabling the integration setting "Allow Insecure TLS/SSL Connections". In most ' +
68
- 'cases, you will need to add your organization\'s Certificate Authority to the Polarity Server to resolve the ' +
68
+ "cases, you will need to add your organization's Certificate Authority to the Polarity Server to resolve the " +
69
69
  'issue permanently.';
70
70
  }
71
71
  else if (code && code === 'ENOTFOUND') {
@@ -22,3 +22,4 @@ __exportStar(require("./errors"), exports);
22
22
  __exportStar(require("./requests"), exports);
23
23
  __exportStar(require("./logging"), exports);
24
24
  __exportStar(require("./types"), exports);
25
+ __exportStar(require("./context"), exports);
@@ -32,11 +32,19 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
36
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
37
+ };
35
38
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.logging = exports.requests = exports.errors = void 0;
39
+ exports.types = exports.context = exports.logging = exports.requests = exports.errors = void 0;
37
40
  const errors = __importStar(require("./errors"));
38
41
  exports.errors = errors;
39
42
  const requests = __importStar(require("./requests"));
40
43
  exports.requests = requests;
41
44
  const logging = __importStar(require("./logging"));
42
45
  exports.logging = logging;
46
+ const context = __importStar(require("./context"));
47
+ exports.context = context;
48
+ const types = __importStar(require("./types"));
49
+ exports.types = types;
50
+ __exportStar(require("./types"), exports);
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createEntity = void 0;
4
+ const createEntity = (type, value) => {
5
+ const isDomain = /^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9](?:\.[a-zA-Z]{2,})+$/.test(value);
6
+ const isIPv4 = /^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/.test(value);
7
+ return {
8
+ value,
9
+ displayValue: value,
10
+ type,
11
+ types: [type],
12
+ isDomain,
13
+ isIPv4,
14
+ isIP: isIPv4,
15
+ isEmail: false,
16
+ isHash: false,
17
+ isHex: false,
18
+ isHTMLTag: false,
19
+ isIPv6: false,
20
+ isMD5: false,
21
+ isPrivateIP: false,
22
+ isSHA1: false,
23
+ isSHA256: false,
24
+ isSHA512: false,
25
+ isURL: false,
26
+ latitude: 0,
27
+ longitude: 0,
28
+ hashType: '',
29
+ IPType: isIPv4 ? 'IPv4' : '',
30
+ channels: [],
31
+ requestContext: {
32
+ requestType: 'onDemand',
33
+ isUserInitiated: true
34
+ }
35
+ };
36
+ };
37
+ exports.createEntity = createEntity;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createMockIntegrationContext = void 0;
4
+ const createMockIntegrationContext = () => {
5
+ const cache = {
6
+ global: {
7
+ get: jest.fn(),
8
+ set: jest.fn(),
9
+ delete: jest.fn()
10
+ },
11
+ integration: {
12
+ get: jest.fn(),
13
+ set: jest.fn(),
14
+ delete: jest.fn()
15
+ },
16
+ user: {
17
+ get: jest.fn(),
18
+ set: jest.fn(),
19
+ delete: jest.fn()
20
+ }
21
+ };
22
+ return {
23
+ cache,
24
+ integrationId: 'test-integration',
25
+ userId: 'test-user',
26
+ logger: {
27
+ info: jest.fn(),
28
+ debug: jest.fn(),
29
+ trace: jest.fn(),
30
+ warn: jest.fn(),
31
+ error: jest.fn(),
32
+ fatal: jest.fn()
33
+ }
34
+ };
35
+ };
36
+ exports.createMockIntegrationContext = createMockIntegrationContext;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mockRequest = void 0;
4
+ const polarity_request_1 = require("../../requests/polarity-request");
5
+ jest.mock('../../requests/polarity-request');
6
+ const mockRequest = () => {
7
+ const mockRequest = {
8
+ get: jest.fn(),
9
+ post: jest.fn(),
10
+ put: jest.fn(),
11
+ delete: jest.fn(),
12
+ patch: jest.fn(),
13
+ head: jest.fn(),
14
+ options: jest.fn()
15
+ };
16
+ polarity_request_1.PolarityRequest.mockImplementation(() => mockRequest);
17
+ return {
18
+ PolarityRequestMock: polarity_request_1.PolarityRequest,
19
+ mockRequest
20
+ };
21
+ };
22
+ exports.mockRequest = mockRequest;