@ptkl/sdk 1.0.0 → 1.0.1

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.
@@ -239,6 +239,19 @@ var ProtokolSDK010 = (function (exports, axios) {
239
239
  options
240
240
  });
241
241
  }
242
+ /**
243
+ * Create many models
244
+ *
245
+ * @param data
246
+ * @param options
247
+ * @returns
248
+ */
249
+ async createMany(data, options) {
250
+ return await this.client.post(`${this.getComponentPath()}/models/bulk`, {
251
+ data,
252
+ options
253
+ });
254
+ }
242
255
  /**
243
256
  * Modify models by filters
244
257
  *
@@ -642,6 +655,17 @@ var ProtokolSDK010 = (function (exports, axios) {
642
655
  async create(data) {
643
656
  return await this.client.post("/v3/system/component/create", data);
644
657
  }
658
+ /**
659
+ * Setup a component with settings in a single atomic operation.
660
+ * This is more comprehensive than create as it handles component creation
661
+ * and settings initialization together.
662
+ *
663
+ * @param data - Component setup data including name, settings, versions, etc.
664
+ * @returns Promise resolving to the created/updated component
665
+ */
666
+ async setup(data) {
667
+ return await this.client.post("/v3/system/component/setup", data);
668
+ }
645
669
  }
646
670
 
647
671
  class Thunder extends PlatformBaseClient {
package/dist/index.0.9.js CHANGED
@@ -1249,7 +1249,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1249
1249
  }
1250
1250
  }
