@civitai/client 0.1.9-beta.9 → 0.2.0-beta.2

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 (73) hide show
  1. package/README.md +0 -0
  2. package/dist/client/CivitaiClient.d.ts +2 -1
  3. package/dist/client/CivitaiClient.js +13 -13
  4. package/dist/generated/client/client.d.ts +2 -0
  5. package/dist/generated/client/client.js +145 -0
  6. package/dist/generated/client/index.d.ts +22 -0
  7. package/dist/generated/client/index.js +4 -0
  8. package/dist/generated/client/types.d.ts +185 -0
  9. package/dist/generated/client/utils.d.ts +72 -0
  10. package/dist/generated/client/utils.js +285 -0
  11. package/dist/generated/client.gen.d.ts +14 -0
  12. package/dist/generated/client.gen.js +3 -0
  13. package/dist/generated/core/auth.d.ts +21 -0
  14. package/dist/generated/core/auth.js +13 -0
  15. package/dist/generated/core/bodySerializer.d.ts +17 -0
  16. package/dist/generated/core/bodySerializer.js +53 -0
  17. package/dist/generated/core/params.d.ts +38 -0
  18. package/dist/generated/core/params.js +88 -0
  19. package/dist/generated/core/pathSerializer.d.ts +49 -0
  20. package/dist/generated/core/pathSerializer.js +105 -0
  21. package/dist/generated/core/types.d.ts +89 -0
  22. package/dist/generated/core/types.js +1 -0
  23. package/dist/generated/index.d.ts +1 -2
  24. package/dist/generated/index.js +2 -6
  25. package/dist/generated/schemas.gen.d.ts +2083 -2028
  26. package/dist/generated/schemas.gen.js +2093 -2031
  27. package/dist/generated/sdk.gen.d.ts +370 -0
  28. package/dist/generated/sdk.gen.js +472 -0
  29. package/dist/generated/services.gen.d.ts +88 -90
  30. package/dist/generated/services.gen.js +100 -147
  31. package/dist/generated/types.gen.d.ts +1545 -1982
  32. package/dist/generated/types.gen.js +70 -134
  33. package/dist/index.js +3 -6
  34. package/dist/utils/Air.js +2 -6
  35. package/dist/utils/TimeSpan.js +24 -28
  36. package/dist/utils/handleError.d.ts +2 -0
  37. package/dist/utils/handleError.js +9 -0
  38. package/dist/utils/index.d.ts +1 -0
  39. package/dist/utils/index.js +4 -6
  40. package/dist/utils/patch-json.js +19 -8
  41. package/dist/utils/types.d.ts +3 -0
  42. package/dist/utils/types.js +1 -0
  43. package/package.json +5 -3
  44. package/dist/client/RequestsClient.d.ts +0 -0
  45. package/dist/client/RequestsClient.js +0 -58
  46. package/dist/generated/GeneratedClient.d.ts +0 -22
  47. package/dist/generated/GeneratedClient.js +0 -40
  48. package/dist/generated/core/ApiError.d.ts +0 -10
  49. package/dist/generated/core/ApiError.js +0 -15
  50. package/dist/generated/core/ApiRequestOptions.d.ts +0 -13
  51. package/dist/generated/core/ApiRequestOptions.js +0 -2
  52. package/dist/generated/core/ApiResult.d.ts +0 -7
  53. package/dist/generated/core/ApiResult.js +0 -2
  54. package/dist/generated/core/AxiosHttpRequest.d.ts +0 -14
  55. package/dist/generated/core/AxiosHttpRequest.js +0 -20
  56. package/dist/generated/core/BaseHttpRequest.d.ts +0 -8
  57. package/dist/generated/core/BaseHttpRequest.js +0 -9
  58. package/dist/generated/core/CancelablePromise.d.ts +0 -37
  59. package/dist/generated/core/CancelablePromise.js +0 -93
  60. package/dist/generated/core/FetchHttpRequest.d.ts +0 -14
  61. package/dist/generated/core/FetchHttpRequest.js +0 -20
  62. package/dist/generated/core/OpenAPI.d.ts +0 -27
  63. package/dist/generated/core/OpenAPI.js +0 -33
  64. package/dist/generated/core/request.d.ts +0 -49
  65. package/dist/generated/core/request.js +0 -325
  66. package/dist/generated/enums.gen.d.ts +0 -97
  67. package/dist/generated/enums.gen.js +0 -101
  68. package/dist/utils/CivitaiClientError.d.ts +0 -0
  69. package/dist/utils/CivitaiClientError.js +0 -4
  70. package/dist/utils/CivitaiError.d.ts +0 -5
  71. package/dist/utils/CivitaiError.js +0 -13
  72. package/dist/utils/createClient.js +0 -119
  73. /package/dist/{utils/createClient.d.ts → generated/client/types.js} +0 -0
