@lowdefy/build 0.0.0-experimental-20260114142524 → 0.0.0-experimental-20260122074446

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 (57) hide show
  1. package/dist/build/addKeys.js +31 -18
  2. package/dist/build/buildApi/validateStepReferences.js +3 -4
  3. package/dist/build/buildAuth/buildAuth.js +2 -1
  4. package/dist/build/buildAuth/buildAuthPlugins.js +13 -13
  5. package/dist/build/buildAuth/validateAuthConfig.js +40 -8
  6. package/dist/build/buildAuth/validateMutualExclusivity.js +7 -7
  7. package/dist/build/buildConnections.js +20 -39
  8. package/dist/build/buildMenu.js +9 -14
  9. package/dist/build/buildPages/buildBlock/buildEvents.js +13 -13
  10. package/dist/build/buildPages/buildBlock/buildRequests.js +15 -15
  11. package/dist/build/buildPages/buildBlock/validateBlock.js +13 -13
  12. package/dist/build/buildPages/buildPage.js +5 -5
  13. package/dist/build/buildPages/validateLinkReferences.js +8 -9
  14. package/dist/build/buildPages/validatePayloadReferences.js +3 -4
  15. package/dist/build/buildPages/validateRequestReferences.js +7 -8
  16. package/dist/build/buildPages/validateStateReferences.js +3 -4
  17. package/dist/build/buildRefs/buildRefs.js +8 -0
  18. package/dist/build/buildRefs/evaluateBuildOperators.js +11 -1
  19. package/dist/build/buildRefs/evaluateStaticOperators.js +54 -0
  20. package/dist/build/buildRefs/getConfigFile.js +18 -13
  21. package/dist/build/buildRefs/getRefContent.js +15 -5
  22. package/dist/build/buildRefs/makeRefDefinition.js +1 -1
  23. package/dist/build/buildRefs/parseRefContent.js +32 -2
  24. package/dist/build/buildRefs/recursiveBuild.js +9 -7
  25. package/dist/build/buildRefs/runRefResolver.js +13 -2
  26. package/dist/build/buildTypes.js +9 -0
  27. package/dist/build/collectDynamicIdentifiers.js +35 -0
  28. package/dist/{utils/formatConfigError.js → build/collectTypeNames.js} +20 -8
  29. package/dist/build/formatBuildError.js +1 -1
  30. package/dist/build/testSchema.js +45 -6
  31. package/dist/build/validateOperatorsDynamic.js +28 -0
  32. package/dist/build/writeRequests.js +3 -3
  33. package/dist/createContext.js +42 -1
  34. package/dist/defaultTypesMap.js +447 -447
  35. package/dist/index.js +43 -4
  36. package/dist/lowdefySchema.js +60 -0
  37. package/dist/test-utils/parseTestYaml.js +110 -0
  38. package/dist/test-utils/runBuild.js +270 -0
  39. package/dist/test-utils/runBuildForSnapshots.js +698 -0
  40. package/dist/{test → test-utils}/testContext.js +15 -1
  41. package/dist/utils/collectConfigError.js +6 -6
  42. package/dist/utils/countOperators.js +5 -3
  43. package/dist/utils/createCheckDuplicateId.js +1 -1
  44. package/dist/utils/findConfigKey.js +37 -0
  45. package/dist/utils/makeId.js +12 -7
  46. package/dist/utils/tryBuildStep.js +12 -5
  47. package/package.json +39 -39
  48. package/dist/utils/formatConfigMessage.js +0 -33
  49. package/dist/utils/formatConfigWarning.js +0 -24
  50. package/dist/utils/formatErrorMessage.js +0 -56
  51. /package/dist/{test → test-utils}/buildRefs/testBuildRefsAsyncFunction.js +0 -0
  52. /package/dist/{test → test-utils}/buildRefs/testBuildRefsErrorResolver.js +0 -0
  53. /package/dist/{test → test-utils}/buildRefs/testBuildRefsNullResolver.js +0 -0
  54. /package/dist/{test → test-utils}/buildRefs/testBuildRefsParsingResolver.js +0 -0
  55. /package/dist/{test → test-utils}/buildRefs/testBuildRefsResolver.js +0 -0
  56. /package/dist/{test → test-utils}/buildRefs/testBuildRefsTransform.js +0 -0
  57. /package/dist/{test → test-utils}/buildRefs/testBuildRefsTransformIdentity.js +0 -0
