@ptkl/sdk 0.10.2 → 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.
Files changed (132) hide show
  1. package/dist/{index.iife.js → index.0.10.js} +417 -230
  2. package/dist/index.0.9.js +2849 -0
  3. package/dist/package.json +12 -7
  4. package/dist/v0.10/api/component.d.ts +136 -0
  5. package/dist/v0.10/api/componentUtils.d.ts +16 -0
  6. package/dist/v0.10/api/index.d.ts +22 -0
  7. package/dist/{types → v0.10}/api/integrationsBaseClient.d.ts +3 -0
  8. package/dist/{types → v0.10}/api/platform.d.ts +2 -2
  9. package/dist/v0.10/apiUser.d.ts +9 -0
  10. package/dist/v0.10/apps.d.ts +8 -0
  11. package/dist/v0.10/baseClient.d.ts +6 -0
  12. package/dist/{types/api → v0.10}/component.d.ts +39 -4
  13. package/dist/v0.10/componentUtils.d.ts +7 -0
  14. package/dist/v0.10/config.d.ts +14 -0
  15. package/dist/v0.10/forge.d.ts +7 -0
  16. package/dist/v0.10/functions.d.ts +23 -0
  17. package/dist/{index.cjs.js → v0.10/index.cjs.js} +417 -230
  18. package/dist/v0.10/index.d.ts +21 -0
  19. package/dist/{index.esm.js → v0.10/index.esm.js} +416 -227
  20. package/dist/v0.10/integrations/dms.d.ts +469 -0
  21. package/dist/v0.10/integrations/invoicing.d.ts +6 -0
  22. package/dist/v0.10/integrations/minimax.d.ts +289 -0
  23. package/dist/v0.10/integrations/payments.d.ts +40 -0
  24. package/dist/v0.10/integrations/serbiaUtil.d.ts +10 -0
  25. package/dist/v0.10/integrations/vpfr.d.ts +4 -0
  26. package/dist/v0.10/integrations.d.ts +22 -0
  27. package/dist/v0.10/integrationsBaseClient.d.ts +11 -0
  28. package/dist/v0.10/platform.d.ts +34 -0
  29. package/dist/v0.10/platformBaseClient.d.ts +27 -0
  30. package/dist/v0.10/project.d.ts +146 -0
  31. package/dist/v0.10/ratchet.d.ts +196 -0
  32. package/dist/v0.10/sandbox.d.ts +14 -0
  33. package/dist/v0.10/system.d.ts +4 -0
  34. package/dist/v0.10/thunder.d.ts +13 -0
  35. package/dist/v0.10/types/component.d.ts +298 -0
  36. package/dist/v0.10/users.d.ts +69 -0
  37. package/dist/v0.10/workflow.d.ts +5 -0
  38. package/dist/v0.9/api/apiUser.d.ts +9 -0
  39. package/dist/v0.9/api/apps.d.ts +8 -0
  40. package/dist/v0.9/api/baseClient.d.ts +6 -0
  41. package/dist/v0.9/api/component.d.ts +136 -0
  42. package/dist/v0.9/api/config.d.ts +14 -0
  43. package/dist/v0.9/api/forge.d.ts +7 -0
  44. package/dist/v0.9/api/functions.d.ts +23 -0
  45. package/dist/v0.9/api/index.d.ts +24 -0
  46. package/dist/v0.9/api/integrations/dms.d.ts +419 -0
  47. package/dist/v0.9/api/integrations/invoicing.d.ts +6 -0
  48. package/dist/v0.9/api/integrations/minimax.d.ts +289 -0
  49. package/dist/v0.9/api/integrations/payments.d.ts +40 -0
  50. package/dist/v0.9/api/integrations/serbiaUtil.d.ts +10 -0
  51. package/dist/v0.9/api/integrations/vpfr.d.ts +4 -0
  52. package/dist/v0.9/api/integrations.d.ts +22 -0
  53. package/dist/v0.9/api/integrationsBaseClient.d.ts +11 -0
  54. package/dist/v0.9/api/platform.d.ts +34 -0
  55. package/dist/v0.9/api/platformBaseClient.d.ts +27 -0
  56. package/dist/v0.9/api/project.d.ts +146 -0
  57. package/dist/v0.9/api/ratchet.d.ts +196 -0
  58. package/dist/v0.9/api/sandbox.d.ts +14 -0
  59. package/dist/v0.9/api/system.d.ts +4 -0
  60. package/dist/v0.9/api/thunder.d.ts +13 -0
  61. package/dist/v0.9/api/users.d.ts +69 -0
  62. package/dist/v0.9/api/workflow.d.ts +5 -0
  63. package/dist/v0.9/apiUser.d.ts +9 -0
  64. package/dist/v0.9/apps.d.ts +8 -0
  65. package/dist/v0.9/baseClient.d.ts +6 -0
  66. package/dist/v0.9/component.d.ts +128 -0
  67. package/dist/v0.9/componentUtils.d.ts +7 -0
  68. package/dist/v0.9/config.d.ts +14 -0
  69. package/dist/v0.9/forge.d.ts +7 -0
  70. package/dist/v0.9/functions.d.ts +23 -0
  71. package/dist/v0.9/index.cjs.js +21811 -0
  72. package/dist/v0.9/index.d.ts +21 -0
  73. package/dist/v0.9/index.esm.js +2820 -0
  74. package/dist/v0.9/integrations/dms.d.ts +469 -0
  75. package/dist/v0.9/integrations/invoicing.d.ts +6 -0
  76. package/dist/v0.9/integrations/minimax.d.ts +289 -0
  77. package/dist/v0.9/integrations/payments.d.ts +40 -0
  78. package/dist/v0.9/integrations/serbiaUtil.d.ts +10 -0
  79. package/dist/v0.9/integrations/vpfr.d.ts +4 -0
  80. package/dist/v0.9/integrations.d.ts +22 -0
  81. package/dist/v0.9/integrationsBaseClient.d.ts +11 -0
  82. package/dist/v0.9/platform.d.ts +34 -0
  83. package/dist/v0.9/platformBaseClient.d.ts +27 -0
  84. package/dist/v0.9/project.d.ts +146 -0
  85. package/dist/v0.9/ratchet.d.ts +196 -0
  86. package/dist/v0.9/sandbox.d.ts +14 -0
  87. package/dist/v0.9/system.d.ts +4 -0
  88. package/dist/v0.9/thunder.d.ts +13 -0
  89. package/dist/{types → v0.9}/types/component.d.ts +34 -2
  90. package/dist/v0.9/types/config.d.ts +11 -0
  91. package/dist/v0.9/types/integrations.d.ts +321 -0
  92. package/dist/v0.9/types/project.d.ts +64 -0
  93. package/dist/v0.9/types/ratchet.d.ts +38 -0
  94. package/dist/v0.9/types/users.d.ts +66 -0
  95. package/dist/v0.9/users.d.ts +69 -0
  96. package/dist/v0.9/util/detectEnv.d.ts +4 -0
  97. package/dist/v0.9/workflow.d.ts +5 -0
  98. package/package.json +12 -7
  99. package/dist/monaco.d.ts +0 -887
  100. package/dist/types/api/index.d.ts +0 -13
  101. package/dist/types/api/integrations/media.d.ts +0 -17
  102. package/dist/types/api/roles.d.ts +0 -9
  103. package/dist/types/index.d.ts +0 -29
  104. package/dist/types/types/media.d.ts +0 -103
  105. /package/dist/{types → v0.10}/api/apiUser.d.ts +0 -0
  106. /package/dist/{types → v0.10}/api/apps.d.ts +0 -0
  107. /package/dist/{types → v0.10}/api/baseClient.d.ts +0 -0
  108. /package/dist/{types → v0.10}/api/config.d.ts +0 -0
  109. /package/dist/{types → v0.10}/api/forge.d.ts +0 -0
  110. /package/dist/{types → v0.10}/api/functions.d.ts +0 -0
  111. /package/dist/{types → v0.10}/api/integrations/dms.d.ts +0 -0
  112. /package/dist/{types → v0.10}/api/integrations/invoicing.d.ts +0 -0
  113. /package/dist/{types → v0.10}/api/integrations/minimax.d.ts +0 -0
  114. /package/dist/{types → v0.10}/api/integrations/payments.d.ts +0 -0
  115. /package/dist/{types → v0.10}/api/integrations/serbiaUtil.d.ts +0 -0
  116. /package/dist/{types → v0.10}/api/integrations/vpfr.d.ts +0 -0
  117. /package/dist/{types → v0.10}/api/integrations.d.ts +0 -0
  118. /package/dist/{types → v0.10}/api/platformBaseClient.d.ts +0 -0
  119. /package/dist/{types → v0.10}/api/project.d.ts +0 -0
  120. /package/dist/{types → v0.10}/api/ratchet.d.ts +0 -0
  121. /package/dist/{types → v0.10}/api/sandbox.d.ts +0 -0
  122. /package/dist/{types → v0.10}/api/system.d.ts +0 -0
  123. /package/dist/{types → v0.10}/api/thunder.d.ts +0 -0
  124. /package/dist/{types → v0.10}/api/users.d.ts +0 -0
  125. /package/dist/{types → v0.10}/api/workflow.d.ts +0 -0
  126. /package/dist/{types → v0.10}/types/config.d.ts +0 -0
  127. /package/dist/{types → v0.10}/types/integrations.d.ts +0 -0
  128. /package/dist/{types → v0.10}/types/project.d.ts +0 -0
  129. /package/dist/{types → v0.10}/types/ratchet.d.ts +0 -0
  130. /package/dist/{types → v0.10}/types/users.d.ts +0 -0
  131. /package/dist/{types → v0.10}/util/detectEnv.d.ts +0 -0
  132. /package/dist/{types → v0.9}/api/componentUtils.d.ts +0 -0
