@uluops/ops-sdk 1.8.5 → 1.8.8
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/CHANGELOG.md +52 -0
- package/README.md +31 -50
- package/dist/client.d.ts +25 -13
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +20 -5
- package/dist/client.js.map +1 -1
- package/dist/config/constants.d.ts +3 -3
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +3 -3
- package/dist/config/constants.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/validators.d.ts +15 -1
- package/dist/config/validators.d.ts.map +1 -1
- package/dist/config/validators.js +22 -2
- package/dist/config/validators.js.map +1 -1
- package/dist/http/http-client.d.ts.map +1 -1
- package/dist/http/http-client.js +5 -0
- package/dist/http/http-client.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/operations/analytics.d.ts +15 -5
- package/dist/operations/analytics.d.ts.map +1 -1
- package/dist/operations/analytics.js +11 -1
- package/dist/operations/analytics.js.map +1 -1
- package/dist/operations/auth.d.ts +41 -10
- package/dist/operations/auth.d.ts.map +1 -1
- package/dist/operations/auth.js +43 -11
- package/dist/operations/auth.js.map +1 -1
- package/dist/operations/projects.d.ts +26 -8
- package/dist/operations/projects.d.ts.map +1 -1
- package/dist/operations/projects.js +40 -13
- package/dist/operations/projects.js.map +1 -1
- package/dist/operations/runs.d.ts +10 -1
- package/dist/operations/runs.d.ts.map +1 -1
- package/dist/operations/runs.js +30 -24
- package/dist/operations/runs.js.map +1 -1
- package/dist/operations/taxonomy.d.ts +5 -1
- package/dist/operations/taxonomy.d.ts.map +1 -1
- package/dist/operations/taxonomy.js +5 -1
- package/dist/operations/taxonomy.js.map +1 -1
- package/dist/types/analytics.d.ts +4 -11
- package/dist/types/analytics.d.ts.map +1 -1
- package/dist/types/response-schemas.d.ts +41 -186
- package/dist/types/response-schemas.d.ts.map +1 -1
- package/dist/types/response-schemas.js +2 -11
- package/dist/types/response-schemas.js.map +1 -1
- package/dist/types/runs.d.ts +7 -1
- package/dist/types/runs.d.ts.map +1 -1
- package/dist/types/schemas.d.ts +101 -0
- package/dist/types/schemas.d.ts.map +1 -1
- package/dist/types/schemas.js +51 -12
- package/dist/types/schemas.js.map +1 -1
- package/dist/utils/helpers.d.ts +0 -62
- package/dist/utils/helpers.d.ts.map +1 -1
- package/dist/utils/helpers.js +0 -134
- package/dist/utils/helpers.js.map +1 -1
- package/package.json +4 -3
- package/dist/operations/index.d.ts +0 -7
- package/dist/operations/index.d.ts.map +0 -1
- package/dist/operations/index.js +0 -7
- package/dist/operations/index.js.map +0 -1
package/dist/utils/helpers.d.ts
CHANGED
|
@@ -5,39 +5,6 @@
|
|
|
5
5
|
* SDK-specific utilities are defined here.
|
|
6
6
|
*/
|
|
7
7
|
export { sleep, retry, truncate, isPlainObject, isUuid } from '@uluops/sdk-core/utils';
|
|
8
|
-
/**
|
|
9
|
-
* Deep merge two objects, recursively merging nested objects
|
|
10
|
-
* @param target - Base object to merge into
|
|
11
|
-
* @param source - Object with values to overlay
|
|
12
|
-
* @returns New merged object (does not mutate inputs)
|
|
13
|
-
*/
|
|
14
|
-
export declare function deepMerge<T extends Record<string, unknown>>(target: T, source: Partial<T>): T;
|
|
15
|
-
/**
|
|
16
|
-
* Pick specified keys from an object
|
|
17
|
-
* @param obj - Source object
|
|
18
|
-
* @param keys - Keys to include in the result
|
|
19
|
-
* @returns New object containing only the specified keys
|
|
20
|
-
*/
|
|
21
|
-
export declare function pick<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: K[]): Pick<T, K>;
|
|
22
|
-
/**
|
|
23
|
-
* Omit specified keys from an object
|
|
24
|
-
* @param obj - Source object
|
|
25
|
-
* @param keys - Keys to exclude from the result
|
|
26
|
-
* @returns New object without the specified keys
|
|
27
|
-
*/
|
|
28
|
-
export declare function omit<T extends Record<string, unknown>, K extends keyof T>(obj: T, keys: K[]): Omit<T, K>;
|
|
29
|
-
/**
|
|
30
|
-
* Remove undefined values from an object
|
|
31
|
-
* @param obj - Source object to compact
|
|
32
|
-
* @returns New object with undefined values removed
|
|
33
|
-
*/
|
|
34
|
-
export declare function compact<T extends Record<string, unknown>>(obj: T): Partial<T>;
|
|
35
|
-
/**
|
|
36
|
-
* Format a date for display as an ISO 8601 string
|
|
37
|
-
* @param date - Date object or date string to format
|
|
38
|
-
* @returns ISO 8601 formatted date string
|
|
39
|
-
*/
|
|
40
|
-
export declare function formatDate(date: string | Date): string;
|
|
41
8
|
/**
|
|
42
9
|
* Convert camelCase to snake_case
|
|
43
10
|
* @param str - camelCase string to convert
|
|
@@ -50,33 +17,4 @@ export declare function toSnakeCase(str: string): string;
|
|
|
50
17
|
* @returns camelCase formatted string
|
|
51
18
|
*/
|
|
52
19
|
export declare function toCamelCase(str: string): string;
|
|
53
|
-
/**
|
|
54
|
-
* Get a property from an object, trying camelCase first then snake_case
|
|
55
|
-
* Useful for handling API responses that may use either format
|
|
56
|
-
*
|
|
57
|
-
* @example
|
|
58
|
-
* ```typescript
|
|
59
|
-
* const count = getFlexibleProperty(response, 'newIssues', 0);
|
|
60
|
-
* // Tries response.newIssues, then response.new_issues, then returns 0
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
export declare function getFlexibleProperty<T>(obj: object, camelCaseKey: string, defaultValue: T): T;
|
|
64
|
-
/** Mapped type: convert a single snake_case string to camelCase */
|
|
65
|
-
type CamelCase<S extends string> = S extends `${infer P}_${infer R}` ? `${P}${Capitalize<CamelCase<R>>}` : S;
|
|
66
|
-
/** Recursively convert all object keys from snake_case to camelCase at the type level */
|
|
67
|
-
export type CamelCaseKeys<T> = T extends readonly unknown[] ? {
|
|
68
|
-
[K in keyof T]: CamelCaseKeys<T[K]>;
|
|
69
|
-
} : T extends Record<string, unknown> ? {
|
|
70
|
-
[K in keyof T as K extends string ? CamelCase<K> : K]: CamelCaseKeys<T[K]>;
|
|
71
|
-
} : T;
|
|
72
|
-
/**
|
|
73
|
-
* Recursively convert all object keys from snake_case to camelCase.
|
|
74
|
-
*
|
|
75
|
-
* @example
|
|
76
|
-
* ```typescript
|
|
77
|
-
* normalizeKeys({ run_number: 1, workflow_type: 'ship' })
|
|
78
|
-
* // → { runNumber: 1, workflowType: 'ship' }
|
|
79
|
-
* ```
|
|
80
|
-
*/
|
|
81
|
-
export declare function normalizeKeys<T>(input: T): CamelCaseKeys<T>;
|
|
82
20
|
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAIvF;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK/C;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
package/dist/utils/helpers.js
CHANGED
|
@@ -7,89 +7,6 @@
|
|
|
7
7
|
// Re-export shared utilities from sdk-core
|
|
8
8
|
export { sleep, retry, truncate, isPlainObject, isUuid } from '@uluops/sdk-core/utils';
|
|
9
9
|
// ---- SDK-specific utilities ----
|
|
10
|
-
/**
|
|
11
|
-
* Check if a value is a plain object (local copy for deepMerge to avoid
|
|
12
|
-
* importing the re-exported version which could cause issues)
|
|
13
|
-
*/
|
|
14
|
-
function isObj(value) {
|
|
15
|
-
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* Deep merge two objects, recursively merging nested objects
|
|
19
|
-
* @param target - Base object to merge into
|
|
20
|
-
* @param source - Object with values to overlay
|
|
21
|
-
* @returns New merged object (does not mutate inputs)
|
|
22
|
-
*/
|
|
23
|
-
export function deepMerge(target, source) {
|
|
24
|
-
const result = { ...target };
|
|
25
|
-
for (const key of Object.keys(source)) {
|
|
26
|
-
if (key === '__proto__' || key === 'constructor' || key === 'prototype')
|
|
27
|
-
continue;
|
|
28
|
-
const sourceValue = source[key];
|
|
29
|
-
const targetValue = result[key];
|
|
30
|
-
if (isObj(sourceValue) && isObj(targetValue)) {
|
|
31
|
-
result[key] = deepMerge(targetValue, sourceValue);
|
|
32
|
-
}
|
|
33
|
-
else if (sourceValue !== undefined) {
|
|
34
|
-
result[key] = sourceValue;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return result;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Pick specified keys from an object
|
|
41
|
-
* @param obj - Source object
|
|
42
|
-
* @param keys - Keys to include in the result
|
|
43
|
-
* @returns New object containing only the specified keys
|
|
44
|
-
*/
|
|
45
|
-
export function pick(obj, keys) {
|
|
46
|
-
const result = {};
|
|
47
|
-
for (const key of keys) {
|
|
48
|
-
if (key in obj) {
|
|
49
|
-
result[key] = obj[key];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return result;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Omit specified keys from an object
|
|
56
|
-
* @param obj - Source object
|
|
57
|
-
* @param keys - Keys to exclude from the result
|
|
58
|
-
* @returns New object without the specified keys
|
|
59
|
-
*/
|
|
60
|
-
export function omit(obj, keys) {
|
|
61
|
-
const result = { ...obj };
|
|
62
|
-
for (const key of keys) {
|
|
63
|
-
delete result[key];
|
|
64
|
-
}
|
|
65
|
-
return result;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Remove undefined values from an object
|
|
69
|
-
* @param obj - Source object to compact
|
|
70
|
-
* @returns New object with undefined values removed
|
|
71
|
-
*/
|
|
72
|
-
export function compact(obj) {
|
|
73
|
-
const result = {};
|
|
74
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
75
|
-
if (value !== undefined) {
|
|
76
|
-
result[key] = value;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Format a date for display as an ISO 8601 string
|
|
83
|
-
* @param date - Date object or date string to format
|
|
84
|
-
* @returns ISO 8601 formatted date string
|
|
85
|
-
*/
|
|
86
|
-
export function formatDate(date) {
|
|
87
|
-
const d = typeof date === 'string' ? new Date(date) : date;
|
|
88
|
-
if (isNaN(d.getTime())) {
|
|
89
|
-
throw new RangeError(`Invalid date: ${String(date)}`);
|
|
90
|
-
}
|
|
91
|
-
return d.toISOString();
|
|
92
|
-
}
|
|
93
10
|
/**
|
|
94
11
|
* Convert camelCase to snake_case
|
|
95
12
|
* @param str - camelCase string to convert
|
|
@@ -109,55 +26,4 @@ export function toSnakeCase(str) {
|
|
|
109
26
|
export function toCamelCase(str) {
|
|
110
27
|
return str.replace(/_([a-z0-9])/g, (_, letter) => letter.toUpperCase());
|
|
111
28
|
}
|
|
112
|
-
/**
|
|
113
|
-
* Get a property from an object, trying camelCase first then snake_case
|
|
114
|
-
* Useful for handling API responses that may use either format
|
|
115
|
-
*
|
|
116
|
-
* @example
|
|
117
|
-
* ```typescript
|
|
118
|
-
* const count = getFlexibleProperty(response, 'newIssues', 0);
|
|
119
|
-
* // Tries response.newIssues, then response.new_issues, then returns 0
|
|
120
|
-
* ```
|
|
121
|
-
*/
|
|
122
|
-
export function getFlexibleProperty(obj, camelCaseKey, defaultValue) {
|
|
123
|
-
const record = obj;
|
|
124
|
-
// SAFETY: The `as T` casts below are justified because callers provide a
|
|
125
|
-
// defaultValue of type T, establishing the expected type for the property.
|
|
126
|
-
// The API response shapes are validated upstream by Zod response schemas
|
|
127
|
-
// before reaching this helper — this is a convenience accessor, not a
|
|
128
|
-
// validation boundary. If the runtime type doesn't match T, the default
|
|
129
|
-
// value (which IS type-safe) would have been returned if the key was missing.
|
|
130
|
-
if (camelCaseKey in record && record[camelCaseKey] !== undefined) {
|
|
131
|
-
return record[camelCaseKey];
|
|
132
|
-
}
|
|
133
|
-
const snakeKey = toSnakeCase(camelCaseKey);
|
|
134
|
-
if (snakeKey in record && record[snakeKey] !== undefined) {
|
|
135
|
-
return record[snakeKey];
|
|
136
|
-
}
|
|
137
|
-
return defaultValue;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Recursively convert all object keys from snake_case to camelCase.
|
|
141
|
-
*
|
|
142
|
-
* @example
|
|
143
|
-
* ```typescript
|
|
144
|
-
* normalizeKeys({ run_number: 1, workflow_type: 'ship' })
|
|
145
|
-
* // → { runNumber: 1, workflowType: 'ship' }
|
|
146
|
-
* ```
|
|
147
|
-
*/
|
|
148
|
-
export function normalizeKeys(input) {
|
|
149
|
-
if (Array.isArray(input)) {
|
|
150
|
-
return input.map(normalizeKeys);
|
|
151
|
-
}
|
|
152
|
-
if (input !== null && typeof input === 'object') {
|
|
153
|
-
const result = {};
|
|
154
|
-
for (const [key, value] of Object.entries(input)) {
|
|
155
|
-
if (key === '__proto__' || key === 'constructor' || key === 'prototype')
|
|
156
|
-
continue;
|
|
157
|
-
result[toCamelCase(key)] = normalizeKeys(value);
|
|
158
|
-
}
|
|
159
|
-
return result;
|
|
160
|
-
}
|
|
161
|
-
return input;
|
|
162
|
-
}
|
|
163
29
|
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,2CAA2C;AAC3C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEvF,mCAAmC;AAEnC
|
|
1
|
+
{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,2CAA2C;AAC3C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEvF,mCAAmC;AAEnC;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG;SACP,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC;SACzC,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACtC,WAAW,EAAE,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,MAAc,EAAE,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC;AAClF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uluops/ops-sdk",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.8",
|
|
4
4
|
"description": "SDK for the UluOps platform API — validation tracker, analytics, auth, and org management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -53,7 +53,8 @@
|
|
|
53
53
|
"./config": {
|
|
54
54
|
"import": "./dist/config/index.js",
|
|
55
55
|
"types": "./dist/config/index.d.ts"
|
|
56
|
-
}
|
|
56
|
+
},
|
|
57
|
+
"./types/response-schemas": null
|
|
57
58
|
},
|
|
58
59
|
"files": [
|
|
59
60
|
"dist",
|
|
@@ -83,7 +84,7 @@
|
|
|
83
84
|
"url": "git+https://github.com/Uluops/-uluops-ops-sdk.git"
|
|
84
85
|
},
|
|
85
86
|
"dependencies": {
|
|
86
|
-
"@uluops/sdk-core": "^0.5.
|
|
87
|
+
"@uluops/sdk-core": "^0.5.6",
|
|
87
88
|
"zod": "^4.3.6"
|
|
88
89
|
},
|
|
89
90
|
"devDependencies": {
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * as authOps from './auth.js';
|
|
2
|
-
export * as projectOps from './projects.js';
|
|
3
|
-
export * as runOps from './runs.js';
|
|
4
|
-
export * as issueOps from './issues.js';
|
|
5
|
-
export * as analyticsOps from './analytics.js';
|
|
6
|
-
export * as taxonomyOps from './taxonomy.js';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/operations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC"}
|
package/dist/operations/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * as authOps from './auth.js';
|
|
2
|
-
export * as projectOps from './projects.js';
|
|
3
|
-
export * as runOps from './runs.js';
|
|
4
|
-
export * as issueOps from './issues.js';
|
|
5
|
-
export * as analyticsOps from './analytics.js';
|
|
6
|
-
export * as taxonomyOps from './taxonomy.js';
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/operations/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,QAAQ,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC"}
|