@8ms/helpers 2.3.26 → 2.3.28

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 (148) hide show
  1. package/dist/_class/index.d.mts +2 -0
  2. package/dist/_class/index.mjs +61 -0
  3. package/dist/adverity/index.d.mts +2 -0
  4. package/dist/adverity/index.mjs +64 -0
  5. package/dist/adverity/server/index.d.mts +18 -0
  6. package/dist/adverity/server/index.mjs +25 -0
  7. package/dist/api/index.d.mts +2 -0
  8. package/dist/api/index.mjs +3 -0
  9. package/dist/api-DGKJDAfb.mjs +139 -0
  10. package/dist/array/index.d.mts +11 -0
  11. package/dist/array/index.mjs +12 -0
  12. package/dist/atInternet/index.d.mts +20 -0
  13. package/dist/atInternet/index.mjs +18 -0
  14. package/dist/aws/ec2/server/index.d.mts +18 -0
  15. package/dist/aws/ec2/server/index.mjs +48 -0
  16. package/dist/aws/ecs/server/index.d.mts +59 -0
  17. package/dist/aws/ecs/server/index.mjs +113 -0
  18. package/dist/aws/glue/server/index.d.mts +19 -0
  19. package/dist/aws/glue/server/index.mjs +36 -0
  20. package/dist/aws/lambda/server/index.d.mts +28 -0
  21. package/dist/aws/lambda/server/index.mjs +57 -0
  22. package/dist/aws/s3/server/index.d.mts +124 -0
  23. package/dist/aws/s3/server/index.mjs +360 -0
  24. package/dist/aws/server/index.d.mts +2 -0
  25. package/dist/aws/server/index.mjs +3 -0
  26. package/dist/aws/ses/server/index.d.mts +105 -0
  27. package/dist/aws/ses/server/index.mjs +268 -0
  28. package/dist/aws/sqs/server/index.d.mts +41 -0
  29. package/dist/aws/sqs/server/index.mjs +56 -0
  30. package/dist/aws/ssm/server/index.d.mts +18 -0
  31. package/dist/aws/ssm/server/index.mjs +47 -0
  32. package/dist/axios/index.d.mts +22 -0
  33. package/dist/axios/index.mjs +50 -0
  34. package/dist/boolean/index.d.mts +7 -0
  35. package/dist/boolean/index.mjs +13 -0
  36. package/dist/brightData/serpApi/server/index.d.mts +93 -0
  37. package/dist/brightData/serpApi/server/index.mjs +229 -0
  38. package/dist/brightData/server/index.d.mts +2 -0
  39. package/dist/brightData/server/index.mjs +18 -0
  40. package/dist/brightData/webScraperIde/server/index.d.mts +19 -0
  41. package/dist/brightData/webScraperIde/server/index.mjs +50 -0
  42. package/dist/cache/server/index.d.mts +10 -0
  43. package/dist/cache/server/index.mjs +31 -0
  44. package/dist/chunk-DDarj8oW.mjs +7 -0
  45. package/dist/crud/index.d.mts +10 -0
  46. package/dist/crud/index.mjs +10 -0
  47. package/dist/crypto/index.d.mts +25 -0
  48. package/dist/crypto/index.mjs +57 -0
  49. package/dist/date/index.d.mts +2 -0
  50. package/dist/date/index.mjs +471 -0
  51. package/dist/drizzle/server/index.d.mts +22 -0
  52. package/dist/drizzle/server/index.mjs +69 -0
  53. package/dist/environment/index.d.mts +37 -0
  54. package/dist/environment/index.mjs +60 -0
  55. package/dist/eskimi/index.d.mts +52 -0
  56. package/dist/eskimi/index.mjs +90 -0
  57. package/dist/eskimi/server/index.d.mts +25 -0
  58. package/dist/eskimi/server/index.mjs +50 -0
  59. package/dist/file/index.d.mts +7 -0
  60. package/dist/file/index.mjs +20 -0
  61. package/dist/file/server/index.d.mts +8 -0
  62. package/dist/file/server/index.mjs +16 -0
  63. package/dist/geo/index.d.mts +26 -0
  64. package/dist/geo/index.mjs +1591 -0
  65. package/dist/getDecimal-CafxtLhH.mjs +40 -0
  66. package/dist/googleAds/keywordPlanner/server/index.d.mts +45 -0
  67. package/dist/googleAds/keywordPlanner/server/index.mjs +51 -0
  68. package/dist/googleAds/server/index.d.mts +27 -0
  69. package/dist/googleAds/server/index.mjs +48 -0
  70. package/dist/googleCloud/bigquery/server/index.d.mts +82 -0
  71. package/dist/googleCloud/bigquery/server/index.mjs +133 -0
  72. package/dist/googleCloud/server/index.d.mts +2 -0
  73. package/dist/googleCloud/server/index.mjs +24 -0
  74. package/dist/googleCloud/sheets/server/index.d.mts +22 -0
  75. package/dist/googleCloud/sheets/server/index.mjs +31 -0
  76. package/dist/googleCloud/storage/server/index.d.mts +31 -0
  77. package/dist/googleCloud/storage/server/index.mjs +79 -0
  78. package/dist/googlePageSpeed/server/index.d.mts +34 -0
  79. package/dist/googlePageSpeed/server/index.mjs +53 -0
  80. package/dist/googleSearchIncidents/server/index.d.mts +73 -0
  81. package/dist/googleSearchIncidents/server/index.mjs +55 -0
  82. package/dist/greenDomain/server/index.d.mts +25 -0
  83. package/dist/greenDomain/server/index.mjs +31 -0
  84. package/dist/index-1fBbJGQz.d.mts +246 -0
  85. package/dist/index-BHuvb_7y.d.mts +116 -0
  86. package/dist/index-BfyGIdDD.d.mts +18 -0
  87. package/dist/index-CqTOMR8f.d.mts +17 -0
  88. package/dist/index-DW9yJLtI.d.mts +67 -0
  89. package/dist/index-DmCSxHCc.d.mts +32 -0
  90. package/dist/index-DwB8X1lz.d.mts +32 -0
  91. package/dist/inngest/index.d.mts +10 -0
  92. package/dist/inngest/index.mjs +10 -0
  93. package/dist/json/index.d.mts +7 -0
  94. package/dist/json/index.mjs +27 -0
  95. package/dist/littleWarden/server/index.d.mts +56 -0
  96. package/dist/littleWarden/server/index.mjs +79 -0
  97. package/dist/lodash/index.d.mts +45 -0
  98. package/dist/lodash/index.mjs +177 -0
  99. package/dist/lumar/api/server/index.d.mts +66 -0
  100. package/dist/lumar/api/server/index.mjs +111 -0
  101. package/dist/lumar/graphql/server/index.d.mts +308 -0
  102. package/dist/lumar/graphql/server/index.mjs +172 -0
  103. package/dist/myTarget/server/index.d.mts +9 -0
  104. package/dist/myTarget/server/index.mjs +16 -0
  105. package/dist/nextAuth/index.d.mts +12 -0
  106. package/dist/nextAuth/index.mjs +15 -0
  107. package/dist/nextJs/client/index.d.mts +10 -0
  108. package/dist/nextJs/client/index.mjs +12 -0
  109. package/dist/nextJs/index.d.mts +19 -0
  110. package/dist/nextJs/index.mjs +12 -0
  111. package/dist/number/index.d.mts +54 -0
  112. package/dist/number/index.mjs +75 -0
  113. package/dist/object/index.d.mts +8 -0
  114. package/dist/object/index.mjs +22 -0
  115. package/dist/onePassword/server/index.d.mts +24 -0
  116. package/dist/onePassword/server/index.mjs +50 -0
  117. package/dist/openAi/server/index.d.mts +20 -0
  118. package/dist/openAi/server/index.mjs +46 -0
  119. package/dist/prisma/index.d.mts +7 -0
  120. package/dist/prisma/index.mjs +15 -0
  121. package/dist/prisma/server/index.d.mts +31 -0
  122. package/dist/prisma/server/index.mjs +64 -0
  123. package/dist/server-Bwy4JI8Z.mjs +33 -0
  124. package/dist/snapchat/server/index.d.mts +25 -0
  125. package/dist/snapchat/server/index.mjs +39 -0
  126. package/dist/sorting/index.d.mts +25 -0
  127. package/dist/sorting/index.mjs +50 -0
  128. package/dist/stream/server/index.d.mts +15 -0
  129. package/dist/stream/server/index.mjs +48 -0
  130. package/dist/string/index.d.mts +107 -0
  131. package/dist/string/index.mjs +187 -0
  132. package/dist/swr/client/index.d.mts +46 -0
  133. package/dist/swr/client/index.mjs +40 -0
  134. package/dist/upTimeRobot/server/index.d.mts +72 -0
  135. package/dist/upTimeRobot/server/index.mjs +82 -0
  136. package/dist/url/index.d.mts +29 -0
  137. package/dist/url/index.mjs +52 -0
  138. package/dist/url/server/index.d.mts +9 -0
  139. package/dist/url/server/index.mjs +35 -0
  140. package/dist/util/index.d.mts +50 -0
  141. package/dist/util/index.mjs +107 -0
  142. package/dist/util/server/index.d.mts +27 -0
  143. package/dist/util/server/index.mjs +61 -0
  144. package/dist/webWorker/index.d.mts +11 -0
  145. package/dist/webWorker/index.mjs +11 -0
  146. package/dist/xml/server/index.d.mts +4 -0
  147. package/dist/xml/server/index.mjs +17 -0
  148. package/package.json +189 -118