@@ -1,36 +1,19 @@
1
- "use strict";
2
1
  // This file is auto-generated by @hey-api/openapi-ts
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.WorkflowStatus = exports.WorkerType = exports.WorkerResourceAvailability = exports.$type21 = exports.$type20 = exports.UpdateWorkflowStatus = exports.$type19 = exports.$type18 = exports.TransactionType = exports.$type17 = exports.$type16 = exports.Scheduler = exports.Priority = exports.NSFWLevel = exports.$type15 = exports.$type14 = exports.engine4 = exports.$type13 = exports.$type12 = exports.$type11 = exports.engine3 = exports.op = exports.JobSupport = exports.JobDependencyContinuation = exports.ImageTransformer = exports.$type10 = exports.$type9 = exports.ImageResouceTrainingModerationStatus = exports.$type8 = exports.$type7 = exports.HumanoidImageMaskCategory = exports.HaiperVideoGenModel = exports.$type6 = exports.engine2 = exports.HaiperVideoGenCameraMovement = exports.HaiperVideoGenAspectRatio = exports.$type5 = exports.engine = exports.FileFormat = exports.$type4 = exports.DownloadSource = exports.ContainerFormat = exports.$type3 = exports.BuzzClientAccount = exports.$type2 = exports.AgeClassificationPrediction = exports.$type = void 0;
5
- exports.$type = {
6
- AGE_CLASSIFICATION: 'ageClassification',
7
- };
8
- exports.AgeClassificationPrediction = {
2
+ export const AgeClassificationPrediction = {
9
3
  PASS: 'pass',
10
4
  FAIL: 'fail',
11
5
  };
12
- exports.$type2 = {
13
- BATCH_OCRSAFETY_CLASSIFICATION: 'batchOCRSafetyClassification',
14
- };
15
- exports.BuzzClientAccount = {
16
- USER: 'user',
17
- GENERATION: 'generation',
18
- };
19
- exports.$type3 = {
20
- COMFY: 'comfy',
6
+ export const BuzzClientAccount = {
7
+ YELLOW: 'yellow',
8
+ BLUE: 'blue',
9
+ GREEN: 'green',
10
+ FAKE_RED: 'fakeRed',
21
11
  };
22
- exports.ContainerFormat = {
12
+ export const ContainerFormat = {
23
13
  MP4: 'mp4',
24
14
  WEB_M: 'webM',
25
15
  };
26
- exports.DownloadSource = {
27
- DEFAULT: 'default',
28
- TIGRIS: 'tigris',
29
- };
30
- exports.$type4 = {
31
- ECHO: 'echo',
32
- };
33
- exports.FileFormat = {
16
+ export const FileFormat = {
34
17
  UNKNOWN: 'unknown',
35
18
  SAFE_TENSOR: 'safeTensor',
36
19
  PICKLE_TENSOR: 'pickleTensor',
@@ -38,20 +21,14 @@ exports.FileFormat = {
38
21
  CORE_ML: 'coreML',
39
22
  ONNX: 'onnx',
40
23
  };
41
- exports.engine = {
42
- FLUX_DEV_FAST: 'flux-dev-fast',
43
- };
44
- exports.$type5 = {
45
- GATE: 'gate',
46
- };
47
- exports.HaiperVideoGenAspectRatio = {
48
- _16_9: '16:9',
49
- _4_3: '4:3',
50
- _1_1: '1:1',
51
- _9_16: '9:16',
52
- _3_4: '3:4',
24
+ export const HaiperVideoGenAspectRatio = {
25
+ '16:9': '16:9',
26
+ '4:3': '4:3',
27
+ '1:1': '1:1',
28
+ '9:16': '9:16',
29
+ '3:4': '3:4',
53
30
  };
54
- exports.HaiperVideoGenCameraMovement = {
31
+ export const HaiperVideoGenCameraMovement = {
55
32
  NONE: 'none',
56
33
  PAN_RIGHT: 'panRight',
57
34
  PAN_LEFT: 'panLeft',
@@ -60,94 +37,68 @@ exports.HaiperVideoGenCameraMovement = {
60
37
  ZOOM_IN: 'zoomIn',
61
38
  ZOOM_OUT: 'zoomOut',
62
39
  };
63
- exports.engine2 = {
64
- HAIPER: 'haiper',
65
- };
66
- exports.$type6 = {
67
- HAIPER: 'haiper',
68
- };
69
- exports.HaiperVideoGenModel = {
40
+ export const HaiperVideoGenModel = {
70
41
  V1_5: 'v1_5',
71
42
  V2: 'v2',
72
43
  };
73
- exports.HumanoidImageMaskCategory = {
44
+ export const HumanoidImageMaskCategory = {
74
45
  DRESSES: 'dresses',
75
46
  UPPER_BODY: 'upperBody',
76
47
  LOWER_BODY: 'lowerBody',
77
48
  };
78
- exports.$type7 = {
79
- HUMANOID_IMAGE_MASK: 'humanoidImageMask',
80
- };
81
- exports.$type8 = {
82
- IMAGE_EMBEDDING: 'imageEmbedding',
83
- };
84
- exports.ImageResouceTrainingModerationStatus = {
49
+ export const ImageResouceTrainingModerationStatus = {
85
50
  EVALUATING: 'evaluating',
86
51
  UNDER_REVIEW: 'underReview',
87
52
  APPROVED: 'approved',
88
53
  REJECTED: 'rejected',
89
54
  };
90
- exports.$type9 = {
91
- IMAGE_RESOURCE_TRAINING: 'imageResourceTraining',
92
- };
93
- exports.$type10 = {
94
- IMAGE_TRANSFORM: 'imageTransform',
95
- };
96
55
  /**
97
56
  * Available image transformers.
98
57
  */
99
- exports.ImageTransformer = {
58
+ export const ImageTransformer = {
100
59
  CANNY: 'canny',
101
60
  DEPTH_ZOE: 'depthZoe',
102
61
  SOFTEDGE_PIDINET: 'softedgePidinet',
103
62
  REMBG: 'rembg',
104
63
  };
105
- exports.JobDependencyContinuation = {
106
- FAIL: 'fail',
107
- SKIP: 'skip',
108
- CONTINUE: 'continue',
109
- };
110
64
  /**
111
65
  * Available levels of job support.
112
66
  */
113
- exports.JobSupport = {
67
+ export const JobSupport = {
114
68
  UNSUPPORTED: 'unsupported',
115
69
  UNAVAILABLE: 'unavailable',
116
70
  AVAILABLE: 'available',
117
71
  };
118
- /**
119
- * The operation type. Allowed values: 'add', 'remove', 'replace', 'move', 'copy', 'test'.
120
- */
121
- exports.op = {
122
- ADD: 'add',
123
- REMOVE: 'remove',
124
- REPLACE: 'replace',
125
- MOVE: 'move',
126
- COPY: 'copy',
127
- TEST: 'test',
128
- };
129
- exports.engine3 = {
130
- KOHYA: 'kohya',
131
- };
132
- exports.$type11 = {
133
- LLM_PROMPT_AUGMENTATION: 'llmPromptAugmentation',
72
+ export const KlingMode = {
73
+ STANDARD: 'standard',
74
+ PROFESSIONAL: 'professional',
134
75
  };
135
- exports.$type12 = {
136
- MEDIA_CAPTIONING: 'mediaCaptioning',
76
+ export const KlingModel = {
77
+ V1: 'v1',
78
+ V1_5: 'v1_5',
79
+ V1_6: 'v1_6',
80
+ V2: 'v2',
137
81
  };
138
- exports.$type13 = {
139
- MEDIA_TAGGING: 'mediaTagging',
82
+ export const KlingVideoGenAspectRatio = {
83
+ '16:9': '16:9',
84
+ '9:16': '9:16',
85
+ '1:1': '1:1',
140
86
  };
141
- exports.engine4 = {
142
- MOCHI: 'mochi',
87
+ export const KlingVideoGenDuration = {
88
+ 5: '5',
89
+ 10: '10',
143
90
  };
144
- exports.$type14 = {
145
- MOCHI: 'mochi',
91
+ export const LightricksAspectRatio = {
92
+ '1:1': '1:1',
93
+ '16:9': '16:9',
94
+ '9:16': '9:16',
95
+ '3:2': '3:2',
96
+ '2:3': '2:3',
146
97
  };
147
- exports.$type15 = {
148
- MOVIE_RATING: 'movieRating',
98
+ export const MiniMaxVideoGenModel = {
99
+ HAILOU: 'hailou',
149
100
  };
150
- exports.NSFWLevel = {
101
+ export const NsfwLevel = {
151
102
  PG: 'pg',
152
103
  P_G13: 'pG13',
153
104
  R: 'r',
@@ -158,7 +109,7 @@ exports.NSFWLevel = {
158
109
  /**
159
110
  * Available options for priority.
160
111
  */
161
- exports.Priority = {
112
+ export const Priority = {
162
113
  HIGH: 'high',
163
114
  NORMAL: 'normal',
164
115
  LOW: 'low',
@@ -166,7 +117,7 @@ exports.Priority = {
166
117
  /**
167
118
  * The available options for schedulers used in image generation.
168
119
  */
169
- exports.Scheduler = {
120
+ export const Scheduler = {
170
121
  EULER_A: 'eulerA',
171
122
  EULER: 'euler',
172
123
  LMS: 'lms',
@@ -179,10 +130,10 @@ exports.Scheduler = {
179
130
  DPM_FAST: 'dpmFast',
180
131
  DPM_ADAPTIVE: 'dpmAdaptive',
181
132
  LMS_KARRAS: 'lmsKarras',
182
- DP_M2KARRAS: 'dpM2Karras',
183
- DP_M2AKARRAS: 'dpM2AKarras',
184
- DP_M2SAKARRAS: 'dpM2SAKarras',
185
- DP_M2MKARRAS: 'dpM2MKarras',
133
+ DP_M2_KARRAS: 'dpM2Karras',
134
+ DP_M2A_KARRAS: 'dpM2AKarras',
135
+ DP_M2SA_KARRAS: 'dpM2SAKarras',
136
+ DP_M2M_KARRAS: 'dpM2MKarras',
186
137
  DPMSDE_KARRAS: 'dpmsdeKarras',
187
138
  DDIM: 'ddim',
188
139
  PLMS: 'plms',
@@ -193,55 +144,33 @@ exports.Scheduler = {
193
144
  DEIS: 'deis',
194
145
  DP_M3MSDE: 'dpM3MSDE',
195
146
  };
196
- exports.$type16 = {
197
- SIMILARITY_SEARCH: 'similaritySearch',
198
- };
199
- exports.$type17 = {
200
- TEXT_TO_IMAGE: 'textToImage',
201
- };
202
- exports.TransactionType = {
147
+ export const TransactionType = {
203
148
  DEBIT: 'debit',
204
149
  CREDIT: 'credit',
205
150
  };
206
- exports.$type18 = {
207
- TRANSCODE: 'transcode',
208
- };
209
- exports.$type19 = {
210
- TRY_ON_U: 'tryOnU',
211
- };
212
151
  /**
213
152
  * Available statuses for updating workflows.
214
153
  */
215
- exports.UpdateWorkflowStatus = {
154
+ export const UpdateWorkflowStatus = {
216
155
  CANCELED: 'canceled',
217
156
  };
218
- exports.$type20 = {
219
- VIDEO_GEN: 'videoGen',
220
- };
221
- exports.$type21 = {
222
- WD_TAGGING: 'wdTagging',
157
+ export const Veo3AspectRatio = {
158
+ '16:9': '16:9',
159
+ '9:16': '9:16',
160
+ '1:1': '1:1',
223
161
  };
224
- /**
225
- * Options for representing the status for a resource on a worker.
226
- */
227
- exports.WorkerResourceAvailability = {
228
- UNKNOWN: 'unknown',
229
- UNSUPPORTED: 'unsupported',
230
- UNAVAILABLE: 'unavailable',
231
- AVAILABLE: 'available',
232
- PROVIDER_UNSUPPORTED: 'providerUnsupported',
162
+ export const ViduVideoGenModel = {
163
+ DEFAULT: 'default',
164
+ Q1: 'q1',
233
165
  };
234
- /**
235
- * Available values for worker type.
236
- */
237
- exports.WorkerType = {
238
- NORMAL: 'normal',
239
- DEFERRED: 'deferred',
166
+ export const ViduVideoGenStyle = {
167
+ GENERAL: 'general',
168
+ ANIME: 'anime',
240
169
  };
241
170
  /**
242
171
  * Values available to represent workflow status.
243
172
  */
244
- exports.WorkflowStatus = {
173
+ export const WorkflowStatus = {
245
174
  UNASSIGNED: 'unassigned',
246
175
  PREPARING: 'preparing',
247
176
  SCHEDULED: 'scheduled',
@@ -251,3 +180,10 @@ exports.WorkflowStatus = {
251
180
  EXPIRED: 'expired',
252
181
  CANCELED: 'canceled',
253
182
  };
183
+ /**
184
+ * Specifies how a workflow should be upgraded when mature content is detected and green or blue buzz was used for payment.
185
+ */
186
+ export const WorkflowUpgradeMode = {
187
+ MANUAL: 'manual',
188
+ AUTOMATIC: 'automatic',
189
+ };
package/dist/index.js CHANGED
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./generated"), exports);
5
- tslib_1.__exportStar(require("./utils"), exports);
6
- tslib_1.__exportStar(require("./client/CivitaiClient"), exports);
1
+ export * from './generated';
2
+ export * from './utils';
3
+ export * from './client/CivitaiClient';
package/dist/utils/Air.js CHANGED
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Air = void 0;
4
- const regex = /^(?:urn:)?(?:air:)?(?:(?<ecosystem>[a-zA-Z0-9_\-\/]+):)?(?:(?<type>[a-zA-Z0-9_\-\/]+):)?(?<source>[a-zA-Z0-9_\-\/]+):(?<id>[a-zA-Z0-9_\-\/]+)(?:@(?<version>[a-zA-Z0-9_\-]+))?(?:\.(?<format>[a-zA-Z0-9_\-]+))?$/i;
1
+ const regex = /^(?:urn:)?(?:air:)?(?:(?<ecosystem>[a-zA-Z0-9_\-\/]+):)?(?:(?<type>[a-zA-Z0-9_\-\/]+):)?(?<source>[a-zA-Z0-9_\-\/]+):(?<id>[a-zA-Z0-9_\-\/\.]+)(?:@(?<version>[a-zA-Z0-9_\-\/.]+))?(?:\.(?<format>[a-zA-Z0-9_\-]+))?$/i;
5
2
  /** https://github.com/civitai/civitai/wiki/AIR-%E2%80%90-Uniform-Resource-Names-for-AI */
6
- class Air {
3
+ export class Air {
7
4
  static parse(identifier) {
8
5
  const match = regex.exec(identifier);
9
6
  if (!match) {
@@ -22,4 +19,3 @@ class Air {
22
19
  return `urn:air:${ecosystem}:${type}:${source}:${id}${version ? `@${version}` : ''}${format ? `:${format}` : ''}`;
23
20
  }
24
21
  }
25
- exports.Air = Air;
@@ -1,30 +1,27 @@
1
- "use strict";
2
1
  var _TimeSpan_ticks, _TimeSpan_add, _TimeSpan_subtract;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.TimeSpan = void 0;
5
- const tslib_1 = require("tslib");
2
+ import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
6
3
  const ticksPerMillisecond = 10000, ticksPerSecond = 1000 * ticksPerMillisecond, ticksPerMinute = 60000 * ticksPerMillisecond, ticksPerHour = 3600000 * ticksPerMillisecond, ticksPerDay = 86400000 * ticksPerMillisecond;
7
4
  const timeSpanWithDays = /^(\d+):(\d+):(\d+):(\d+).(\d+)?/, timeSpanNoDays = /^(\d+):(\d+):(\d+).(\d+)?/;
8
5
  function toDoubleDigitString(n) {
9
6
  return `${n < 10 ? '0' + n : n}`;
10
7
  }
11
- class TimeSpan {
8
+ export class TimeSpan {
12
9
  constructor() {
13
10
  _TimeSpan_ticks.set(this, 0);
14
- _TimeSpan_add.set(this, (value, multiplier) => (tslib_1.__classPrivateFieldSet(this, _TimeSpan_ticks, tslib_1.__classPrivateFieldGet(this, _TimeSpan_ticks, "f") + (multiplier ? value * multiplier : value), "f")));
15
- _TimeSpan_subtract.set(this, (value, multiplier) => (tslib_1.__classPrivateFieldSet(this, _TimeSpan_ticks, tslib_1.__classPrivateFieldGet(this, _TimeSpan_ticks, "f") - (multiplier ? value * multiplier : value), "f")));
16
- this.addTicks = (value) => tslib_1.__classPrivateFieldGet(this, _TimeSpan_add, "f").call(this, value);
17
- this.subtractTicks = (value) => tslib_1.__classPrivateFieldGet(this, _TimeSpan_subtract, "f").call(this, value);
18
- this.addMilliseconds = (value) => tslib_1.__classPrivateFieldGet(this, _TimeSpan_add, "f").call(this, value, ticksPerMillisecond);
19
- this.subtracktMilliseconds = (value) => tslib_1.__classPrivateFieldGet(this, _TimeSpan_subtract, "f").call(this, value, ticksPerMillisecond);
20
- this.addSeconds = (value) => tslib_1.__classPrivateFieldGet(this, _TimeSpan_add, "f").call(this, value, ticksPerSecond);
21
- this.subtractSeconds = (value) => tslib_1.__classPrivateFieldGet(this, _TimeSpan_subtract, "f").call(this, value, ticksPerSecond);
22
- this.addMinutes = (value) => tslib_1.__classPrivateFieldGet(this, _TimeSpan_add, "f").call(this, value, ticksPerMinute);
23
- this.subtractMinutes = (value) => tslib_1.__classPrivateFieldGet(this, _TimeSpan_subtract, "f").call(this, value, ticksPerMinute);
24
- this.addHours = (value) => tslib_1.__classPrivateFieldGet(this, _TimeSpan_add, "f").call(this, value, ticksPerHour);
25
- this.subtractHours = (value) => tslib_1.__classPrivateFieldGet(this, _TimeSpan_subtract, "f").call(this, value, ticksPerHour);
26
- this.addDays = (value) => tslib_1.__classPrivateFieldGet(this, _TimeSpan_add, "f").call(this, value, ticksPerDay);
27
- this.subtractDays = (value) => tslib_1.__classPrivateFieldGet(this, _TimeSpan_subtract, "f").call(this, value, ticksPerDay);
11
+ _TimeSpan_add.set(this, (value, multiplier) => (__classPrivateFieldSet(this, _TimeSpan_ticks, __classPrivateFieldGet(this, _TimeSpan_ticks, "f") + (multiplier ? value * multiplier : value), "f")));
12
+ _TimeSpan_subtract.set(this, (value, multiplier) => (__classPrivateFieldSet(this, _TimeSpan_ticks, __classPrivateFieldGet(this, _TimeSpan_ticks, "f") - (multiplier ? value * multiplier : value), "f")));
13
+ this.addTicks = (value) => __classPrivateFieldGet(this, _TimeSpan_add, "f").call(this, value);
14
+ this.subtractTicks = (value) => __classPrivateFieldGet(this, _TimeSpan_subtract, "f").call(this, value);
15
+ this.addMilliseconds = (value) => __classPrivateFieldGet(this, _TimeSpan_add, "f").call(this, value, ticksPerMillisecond);
16
+ this.subtracktMilliseconds = (value) => __classPrivateFieldGet(this, _TimeSpan_subtract, "f").call(this, value, ticksPerMillisecond);
17
+ this.addSeconds = (value) => __classPrivateFieldGet(this, _TimeSpan_add, "f").call(this, value, ticksPerSecond);
18
+ this.subtractSeconds = (value) => __classPrivateFieldGet(this, _TimeSpan_subtract, "f").call(this, value, ticksPerSecond);
19
+ this.addMinutes = (value) => __classPrivateFieldGet(this, _TimeSpan_add, "f").call(this, value, ticksPerMinute);
20
+ this.subtractMinutes = (value) => __classPrivateFieldGet(this, _TimeSpan_subtract, "f").call(this, value, ticksPerMinute);
21
+ this.addHours = (value) => __classPrivateFieldGet(this, _TimeSpan_add, "f").call(this, value, ticksPerHour);
22
+ this.subtractHours = (value) => __classPrivateFieldGet(this, _TimeSpan_subtract, "f").call(this, value, ticksPerHour);
23
+ this.addDays = (value) => __classPrivateFieldGet(this, _TimeSpan_add, "f").call(this, value, ticksPerDay);
24
+ this.subtractDays = (value) => __classPrivateFieldGet(this, _TimeSpan_subtract, "f").call(this, value, ticksPerDay);
28
25
  this.toString = (include) => {
29
26
  const toInclude = include ? [...new Set([...include])] : undefined;
30
27
  const parts1 = (toInclude !== null && toInclude !== void 0 ? toInclude : ['days', 'hours', 'minutes', 'seconds'])
@@ -68,29 +65,29 @@ class TimeSpan {
68
65
  this.addTicks(ticks);
69
66
  }
70
67
  get days() {
71
- return Math.floor(tslib_1.__classPrivateFieldGet(this, _TimeSpan_ticks, "f") / ticksPerDay);
68
+ return Math.floor(__classPrivateFieldGet(this, _TimeSpan_ticks, "f") / ticksPerDay);
72
69
  }
73
70
  get hours() {
74
- return Math.floor(tslib_1.__classPrivateFieldGet(this, _TimeSpan_ticks, "f") / ticksPerHour) % 24;
71
+ return Math.floor(__classPrivateFieldGet(this, _TimeSpan_ticks, "f") / ticksPerHour) % 24;
75
72
  }
76
73
  get minutes() {
77
- return Math.floor(tslib_1.__classPrivateFieldGet(this, _TimeSpan_ticks, "f") / ticksPerMinute) % 60;
74
+ return Math.floor(__classPrivateFieldGet(this, _TimeSpan_ticks, "f") / ticksPerMinute) % 60;
78
75
  }
79
76
  get seconds() {
80
- return Math.floor(tslib_1.__classPrivateFieldGet(this, _TimeSpan_ticks, "f") / ticksPerSecond) % 60;
77
+ return Math.floor(__classPrivateFieldGet(this, _TimeSpan_ticks, "f") / ticksPerSecond) % 60;
81
78
  }
82
79
  get milliseconds() {
83
- return Math.floor(tslib_1.__classPrivateFieldGet(this, _TimeSpan_ticks, "f") / ticksPerMillisecond) % 1000;
80
+ return Math.floor(__classPrivateFieldGet(this, _TimeSpan_ticks, "f") / ticksPerMillisecond) % 1000;
84
81
  }
85
82
  get ticks() {
86
83
  const dayTicks = this.days * ticksPerDay;
87
84
  const hourTicks = this.hours * ticksPerHour;
88
85
  const minuteTicks = this.minutes * ticksPerMinute;
89
86
  const secondTicks = this.seconds * ticksPerSecond;
90
- return tslib_1.__classPrivateFieldGet(this, _TimeSpan_ticks, "f") - dayTicks - hourTicks - minuteTicks - secondTicks;
87
+ return __classPrivateFieldGet(this, _TimeSpan_ticks, "f") - dayTicks - hourTicks - minuteTicks - secondTicks;
91
88
  }
92
89
  get totalMilliseconds() {
93
- return Math.floor(tslib_1.__classPrivateFieldGet(this, _TimeSpan_ticks, "f") / ticksPerMillisecond);
90
+ return Math.floor(__classPrivateFieldGet(this, _TimeSpan_ticks, "f") / ticksPerMillisecond);
94
91
  }
95
92
  get totalMinutes() {
96
93
  return Math.floor(this.minutes / ticksPerMinute);
@@ -105,8 +102,7 @@ class TimeSpan {
105
102
  return Math.floor(this.days / ticksPerDay);
106
103
  }
107
104
  get totalTicks() {
108
- return tslib_1.__classPrivateFieldGet(this, _TimeSpan_ticks, "f");
105
+ return __classPrivateFieldGet(this, _TimeSpan_ticks, "f");
109
106
  }
110
107
  }
111
- exports.TimeSpan = TimeSpan;
112
108
  _TimeSpan_ticks = new WeakMap(), _TimeSpan_add = new WeakMap(), _TimeSpan_subtract = new WeakMap();
@@ -0,0 +1,2 @@
1
+ import { ProblemDetails } from 'src/generated';
2
+ export declare function handleError(error: string | ProblemDetails): string | undefined;
@@ -0,0 +1,9 @@
1
+ export function handleError(error) {
2
+ if (typeof error === 'string')
3
+ return error;
4
+ const errors = error.errors && Array.isArray(error.errors)
5
+ ? error.errors
6
+ : undefined;
7
+ const message = errors ? errors.messages.join('\n') : error.detail;
8
+ return message === null ? undefined : message;
9
+ }
@@ -1,3 +1,4 @@
1
1
  export * from './Air';
2
2
  export * from './TimeSpan';
3
3
  export * from './patch-json';
4
+ export * from './handleError';
@@ -1,6 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- tslib_1.__exportStar(require("./Air"), exports);
5
- tslib_1.__exportStar(require("./TimeSpan"), exports);
6
- tslib_1.__exportStar(require("./patch-json"), exports);
1
+ export * from './Air';
2
+ export * from './TimeSpan';
3
+ export * from './patch-json';
4
+ export * from './handleError';
@@ -1,9 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPatch = exports.applyPatch = exports.JsonPatchFactory = void 0;
4
- const rfc6902_1 = require("rfc6902");
5
- Object.defineProperty(exports, "applyPatch", { enumerable: true, get: function () { return rfc6902_1.applyPatch; } });
6
- Object.defineProperty(exports, "createPatch", { enumerable: true, get: function () { return rfc6902_1.createPatch; } });
1
+ import { applyPatch, createPatch } from 'rfc6902';
7
2
  // export function jsonPatchOperationFactory<TData extends object>() {
8
3
  // return function <
9
4
  // TOperation extends 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test',
@@ -23,7 +18,7 @@ Object.defineProperty(exports, "createPatch", { enumerable: true, get: function
23
18
  // };
24
19
  // };
25
20
  // }
26
- class JsonPatchFactory {
21
+ export class JsonPatchFactory {
27
22
  constructor() {
28
23
  this._operations = [];
29
24
  }
@@ -40,7 +35,23 @@ class JsonPatchFactory {
40
35
  this._operations.push(operation);
41
36
  }
42
37
  }
43
- exports.JsonPatchFactory = JsonPatchFactory;
38
+ // export function createJsonPatchOperation<
39
+ // TOperation extends 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test',
40
+ // TData extends object,
41
+ // TPath extends JsonPatchPath<TData>,
42
+ // TFrom extends JsonPatchPath<TData> = any,
43
+ // >(
44
+ // jsonObj: TData,
45
+ // data: {
46
+ // op: TOperation;
47
+ // path: TPath;
48
+ // from?: TFrom;
49
+ // value: DeepPartial<JsonPatchPathValue<TData, TPath>>;
50
+ // }
51
+ // ) {
52
+ // return jsonPatchOperationFactory<TData>()(data);
53
+ // }
54
+ export { applyPatch, createPatch };
44
55
  // type Model = {
45
56
  // params?:
46
57
  // | {
@@ -0,0 +1,3 @@
1
+ type Prettify<T> = {
2
+ [K in keyof T]: T[K];
3
+ } & NonNullable<unknown>;
@@ -0,0 +1 @@
1
+ "use strict";
package/package.json CHANGED
@@ -1,9 +1,11 @@
1
1
  {
2
2
  "name": "@civitai/client",
3
- "version": "0.1.9-beta.9",
3
+ "version": "0.2.0-beta.2",
4
4
  "description": "Civitai's javascript client for generating ai content",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
+ "sideEffects": false,
8
+ "type": "module",
7
9
  "repository": {
8
10
  "type": "git",
9
11
  "url": "git+https://github.com/civitai/civitai-client-javascript.git"
@@ -30,7 +32,7 @@
30
32
  "release": "npm run typecheck && npm run build && npm publish --tag beta"
31
33
  },
32
34
  "devDependencies": {
33
- "@hey-api/openapi-ts": "^0.47.2",
35
+ "@hey-api/openapi-ts": "^0.80.5",
34
36
  "@types/jest": "^29.5.12",
35
37
  "@types/node": "^20.11.19",
36
38
  "@typescript-eslint/eslint-plugin": "^8.7.0",
@@ -42,7 +44,7 @@
42
44
  "jest": "^29.7.0",
43
45
  "prettier": "^3.2.5",
44
46
  "ts-jest": "^29.1.2",
45
- "typescript": "^5.3.3"
47
+ "typescript": "^5.9.2"
46
48
  },
47
49
  "dependencies": {
48
50
  "@hey-api/client-fetch": "^0.1.6",
File without changes
@@ -1,58 +0,0 @@
1
- "use strict";
2
- // import {
3
- // BaseHttpRequest,
4
- // CancelError,
5
- // CancelablePromise,
6
- // JobTemplateReference,
7
- // RequestInfo,
8
- // RequestsService,
9
- // ResultInclusion,
10
- // } from '../generated';
11
- // export class RequestsClient extends RequestsService {
12
- // constructor(public readonly httpRequest: BaseHttpRequest) {
13
- // super(httpRequest);
14
- // }
15
- // public override submitRequest(
16
- // props?: {
17
- // include?: ResultInclusion | undefined;
18
- // requestBody?: JobTemplateReference | JobTemplateReference[] | undefined;
19
- // wait?: boolean | undefined;
20
- // whatif?: boolean | undefined;
21
- // },
22
- // options?: { cleanupOnCancellation?: boolean }
23
- // ): CancelablePromise<RequestInfo> {
24
- // return new CancelablePromise<RequestInfo>(async (resolve, reject, oncancel) => {
25
- // try {
26
- // const { wait, include } = props ?? {};
27
- // const { cleanupOnCancellation = true } = options ?? {};
28
- // let result = await withCancellation(super.submitRequest({ ...props, wait: false }));
29
- // if (!result) throw new Error('no result');
30
- // try {
31
- // while (wait && (result.status === 'Initialized' || result.status === 'Processing')) {
32
- // result = await withCancellation(
33
- // this.getRequest({ requestId: result.id, include, wait })
34
- // );
35
- // }
36
- // resolve(result);
37
- // } catch (error) {
38
- // if (error instanceof CancelError && wait && cleanupOnCancellation) {
39
- // console.log('cancelling request');
40
- // await this.updateRequest({
41
- // requestId: result.id,
42
- // requestBody: {
43
- // status: 'Canceled',
44
- // },
45
- // });
46
- // }
47
- // throw error;
48
- // }
49
- // } catch (error) {
50
- // reject(error);
51
- // }
52
- // function withCancellation<T>(promise: CancelablePromise<T>) {
53
- // oncancel(promise.cancel);
54
- // return promise;
55
- // }
56
- // });
57
- // }
58
- // }
@@ -1,22 +0,0 @@
1
- import type { BaseHttpRequest } from './core/BaseHttpRequest';
2
- import type { OpenAPIConfig } from './core/OpenAPI';
3
- import { BlobsService } from './services.gen';
4
- import { ConfigurationsService } from './services.gen';
5
- import { ResourcesService } from './services.gen';
6
- import { WorkerJobsService } from './services.gen';
7
- import { WorkersService } from './services.gen';
8
- import { WorkflowsService } from './services.gen';
9
- import { WorkflowStepsService } from './services.gen';
10
- type HttpRequestConstructor = new (config: OpenAPIConfig) => BaseHttpRequest;
11
- export declare class GeneratedClient {
12
- readonly blobs: BlobsService;
13
- readonly configurations: ConfigurationsService;
14
- readonly resources: ResourcesService;
15
- readonly workerJobs: WorkerJobsService;
16
- readonly workers: WorkersService;
17
- readonly workflows: WorkflowsService;
18
- readonly workflowSteps: WorkflowStepsService;
19
- readonly request: BaseHttpRequest;
20
- constructor(config?: Partial<OpenAPIConfig>, HttpRequest?: HttpRequestConstructor);
21
- }
22
- export {};