@@ -0,0 +1,698 @@
1
+ /*
2
+ Copyright 2020-2024 Lowdefy, Inc
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */ import { jest } from '@jest/globals';
16
+ import path from 'path';
17
+ /**
18
+ * Extended types map for success tests - includes more types for comprehensive coverage.
19
+ */ const snapshotTypesMap = {
20
+ actions: {
21
+ CallMethod: {
22
+ package: '@lowdefy/actions-core'
23
+ },
24
+ CopyToClipboard: {
25
+ package: '@lowdefy/actions-core'
26
+ },
27
+ DisplayMessage: {
28
+ package: '@lowdefy/actions-core'
29
+ },
30
+ Link: {
31
+ package: '@lowdefy/actions-core'
32
+ },
33
+ Login: {
34
+ package: '@lowdefy/actions-core'
35
+ },
36
+ Logout: {
37
+ package: '@lowdefy/actions-core'
38
+ },
39
+ Request: {
40
+ package: '@lowdefy/actions-core'
41
+ },
42
+ Reset: {
43
+ package: '@lowdefy/actions-core'
44
+ },
45
+ ResetValidation: {
46
+ package: '@lowdefy/actions-core'
47
+ },
48
+ ScrollTo: {
49
+ package: '@lowdefy/actions-core'
50
+ },
51
+ SetFocus: {
52
+ package: '@lowdefy/actions-core'
53
+ },
54
+ SetGlobal: {
55
+ package: '@lowdefy/actions-core'
56
+ },
57
+ SetState: {
58
+ package: '@lowdefy/actions-core'
59
+ },
60
+ Throw: {
61
+ package: '@lowdefy/actions-core'
62
+ },
63
+ Validate: {
64
+ package: '@lowdefy/actions-core'
65
+ },
66
+ Wait: {
67
+ package: '@lowdefy/actions-core'
68
+ },
69
+ Return: {
70
+ package: '@lowdefy/api'
71
+ },
72
+ Log: {
73
+ package: '@lowdefy/actions-core'
74
+ }
75
+ },
76
+ blocks: {
77
+ // Basic blocks
78
+ Anchor: {
79
+ package: '@lowdefy/blocks-basic'
80
+ },
81
+ Box: {
82
+ package: '@lowdefy/blocks-basic'
83
+ },
84
+ Button: {
85
+ package: '@lowdefy/blocks-basic'
86
+ },
87
+ DangerousHtml: {
88
+ package: '@lowdefy/blocks-basic'
89
+ },
90
+ Html: {
91
+ package: '@lowdefy/blocks-basic'
92
+ },
93
+ Icon: {
94
+ package: '@lowdefy/blocks-basic'
95
+ },
96
+ Img: {
97
+ package: '@lowdefy/blocks-basic'
98
+ },
99
+ List: {
100
+ package: '@lowdefy/blocks-basic'
101
+ },
102
+ Paragraph: {
103
+ package: '@lowdefy/blocks-basic'
104
+ },
105
+ Span: {
106
+ package: '@lowdefy/blocks-basic'
107
+ },
108
+ Throw: {
109
+ package: '@lowdefy/blocks-basic'
110
+ },
111
+ Title: {
112
+ package: '@lowdefy/blocks-basic'
113
+ },
114
+ // Loaders
115
+ ProgressBar: {
116
+ package: '@lowdefy/blocks-loaders'
117
+ },
118
+ Skeleton: {
119
+ package: '@lowdefy/blocks-loaders'
120
+ },
121
+ SkeletonAvatar: {
122
+ package: '@lowdefy/blocks-loaders'
123
+ },
124
+ SkeletonButton: {
125
+ package: '@lowdefy/blocks-loaders'
126
+ },
127
+ SkeletonInput: {
128
+ package: '@lowdefy/blocks-loaders'
129
+ },
130
+ SkeletonParagraph: {
131
+ package: '@lowdefy/blocks-loaders'
132
+ },
133
+ Spinner: {
134
+ package: '@lowdefy/blocks-loaders'
135
+ },
136
+ // Antd blocks
137
+ Alert: {
138
+ package: '@lowdefy/blocks-antd'
139
+ },
140
+ AutoComplete: {
141
+ package: '@lowdefy/blocks-antd'
142
+ },
143
+ Avatar: {
144
+ package: '@lowdefy/blocks-antd'
145
+ },
146
+ Badge: {
147
+ package: '@lowdefy/blocks-antd'
148
+ },
149
+ Breadcrumb: {
150
+ package: '@lowdefy/blocks-antd'
151
+ },
152
+ Card: {
153
+ package: '@lowdefy/blocks-antd'
154
+ },
155
+ Carousel: {
156
+ package: '@lowdefy/blocks-antd'
157
+ },
158
+ CheckboxSelector: {
159
+ package: '@lowdefy/blocks-antd'
160
+ },
161
+ Collapse: {
162
+ package: '@lowdefy/blocks-antd'
163
+ },
164
+ Comment: {
165
+ package: '@lowdefy/blocks-antd'
166
+ },
167
+ ConfirmModal: {
168
+ package: '@lowdefy/blocks-antd'
169
+ },
170
+ Content: {
171
+ package: '@lowdefy/blocks-antd'
172
+ },
173
+ DateSelector: {
174
+ package: '@lowdefy/blocks-antd'
175
+ },
176
+ Descriptions: {
177
+ package: '@lowdefy/blocks-antd'
178
+ },
179
+ Divider: {
180
+ package: '@lowdefy/blocks-antd'
181
+ },
182
+ Drawer: {
183
+ package: '@lowdefy/blocks-antd'
184
+ },
185
+ Footer: {
186
+ package: '@lowdefy/blocks-antd'
187
+ },
188
+ Header: {
189
+ package: '@lowdefy/blocks-antd'
190
+ },
191
+ Label: {
192
+ package: '@lowdefy/blocks-antd'
193
+ },
194
+ Layout: {
195
+ package: '@lowdefy/blocks-antd'
196
+ },
197
+ Menu: {
198
+ package: '@lowdefy/blocks-antd'
199
+ },
200
+ Message: {
201
+ package: '@lowdefy/blocks-antd'
202
+ },
203
+ MobileMenu: {
204
+ package: '@lowdefy/blocks-antd'
205
+ },
206
+ Modal: {
207
+ package: '@lowdefy/blocks-antd'
208
+ },
209
+ MultipleSelector: {
210
+ package: '@lowdefy/blocks-antd'
211
+ },
212
+ NumberInput: {
213
+ package: '@lowdefy/blocks-antd'
214
+ },
215
+ PageHeaderMenu: {
216
+ package: '@lowdefy/blocks-antd'
217
+ },
218
+ PageSiderMenu: {
219
+ package: '@lowdefy/blocks-antd'
220
+ },
221
+ Pagination: {
222
+ package: '@lowdefy/blocks-antd'
223
+ },
224
+ ParagraphInput: {
225
+ package: '@lowdefy/blocks-antd'
226
+ },
227
+ PasswordInput: {
228
+ package: '@lowdefy/blocks-antd'
229
+ },
230
+ Popover: {
231
+ package: '@lowdefy/blocks-antd'
232
+ },
233
+ Progress: {
234
+ package: '@lowdefy/blocks-antd'
235
+ },
236
+ RadioSelector: {
237
+ package: '@lowdefy/blocks-antd'
238
+ },
239
+ RatingSlider: {
240
+ package: '@lowdefy/blocks-antd'
241
+ },
242
+ Result: {
243
+ package: '@lowdefy/blocks-antd'
244
+ },
245
+ Selector: {
246
+ package: '@lowdefy/blocks-antd'
247
+ },
248
+ Sider: {
249
+ package: '@lowdefy/blocks-antd'
250
+ },
251
+ Statistic: {
252
+ package: '@lowdefy/blocks-antd'
253
+ },
254
+ Switch: {
255
+ package: '@lowdefy/blocks-antd'
256
+ },
257
+ Tabs: {
258
+ package: '@lowdefy/blocks-antd'
259
+ },
260
+ Tag: {
261
+ package: '@lowdefy/blocks-antd'
262
+ },
263
+ TextArea: {
264
+ package: '@lowdefy/blocks-antd'
265
+ },
266
+ TextInput: {
267
+ package: '@lowdefy/blocks-antd'
268
+ },
269
+ TitleInput: {
270
+ package: '@lowdefy/blocks-antd'
271
+ },
272
+ Tooltip: {
273
+ package: '@lowdefy/blocks-antd'
274
+ },
275
+ TreeSelector: {
276
+ package: '@lowdefy/blocks-antd'
277
+ }
278
+ },
279
+ connections: {
280
+ AxiosHttp: {
281
+ package: '@lowdefy/connection-axios-http'
282
+ },
283
+ MongoDBCollection: {
284
+ package: '@lowdefy/connection-mongodb'
285
+ },
286
+ Knex: {
287
+ package: '@lowdefy/connection-knex'
288
+ },
289
+ Redis: {
290
+ package: '@lowdefy/connection-redis'
291
+ },
292
+ SendGridMail: {
293
+ package: '@lowdefy/connection-sendgrid'
294
+ },
295
+ Stripe: {
296
+ package: '@lowdefy/connection-stripe'
297
+ },
298
+ GoogleSheet: {
299
+ package: '@lowdefy/connection-google-sheets'
300
+ },
301
+ Elasticsearch: {
302
+ package: '@lowdefy/connection-elasticsearch'
303
+ },
304
+ AWSS3: {
305
+ package: '@lowdefy/plugin-aws'
306
+ }
307
+ },
308
+ requests: {
309
+ AxiosHttp: {
310
+ package: '@lowdefy/connection-axios-http'
311
+ },
312
+ MongoDBFind: {
313
+ package: '@lowdefy/connection-mongodb'
314
+ },
315
+ MongoDBFindOne: {
316
+ package: '@lowdefy/connection-mongodb'
317
+ },
318
+ MongoDBInsertOne: {
319
+ package: '@lowdefy/connection-mongodb'
320
+ },
321
+ MongoDBInsertMany: {
322
+ package: '@lowdefy/connection-mongodb'
323
+ },
324
+ MongoDBUpdateOne: {
325
+ package: '@lowdefy/connection-mongodb'
326
+ },
327
+ MongoDBUpdateMany: {
328
+ package: '@lowdefy/connection-mongodb'
329
+ },
330
+ MongoDBDeleteOne: {
331
+ package: '@lowdefy/connection-mongodb'
332
+ },
333
+ MongoDBDeleteMany: {
334
+ package: '@lowdefy/connection-mongodb'
335
+ },
336
+ MongoDBAggregate: {
337
+ package: '@lowdefy/connection-mongodb'
338
+ },
339
+ KnexRaw: {
340
+ package: '@lowdefy/connection-knex'
341
+ },
342
+ RedisGet: {
343
+ package: '@lowdefy/connection-redis'
344
+ },
345
+ RedisSet: {
346
+ package: '@lowdefy/connection-redis'
347
+ },
348
+ SendGridMailSend: {
349
+ package: '@lowdefy/connection-sendgrid'
350
+ },
351
+ StripePaymentIntents: {
352
+ package: '@lowdefy/connection-stripe'
353
+ },
354
+ GoogleSheetGetMany: {
355
+ package: '@lowdefy/connection-google-sheets'
356
+ },
357
+ GoogleSheetAppendOne: {
358
+ package: '@lowdefy/connection-google-sheets'
359
+ },
360
+ ElasticsearchSearch: {
361
+ package: '@lowdefy/connection-elasticsearch'
362
+ },
363
+ AWSS3GetObject: {
364
+ package: '@lowdefy/plugin-aws'
365
+ },
366
+ AWSS3PutObject: {
367
+ package: '@lowdefy/plugin-aws'
368
+ }
369
+ },
370
+ auth: {
371
+ adapters: {
372
+ MongoDBAdapter: {
373
+ package: '@lowdefy/plugin-next-auth'
374
+ }
375
+ },
376
+ callbacks: {
377
+ JwtCallback: {
378
+ package: '@lowdefy/plugin-next-auth'
379
+ },
380
+ SessionCallback: {
381
+ package: '@lowdefy/plugin-next-auth'
382
+ },
383
+ SignInCallback: {
384
+ package: '@lowdefy/plugin-next-auth'
385
+ },
386
+ RedirectCallback: {
387
+ package: '@lowdefy/plugin-next-auth'
388
+ }
389
+ },
390
+ events: {
391
+ SignIn: {
392
+ package: '@lowdefy/plugin-next-auth'
393
+ },
394
+ SignOut: {
395
+ package: '@lowdefy/plugin-next-auth'
396
+ },
397
+ CreateUser: {
398
+ package: '@lowdefy/plugin-next-auth'
399
+ },
400
+ UpdateUser: {
401
+ package: '@lowdefy/plugin-next-auth'
402
+ },
403
+ LinkAccount: {
404
+ package: '@lowdefy/plugin-next-auth'
405
+ },
406
+ Session: {
407
+ package: '@lowdefy/plugin-next-auth'
408
+ }
409
+ },
410
+ providers: {
411
+ Auth0Provider: {
412
+ package: '@lowdefy/plugin-auth0'
413
+ },
414
+ GoogleProvider: {
415
+ package: 'next-auth'
416
+ },
417
+ GitHubProvider: {
418
+ package: 'next-auth'
419
+ },
420
+ CredentialsProvider: {
421
+ package: 'next-auth'
422
+ },
423
+ EmailProvider: {
424
+ package: 'next-auth'
425
+ }
426
+ }
427
+ },
428
+ operators: {
429
+ client: {
430
+ _state: {
431
+ package: '@lowdefy/operators-js'
432
+ },
433
+ _input: {
434
+ package: '@lowdefy/operators-js'
435
+ },
436
+ _global: {
437
+ package: '@lowdefy/operators-js'
438
+ },
439
+ _request: {
440
+ package: '@lowdefy/operators-js'
441
+ },
442
+ _user: {
443
+ package: '@lowdefy/operators-js'
444
+ },
445
+ _event: {
446
+ package: '@lowdefy/operators-js'
447
+ },
448
+ _actions: {
449
+ package: '@lowdefy/operators-js'
450
+ },
451
+ _location: {
452
+ package: '@lowdefy/operators-js'
453
+ },
454
+ _media: {
455
+ package: '@lowdefy/operators-js'
456
+ },
457
+ _menu: {
458
+ package: '@lowdefy/operators-js'
459
+ },
460
+ _if: {
461
+ package: '@lowdefy/operators-js'
462
+ },
463
+ _eq: {
464
+ package: '@lowdefy/operators-js'
465
+ },
466
+ _ne: {
467
+ package: '@lowdefy/operators-js'
468
+ },
469
+ _lt: {
470
+ package: '@lowdefy/operators-js'
471
+ },
472
+ _lte: {
473
+ package: '@lowdefy/operators-js'
474
+ },
475
+ _gt: {
476
+ package: '@lowdefy/operators-js'
477
+ },
478
+ _gte: {
479
+ package: '@lowdefy/operators-js'
480
+ },
481
+ _and: {
482
+ package: '@lowdefy/operators-js'
483
+ },
484
+ _or: {
485
+ package: '@lowdefy/operators-js'
486
+ },
487
+ _not: {
488
+ package: '@lowdefy/operators-js'
489
+ },
490
+ _type: {
491
+ package: '@lowdefy/operators-js'
492
+ },
493
+ _get: {
494
+ package: '@lowdefy/operators-js'
495
+ },
496
+ _array: {
497
+ package: '@lowdefy/operators-js'
498
+ },
499
+ _object: {
500
+ package: '@lowdefy/operators-js'
501
+ },
502
+ _string: {
503
+ package: '@lowdefy/operators-js'
504
+ },
505
+ _sum: {
506
+ package: '@lowdefy/operators-js'
507
+ },
508
+ _subtract: {
509
+ package: '@lowdefy/operators-js'
510
+ },
511
+ _product: {
512
+ package: '@lowdefy/operators-js'
513
+ },
514
+ _divide: {
515
+ package: '@lowdefy/operators-js'
516
+ },
517
+ _json: {
518
+ package: '@lowdefy/operators-js'
519
+ },
520
+ _yaml: {
521
+ package: '@lowdefy/operators-js'
522
+ },
523
+ _date: {
524
+ package: '@lowdefy/operators-js'
525
+ },
526
+ _payload: {
527
+ package: '@lowdefy/operators-js'
528
+ },
529
+ _args: {
530
+ package: '@lowdefy/operators-js'
531
+ },
532
+ _function: {
533
+ package: '@lowdefy/operators-js'
534
+ },
535
+ _random: {
536
+ package: '@lowdefy/operators-js'
537
+ },
538
+ _uuid: {
539
+ package: '@lowdefy/operators-uuid'
540
+ },
541
+ _moment: {
542
+ package: '@lowdefy/operators-moment'
543
+ },
544
+ _regex: {
545
+ package: '@lowdefy/operators-js'
546
+ },
547
+ _hash: {
548
+ package: '@lowdefy/operators-js'
549
+ },
550
+ _base64: {
551
+ package: '@lowdefy/operators-js'
552
+ },
553
+ _uri: {
554
+ package: '@lowdefy/operators-js'
555
+ },
556
+ _url_query: {
557
+ package: '@lowdefy/operators-js'
558
+ },
559
+ _intl: {
560
+ package: '@lowdefy/operators-js'
561
+ },
562
+ _change_case: {
563
+ package: '@lowdefy/operators-change-case'
564
+ },
565
+ _diff: {
566
+ package: '@lowdefy/operators-diff'
567
+ },
568
+ _mql: {
569
+ package: '@lowdefy/operators-mql'
570
+ },
571
+ _nunjucks: {
572
+ package: '@lowdefy/operators-nunjucks'
573
+ },
574
+ _js: {
575
+ package: '@lowdefy/operators-js'
576
+ }
577
+ },
578
+ server: {
579
+ _payload: {
580
+ package: '@lowdefy/operators-js'
581
+ },
582
+ _step: {
583
+ package: '@lowdefy/operators-js'
584
+ },
585
+ _secret: {
586
+ package: '@lowdefy/operators-js'
587
+ },
588
+ _request: {
589
+ package: '@lowdefy/operators-js'
590
+ },
591
+ _user: {
592
+ package: '@lowdefy/operators-js'
593
+ },
594
+ _if: {
595
+ package: '@lowdefy/operators-js'
596
+ },
597
+ _eq: {
598
+ package: '@lowdefy/operators-js'
599
+ },
600
+ _get: {
601
+ package: '@lowdefy/operators-js'
602
+ },
603
+ _array: {
604
+ package: '@lowdefy/operators-js'
605
+ },
606
+ _object: {
607
+ package: '@lowdefy/operators-js'
608
+ },
609
+ _string: {
610
+ package: '@lowdefy/operators-js'
611
+ },
612
+ _json: {
613
+ package: '@lowdefy/operators-js'
614
+ },
615
+ _yaml: {
616
+ package: '@lowdefy/operators-js'
617
+ },
618
+ _date: {
619
+ package: '@lowdefy/operators-js'
620
+ },
621
+ _mql: {
622
+ package: '@lowdefy/operators-mql'
623
+ },
624
+ _js: {
625
+ package: '@lowdefy/operators-js'
626
+ }
627
+ }
628
+ },
629
+ controls: {
630
+ Endpoint: {
631
+ package: '@lowdefy/api'
632
+ },
633
+ Log: {
634
+ package: '@lowdefy/api'
635
+ },
636
+ Return: {
637
+ package: '@lowdefy/api'
638
+ },
639
+ Throw: {
640
+ package: '@lowdefy/api'
641
+ },
642
+ SetState: {
643
+ package: '@lowdefy/api'
644
+ }
645
+ }
646
+ };
647
+ /**
648
+ * Creates a runBuild helper function for snapshot testing build artifacts.
649
+ *
650
+ * @param {Function} build - The build function
651
+ * @param {string} fixturesDir - Absolute path to the fixtures directory
652
+ * @param {Function} mockWriteBuildArtifact - Mock function to capture artifacts
653
+ * @returns {Function} runBuild helper function
654
+ */ function createRunBuildForSnapshots(build, fixturesDir, mockWriteBuildArtifact) {
655
+ return async function runBuild(fixtureDir, stage = 'prod') {
656
+ const configDir = path.join(fixturesDir, fixtureDir);
657
+ const artifacts = {};
658
+ // Create a mock that captures written artifacts
659
+ mockWriteBuildArtifact.mockImplementation((filePath, content)=>{
660
+ artifacts[filePath] = content;
661
+ });
662
+ const logger = {
663
+ info: jest.fn(),
664
+ log: jest.fn(),
665
+ warn: jest.fn(),
666
+ error: jest.fn(),
667
+ succeed: jest.fn()
668
+ };
669
+ await build({
670
+ customTypesMap: snapshotTypesMap,
671
+ directories: {
672
+ config: configDir,
673
+ build: path.join(configDir, '.lowdefy'),
674
+ server: path.join(configDir, '.lowdefy', 'server')
675
+ },
676
+ logger,
677
+ stage
678
+ });
679
+ // Parse JSON artifacts for snapshot comparison
680
+ const parsedArtifacts = {};
681
+ for (const [filePath, content] of Object.entries(artifacts)){
682
+ if (filePath.endsWith('.json')) {
683
+ try {
684
+ parsedArtifacts[filePath] = JSON.parse(content);
685
+ } catch {
686
+ parsedArtifacts[filePath] = content;
687
+ }
688
+ } else {
689
+ parsedArtifacts[filePath] = content;
690
+ }
691
+ }
692
+ return {
693
+ artifacts: parsedArtifacts,
694
+ logger
695
+ };
696
+ };
697
+ }
698
+ export { snapshotTypesMap, createRunBuildForSnapshots };