@@ -0,0 +1,2 @@
1
+ import { n as BaseClass, t as BaseNamespace } from "../index-DwB8X1lz.mjs";
2
+ export { BaseClass, BaseNamespace };
@@ -0,0 +1,61 @@
1
+ import { set } from "../lodash/index.mjs";
2
+ import { defaultTo } from "../util/index.mjs";
3
+ import { isServer } from "../environment/index.mjs";
4
+
5
+ //#region src/_class/BaseClass.ts
6
+ var BaseClass = class {
7
+ /**
8
+ * Shortcut to set a value to an array and return the instance.
9
+ */
10
+ _setArray = (fields, input) => {
11
+ if (Array.isArray(input)) set(this, fields, input);
12
+ else set(this, fields, [input]);
13
+ return this;
14
+ };
15
+ /**
16
+ * Shortcut to set a value and return the instance.
17
+ */
18
+ _setValue = (fields, input) => {
19
+ set(this, fields, input);
20
+ return this;
21
+ };
22
+ /**
23
+ * Shortcut to add a value to an existing array.
24
+ */
25
+ _push = (fields, input) => {
26
+ let temp = this._get(fields, []);
27
+ if (Array.isArray(input)) temp = temp.concat(input);
28
+ else temp = temp.push(input);
29
+ set(this, fields, temp);
30
+ return this;
31
+ };
32
+ /**
33
+ * Shortcut to get a value, but default if the fields don't exist.
34
+ */
35
+ _get = (fields, defaultValue = null) => {
36
+ return defaultTo(this, fields, defaultValue);
37
+ };
38
+ };
39
+
40
+ //#endregion
41
+ //#region src/_class/BaseNamespace.ts
42
+ var BaseNamespace = class {
43
+ client = null;
44
+ key;
45
+ config = null;
46
+ constructor(key, config) {
47
+ if (!isServer) throw new Error("Server-side only class accessed from client");
48
+ this.key = key;
49
+ this.config = config;
50
+ }
51
+ ensureInit = async () => {};
52
+ reset = () => {
53
+ this.client = null;
54
+ };
55
+ getClient = async () => {
56
+ return this.client();
57
+ };
58
+ };
59
+
60
+ //#endregion
61
+ export { BaseClass, BaseNamespace };
@@ -0,0 +1,2 @@
1
+ import { a as jobSchema, i as datastreamSchema, n as JobSchemaType, o as stackSchema, r as StackSchemaType, t as DatastreamSchemaType } from "../index-BHuvb_7y.mjs";
2
+ export { DatastreamSchemaType, JobSchemaType, StackSchemaType, datastreamSchema, jobSchema, stackSchema };
@@ -0,0 +1,64 @@
1
+ import { z } from "zod/v4";
2
+
3
+ //#region src/adverity/adverity.ts
4
+ const stackSchema = z.object({
5
+ id: z.string(),
6
+ uuid: z.string(),
7
+ name: z.string(),
8
+ slug: z.string(),
9
+ url: z.string(),
10
+ change_url: z.string(),
11
+ extracts_url: z.string(),
12
+ issues_url: z.string(),
13
+ overview_url: z.string(),
14
+ permissions: z.object({
15
+ isCreator: z.boolean(),
16
+ isDatastreamManager: z.boolean(),
17
+ isViewer: z.boolean()
18
+ })
19
+ });
20
+ const datastreamSchema = z.object({
21
+ id: z.number(),
22
+ stack: stackSchema,
23
+ stack_id: z.number(),
24
+ name: z.string(),
25
+ slug: z.string(),
26
+ app_label: z.string(),
27
+ absolute_url: z.string(),
28
+ change_url: z.string(),
29
+ extracts_url: z.string(),
30
+ fetch_url: z.string(),
31
+ overview_url: z.string(),
32
+ schema_mapping_url: z.string(),
33
+ enabled: z.bigint(),
34
+ next_run: z.union([z.string(), z.literal("Not Scheduled")]),
35
+ url: z.string(),
36
+ datastream_type_id: z.number(),
37
+ logo_url: z.string(),
38
+ extracts_stream_url: z.string(),
39
+ supports_extended_intervals: z.number(),
40
+ updated: z.string(),
41
+ created: z.string(),
42
+ creator: z.string(),
43
+ can_be_fetched: z.number()
44
+ });
45
+ const jobSchema = z.object({
46
+ id: z.number(),
47
+ url: z.string(),
48
+ job_start: z.string().nullable(),
49
+ job_end: z.string().nullable(),
50
+ progress: z.number(),
51
+ state: z.number(),
52
+ state_label: z.string(),
53
+ state_color: z.string(),
54
+ datastream: datastreamSchema,
55
+ issues: z.any().array(),
56
+ type: z.union([
57
+ z.string("Fetch"),
58
+ z.string("Enrich"),
59
+ z.string("Transfer")
60
+ ])
61
+ });
62
+
63
+ //#endregion
64
+ export { datastreamSchema, jobSchema, stackSchema };
@@ -0,0 +1,18 @@
1
+ import { n as JobSchemaType } from "../../index-BHuvb_7y.mjs";
2
+ import { X as InputDate } from "../../index-1fBbJGQz.mjs";
3
+
4
+ //#region src/adverity/server/getJobs.d.ts
5
+ type AdverityJobsResponse = {
6
+ count: number;
7
+ next: string | null;
8
+ previous: string | null;
9
+ results: JobSchemaType[];
10
+ };
11
+ /**
12
+ * Fetch all the jobs that ran yesterday by default.
13
+ * A job can either by in Fetch, Enrich or Transfer states, but all have different job ids. This makes it difficult to track and we would be reliant on the start/end time which could varu.
14
+ * As a result, we only store the Transfer jobs as this is when it gets moved into Bigquery. If it's not in Bigquery we cant use it anyway.
15
+ */
16
+ declare const getJobs: (apiKey: string, start?: InputDate, end?: InputDate, url?: string) => Promise<AdverityJobsResponse[]>;
17
+ //#endregion
18
+ export { getJobs };
@@ -0,0 +1,25 @@
1
+ import "../../api-DGKJDAfb.mjs";
2
+ import { get } from "../../axios/index.mjs";
3
+ import { getLuxonDate, getToday, getYesterday, getYmdString } from "../../date/index.mjs";
4
+
5
+ //#region src/adverity/server/getJobs.ts
6
+ /**
7
+ * Fetch all the jobs that ran yesterday by default.
8
+ * A job can either by in Fetch, Enrich or Transfer states, but all have different job ids. This makes it difficult to track and we would be reliant on the start/end time which could varu.
9
+ * As a result, we only store the Transfer jobs as this is when it gets moved into Bigquery. If it's not in Bigquery we cant use it anyway.
10
+ */
11
+ const getJobs = async (apiKey, start, end, url) => {
12
+ const startYmd = getYmdString(start ? getLuxonDate(start) : getYesterday());
13
+ const endYmd = getYmdString(end ? getLuxonDate(end) : getToday());
14
+ const finalUrl = "undefined" !== typeof url ? url : `https://8ms.datatap.adverity.com/api/jobs/?start=${startYmd}&end=${endYmd}&page_size=300`;
15
+ let response = [];
16
+ const apiResponse = await get(finalUrl, { headers: { Authorization: `Bearer ${apiKey}` } });
17
+ if (apiResponse.isSuccess()) {
18
+ const apiResponseBody = apiResponse.getBody();
19
+ if (apiResponseBody.next) response = [...apiResponse.getBody(), await getJobs(apiKey, start, end, apiResponseBody.next)];
20
+ }
21
+ return response;
22
+ };
23
+
24
+ //#endregion
25
+ export { getJobs };
@@ -0,0 +1,2 @@
1
+ import { a as isSuccess, c as ApiState, d as unexpectedError, f as ApiResponseClass, i as isPending, l as apiState, n as isError, o as isValidationError, r as isIdle, s as ApiResponse, t as isCancelled, u as defaultResponse } from "../index-DW9yJLtI.mjs";
2
+ export { ApiResponse, ApiResponseClass, ApiState, apiState, defaultResponse, isCancelled, isError, isIdle, isPending, isSuccess, isValidationError, unexpectedError };
@@ -0,0 +1,3 @@
1
+ import { a as isSuccess, c as defaultResponse, i as isPending, l as unexpectedError, n as isError, o as isValidationError, r as isIdle, s as apiState, t as isCancelled, u as ApiResponseClass } from "../api-DGKJDAfb.mjs";
2
+
3
+ export { ApiResponseClass, apiState, defaultResponse, isCancelled, isError, isIdle, isPending, isSuccess, isValidationError, unexpectedError };
@@ -0,0 +1,139 @@
1
+ import { defaultTo } from "./util/index.mjs";
2
+
3
+ //#region src/api/ApiResponseClass.ts
4
+ /**
5
+ * Class version of the API to enable quicker instances.
6
+ */
7
+ var ApiResponseClass = class ApiResponseClass {
8
+ state = apiState.IDLE;
9
+ body = null;
10
+ error = null;
11
+ constructor({ body, error, state } = {}) {
12
+ this.body = body || null;
13
+ this.error = error || null;
14
+ this.state = state || apiState.IDLE;
15
+ return this;
16
+ }
17
+ fromJson = (input) => {
18
+ this.body = input.body;
19
+ this.error = input.error;
20
+ this.state = input.state;
21
+ return this;
22
+ };
23
+ getBody = () => {
24
+ return this.body;
25
+ };
26
+ getBodyDefaultTo = (keys, defaultValue) => {
27
+ return defaultTo(this.body, keys, defaultValue);
28
+ };
29
+ getError = () => {
30
+ return this.error;
31
+ };
32
+ getJson = () => {
33
+ return {
34
+ body: this.body,
35
+ error: this.error,
36
+ state: this.state
37
+ };
38
+ };
39
+ getApiState = () => {
40
+ return this.state;
41
+ };
42
+ isError = () => {
43
+ return this.state === apiState.ERROR;
44
+ };
45
+ isIdle = () => {
46
+ return this.state === apiState.IDLE;
47
+ };
48
+ isPending = () => {
49
+ return this.state === apiState.PENDING;
50
+ };
51
+ isSuccess = () => {
52
+ return this.state === apiState.SUCCESS;
53
+ };
54
+ setToIdle = () => {
55
+ this.state = apiState.IDLE;
56
+ return this;
57
+ };
58
+ setToPending = () => {
59
+ this.state = apiState.PENDING;
60
+ return this;
61
+ };
62
+ setToError = (error, body) => {
63
+ this.body = body || null;
64
+ this.error = error;
65
+ this.state = apiState.ERROR;
66
+ return this;
67
+ };
68
+ setToSuccess = (body) => {
69
+ this.body = body;
70
+ this.state = apiState.SUCCESS;
71
+ return this;
72
+ };
73
+ setBody = (body) => {
74
+ this.body = body;
75
+ return this;
76
+ };
77
+ setError = (error) => {
78
+ this.error = error;
79
+ return this;
80
+ };
81
+ setApiState = (state) => {
82
+ this.state = state;
83
+ return this;
84
+ };
85
+ validateZod = (schema) => {
86
+ try {
87
+ return new ApiResponseClass({
88
+ body: schema.parse(this.body),
89
+ state: this.state
90
+ });
91
+ } catch (error) {
92
+ return new ApiResponseClass({
93
+ error,
94
+ state: apiState.ERROR
95
+ });
96
+ }
97
+ };
98
+ };
99
+
100
+ //#endregion
101
+ //#region src/api/api.ts
102
+ const apiState = {
103
+ CANCELLED: "CANCELLED",
104
+ ERROR: "ERROR",
105
+ IDLE: "IDLE",
106
+ PENDING: "PENDING",
107
+ SUCCESS: "SUCCESS",
108
+ VALIDATION_ERROR: "VALIDATION_ERROR"
109
+ };
110
+ const defaultResponse = {
111
+ body: null,
112
+ error: null,
113
+ state: apiState.IDLE
114
+ };
115
+ const unexpectedError = "An unexpected error occurred, please try again.";
116
+
117
+ //#endregion
118
+ //#region src/api/functions.ts
119
+ const isCancelled = (apiResponse) => {
120
+ return apiState.CANCELLED === apiResponse.state;
121
+ };
122
+ const isError = (apiResponse) => {
123
+ return apiState.ERROR === apiResponse.state;
124
+ };
125
+ const isIdle = (apiResponse) => {
126
+ return apiState.IDLE === apiResponse.state;
127
+ };
128
+ const isPending = (apiResponse) => {
129
+ return apiState.PENDING === apiResponse.state;
130
+ };
131
+ const isSuccess = (apiResponse) => {
132
+ return apiState.SUCCESS === apiResponse.state;
133
+ };
134
+ const isValidationError = (apiResponse) => {
135
+ return apiState.VALIDATION_ERROR === apiResponse.state;
136
+ };
137
+
138
+ //#endregion
139
+ export { isSuccess as a, defaultResponse as c, isPending as i, unexpectedError as l, isError as n, isValidationError as o, isIdle as r, apiState as s, isCancelled as t, ApiResponseClass as u };
@@ -0,0 +1,11 @@
1
+ //#region src/array/array.d.ts
2
+ /**
3
+ * Shorthand to check if an array or string contains a needle.
4
+ */
5
+ declare const contains: <T>(haystack: T[], needle: T) => boolean;
6
+ /**
7
+ * Convert an array into an array or return if already an array.
8
+ */
9
+ declare const getArray: <T>(input: T) => T[];
10
+ //#endregion
11
+ export { contains, getArray };
@@ -0,0 +1,12 @@
1
+ //#region src/array/array.ts
2
+ /**
3
+ * Shorthand to check if an array or string contains a needle.
4
+ */
5
+ const contains = (haystack, needle) => -1 !== haystack.indexOf(needle);
6
+ /**
7
+ * Convert an array into an array or return if already an array.
8
+ */
9
+ const getArray = (input) => Array.isArray(input) ? input : [input];
10
+
11
+ //#endregion
12
+ export { contains, getArray };
@@ -0,0 +1,20 @@
1
+ import { z } from "zod/v4";
2
+
3
+ //#region src/atInternet/atInternet.d.ts
4
+ /**
5
+ * The request in the structure required by AT Internet.
6
+ */
7
+ declare const requestSchema: z.ZodObject<{
8
+ columns: z.ZodArray<z.ZodString>;
9
+ evo: z.ZodObject<{}, z.core.$strip>;
10
+ filter: z.ZodObject<{}, z.core.$strip>;
11
+ "max-results": z.ZodNumber;
12
+ options: z.ZodObject<{
13
+ ignore_null_properties: z.ZodBoolean;
14
+ }, z.core.$strip>;
15
+ "page-num": z.ZodNumber;
16
+ period: z.ZodObject<{}, z.core.$strip>;
17
+ }, z.core.$strip>;
18
+ type RequestSchemaType = z.infer<typeof requestSchema>;
19
+ //#endregion
20
+ export { RequestSchemaType, requestSchema };
@@ -0,0 +1,18 @@
1
+ import { z } from "zod/v4";
2
+
3
+ //#region src/atInternet/atInternet.ts
4
+ /**
5
+ * The request in the structure required by AT Internet.
6
+ */
7
+ const requestSchema = z.object({
8
+ columns: z.array(z.string()),
9
+ evo: z.object({}),
10
+ filter: z.object({}),
11
+ "max-results": z.number(),
12
+ options: z.object({ "ignore_null_properties": z.boolean() }),
13
+ "page-num": z.number(),
14
+ period: z.object({})
15
+ });
16
+
17
+ //#endregion
18
+ export { requestSchema };
@@ -0,0 +1,18 @@
1
+ import { t as BaseNamespace } from "../../../index-DwB8X1lz.mjs";
2
+ import { t as AwsConfig } from "../../../index-CqTOMR8f.mjs";
3
+ import * as _aws_sdk_client_ec20 from "@aws-sdk/client-ec2";
4
+ import { EC2Client } from "@aws-sdk/client-ec2";
5
+
6
+ //#region src/aws/ec2/server/AwsEc2Namespace.d.ts
7
+ declare class AwsEc2Namespace extends BaseNamespace {
8
+ client: EC2Client;
9
+ config: AwsConfig;
10
+ ensureInit: () => Promise<void>;
11
+ startInstances: (instanceIds: string[], additionalInfo?: string, dryRun?: boolean) => Promise<_aws_sdk_client_ec20.StartInstancesCommandOutput>;
12
+ stopInstances: (instanceIds: string[], hibernate?: boolean, force?: boolean, dryRun?: boolean) => Promise<_aws_sdk_client_ec20.StopInstancesCommandOutput>;
13
+ }
14
+ //#endregion
15
+ //#region src/aws/ec2/server/awsEc2.d.ts
16
+ declare const awsEc2Client: (key?: string, config?: AwsConfig, vaultId?: string, itemId?: string) => Promise<AwsEc2Namespace>;
17
+ //#endregion
18
+ export { AwsEc2Namespace, awsEc2Client };
@@ -0,0 +1,48 @@
1
+ import { BaseNamespace } from "../../../_class/index.mjs";
2
+ import { t as getConfig } from "../../../server-Bwy4JI8Z.mjs";
3
+
4
+ //#region src/aws/ec2/server/AwsEc2Namespace.ts
5
+ var AwsEc2Namespace = class extends BaseNamespace {
6
+ ensureInit = async () => {
7
+ if (!this.client) try {
8
+ const { EC2Client } = await import("@aws-sdk/client-ec2");
9
+ this.client = new EC2Client(this.config);
10
+ } catch (e) {
11
+ throw new Error("AWS EC2 Client not installed");
12
+ }
13
+ };
14
+ startInstances = async (instanceIds, additionalInfo, dryRun) => {
15
+ await this.ensureInit();
16
+ const { StartInstancesCommand } = await import("@aws-sdk/client-ec2");
17
+ const command = new StartInstancesCommand({
18
+ InstanceIds: instanceIds,
19
+ AdditionalInfo: additionalInfo,
20
+ DryRun: dryRun
21
+ });
22
+ return await this.client.send(command);
23
+ };
24
+ stopInstances = async (instanceIds, hibernate, force, dryRun) => {
25
+ await this.ensureInit();
26
+ const { StopInstancesCommand } = await import("@aws-sdk/client-ec2");
27
+ const command = new StopInstancesCommand({
28
+ InstanceIds: instanceIds,
29
+ Hibernate: hibernate,
30
+ DryRun: dryRun,
31
+ Force: force
32
+ });
33
+ return await this.client.send(command);
34
+ };
35
+ };
36
+
37
+ //#endregion
38
+ //#region src/aws/ec2/server/awsEc2.ts
39
+ const awsEc2Namespaces = /* @__PURE__ */ new Map();
40
+ const awsEc2Client = async (key = "default", config, vaultId, itemId) => {
41
+ if (awsEc2Namespaces.has(key)) return awsEc2Namespaces.get(key);
42
+ const namespace = new AwsEc2Namespace(key, await getConfig(key, config, vaultId, itemId));
43
+ awsEc2Namespaces.set(key, namespace);
44
+ return namespace;
45
+ };
46
+
47
+ //#endregion
48
+ export { AwsEc2Namespace, awsEc2Client };
@@ -0,0 +1,59 @@
1
+ import { t as BaseNamespace } from "../../../index-DwB8X1lz.mjs";
2
+ import { t as AwsConfig } from "../../../index-CqTOMR8f.mjs";
3
+ import { DesiredStatus, ECSClient, LaunchType, NetworkConfiguration, SortOrder, TaskDefinitionStatus, TaskOverride } from "@aws-sdk/client-ecs";
4
+
5
+ //#region src/aws/ecs/server/AwsEcsNamespace.d.ts
6
+ type GetTaskDefinitionsProps = {
7
+ familyPrefix?: string;
8
+ maxResults?: number;
9
+ sort?: SortOrder;
10
+ status?: TaskDefinitionStatus;
11
+ };
12
+ type GetTasksProps = {
13
+ cluster?: string;
14
+ containerInstance?: string;
15
+ desiredStatus?: DesiredStatus;
16
+ family?: string;
17
+ maxResults?: number;
18
+ serviceName?: string;
19
+ startedBy?: string;
20
+ };
21
+ type RunTaskProps = {
22
+ cluster?: string;
23
+ count?: number;
24
+ launchType?: LaunchType;
25
+ networkConfiguration?: NetworkConfiguration;
26
+ overrides?: TaskOverride;
27
+ taskDefinition?: string;
28
+ };
29
+ declare class AwsEcsNamespace extends BaseNamespace {
30
+ client: ECSClient;
31
+ config: AwsConfig;
32
+ ensureInit: () => Promise<void>;
33
+ /**
34
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ecs/command/ListClustersCommand/
35
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/ListClustersCommandInput/
36
+ */
37
+ getClusters: (maxResults?: number) => Promise<string[]>;
38
+ /**
39
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ecs/command/ListTaskDefinitionsCommand/
40
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/ListTaskDefinitionsCommandInput/
41
+ */
42
+ getTaskDefinitions: (props: GetTaskDefinitionsProps) => Promise<string[]>;
43
+ /**
44
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ecs/command/ListTasksCommand/
45
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/ListTasksCommandInput/
46
+ */
47
+ getTasks: (props: GetTasksProps) => Promise<string[]>;
48
+ /**
49
+ * Initialise and run a task
50
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ecs/command/RunTaskCommand/
51
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/RunTaskCommandInput/
52
+ */
53
+ runTask: (props: RunTaskProps) => Promise<any>;
54
+ }
55
+ //#endregion
56
+ //#region src/aws/ecs/server/awsEcs.d.ts
57
+ declare const awsEcsClient: (key?: string, config?: AwsConfig, vaultId?: string, itemId?: string) => Promise<AwsEcsNamespace>;
58
+ //#endregion
59
+ export { AwsEcsNamespace, awsEcsClient };
@@ -0,0 +1,113 @@
1
+ import { BaseNamespace } from "../../../_class/index.mjs";
2
+ import { n as isResponse200, t as getConfig } from "../../../server-Bwy4JI8Z.mjs";
3
+
4
+ //#region src/aws/ecs/server/AwsEcsNamespace.ts
5
+ var AwsEcsNamespace = class extends BaseNamespace {
6
+ ensureInit = async () => {
7
+ if (!this.client) try {
8
+ const { ECSClient } = await import("@aws-sdk/client-ecs");
9
+ this.client = new ECSClient(this.config);
10
+ } catch (e) {
11
+ throw new Error("AWS ECS Client not installed");
12
+ }
13
+ };
14
+ /**
15
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ecs/command/ListClustersCommand/
16
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/ListClustersCommandInput/
17
+ */
18
+ getClusters = async (maxResults) => {
19
+ await this.ensureInit();
20
+ const { ListClustersCommand } = await import("@aws-sdk/client-ecs");
21
+ let response = [];
22
+ let apiResponse = null;
23
+ while (null === apiResponse || apiResponse?.nextToken) {
24
+ const listClustersCommand = new ListClustersCommand({
25
+ maxResults,
26
+ nextToken: apiResponse?.nextToken
27
+ });
28
+ apiResponse = await this.client.send(listClustersCommand);
29
+ if (isResponse200(apiResponse)) response = [...response, ...apiResponse.clusterArns];
30
+ }
31
+ return response;
32
+ };
33
+ /**
34
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ecs/command/ListTaskDefinitionsCommand/
35
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/ListTaskDefinitionsCommandInput/
36
+ */
37
+ getTaskDefinitions = async (props) => {
38
+ await this.ensureInit();
39
+ const { ListTaskDefinitionsCommand } = await import("@aws-sdk/client-ecs");
40
+ let response = [];
41
+ let apiResponse = null;
42
+ while (null === apiResponse || apiResponse?.nextToken) {
43
+ const listTaskDefinitionsCommand = new ListTaskDefinitionsCommand({
44
+ maxResults: props?.maxResults,
45
+ familyPrefix: props?.familyPrefix,
46
+ sort: props?.sort,
47
+ status: props?.status,
48
+ nextToken: apiResponse?.nextToken
49
+ });
50
+ apiResponse = await this.client.send(listTaskDefinitionsCommand);
51
+ if (isResponse200(apiResponse)) response = [...response, ...apiResponse.taskDefinitionArns];
52
+ }
53
+ return response;
54
+ };
55
+ /**
56
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ecs/command/ListTasksCommand/
57
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/ListTasksCommandInput/
58
+ */
59
+ getTasks = async (props) => {
60
+ await this.ensureInit();
61
+ const { ListTasksCommand } = await import("@aws-sdk/client-ecs");
62
+ let response = [];
63
+ let apiResponse = null;
64
+ while (null === apiResponse || apiResponse?.nextToken) {
65
+ const listTasksCommand = new ListTasksCommand({
66
+ cluster: props?.cluster,
67
+ containerInstance: props?.containerInstance,
68
+ desiredStatus: props?.desiredStatus,
69
+ family: props?.family,
70
+ maxResults: props?.maxResults,
71
+ nextToken: apiResponse?.nextToken,
72
+ serviceName: props?.serviceName,
73
+ startedBy: props?.startedBy
74
+ });
75
+ apiResponse = await this.client.send(listTasksCommand);
76
+ if (isResponse200(apiResponse)) response = [...response, ...apiResponse.taskArns];
77
+ }
78
+ return response;
79
+ };
80
+ /**
81
+ * Initialise and run a task
82
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/ecs/command/RunTaskCommand/
83
+ * https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-ecs/Interface/RunTaskCommandInput/
84
+ */
85
+ runTask = async (props) => {
86
+ await this.ensureInit();
87
+ const { RunTaskCommand } = await import("@aws-sdk/client-ecs");
88
+ let response = false;
89
+ const runtTaskCommand = new RunTaskCommand({
90
+ cluster: props?.cluster,
91
+ launchType: props?.launchType,
92
+ networkConfiguration: props?.networkConfiguration,
93
+ overrides: props?.overrides,
94
+ taskDefinition: props?.taskDefinition
95
+ });
96
+ const apiResponse = await this.client.send(runtTaskCommand);
97
+ if (isResponse200(apiResponse)) response = apiResponse;
98
+ return response;
99
+ };
100
+ };
101
+
102
+ //#endregion
103
+ //#region src/aws/ecs/server/awsEcs.ts
104
+ const awsEcsNamespaces = /* @__PURE__ */ new Map();
105
+ const awsEcsClient = async (key = "default", config, vaultId, itemId) => {
106
+ if (awsEcsNamespaces.has(key)) return awsEcsNamespaces.get(key);
107
+ const namespace = new AwsEcsNamespace(key, await getConfig(key, config, vaultId, itemId));
108
+ awsEcsNamespaces.set(key, namespace);
109
+ return namespace;
110
+ };
111
+
112
+ //#endregion
113
+ export { AwsEcsNamespace, awsEcsClient };
@@ -0,0 +1,19 @@
1
+ import { t as BaseNamespace } from "../../../index-DwB8X1lz.mjs";
2
+ import { t as AwsConfig } from "../../../index-CqTOMR8f.mjs";
3
+ import { GlueClient } from "@aws-sdk/client-glue";
4
+
5
+ //#region src/aws/glue/server/AwsGlueNamespace.d.ts
6
+ declare class AwsGlueNamespace extends BaseNamespace {
7
+ client: GlueClient;
8
+ config: AwsConfig;
9
+ ensureInit: () => Promise<void>;
10
+ /**
11
+ * Invoke an AWS Glue Crawler by passing in the name of the Crawler.
12
+ */
13
+ invoke: (crawler: string) => Promise<boolean>;
14
+ }
15
+ //#endregion
16
+ //#region src/aws/glue/server/awsGlue.d.ts
17
+ declare const awsGlueClient: (key?: string, config?: AwsConfig, vaultId?: string, itemId?: string) => Promise<AwsGlueNamespace>;
18
+ //#endregion
19
+ export { AwsGlueNamespace, awsGlueClient };