@stonecrop/graphql-client 0.10.7 → 0.10.9

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.
@@ -1,5 +1,5 @@
1
- import type { DataClient, DoctypeMeta, DoctypeContext } from '@stonecrop/schema';
2
- export type { DoctypeContext };
1
+ import type { DataClient, DoctypeMeta, DoctypeContext, DoctypeRef } from '@stonecrop/schema';
2
+ export type { DoctypeContext, DoctypeRef };
3
3
  /**
4
4
  * Options for creating a Stonecrop client
5
5
  * @public
@@ -42,16 +42,16 @@ export declare class StonecropClient implements DataClient {
42
42
  getAllMeta(): Promise<DoctypeMeta[]>;
43
43
  /**
44
44
  * Get a single record by ID
45
- * @param doctype - Doctype metadata
45
+ * @param doctype - Doctype reference (name and optional slug)
46
46
  * @param recordId - Record ID to fetch
47
47
  */
48
- getRecord(doctype: DoctypeMeta, recordId: string): Promise<Record<string, unknown> | null>;
48
+ getRecord(doctype: DoctypeRef, recordId: string): Promise<Record<string, unknown> | null>;
49
49
  /**
50
50
  * Get multiple records with optional filtering and pagination
51
- * @param doctype - Doctype metadata
51
+ * @param doctype - Doctype reference (name and optional slug)
52
52
  * @param options - Query options (filters, orderBy, limit, offset)
53
53
  */
54
- getRecords(doctype: DoctypeMeta, options?: {
54
+ getRecords(doctype: DoctypeRef, options?: {
55
55
  filters?: Record<string, unknown>;
56
56
  orderBy?: string;
57
57
  limit?: number;
@@ -59,11 +59,11 @@ export declare class StonecropClient implements DataClient {
59
59
  }): Promise<Record<string, unknown>[]>;
60
60
  /**
61
61
  * Execute a doctype action
62
- * @param doctype - Doctype metadata
62
+ * @param doctype - Doctype reference (name and optional slug)
63
63
  * @param action - Action name to execute
64
64
  * @param args - Action arguments
65
65
  */
66
- runAction(doctype: DoctypeMeta, action: string, args?: unknown[]): Promise<{
66
+ runAction(doctype: DoctypeRef, action: string, args?: unknown[]): Promise<{
67
67
  success: boolean;
68
68
  data: unknown;
69
69
  error: string | null;
@@ -1 +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"MIT",
5
5
  "type": "module",
6
6
  "author": {
@@ -33,8 +33,8 @@
33
33
  "decimal.js": "^10.6.0",
34
34
  "graphql": "^16.12.0",
35
35
  "graphql-request": "^7.4.0",
36
- "@stonecrop/schema": "0.10.7",
37
- "@stonecrop/stonecrop": "0.10.7"
36
+ "@stonecrop/stonecrop": "0.10.9",
37
+ "@stonecrop/schema": "0.10.9"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@eslint/js": "^9.39.2",
package/src/client.ts CHANGED
@@ -1,6 +1,6 @@
1
- import type { DataClient, DoctypeMeta, DoctypeContext } from '@stonecrop/schema'
1
+ import type { DataClient, DoctypeMeta, DoctypeContext, DoctypeRef } from '@stonecrop/schema'
2
2
 
3
- export type { DoctypeContext }
3
+ export type { DoctypeContext, DoctypeRef }
4
4
 
5
5
  /**
6
6
  * Options for creating a Stonecrop client
@@ -99,7 +99,14 @@ export class StonecropClient implements DataClient {
99
99
  }
100
100
  workflow {
101
101
  states
102
- actions
102
+ actions {
103
+ label
104
+ handler
105
+ requiredFields
106
+ allowedStates
107
+ confirm
108
+ args
109
+ }
103
110
  }
104
111
  inherits
105
112
  listDoctype
@@ -149,7 +156,14 @@ export class StonecropClient implements DataClient {
149
156
  }
150
157
  workflow {
151
158
  states
152
- actions
159
+ actions {
160
+ label
161
+ handler
162
+ requiredFields
163
+ allowedStates
164
+ confirm
165
+ args
166
+ }
153
167
  }
154
168
  inherits
155
169
  listDoctype
@@ -168,10 +182,10 @@ export class StonecropClient implements DataClient {
168
182
 
169
183
  /**
170
184
  * Get a single record by ID
171
- * @param doctype - Doctype metadata
185
+ * @param doctype - Doctype reference (name and optional slug)
172
186
  * @param recordId - Record ID to fetch
173
187
  */
174
- async getRecord(doctype: DoctypeMeta, recordId: string): Promise<Record<string, unknown> | null> {
188
+ async getRecord(doctype: DoctypeRef, recordId: string): Promise<Record<string, unknown> | null> {
175
189
  const result = await this.query<{
176
190
  stonecropRecord: { data: Record<string, unknown> | null }
177
191
  }>(
@@ -190,11 +204,11 @@ export class StonecropClient implements DataClient {
190
204
 
191
205
  /**
192
206
  * Get multiple records with optional filtering and pagination
193
- * @param doctype - Doctype metadata
207
+ * @param doctype - Doctype reference (name and optional slug)
194
208
  * @param options - Query options (filters, orderBy, limit, offset)
195
209
  */
196
210
  async getRecords(
197
- doctype: DoctypeMeta,
211
+ doctype: DoctypeRef,
198
212
  options?: {
199
213
  filters?: Record<string, unknown>
200
214
  orderBy?: string
@@ -236,12 +250,12 @@ export class StonecropClient implements DataClient {
236
250
 
237
251
  /**
238
252
  * Execute a doctype action
239
- * @param doctype - Doctype metadata
253
+ * @param doctype - Doctype reference (name and optional slug)
240
254
  * @param action - Action name to execute
241
255
  * @param args - Action arguments
242
256
  */
243
257
  async runAction(
244
- doctype: DoctypeMeta,
258
+ doctype: DoctypeRef,
245
259
  action: string,
246
260
  args?: unknown[]
247
261
  ): Promise<{ success: boolean; data: unknown; error: string | null }> {