@@ -0,0 +1,196 @@
1
+ import PlatformBaseClient from "./platformBaseClient";
2
+ import { AxiosResponse } from "axios";
3
+ import { RatchetQueryResponse, RatchetConnection, CreateRatchetConnectionRequest, InspectQueryRequest } from "../types/ratchet";
4
+ export default class Ratchet extends PlatformBaseClient {
5
+ /**
6
+ * Get all database connections for the current project
7
+ *
8
+ * @returns List of all configured ratchet connections
9
+ *
10
+ * @example
11
+ * ```typescript
12
+ * const ratchet = new Ratchet();
13
+ * const connections = await ratchet.getConnections();
14
+ * console.log(connections.data); // Array of connections
15
+ * ```
16
+ */
17
+ getConnections(): Promise<AxiosResponse<RatchetConnection[]>>;
18
+ /**
19
+ * Get a specific database connection by ID
20
+ *
21
+ * @param id - Connection ID
22
+ * @returns Connection details including queries
23
+ *
24
+ * @example
25
+ * ```typescript
26
+ * const ratchet = new Ratchet();
27
+ * const connection = await ratchet.getConnection('users_db');
28
+ * console.log(connection.data.queries); // Available queries for this connection
29
+ * ```
30
+ */
31
+ getConnection(id: string): Promise<AxiosResponse<RatchetConnection>>;
32
+ /**
33
+ * Create a new database connection
34
+ *
35
+ * Supports multiple database types:
36
+ * - MySQL: Use credentials with host, dbname, user, password
37
+ * - PostgreSQL: Use credentials with host, dbname, user, password
38
+ * - MongoDB: Use DSN connection string
39
+ * - BigQuery: Use service_account_json and project_id
40
+ *
41
+ * @param connection - Connection configuration
42
+ * @returns Created connection details
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * const ratchet = new Ratchet();
47
+ *
48
+ * // MySQL/PostgreSQL connection
49
+ * await ratchet.createConnection({
50
+ * id: 'users_db',
51
+ * type: 'MySQL',
52
+ * credentials: {
53
+ * type: 'Credentials',
54
+ * host: 'localhost',
55
+ * dbname: 'users',
56
+ * user: 'admin',
57
+ * password: 'secret'
58
+ * }
59
+ * });
60
+ *
61
+ * // MongoDB connection
62
+ * await ratchet.createConnection({
63
+ * id: 'mongo_db',
64
+ * type: 'MongoDB',
65
+ * credentials: {
66
+ * type: 'DSN',
67
+ * dsn: 'mongodb://localhost:27017/mydb'
68
+ * }
69
+ * });
70
+ *
71
+ * // BigQuery connection
72
+ * await ratchet.createConnection({
73
+ * id: 'analytics_bq',
74
+ * type: 'BigQuery',
75
+ * credentials: {
76
+ * type: 'ServiceAccount',
77
+ * service_account_json: '{"type":"service_account",...}',
78
+ * project_id: 'my-project-id'
79
+ * }
80
+ * });
81
+ * ```
82
+ */
83
+ createConnection(connection: CreateRatchetConnectionRequest): Promise<AxiosResponse<RatchetConnection>>;
84
+ /**
85
+ * Update an existing database connection
86
+ *
87
+ * @param connection - Updated connection configuration
88
+ * @returns Success status
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * const ratchet = new Ratchet();
93
+ * await ratchet.updateConnection({
94
+ * id: 'users_db',
95
+ * type: 'postgres',
96
+ * credentials: {
97
+ * type: 'postgres',
98
+ * host: 'localhost',
99
+ * dbname: 'users',
100
+ * user: 'admin',
101
+ * password: 'new_secret'
102
+ * },
103
+ * queries: [
104
+ * { id: 'get_user', expression: 'SELECT * FROM users WHERE id = $1' }
105
+ * ]
106
+ * });
107
+ * ```
108
+ */
109
+ updateConnection(connection: RatchetConnection): Promise<AxiosResponse<{
110
+ status: boolean;
111
+ }>>;
112
+ /**
113
+ * Delete a database connection
114
+ *
115
+ * @param id - Connection ID to delete
116
+ * @returns Success status
117
+ *
118
+ * @example
119
+ * ```typescript
120
+ * const ratchet = new Ratchet();
121
+ * await ratchet.deleteConnection('users_db');
122
+ * ```
123
+ */
124
+ deleteConnection(id: string): Promise<AxiosResponse<{
125
+ status: boolean;
126
+ }>>;
127
+ /**
128
+ * Test a database connection without saving it
129
+ *
130
+ * @param connection - Connection configuration to test
131
+ * @returns Success status if connection is valid
132
+ *
133
+ * @example
134
+ * ```typescript
135
+ * const ratchet = new Ratchet();
136
+ * const isValid = await ratchet.testConnection({
137
+ * id: 'test_db',
138
+ * type: 'postgres',
139
+ * credentials: {
140
+ * type: 'postgres',
141
+ * host: 'localhost',
142
+ * dbname: 'test',
143
+ * user: 'admin',
144
+ * password: 'secret'
145
+ * }
146
+ * });
147
+ * ```
148
+ */
149
+ testConnection(connection: RatchetConnection): Promise<AxiosResponse<{
150
+ status: boolean;
151
+ }>>;
152
+ /**
153
+ * Execute a predefined database query
154
+ *
155
+ * Runs a query that has been previously configured in a ratchet connection.
156
+ * The query is identified by a qualified name in the format: `connectionId.queryId`
157
+ *
158
+ * @param name - Qualified name of the query (format: `connectionId.queryId`)
159
+ * @param params - Array of parameters to pass to the query
160
+ * @returns Query execution results
161
+ *
162
+ * @example
163
+ * ```typescript
164
+ * const ratchet = new Ratchet();
165
+ *
166
+ * // Execute a query with parameters
167
+ * const result = await ratchet.query('users_db.get_user_by_id', [123]);
168
+ *
169
+ * // Execute a query without parameters
170
+ * const allUsers = await ratchet.query('users_db.get_all_users', []);
171
+ * ```
172
+ */
173
+ query<T = any>(name: string, params: any[] | Record<string, any>): Promise<AxiosResponse<RatchetQueryResponse<T>>>;
174
+ /**
175
+ * Inspect and execute a custom query without saving it
176
+ *
177
+ * This allows you to test queries before saving them to a connection.
178
+ *
179
+ * @param request - Query inspection request with connection name, query, and params
180
+ * @returns Query execution results
181
+ *
182
+ * @example
183
+ * ```typescript
184
+ * const ratchet = new Ratchet();
185
+ * const result = await ratchet.inspectQuery({
186
+ * name: 'users_db.test_query',
187
+ * query: {
188
+ * id: 'test_query',
189
+ * expression: 'SELECT * FROM users WHERE email = $1'
190
+ * },
191
+ * params: ['user@example.com']
192
+ * });
193
+ * ```
194
+ */
195
+ inspectQuery<T = any>(request: InspectQueryRequest): Promise<AxiosResponse<RatchetQueryResponse<T>>>;
196
+ }
@@ -0,0 +1,14 @@
1
+ import PlatformBaseClient from "./platformBaseClient";
2
+ export default class Sandbox extends PlatformBaseClient {
3
+ /**
4
+ * Call the sandbox service to execute a serverless function
5
+ *
6
+ * @param name
7
+ * @param data
8
+ * @returns
9
+ *
10
+ * @example
11
+ * const result = await platform.sandbox().spark("myFunction", { foo: "bar" })
12
+ */
13
+ spark(name: string, data: any): Promise<import("axios").AxiosResponse<any, any>>;
14
+ }
@@ -0,0 +1,4 @@
1
+ import PlatformBaseClient from "./platformBaseClient";
2
+ export default class System extends PlatformBaseClient {
3
+ resourceResolver(ref: string, resourceName: string, format?: string): Promise<import("axios").AxiosResponse<any, any>>;
4
+ }
@@ -0,0 +1,13 @@
1
+ import PlatformBaseClient from "./platformBaseClient";
2
+ export default class Thunder extends PlatformBaseClient {
3
+ read(type: string, filters: any, flag: string, options?: any): Promise<import("axios").AxiosResponse<any, any>>;
4
+ write(type: string, filters: any, d: any, flag: any): Promise<import("axios").AxiosResponse<any, any>>;
5
+ operation(name: string, filters: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
6
+ find(name: string, filters: any): Promise<import("axios").AxiosResponse<any, any>>;
7
+ findOne(name: string, filters: any): Promise<import("axios").AxiosResponse<any, any>>;
8
+ paginate(name: string, filters: any, options?: any): Promise<import("axios").AxiosResponse<any, any>>;
9
+ upsert(name: string, filters: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
10
+ insertOne(name: string, data: any): Promise<import("axios").AxiosResponse<any, any>>;
11
+ updateOne(name: string, filters: any, data: any): Promise<import("axios").AxiosResponse<any, any>>;
12
+ delete(name: string, filters: any): Promise<import("axios").AxiosResponse<any, any>>;
13
+ }
@@ -0,0 +1,69 @@
1
+ import PlatformBaseClient from "./platformBaseClient";
2
+ import { UserClaims, UserModel, Role, CreateRoleRequest, EditRoleRequest, RoleModel, Permission } from "../types/users";
3
+ import { AxiosResponse } from "axios";
4
+ export default class Users extends PlatformBaseClient {
5
+ auth(username: string, password: string, project: string): Promise<AxiosResponse<any>>;
6
+ /**
7
+ * Resend confirmation email
8
+ * @param email User email
9
+ */
10
+ resendConfirmationEmail(email: string): Promise<AxiosResponse<any>>;
11
+ /**
12
+ * Request password reset email
13
+ * This only sends an email with a reset link, does not expose or change passwords
14
+ * @param email User email
15
+ */
16
+ requestPasswordReset(email: string): Promise<AxiosResponse<any>>;
17
+ /**
18
+ * Get current user's model
19
+ */
20
+ getUser(): Promise<AxiosResponse<UserModel>>;
21
+ /**
22
+ * Get current user's claims
23
+ */
24
+ getClaims(): Promise<AxiosResponse<UserClaims>>;
25
+ /**
26
+ * Edit user profile
27
+ * @param data Profile update data
28
+ */
29
+ editProfile(data: any): Promise<AxiosResponse<any>>;
30
+ /**
31
+ * Get user permissions
32
+ */
33
+ getPermissions(): Promise<AxiosResponse<Permission[]>>;
34
+ /**
35
+ * Get list of available permissions
36
+ */
37
+ listPermissions(): Promise<AxiosResponse<Permission[]>>;
38
+ /**
39
+ * Create a new role
40
+ * @param role Role data including name, permissions, workspaces, and level
41
+ */
42
+ createRole(role: CreateRoleRequest): Promise<AxiosResponse<Role>>;
43
+ /**
44
+ * Delete a role
45
+ * @param uuid Role UUID
46
+ */
47
+ deleteRole(uuid: string): Promise<AxiosResponse<{
48
+ status: boolean;
49
+ }>>;
50
+ /**
51
+ * List all roles
52
+ */
53
+ listRoles(): Promise<AxiosResponse<Role[]>>;
54
+ /**
55
+ * Get role details by UUID
56
+ * @param uuid Role UUID
57
+ */
58
+ getRoleModel(uuid: string): Promise<AxiosResponse<RoleModel>>;
59
+ /**
60
+ * Edit a role
61
+ * @param uuid Role UUID
62
+ * @param data Role update data including permissions, workspaces, and level
63
+ */
64
+ editRole(uuid: string, data: EditRoleRequest): Promise<AxiosResponse<Role>>;
65
+ /**
66
+ * @deprecated Use getPermissions() instead
67
+ */
68
+ permissions(): Promise<AxiosResponse<any>>;
69
+ }
@@ -0,0 +1,5 @@
1
+ import PlatformBaseClient from "./platformBaseClient";
2
+ export default class Workflow extends PlatformBaseClient {
3
+ trigger(id: string, event: string, data: any): Promise<import("axios").AxiosResponse<any, any>>;
4
+ publish(event: string, data: any): Promise<import("axios").AxiosResponse<any, any>>;
5
+ }
@@ -0,0 +1,9 @@
1
+ import PlatformBaseClient from "./platformBaseClient";
2
+ export default class APIUser extends PlatformBaseClient {
3
+ auth(username: string, password: string, project: string): Promise<import("axios").AxiosResponse<any, any>>;
4
+ newSecret(uuid: string): Promise<import("axios").AxiosResponse<any, any>>;
5
+ revokeSecret(uuid: string): Promise<import("axios").AxiosResponse<any, any>>;
6
+ edit(uuid: string, roles: string[]): Promise<import("axios").AxiosResponse<any, any>>;
7
+ list(): Promise<any>;
8
+ get(uuid: string): Promise<import("axios").AxiosResponse<any, any>>;
9
+ }
@@ -0,0 +1,8 @@
1
+ import PlatformBaseClient from "./platformBaseClient";
2
+ export default class Apps extends PlatformBaseClient {
3
+ private appType;
4
+ constructor(appType?: string);
5
+ updateSettings(updateValues: any, ref: string): Promise<any>;
6
+ download(ref: string, version: string): Promise<any>;
7
+ upload(formData: FormData): Promise<any>;
8
+ }
@@ -0,0 +1,6 @@
1
+ import { AxiosInstance } from "axios";
2
+ export default class BaseClient {
3
+ client: AxiosInstance;
4
+ constructor(client: AxiosInstance);
5
+ setClient(client: AxiosInstance): this;
6
+ }
@@ -0,0 +1,128 @@
1
+ import { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, ModifyOptions, StreamHandler, AggregateChainable, ComponentOptions } from "./types/component";
2
+ import PlatformBaseClient from "./platformBaseClient";
3
+ import { AxiosResponse } from "axios";
4
+ export default class Component extends PlatformBaseClient {
5
+ private ref;
6
+ private version;
7
+ constructor(ref?: string | null, options?: ComponentOptions);
8
+ /**
9
+ * Get the base path for component API calls
10
+ * @private
11
+ */
12
+ private getComponentPath;
13
+ /**
14
+ * Find method to search for models
15
+ *
16
+ * @param {FindParams} filters - The filters to apply to the search
17
+ * @param {FindOptions} opts - The options to apply to the search
18
+ *
19
+ * @returns {Promise<FindResponse>} - The result of the search
20
+ *
21
+ * @example
22
+ * platform.component(name).find({
23
+ * currentPage: 1,
24
+ * perPage: 10,
25
+ * })
26
+ *
27
+ * // advanced search
28
+ * platform.component(name).find({
29
+ * $adv: {
30
+ * name: "John Doe",
31
+ * }
32
+ * )
33
+ **/
34
+ find(filters: FindParams, opts?: FindOptions): Promise<AxiosResponse<FindResponse>>;
35
+ /**
36
+ * FindOne method to search for a single model
37
+ *
38
+ * @param {FindAdvancedParams} filter - The filters to apply to the search
39
+ * @param {FindOptions} opts - The options to apply to the search
40
+ *
41
+ * @returns {Promise<?Model>} - The result of the search
42
+ *
43
+ * @example
44
+ * platform.component(name).findOne({
45
+ * name: "John Doe",
46
+ * })
47
+ **/
48
+ findOne(filter: FindAdvancedParams, opts: FindOptions): Promise<Model | null>;
49
+ /**
50
+ * Get model by uuid
51
+ *
52
+ * @param uuid string - The uuid of the model
53
+ * @returns (Promise<Model>)
54
+ */
55
+ get(uuid: string): Promise<AxiosResponse<Model>>;
56
+ /**
57
+ * Update model by uuid
58
+ *
59
+ * @param uuid string - The uuid of the model
60
+ * @param data
61
+ * @returns
62
+ */
63
+ update(uuid: string, data: Record<string, any>, options: UpdateOptions): Promise<AxiosResponse<any, any>>;
64
+ /**
65
+ * Update many models
66
+ *
67
+ * @param data
68
+ * @param options
69
+ * @returns
70
+ */
71
+ updateMany(data: Record<string, any>[], options: UpdateOptions): Promise<AxiosResponse<any, any>>;
72
+ /**
73
+ * Modify models by filters
74
+ *
75
+ * @param data
76
+ * @param options
77
+ * @returns
78
+ */
79
+ modify(filters: Record<string, any>, data: Record<string, any>, options: ModifyOptions): Promise<AxiosResponse<any, any>>;
80
+ /**
81
+ * Concurrent update model by uuid
82
+ *
83
+ * @param uuid string - The uuid of the model
84
+ * @param version number - The version of the model
85
+ * @param data
86
+ * @returns
87
+ */
88
+ concurrentUpdate(uuid: string, version: number, data: Record<string, any>, options: UpdateOptions): Promise<AxiosResponse<any, any>>;
89
+ create(model: Record<string, any>): Promise<AxiosResponse<any, any>>;
90
+ delete(uuid: string): Promise<AxiosResponse<any, any>>;
91
+ /**
92
+ * Execute aggregate pipeline with optional streaming support
93
+ *
94
+ * Returns a chainable object that allows both buffered and streaming modes.
95
+ * Call .onData() to enable streaming mode, or await directly for buffered mode.
96
+ *
97
+ * @param {FindAggregateParams} pipeline - MongoDB aggregation pipeline
98
+ *
99
+ * @returns {AggregateChainable} Chainable object with streaming methods and Promise interface
100
+ *
101
+ * @example
102
+ * ```typescript
103
+ * // Buffered response (default, up to 5K documents)
104
+ * const result = await component.aggregate([{ $match: { status: 'active' } }]);
105
+ * console.log(result.data); // All results at once
106
+ *
107
+ * // Streaming response (up to 25K documents)
108
+ * await component.aggregate([{ $match: { status: 'active' } }])
109
+ * .onData((doc) => console.log('Received:', doc))
110
+ * .onError((err) => console.error('Error:', err))
111
+ * .onEnd(() => console.log('Stream complete'));
112
+ * ```
113
+ */
114
+ aggregate(pipeline: FindAggregateParams): AggregateChainable;
115
+ settings(): Promise<AxiosResponse<any, any>>;
116
+ saveSettings(settings: any, version: string): Promise<AxiosResponse<any, any>>;
117
+ saveTemplatesDist(version: string, sdkVersion: string, engine: string, dist: Record<string, string>): Promise<any>;
118
+ workflow(event: string, input: any): Promise<AxiosResponse<any, any>>;
119
+ function(name: string, input: any): Promise<AxiosResponse<any, any>>;
120
+ revisions(uuid: string): Promise<AxiosResponse<any, any>>;
121
+ /**
122
+ * Internal method to handle NDJSON streaming responses
123
+ *
124
+ * @private
125
+ */
126
+ private _streamNDJSON;
127
+ }
128
+ export { FindParams, FindOptions, FindResponse, FindAdvancedParams, FindAggregateParams, Model, UpdateOptions, StreamHandler, AggregateChainable, ComponentOptions, };
@@ -0,0 +1,7 @@
1
+ import { AxiosResponse } from "axios";
2
+ import { ComponentListResponse } from "./types/component";
3
+ import PlatformBaseClient from "./platformBaseClient";
4
+ export default class ComponentUtils extends PlatformBaseClient {
5
+ list(): Promise<AxiosResponse<ComponentListResponse>>;
6
+ create(data: any): Promise<AxiosResponse<any, any>>;
7
+ }
@@ -0,0 +1,14 @@
1
+ import PlatformBaseClient from "./platformBaseClient";
2
+ import { AxiosResponse } from "axios";
3
+ import { ConfigUpdateRequest, UserConfig } from './types/config';
4
+ export default class Config extends PlatformBaseClient {
5
+ /**
6
+ * Get user configuration
7
+ */
8
+ getUserConfig(): Promise<AxiosResponse<UserConfig>>;
9
+ /**
10
+ * Update user configuration
11
+ * @param config Configuration data
12
+ */
13
+ updateUserConfig(config: ConfigUpdateRequest): Promise<AxiosResponse<any>>;
14
+ }
@@ -0,0 +1,7 @@
1
+ import PlatformBaseClient from "./platformBaseClient";
2
+ export default class Forge extends PlatformBaseClient {
3
+ bundleUpload(buffer: Buffer): Promise<any>;
4
+ getWorkspaceApps(): Promise<any>;
5
+ removeVersion(ref: string, version: string): Promise<any>;
6
+ list(): Promise<any>;
7
+ }
@@ -0,0 +1,23 @@
1
+ import PlatformBaseClient from "./platformBaseClient";
2
+ export default class Functions extends PlatformBaseClient {
3
+ list(): Promise<any>;
4
+ get(ref: string): Promise<any>;
5
+ update(uuid: string, update: any): Promise<any>;
6
+ /**
7
+ * Run platform function
8
+ *
9
+ * @param id - Function ID
10
+ * @param input - Input data
11
+ * @param query - Query parameters
12
+ * @returns - Function result
13
+ *
14
+ * @example
15
+ * const result = await platform.function().run("myFunction", {input: { foo: "bar" }})
16
+ */
17
+ run(id: string, d: {
18
+ input?: Record<string, any>;
19
+ query?: Record<string, string>;
20
+ headers?: Record<string, string>;
21
+ }): Promise<any>;
22
+ generateSignature(ref: string, env: string): Promise<import("axios").AxiosResponse<any, any>>;
23
+ }