1251
1251
  else if (isNode) {
1252
- host = (_c = host !== null && host !== void 0 ? host : process.env.API_HOST) !== null && _c !== void 0 ? _c : null;
1252
+ host = (_c = host !== null && host !== void 0 ? host : process.env.INTEGRATION_API) !== null && _c !== void 0 ? _c : null;
1253
1253
  env = (_d = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _d !== void 0 ? _d : null;
1254
1254
  token = (_e = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _e !== void 0 ? _e : null;
1255
1255
  project_uuid = (_f = process.env.PROJECT_UUID) !== null && _f !== void 0 ? _f : null;
@@ -1257,7 +1257,7 @@ var ProtokolSDK09 = (function (exports, axios) {
1257
1257
  else if (isSandbox) {
1258
1258
  // @ts-ignore
1259
1259
  const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
1260
- host = (_g = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.API_HOST) !== null && _g !== void 0 ? _g : host;
1260
+ host = (_g = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.INTEGRATION_API) !== null && _g !== void 0 ? _g : host;
1261
1261
  // @ts-ignore
1262
1262
  env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
1263
1263
  token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "0.10.2",
3
+ "version": "1.0.1",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",
@@ -1,4 +1,4 @@
1
- import { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions, StreamHandler, AggregateChainable, ComponentOptions } from "../types/component";
1
+ import { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions, StreamHandler, AggregateChainable, ComponentOptions, UpdateManyOptions, CreateManyOptions } from "../types/component";
2
2
  import PlatformBaseClient from "./platformBaseClient";
3
3
  import { AxiosResponse } from "axios";
4
4
  export default class Component extends PlatformBaseClient {
@@ -68,7 +68,15 @@ export default class Component extends PlatformBaseClient {
68
68
  * @param options
69
69
  * @returns
70
70
  */
71
- updateMany(data: Record<string, any>[], options: UpdateOptions): Promise<AxiosResponse<any, any>>;
71
+ updateMany(data: Record<string, any>[], options: UpdateManyOptions): Promise<AxiosResponse<any, any>>;
72
+ /**
73
+ * Create many models
74
+ *
75
+ * @param data
76
+ * @param options
77
+ * @returns
78
+ */
79
+ createMany(data: Record<string, any>[], options: CreateManyOptions): Promise<AxiosResponse<any, any>>;
72
80
  /**
73
81
  * Modify models by filters
74
82
  *
@@ -1,7 +1,16 @@
1
1
  import { AxiosResponse } from "axios";
2
- import { ComponentListResponse } from "../types/component";
2
+ import { ComponentListResponse, SetupData, ComponentCreateResponse } from "../types/component";
3
3
  import PlatformBaseClient from "./platformBaseClient";
4
4
  export default class ComponentUtils extends PlatformBaseClient {
5
5
  list(): Promise<AxiosResponse<ComponentListResponse>>;
6
6
  create(data: any): Promise<AxiosResponse<any, any>>;
7
+ /**
8
+ * Setup a component with settings in a single atomic operation.
9
+ * This is more comprehensive than create as it handles component creation
10
+ * and settings initialization together.
11
+ *
12
+ * @param data - Component setup data including name, settings, versions, etc.
13
+ * @returns Promise resolving to the created/updated component
14
+ */
15
+ setup(data: SetupData): Promise<AxiosResponse<ComponentCreateResponse>>;
7
16
  }
@@ -19205,6 +19205,19 @@ class Component extends PlatformBaseClient {
19205
19205
  options
19206
19206
  });
19207
19207
  }
19208
+ /**
19209
+ * Create many models
19210
+ *
19211
+ * @param data
19212
+ * @param options
19213
+ * @returns
19214
+ */
19215
+ async createMany(data, options) {
19216
+ return await this.client.post(`${this.getComponentPath()}/models/bulk`, {
19217
+ data,
19218
+ options
19219
+ });
19220
+ }
19208
19221
  /**
19209
19222
  * Modify models by filters
19210
19223
  *
@@ -19608,6 +19621,17 @@ class ComponentUtils extends PlatformBaseClient {
19608
19621
  async create(data) {
19609
19622
  return await this.client.post("/v3/system/component/create", data);
19610
19623
  }
19624
+ /**
19625
+ * Setup a component with settings in a single atomic operation.
19626
+ * This is more comprehensive than create as it handles component creation
19627
+ * and settings initialization together.
19628
+ *
19629
+ * @param data - Component setup data including name, settings, versions, etc.
19630
+ * @returns Promise resolving to the created/updated component
19631
+ */
19632
+ async setup(data) {
19633
+ return await this.client.post("/v3/system/component/setup", data);
19634
+ }
19611
19635
  }
19612
19636
 
19613
19637
  class Thunder extends PlatformBaseClient {
@@ -238,6 +238,19 @@ class Component extends PlatformBaseClient {
238
238
  options
239
239
  });
240
240
  }
241
+ /**
242
+ * Create many models
243
+ *
244
+ * @param data
245
+ * @param options
246
+ * @returns
247
+ */
248
+ async createMany(data, options) {
249
+ return await this.client.post(`${this.getComponentPath()}/models/bulk`, {
250
+ data,
251
+ options
252
+ });
253
+ }
241
254
  /**
242
255
  * Modify models by filters
243
256
  *
@@ -641,6 +654,17 @@ class ComponentUtils extends PlatformBaseClient {
641
654
  async create(data) {
642
655
  return await this.client.post("/v3/system/component/create", data);
643
656
  }
657
+ /**
658
+ * Setup a component with settings in a single atomic operation.
659
+ * This is more comprehensive than create as it handles component creation
660
+ * and settings initialization together.
661
+ *
662
+ * @param data - Component setup data including name, settings, versions, etc.
663
+ * @returns Promise resolving to the created/updated component
664
+ */
665
+ async setup(data) {
666
+ return await this.client.post("/v3/system/component/setup", data);
667
+ }
644
668
  }
645
669
 
646
670
  class Thunder extends PlatformBaseClient {
@@ -65,7 +65,13 @@ type Model = {
65
65
  [key: string]: any;
66
66
  };
67
67
  type UpdateOptions = {
68
- force_update_protected_fields: boolean;
68
+ forceUpdateProtectedFields: boolean;
69
+ };
70
+ type UpdateManyOptions = UpdateOptions & {
71
+ rollbackOnError: boolean;
72
+ };
73
+ type CreateManyOptions = {
74
+ rollbackOnError: boolean;
69
75
  };
70
76
  type ModifyOptions = {
71
77
  upsert: boolean;
@@ -107,4 +113,186 @@ type ComponentListItem = {
107
113
  storage_size: number;
108
114
  };
109
115
  type ComponentListResponse = ComponentListItem[];
110
- export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions, ComponentOptions, ComponentListResponse, ComponentListItem, ComponentLabel, ComponentWorkspace, StreamCallback, StreamHandler, AggregateChainable, };
116
+ type FieldRoles = {
117
+ see: string[];
118
+ edit: string[];
119
+ };
120
+ type Context = {
121
+ key: string;
122
+ value: any;
123
+ };
124
+ type FieldConstraints = {
125
+ required?: boolean;
126
+ unique?: boolean;
127
+ placeholder?: string;
128
+ default?: string;
129
+ length?: {
130
+ min?: number | null;
131
+ max?: number | null;
132
+ };
133
+ not_allowed_words?: string;
134
+ regex?: string;
135
+ date?: {
136
+ pattern?: string;
137
+ disable_past_dates?: boolean;
138
+ disable_future_dates?: boolean;
139
+ disabled_dates?: {
140
+ dates?: string[];
141
+ to?: string;
142
+ from?: string;
143
+ days?: number[];
144
+ days_of_month?: number[];
145
+ ranges?: Array<{
146
+ from: string;
147
+ to: string;
148
+ }>;
149
+ };
150
+ highlighted_dates?: {
151
+ dates?: string[];
152
+ to?: string;
153
+ from?: string;
154
+ days?: number[];
155
+ days_of_month?: number[];
156
+ ranges?: Array<{
157
+ from: string;
158
+ to: string;
159
+ }>;
160
+ include_disabled?: boolean;
161
+ };
162
+ };
163
+ selectables?: {
164
+ items?: any[];
165
+ multiple?: boolean;
166
+ range?: {
167
+ from: number;
168
+ to: number;
169
+ };
170
+ custom?: boolean;
171
+ };
172
+ table?: {
173
+ search?: boolean;
174
+ per_page?: number;
175
+ save_on_create?: boolean;
176
+ fields?: SettingsField[];
177
+ };
178
+ relation?: {
179
+ label?: string;
180
+ searchOn?: string[];
181
+ };
182
+ };
183
+ type SettingsField = {
184
+ name: string;
185
+ label: Record<string, any>;
186
+ key: string;
187
+ type: string;
188
+ description?: Record<string, any>;
189
+ module?: string;
190
+ group?: string;
191
+ sortOrder?: number;
192
+ visible?: boolean;
193
+ protected?: boolean;
194
+ roles?: FieldRoles;
195
+ context?: Context[];
196
+ constraints?: FieldConstraints;
197
+ relation?: {
198
+ foreign?: string;
199
+ key?: string[];
200
+ type?: string;
201
+ foreign_uuid?: string | null;
202
+ };
203
+ mutators?: {
204
+ get?: string;
205
+ set?: string;
206
+ };
207
+ provided_template?: boolean;
208
+ provided_template_component?: string;
209
+ component_template?: string;
210
+ template?: string;
211
+ permissions?: string[];
212
+ };
213
+ type Filters = {
214
+ filter?: string;
215
+ filterOn?: string[];
216
+ dateField?: string;
217
+ dateFrom?: string;
218
+ dateTo?: string;
219
+ $adv?: Record<string, any>;
220
+ };
221
+ type PresetContext = {
222
+ filters?: Filters;
223
+ default?: boolean;
224
+ locked?: boolean;
225
+ expr?: string;
226
+ };
227
+ type Preset = {
228
+ name: string;
229
+ roles: string[];
230
+ context: PresetContext;
231
+ };
232
+ type Function = {
233
+ name: string;
234
+ expr: string;
235
+ };
236
+ type TemplatesDist = {
237
+ sdk_version: number;
238
+ sdk_engine: string;
239
+ dist: Record<string, any>;
240
+ };
241
+ type Settings = {
242
+ version?: string;
243
+ appearance?: {
244
+ list_entrypoint?: string;
245
+ create_entrypoint?: string;
246
+ edit_entrypoint?: string;
247
+ };
248
+ list?: {
249
+ quick_actions?: boolean;
250
+ perPage?: number;
251
+ fields?: Array<{
252
+ key: string;
253
+ label: Record<string, any>;
254
+ name?: string;
255
+ sortOrder?: number;
256
+ sortable?: boolean;
257
+ filterable?: boolean;
258
+ sortDirection?: string;
259
+ sortByFormatted?: boolean;
260
+ filterByFormatted?: boolean;
261
+ formatterEditor?: string;
262
+ variant?: string;
263
+ formatter?: string;
264
+ provided_template_component?: string;
265
+ component_template?: string;
266
+ }>;
267
+ };
268
+ fields?: SettingsField[];
269
+ model?: {
270
+ events?: Record<string, any>[];
271
+ unique_indexes_combinations?: string[][];
272
+ };
273
+ presets?: Preset[];
274
+ templates?: Record<string, any>[];
275
+ templates_dist?: TemplatesDist;
276
+ config?: Record<string, any>;
277
+ functions?: Function[];
278
+ };
279
+ type SetupData = {
280
+ name: string;
281
+ label?: Record<string, any>;
282
+ tag: string;
283
+ scope?: string;
284
+ public_version?: string;
285
+ dev_version?: string;
286
+ project_uuid?: string;
287
+ workspaces?: string[];
288
+ roles?: string[];
289
+ settings?: Settings;
290
+ env?: string;
291
+ is_active?: boolean;
292
+ is_public?: boolean;
293
+ icon?: string;
294
+ template_component_id?: string;
295
+ integrator?: string;
296
+ };
297
+ type ComponentCreateResponse = ComponentListItem;
298
+ export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions, ComponentOptions, ComponentListResponse, ComponentListItem, ComponentLabel, ComponentWorkspace, StreamCallback, StreamHandler, AggregateChainable, UpdateManyOptions, CreateManyOptions, Settings, SettingsField, FieldRoles, FieldConstraints, Context, Preset, PresetContext, Filters, Function, TemplatesDist, SetupData, ComponentCreateResponse, };
@@ -20217,7 +20217,7 @@ class IntegrationsBaseClient extends BaseClient {
20217
20217
  }
20218
20218
  }
20219
20219
  else if (isNode) {
20220
- host = (_c = host !== null && host !== void 0 ? host : process.env.API_HOST) !== null && _c !== void 0 ? _c : null;
20220
+ host = (_c = host !== null && host !== void 0 ? host : process.env.INTEGRATION_API) !== null && _c !== void 0 ? _c : null;
20221
20221
  env = (_d = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _d !== void 0 ? _d : null;
20222
20222
  token = (_e = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _e !== void 0 ? _e : null;
20223
20223
  project_uuid = (_f = process.env.PROJECT_UUID) !== null && _f !== void 0 ? _f : null;
@@ -20225,7 +20225,7 @@ class IntegrationsBaseClient extends BaseClient {
20225
20225
  else if (isSandbox) {
20226
20226
  // @ts-ignore
20227
20227
  const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
20228
- host = (_g = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.API_HOST) !== null && _g !== void 0 ? _g : host;
20228
+ host = (_g = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.INTEGRATION_API) !== null && _g !== void 0 ? _g : host;
20229
20229
  // @ts-ignore
20230
20230
  env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
20231
20231
  token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
@@ -1248,7 +1248,7 @@ class IntegrationsBaseClient extends BaseClient {
1248
1248
  }
1249
1249
  }
1250
1250
  else if (isNode) {
1251
- host = (_c = host !== null && host !== void 0 ? host : process.env.API_HOST) !== null && _c !== void 0 ? _c : null;
1251
+ host = (_c = host !== null && host !== void 0 ? host : process.env.INTEGRATION_API) !== null && _c !== void 0 ? _c : null;
1252
1252
  env = (_d = env !== null && env !== void 0 ? env : process.env.PROJECT_ENV) !== null && _d !== void 0 ? _d : null;
1253
1253
  token = (_e = token !== null && token !== void 0 ? token : process.env.PROJECT_API_TOKEN) !== null && _e !== void 0 ? _e : null;
1254
1254
  project_uuid = (_f = process.env.PROJECT_UUID) !== null && _f !== void 0 ? _f : null;
@@ -1256,7 +1256,7 @@ class IntegrationsBaseClient extends BaseClient {
1256
1256
  else if (isSandbox) {
1257
1257
  // @ts-ignore
1258
1258
  const __global_env__ = window === null || window === void 0 ? void 0 : window.__ENV_VARIABLES__;
1259
- host = (_g = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.API_HOST) !== null && _g !== void 0 ? _g : host;
1259
+ host = (_g = __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.INTEGRATION_API) !== null && _g !== void 0 ? _g : host;
1260
1260
  // @ts-ignore
1261
1261
  env = env !== null && env !== void 0 ? env : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_ENV;
1262
1262
  token = token !== null && token !== void 0 ? token : __global_env__ === null || __global_env__ === void 0 ? void 0 : __global_env__.PROJECT_API_TOKEN;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",