@appsemble/utils 0.30.14-test.6 → 0.32.1-test.15
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.
- package/README.md +3 -3
- package/allActions.js +5 -3
- package/api/components/parameters/$orderby.js +2 -2
- package/api/components/parameters/index.d.ts +2 -1
- package/api/components/parameters/index.js +2 -1
- package/api/components/parameters/webhookName.d.ts +2 -0
- package/api/components/parameters/webhookName.js +10 -0
- package/api/components/parameters/webhookSecretId.d.ts +2 -0
- package/api/components/parameters/webhookSecretId.js +8 -0
- package/api/components/schemas/ActionDefinition.js +3 -0
- package/api/components/schemas/App.js +8 -0
- package/api/components/schemas/AppDefinition.js +6 -0
- package/api/components/schemas/AppLayoutDefinition.js +8 -0
- package/api/components/schemas/AppServiceSecret.js +5 -0
- package/api/components/schemas/AppWebhookSecret.d.ts +2 -0
- package/api/components/schemas/AppWebhookSecret.js +25 -0
- package/api/components/schemas/DialogOkActionDefinition.js +1 -1
- package/api/components/schemas/FilterParametersDefinition.d.ts +2 -0
- package/api/components/schemas/FilterParametersDefinition.js +15 -0
- package/api/components/schemas/FlowCancelActionDefinition.js +1 -1
- package/api/components/schemas/FlowFinishActionDefinition.js +1 -1
- package/api/components/schemas/GroupMemberDeleteActionDefinition.js +1 -1
- package/api/components/schemas/ResourceDefinition.js +5 -0
- package/api/components/schemas/ResourceDeleteAllActionDefinition.d.ts +1 -0
- package/api/components/schemas/ResourceDeleteAllActionDefinition.js +21 -0
- package/api/components/schemas/ResourceDeleteBulkActionDefinition.d.ts +1 -0
- package/api/components/schemas/ResourceDeleteBulkActionDefinition.js +18 -0
- package/api/components/schemas/ResourceGetActionDefinition.js +3 -0
- package/api/components/schemas/ResourcePatchActionDefinition.js +3 -0
- package/api/components/schemas/ResourceSubscriptionStatusActionDefinition.js +1 -0
- package/api/components/schemas/ResourceSubscriptionSubscribeActionDefinition.js +1 -0
- package/api/components/schemas/ResourceSubscriptionToggleActionDefinition.js +1 -0
- package/api/components/schemas/ResourceSubscriptionUnsubscribeActionDefinition.js +1 -0
- package/api/components/schemas/ResourceUpdatePositionsActionDefinition.d.ts +1 -0
- package/api/components/schemas/ResourceUpdatePositionsActionDefinition.js +21 -0
- package/api/components/schemas/SecurityCronDefinition.d.ts +2 -0
- package/api/components/schemas/SecurityCronDefinition.js +26 -0
- package/api/components/schemas/SecurityDefinition.js +1 -0
- package/api/components/schemas/StorageSubtractActionDefinition.js +2 -2
- package/api/components/schemas/Training.js +2 -25
- package/api/components/schemas/TrainingCompleted.d.ts +2 -0
- package/api/components/schemas/TrainingCompleted.js +17 -0
- package/api/components/schemas/WebhookDefinition.d.ts +2 -0
- package/api/components/schemas/WebhookDefinition.js +17 -0
- package/api/components/schemas/index.d.ts +8 -1
- package/api/components/schemas/index.js +8 -1
- package/api/components/schemas/utils.js +1 -1
- package/api/components/securitySchemes/index.d.ts +1 -0
- package/api/components/securitySchemes/index.js +1 -0
- package/api/components/securitySchemes/webhook.d.ts +2 -0
- package/api/components/securitySchemes/webhook.js +6 -0
- package/api/paths/apps/appId/resources/resourceType/resourceId/positions.js +54 -0
- package/api/paths/apps/appId/secrets/webhook/secretId.js +61 -0
- package/api/paths/apps/appId/secrets/webhook.js +44 -0
- package/api/paths/apps/appId/webhooks/webhookName.js +35 -0
- package/api/paths/apps/appId.js +6 -0
- package/api/paths/auth/email/patchPassword.js +30 -0
- package/api/paths/index.d.ts +7 -5
- package/api/paths/index.js +16 -12
- package/api/paths/trainings/completeTraining.js +18 -0
- package/api/paths/trainings/completedTrainings.d.ts +2 -0
- package/api/paths/trainings/completedTrainings.js +21 -0
- package/api/paths/trainings/trainingIds.d.ts +2 -0
- package/api/paths/trainings/trainingIds.js +20 -0
- package/api/tags/index.js +4 -4
- package/appMessages.js +1 -1
- package/assets.js +1 -1
- package/authorization.d.ts +1 -1
- package/authorization.js +1 -1
- package/blockUtils.d.ts +1 -1
- package/blockUtils.js +1 -0
- package/convertToCsv.js +2 -0
- package/examples.js +214 -4
- package/formatRequestAction.js +2 -2
- package/has.d.ts +1 -1
- package/has.js +1 -1
- package/i18n.js +6 -8
- package/ics.js +1 -1
- package/iterApp.js +3 -3
- package/jsonschema.js +16 -3
- package/package.json +15 -11
- package/reference-schemas/actions/appMember.d.ts +2 -0
- package/reference-schemas/actions/appMember.js +21 -0
- package/reference-schemas/actions/flow.d.ts +2 -0
- package/reference-schemas/actions/flow.js +13 -0
- package/reference-schemas/actions/group.d.ts +2 -0
- package/reference-schemas/actions/group.js +13 -0
- package/reference-schemas/actions/index.d.ts +7 -0
- package/reference-schemas/actions/index.js +8 -0
- package/reference-schemas/actions/link.d.ts +2 -0
- package/reference-schemas/actions/link.js +9 -0
- package/reference-schemas/actions/miscellaneous.d.ts +2 -0
- package/reference-schemas/actions/miscellaneous.js +41 -0
- package/reference-schemas/actions/resources.d.ts +2 -0
- package/reference-schemas/actions/resources.js +19 -0
- package/reference-schemas/actions/storage.d.ts +2 -0
- package/reference-schemas/actions/storage.js +15 -0
- package/reference-schemas/remappers/conditionals.js +39 -0
- package/reference-schemas/remappers/data.js +26 -2
- package/reference-schemas/remappers/index.d.ts +1 -0
- package/reference-schemas/remappers/index.js +1 -0
- package/reference-schemas/remappers/objects.js +32 -0
- package/reference-schemas/remappers/odata.d.ts +2 -0
- package/reference-schemas/remappers/odata.js +95 -0
- package/reference-schemas/remappers/strings.js +33 -0
- package/reference-schemas/remappers/unsorted.js +9 -0
- package/remap.d.ts +2 -0
- package/remap.js +192 -15
- package/serializeResource.d.ts +7 -0
- package/serializeResource.js +7 -0
- package/serverActions.d.ts +1 -1
- package/serverActions.js +2 -0
- package/theme.js +5 -1
- package/validateStyle.js +2 -0
- package/validation.js +52 -16
- package/api/components/parameters/trainingBlockId.d.ts +0 -2
- package/api/components/parameters/trainingBlockId.js +0 -8
- package/api/components/schemas/TrainingBlock.d.ts +0 -2
- package/api/components/schemas/TrainingBlock.js +0 -38
- package/api/components/securitySchemes/cli.test.d.ts +0 -1
- package/api/components/securitySchemes/cli.test.js +0 -7
- package/api/index.test.d.ts +0 -1
- package/api/index.test.js +0 -180
- package/api/paths/trainingBlocks/trainingBlockId.js +0 -41
- package/api/paths/trainings/trainingId/blocks.js +0 -51
- package/api/paths/trainings/trainingId/users/current.js +0 -62
- package/api/paths/trainings/trainingId/users.js +0 -25
- package/api/paths/trainings/trainingId.js +0 -85
- package/api/paths/trainings.js +0 -44
- package/appMessages.test.d.ts +0 -1
- package/appMessages.test.js +0 -409
- package/blockUtils.test.d.ts +0 -1
- package/blockUtils.test.js +0 -77
- package/constants/patterns.test.d.ts +0 -1
- package/constants/patterns.test.js +0 -83
- package/convertToCsv.test.d.ts +0 -1
- package/convertToCsv.test.js +0 -55
- package/has.test.d.ts +0 -1
- package/has.test.js +0 -17
- package/i18n.test.d.ts +0 -1
- package/i18n.test.js +0 -76
- package/iterApp.test.d.ts +0 -1
- package/iterApp.test.js +0 -439
- package/jsonschema.test.d.ts +0 -1
- package/jsonschema.test.js +0 -256
- package/mapValues.test.d.ts +0 -1
- package/mapValues.test.js +0 -16
- package/miscellaneous.test.d.ts +0 -1
- package/miscellaneous.test.js +0 -87
- package/normalize.test.d.ts +0 -1
- package/normalize.test.js +0 -23
- package/objectCache.test.d.ts +0 -1
- package/objectCache.test.js +0 -20
- package/prefix.test.d.ts +0 -1
- package/prefix.test.js +0 -11
- package/remap.test.d.ts +0 -1
- package/remap.test.js +0 -1387
- package/string.test.d.ts +0 -1
- package/string.test.js +0 -27
- package/theme.test.d.ts +0 -1
- package/theme.test.js +0 -91
- package/validateStyle.test.d.ts +0 -1
- package/validateStyle.test.js +0 -13
- package/validation.test.d.ts +0 -1
- package/validation.test.js +0 -3121
- /package/api/paths/{trainingBlocks/trainingBlockId.d.ts → apps/appId/resources/resourceType/resourceId/positions.d.ts} +0 -0
- /package/api/paths/{trainings/trainingId.d.ts → apps/appId/secrets/webhook/secretId.d.ts} +0 -0
- /package/api/paths/{trainings.d.ts → apps/appId/secrets/webhook.d.ts} +0 -0
- /package/api/paths/{trainings/trainingId/blocks.d.ts → apps/appId/webhooks/webhookName.d.ts} +0 -0
- /package/api/paths/{trainings/trainingId/users.d.ts → auth/email/patchPassword.d.ts} +0 -0
- /package/api/paths/trainings/{trainingId/users/current.d.ts → completeTraining.d.ts} +0 -0
package/examples.js
CHANGED
|
@@ -52,6 +52,12 @@ export const examples = {
|
|
|
52
52
|
item: {
|
|
53
53
|
array: 'item',
|
|
54
54
|
},
|
|
55
|
+
prevItem: {
|
|
56
|
+
array: 'prevItem',
|
|
57
|
+
},
|
|
58
|
+
nextItem: {
|
|
59
|
+
array: 'nextItem',
|
|
60
|
+
},
|
|
55
61
|
},
|
|
56
62
|
},
|
|
57
63
|
},
|
|
@@ -60,19 +66,30 @@ export const examples = {
|
|
|
60
66
|
index: 0,
|
|
61
67
|
length: 3,
|
|
62
68
|
item: 'a',
|
|
69
|
+
prevItem: undefined,
|
|
70
|
+
nextItem: 'b',
|
|
63
71
|
},
|
|
64
72
|
{
|
|
65
73
|
index: 1,
|
|
66
74
|
length: 3,
|
|
67
75
|
item: 'b',
|
|
76
|
+
prevItem: 'a',
|
|
77
|
+
nextItem: 'c',
|
|
68
78
|
},
|
|
69
79
|
{
|
|
70
80
|
index: 2,
|
|
71
81
|
length: 3,
|
|
72
82
|
item: 'c',
|
|
83
|
+
prevItem: 'b',
|
|
84
|
+
nextItem: undefined,
|
|
73
85
|
},
|
|
74
86
|
],
|
|
75
87
|
},
|
|
88
|
+
len: {
|
|
89
|
+
input: 'string',
|
|
90
|
+
remapper: { len: null },
|
|
91
|
+
result: 6,
|
|
92
|
+
},
|
|
76
93
|
'array.append': {
|
|
77
94
|
input: [
|
|
78
95
|
{
|
|
@@ -516,6 +533,16 @@ export const examples = {
|
|
|
516
533
|
remapper: { not: [{ prop: 'number' }, 4] },
|
|
517
534
|
result: true,
|
|
518
535
|
},
|
|
536
|
+
and: {
|
|
537
|
+
input: { foo: true },
|
|
538
|
+
remapper: { and: [{ prop: 'foo' }, true] },
|
|
539
|
+
result: true,
|
|
540
|
+
},
|
|
541
|
+
or: {
|
|
542
|
+
input: { foo: true },
|
|
543
|
+
remapper: { or: [{ prop: 'foo' }, false] },
|
|
544
|
+
result: true,
|
|
545
|
+
},
|
|
519
546
|
'null.strip': {
|
|
520
547
|
input: null,
|
|
521
548
|
remapper: {},
|
|
@@ -570,6 +597,64 @@ export const examples = {
|
|
|
570
597
|
title: 'Weekly fishing 21',
|
|
571
598
|
},
|
|
572
599
|
},
|
|
600
|
+
'object.compare': {
|
|
601
|
+
input: { name: 'Alice' },
|
|
602
|
+
remapper: {
|
|
603
|
+
'object.compare': [
|
|
604
|
+
{
|
|
605
|
+
'object.from': {
|
|
606
|
+
name: { prop: 'name' },
|
|
607
|
+
age: 25,
|
|
608
|
+
address: {
|
|
609
|
+
'object.from': {
|
|
610
|
+
city: 'Paris',
|
|
611
|
+
zip: 7500,
|
|
612
|
+
},
|
|
613
|
+
},
|
|
614
|
+
},
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
'object.from': {
|
|
618
|
+
name: 'Alice',
|
|
619
|
+
age: 26,
|
|
620
|
+
address: {
|
|
621
|
+
'object.from': {
|
|
622
|
+
city: 'Lyon',
|
|
623
|
+
country: 'France',
|
|
624
|
+
},
|
|
625
|
+
},
|
|
626
|
+
},
|
|
627
|
+
},
|
|
628
|
+
],
|
|
629
|
+
},
|
|
630
|
+
result: [
|
|
631
|
+
{ path: ['age'], type: 'changed', from: 25, to: 26 },
|
|
632
|
+
{ path: ['address', 'city'], type: 'changed', from: 'Paris', to: 'Lyon' },
|
|
633
|
+
{ path: ['address', 'zip'], type: 'removed', value: 7500 },
|
|
634
|
+
{ path: ['address', 'country'], type: 'added', value: 'France' },
|
|
635
|
+
],
|
|
636
|
+
},
|
|
637
|
+
'object.explode': {
|
|
638
|
+
input: {
|
|
639
|
+
ownerName: 'John',
|
|
640
|
+
country: 'USA',
|
|
641
|
+
pets: [
|
|
642
|
+
{ name: 'Milka' },
|
|
643
|
+
{ name: 'Sven', country: 'Sweden' },
|
|
644
|
+
{ name: 'Tom', likes: ['mice', 'fish'] },
|
|
645
|
+
{ name: 'Jerry', looks: { color: 'brown' } },
|
|
646
|
+
],
|
|
647
|
+
},
|
|
648
|
+
remapper: {
|
|
649
|
+
'object.explode': 'pets',
|
|
650
|
+
},
|
|
651
|
+
result: [
|
|
652
|
+
{ ownerName: 'John', name: 'Milka', country: 'USA' },
|
|
653
|
+
{ ownerName: 'John', name: 'Sven', country: 'Sweden' },
|
|
654
|
+
{ ownerName: 'John', name: 'Tom', country: 'USA', likes: ['mice', 'fish'] },
|
|
655
|
+
{ ownerName: 'John', name: 'Jerry', country: 'USA', looks: { color: 'brown' } },
|
|
656
|
+
],
|
|
657
|
+
},
|
|
573
658
|
'omit.history': {
|
|
574
659
|
input: null,
|
|
575
660
|
remapper: {},
|
|
@@ -647,6 +732,30 @@ export const examples = {
|
|
|
647
732
|
},
|
|
648
733
|
result: 'PATRICK',
|
|
649
734
|
},
|
|
735
|
+
'string.startsWith': {
|
|
736
|
+
input: 'Random string here',
|
|
737
|
+
remapper: {
|
|
738
|
+
'string.startsWith': 'Random',
|
|
739
|
+
},
|
|
740
|
+
result: true,
|
|
741
|
+
},
|
|
742
|
+
'string.endsWith': {
|
|
743
|
+
input: 'Random string here',
|
|
744
|
+
remapper: {
|
|
745
|
+
'string.endsWith': {
|
|
746
|
+
substring: 'Here',
|
|
747
|
+
strict: false,
|
|
748
|
+
},
|
|
749
|
+
},
|
|
750
|
+
result: true,
|
|
751
|
+
},
|
|
752
|
+
slice: {
|
|
753
|
+
input: 'Laziness',
|
|
754
|
+
remapper: {
|
|
755
|
+
slice: [3, 6],
|
|
756
|
+
},
|
|
757
|
+
result: 'ine',
|
|
758
|
+
},
|
|
650
759
|
'string.format': {
|
|
651
760
|
input: {
|
|
652
761
|
lotteryPrize: '5000',
|
|
@@ -684,6 +793,107 @@ export const examples = {
|
|
|
684
793
|
result: {},
|
|
685
794
|
skip: true,
|
|
686
795
|
},
|
|
796
|
+
'filter.from': {
|
|
797
|
+
input: { exclude: 'Peter' },
|
|
798
|
+
remapper: {
|
|
799
|
+
'filter.from': {
|
|
800
|
+
name: { type: 'String', comparator: 'ne', value: { prop: 'exclude' } },
|
|
801
|
+
age: { type: 'Number', comparator: 'lt', value: 10 },
|
|
802
|
+
height: { type: 'Number', comparator: 'le', value: 1.75 },
|
|
803
|
+
heightString: { type: 'Number', comparator: 'le', value: '1.75' },
|
|
804
|
+
birthday: { type: 'Date', comparator: 'ge', value: '2000-01-01' },
|
|
805
|
+
friendsSince: { type: 'Date', comparator: 'ge', value: '2014-01-01T00:00:00Z' },
|
|
806
|
+
job: { type: 'String', comparator: 'eq', value: null },
|
|
807
|
+
employed: { type: 'Boolean', comparator: 'eq', value: false },
|
|
808
|
+
id: { type: 'Guid', comparator: 'eq', value: '03a0a47b-e3a2-e311-9402-00155d104c24' },
|
|
809
|
+
undefined: { type: 'String', comparator: 'eq', value: undefined },
|
|
810
|
+
special: {
|
|
811
|
+
type: 'String',
|
|
812
|
+
comparator: 'eq',
|
|
813
|
+
value: 'Special character\'s "test" \\%&+?^/',
|
|
814
|
+
},
|
|
815
|
+
},
|
|
816
|
+
},
|
|
817
|
+
result: "name ne 'Peter' and age lt 10 and height le 1.75 and heightString le 1.75 and birthday ge 2000-01-01 and friendsSince ge 2014-01-01T00:00:00Z and job eq null and employed eq false and id eq 03a0a47b-e3a2-e311-9402-00155d104c24 and undefined eq null and special eq 'Special character''s \"test\" \\\\%&+?^/'",
|
|
818
|
+
},
|
|
819
|
+
'order.from': {
|
|
820
|
+
input: null,
|
|
821
|
+
remapper: {
|
|
822
|
+
'order.from': {
|
|
823
|
+
name: 'asc',
|
|
824
|
+
age: 'desc',
|
|
825
|
+
},
|
|
826
|
+
},
|
|
827
|
+
result: 'name asc,age desc',
|
|
828
|
+
},
|
|
829
|
+
'xml.parse': {
|
|
830
|
+
input: {
|
|
831
|
+
xml: `
|
|
832
|
+
<obj>
|
|
833
|
+
<foo>bar</foo>
|
|
834
|
+
<item foo="bar">
|
|
835
|
+
<item foo="bar">
|
|
836
|
+
<text>text</text>
|
|
837
|
+
</item>
|
|
838
|
+
</item>
|
|
839
|
+
<item bar="baz">
|
|
840
|
+
<item bar="baz">
|
|
841
|
+
<text>text 2</text>
|
|
842
|
+
</item>
|
|
843
|
+
</item>
|
|
844
|
+
<item>
|
|
845
|
+
<item foo="bar">
|
|
846
|
+
<item foo="bar">
|
|
847
|
+
<text>text</text>
|
|
848
|
+
</item>
|
|
849
|
+
</item>
|
|
850
|
+
<item bar="baz">
|
|
851
|
+
<item bar="baz">
|
|
852
|
+
<text>text 2</text>
|
|
853
|
+
</item>
|
|
854
|
+
</item>
|
|
855
|
+
</item>
|
|
856
|
+
</obj>
|
|
857
|
+
`,
|
|
858
|
+
},
|
|
859
|
+
remapper: { 'xml.parse': { prop: 'xml' } },
|
|
860
|
+
result: {
|
|
861
|
+
obj: {
|
|
862
|
+
foo: 'bar',
|
|
863
|
+
item: [
|
|
864
|
+
{
|
|
865
|
+
foo: 'bar',
|
|
866
|
+
item: { foo: 'bar', text: 'text' },
|
|
867
|
+
},
|
|
868
|
+
{
|
|
869
|
+
bar: 'baz',
|
|
870
|
+
item: { bar: 'baz', text: 'text 2' },
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
item: [
|
|
874
|
+
{
|
|
875
|
+
foo: 'bar',
|
|
876
|
+
item: { foo: 'bar', text: 'text' },
|
|
877
|
+
},
|
|
878
|
+
{
|
|
879
|
+
bar: 'baz',
|
|
880
|
+
item: { bar: 'baz', text: 'text 2' },
|
|
881
|
+
},
|
|
882
|
+
],
|
|
883
|
+
},
|
|
884
|
+
],
|
|
885
|
+
},
|
|
886
|
+
},
|
|
887
|
+
},
|
|
888
|
+
defined: {
|
|
889
|
+
input: [0, '', false, undefined, null],
|
|
890
|
+
remapper: {
|
|
891
|
+
'array.map': {
|
|
892
|
+
defined: { array: 'item' },
|
|
893
|
+
},
|
|
894
|
+
},
|
|
895
|
+
result: [true, true, true, false, false],
|
|
896
|
+
},
|
|
687
897
|
};
|
|
688
898
|
/**
|
|
689
899
|
* @param remapper The remapper example to use.
|
|
@@ -695,21 +905,21 @@ export function schemaExample(remapper, options) {
|
|
|
695
905
|
let example = '';
|
|
696
906
|
if (!exclude.includes('input')) {
|
|
697
907
|
const spacing = input === 'pretty' && 2;
|
|
698
|
-
example += `Input:\n\n\`\`\`json\n${JSON.stringify(examples[remapper].input, null, spacing)}\n\`\`\`\n`;
|
|
908
|
+
example += `Input:\n\n\`\`\`json\n${JSON.stringify(examples[remapper].input, null, spacing || undefined)}\n\`\`\`\n`;
|
|
699
909
|
}
|
|
700
910
|
if (!exclude.includes('remapper')) {
|
|
701
911
|
example += `\`\`\`yaml\n${stringify(examples[remapper].remapper)}\n\`\`\`\n`;
|
|
702
912
|
}
|
|
703
913
|
if (!exclude.includes('result')) {
|
|
704
914
|
const spacing = result === 'pretty' && 2;
|
|
705
|
-
example += `Result:\n\n\`\`\`json\n${JSON.stringify(examples[remapper].result, null, spacing)}\n\`\`\`\n`;
|
|
915
|
+
example += `Result:\n\n\`\`\`json\n${JSON.stringify(examples[remapper].result, null, spacing || undefined)}\n\`\`\`\n`;
|
|
706
916
|
}
|
|
707
917
|
return example;
|
|
708
918
|
}
|
|
709
919
|
export function createExampleContext(url, lang, userInfo, history) {
|
|
710
920
|
return {
|
|
711
|
-
getMessage: ({ defaultMessage }) => new IntlMessageFormat(defaultMessage, lang, undefined),
|
|
712
|
-
getVariable: (name) => (name === 'MY_VARIABLE' ? 'variable value' :
|
|
921
|
+
getMessage: ({ defaultMessage }) => new IntlMessageFormat(defaultMessage ?? [], lang, undefined),
|
|
922
|
+
getVariable: (name) => (name === 'MY_VARIABLE' ? 'variable value' : undefined),
|
|
713
923
|
url: String(url),
|
|
714
924
|
appUrl: `${url.protocol}//example-app.example-organization.${url.host}`,
|
|
715
925
|
context: {},
|
package/formatRequestAction.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export function formatRequestAction({ method = 'GET', query, ...action }, data, remap, context) {
|
|
2
2
|
return {
|
|
3
3
|
method,
|
|
4
|
-
url: String(remap(action.url, data, context)),
|
|
5
|
-
params: remap(query, data, context),
|
|
4
|
+
url: String(remap(action.url ?? null, data, context)),
|
|
5
|
+
params: remap(query ?? null, data, context),
|
|
6
6
|
responseType: 'arraybuffer',
|
|
7
7
|
headers: {},
|
|
8
8
|
};
|
package/has.d.ts
CHANGED
package/has.js
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
* @returns Whether or not the key exists on the target.
|
|
7
7
|
*/
|
|
8
8
|
export function has(target, key) {
|
|
9
|
-
return target != null && Object.hasOwnProperty.call(target, key);
|
|
9
|
+
return target != null && target !== undefined && Object.hasOwnProperty.call(target, key);
|
|
10
10
|
}
|
|
11
11
|
//# sourceMappingURL=has.js.map
|
package/i18n.js
CHANGED
|
@@ -36,14 +36,12 @@ export function sortLocales(languages) {
|
|
|
36
36
|
export function detectLocale(languages, choices) {
|
|
37
37
|
const supportedLocales = sortLocales(languages);
|
|
38
38
|
const wantedLocales = sortLocales(choices);
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
for (const wanted of wantedLocales) {
|
|
40
|
+
for (const supported of supportedLocales) {
|
|
41
|
+
if (wanted.startsWith(supported)) {
|
|
42
|
+
return supported;
|
|
43
|
+
}
|
|
44
44
|
}
|
|
45
|
-
|
|
46
|
-
}));
|
|
47
|
-
return result;
|
|
45
|
+
}
|
|
48
46
|
}
|
|
49
47
|
//# sourceMappingURL=i18n.js.map
|
package/ics.js
CHANGED
|
@@ -5,7 +5,7 @@ const hourLength = 60 * minuteLength;
|
|
|
5
5
|
const dayLength = 24 * hourLength;
|
|
6
6
|
const weekLength = 7 * dayLength;
|
|
7
7
|
export function getDuration(duration) {
|
|
8
|
-
let milliseconds = typeof duration === 'string' ? parseDuration(duration) : duration;
|
|
8
|
+
let milliseconds = typeof duration === 'string' ? (parseDuration(duration) ?? 0) : duration;
|
|
9
9
|
const weeks = Math.floor(milliseconds / weekLength);
|
|
10
10
|
milliseconds %= weekLength;
|
|
11
11
|
const days = Math.floor(milliseconds / dayLength);
|
package/iterApp.js
CHANGED
|
@@ -92,14 +92,14 @@ export function iterPage(page, callbacks, prefix = []) {
|
|
|
92
92
|
if (page.type === 'flow' || page.type === 'tabs') {
|
|
93
93
|
let result = false;
|
|
94
94
|
if ('actions' in page) {
|
|
95
|
-
result = Object.entries(page.actions).some(([key, action]) => iterAction(action, callbacks, [...prefix, 'actions', key]));
|
|
95
|
+
result = Object.entries(page.actions ?? {}).some(([key, action]) => iterAction(action, callbacks, [...prefix, 'actions', key]));
|
|
96
96
|
}
|
|
97
97
|
return (result ||
|
|
98
98
|
(page.type === 'flow'
|
|
99
99
|
? page.steps.some((step, index) => iterBlockList(step.blocks, callbacks, [...prefix, 'steps', index, 'blocks']))
|
|
100
100
|
: page.tabs
|
|
101
101
|
? page.tabs.some((tab, index) => iterBlockList(tab.blocks, callbacks, [...prefix, 'tabs', index, 'blocks']))
|
|
102
|
-
: iterBlockList(page.definition
|
|
102
|
+
: iterBlockList(page.definition?.foreach.blocks ?? [], callbacks, [
|
|
103
103
|
...prefix,
|
|
104
104
|
'tabs',
|
|
105
105
|
0,
|
|
@@ -109,7 +109,7 @@ export function iterPage(page, callbacks, prefix = []) {
|
|
|
109
109
|
if (page.type === 'loop') {
|
|
110
110
|
let result = false;
|
|
111
111
|
if ('actions' in page) {
|
|
112
|
-
result = Object.entries(page.actions).some(([key, action]) => iterAction(action, callbacks, [...prefix, 'actions', key]));
|
|
112
|
+
result = Object.entries(page.actions ?? {}).some(([key, action]) => iterAction(action, callbacks, [...prefix, 'actions', key]));
|
|
113
113
|
}
|
|
114
114
|
return (result ||
|
|
115
115
|
['steps.first', 'steps', 'steps.last'].some((suffix) => iterBlockList(page.foreach.blocks, callbacks, [...prefix, suffix, 'blocks'])));
|
package/jsonschema.js
CHANGED
|
@@ -11,16 +11,16 @@ import { mapValues } from './mapValues.js';
|
|
|
11
11
|
*/
|
|
12
12
|
export function generateDataFromSchema(schema) {
|
|
13
13
|
if (!schema) {
|
|
14
|
-
return;
|
|
14
|
+
return null;
|
|
15
15
|
}
|
|
16
16
|
// Let’s assume the default conforms to the schema, although this might not be true.
|
|
17
17
|
if ('default' in schema) {
|
|
18
|
-
return schema.default;
|
|
18
|
+
return schema.default ?? null;
|
|
19
19
|
}
|
|
20
20
|
// If no predefined value exists, generate something based on its type.
|
|
21
21
|
switch (schema.type) {
|
|
22
22
|
case 'array':
|
|
23
|
-
return Array.from({ length: schema.minItems }, (empty, index) => generateDataFromSchema(Array.isArray(schema.items)
|
|
23
|
+
return Array.from({ length: schema.minItems ?? 0 }, (empty, index) => generateDataFromSchema(Array.isArray(schema.items)
|
|
24
24
|
? schema.items[index] ||
|
|
25
25
|
(typeof schema.additionalItems === 'object' && schema.additionalItems)
|
|
26
26
|
: schema.items));
|
|
@@ -46,6 +46,7 @@ export function generateDataFromSchema(schema) {
|
|
|
46
46
|
default:
|
|
47
47
|
break;
|
|
48
48
|
}
|
|
49
|
+
return null;
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
51
52
|
* Combine a list of schemas into one schema matching all of them.
|
|
@@ -67,18 +68,30 @@ export function combineSchemas(...schemas) {
|
|
|
67
68
|
}
|
|
68
69
|
if ('minimum' in schema) {
|
|
69
70
|
result.minimum =
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
|
|
72
|
+
// @ts-ignore 2345 argument of type is not assignable to parameter of type
|
|
73
|
+
// (strictNullChecks)
|
|
70
74
|
'minimum' in result ? Math.max(result.minimum, schema.minimum) : schema.minimum;
|
|
71
75
|
}
|
|
72
76
|
if ('minLength' in schema) {
|
|
73
77
|
result.minLength =
|
|
78
|
+
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
|
|
79
|
+
// @ts-ignore 2345 argument of type is not assignable to parameter of type
|
|
80
|
+
// (strictNullChecks)
|
|
74
81
|
'minLength' in result ? Math.max(result.minLength, schema.minLength) : schema.minLength;
|
|
75
82
|
}
|
|
76
83
|
if ('maximum' in schema) {
|
|
77
84
|
result.maximum =
|
|
85
|
+
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
|
|
86
|
+
// @ts-ignore 2345 argument of type is not assignable to parameter of type
|
|
87
|
+
// (strictNullChecks)
|
|
78
88
|
'maximum' in result ? Math.min(result.maximum, schema.maximum) : schema.maximum;
|
|
79
89
|
}
|
|
80
90
|
if ('maxLength' in schema) {
|
|
81
91
|
result.maxLength =
|
|
92
|
+
// eslint-disable-next-line @typescript-eslint/prefer-ts-expect-error
|
|
93
|
+
// @ts-ignore 2345 argument of type is not assignable to parameter of type
|
|
94
|
+
// (strictNullChecks)
|
|
82
95
|
'maxLength' in result ? Math.min(result.maxLength, schema.maxLength) : schema.maxLength;
|
|
83
96
|
}
|
|
84
97
|
if (schema.multipleOf) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@appsemble/utils",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.1-test.15",
|
|
4
4
|
"description": "Utility functions used in Appsemble internally",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"app",
|
|
@@ -22,14 +22,16 @@
|
|
|
22
22
|
"sideEffects": false,
|
|
23
23
|
"type": "module",
|
|
24
24
|
"exports": {
|
|
25
|
-
".":
|
|
26
|
-
"./index.
|
|
27
|
-
"./index.
|
|
28
|
-
|
|
25
|
+
".": {
|
|
26
|
+
"ts-source": "./index.ts",
|
|
27
|
+
"default": "./index.js"
|
|
28
|
+
}
|
|
29
29
|
},
|
|
30
30
|
"files": [
|
|
31
31
|
"**/*.d.ts",
|
|
32
32
|
"**/*.js",
|
|
33
|
+
"!**/*.test.js",
|
|
34
|
+
"!**/*.test.d.ts",
|
|
33
35
|
"!*.config.js"
|
|
34
36
|
],
|
|
35
37
|
"scripts": {
|
|
@@ -37,30 +39,32 @@
|
|
|
37
39
|
"test": "vitest"
|
|
38
40
|
},
|
|
39
41
|
"dependencies": {
|
|
40
|
-
"@appsemble/types": "0.
|
|
42
|
+
"@appsemble/types": "0.32.1-test.15",
|
|
43
|
+
"@odata/parser": "^0.2.14",
|
|
41
44
|
"axios": "^1.0.0",
|
|
42
45
|
"cron-parser": "^4.0.0",
|
|
43
46
|
"date-fns": "^2.0.0",
|
|
44
47
|
"fast-deep-equal": "^3.0.0",
|
|
48
|
+
"fast-xml-parser": "^5.0.8",
|
|
45
49
|
"ics": "^3.0.0",
|
|
46
50
|
"intl-messageformat": "^10.0.0",
|
|
47
|
-
"jsonschema": "
|
|
51
|
+
"jsonschema": "~1.4.1",
|
|
48
52
|
"langmap": "^0.0.16",
|
|
49
53
|
"language-tags": "^1.0.0",
|
|
50
54
|
"lcm": "^0.0.3",
|
|
51
55
|
"openapi-types": "^12.0.0",
|
|
52
56
|
"parse-duration": "^1.0.0",
|
|
53
57
|
"postcss": "^8.0.0",
|
|
54
|
-
"
|
|
55
|
-
"
|
|
58
|
+
"type-fest": "^4.0.0",
|
|
59
|
+
"yaml": "^2.0.0"
|
|
56
60
|
},
|
|
57
61
|
"devDependencies": {
|
|
58
62
|
"@types/langmap": "^0.0.3",
|
|
59
63
|
"@types/language-tags": "^1.0.0",
|
|
60
64
|
"@types/lcm": "^0.0.2",
|
|
61
|
-
"bulma": "0.9.3",
|
|
65
|
+
"bulma": "=0.9.3",
|
|
62
66
|
"koas-core": "^0.7.0",
|
|
63
|
-
"vitest": "^
|
|
67
|
+
"vitest": "^2.0.0"
|
|
64
68
|
},
|
|
65
69
|
"engines": {
|
|
66
70
|
"node": ">=20"
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AppMemberCurrentPatchActionDefinition } from '../../api/components/schemas/AppMemberCurrentPatchActionDefinition.js';
|
|
2
|
+
import { AppMemberDeleteActionDefinition } from '../../api/components/schemas/AppMemberDeleteActionDefinition.js';
|
|
3
|
+
import { AppMemberInviteActionDefinition } from '../../api/components/schemas/AppMemberInviteActionDefinition.js';
|
|
4
|
+
import { AppMemberLoginActionDefinition } from '../../api/components/schemas/AppMemberLoginActionDefinition.js';
|
|
5
|
+
import { AppMemberLogoutActionDefinition } from '../../api/components/schemas/AppMemberLogoutActionDefinition.js';
|
|
6
|
+
import { AppMemberPropertiesPatchActionDefinition } from '../../api/components/schemas/AppMemberPropertiesPatchActionDefinition.js';
|
|
7
|
+
import { AppMemberQueryActionDefinition } from '../../api/components/schemas/AppMemberQueryActionDefinition.js';
|
|
8
|
+
import { AppMemberRegisterActionDefinition } from '../../api/components/schemas/AppMemberRegisterActionDefinition.js';
|
|
9
|
+
import { AppMemberRoleUpdateActionDefinition } from '../../api/components/schemas/AppMemberRoleUpdateActionDefinition.js';
|
|
10
|
+
export const appMemberActions = {
|
|
11
|
+
'app.member.register': AppMemberRegisterActionDefinition,
|
|
12
|
+
'app.member.invite': AppMemberInviteActionDefinition,
|
|
13
|
+
'app.member.login': AppMemberLoginActionDefinition,
|
|
14
|
+
'app.member.logout': AppMemberLogoutActionDefinition,
|
|
15
|
+
'app.member.query': AppMemberQueryActionDefinition,
|
|
16
|
+
'app.member.current.patch': AppMemberCurrentPatchActionDefinition,
|
|
17
|
+
'app.member.role.update': AppMemberRoleUpdateActionDefinition,
|
|
18
|
+
'app.member.properties.patch': AppMemberPropertiesPatchActionDefinition,
|
|
19
|
+
'app.member.delete': AppMemberDeleteActionDefinition,
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=appMember.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FlowBackActionDefinition } from '../../api/components/schemas/FlowBackActionDefinition.js';
|
|
2
|
+
import { FlowCancelActionDefinition } from '../../api/components/schemas/FlowCancelActionDefinition.js';
|
|
3
|
+
import { FlowFinishActionDefinition } from '../../api/components/schemas/FlowFinishActionDefinition.js';
|
|
4
|
+
import { FlowNextActionDefinition } from '../../api/components/schemas/FlowNextActionDefinition.js';
|
|
5
|
+
import { FlowToActionDefinition } from '../../api/components/schemas/FlowToActionDefinition.js';
|
|
6
|
+
export const flowActions = {
|
|
7
|
+
'flow.next': FlowNextActionDefinition,
|
|
8
|
+
'flow.finish': FlowFinishActionDefinition,
|
|
9
|
+
'flow.back': FlowBackActionDefinition,
|
|
10
|
+
'flow.cancel': FlowCancelActionDefinition,
|
|
11
|
+
'flow.to': FlowToActionDefinition,
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=flow.js.map
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GroupMemberDeleteActionDefinition } from '../../api/components/schemas/GroupMemberDeleteActionDefinition.js';
|
|
2
|
+
import { GroupMemberInviteActionDefinition } from '../../api/components/schemas/GroupMemberInviteActionDefinition.js';
|
|
3
|
+
import { GroupMemberQueryActionDefinition } from '../../api/components/schemas/GroupMemberQueryActionDefinition.js';
|
|
4
|
+
import { GroupMemberRoleUpdateActionDefinition } from '../../api/components/schemas/GroupMemberRoleUpdateActionDefinition.js';
|
|
5
|
+
import { GroupQueryActionDefinition } from '../../api/components/schemas/GroupQueryActionDefinition.js';
|
|
6
|
+
export const groupActions = {
|
|
7
|
+
'group.query': GroupQueryActionDefinition,
|
|
8
|
+
'group.member.invite': GroupMemberInviteActionDefinition,
|
|
9
|
+
'group.member.query': GroupMemberQueryActionDefinition,
|
|
10
|
+
'group.member.delete': GroupMemberDeleteActionDefinition,
|
|
11
|
+
'group.member.role.update': GroupMemberRoleUpdateActionDefinition,
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=group.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LinkActionDefinition } from '../../api/components/schemas/LinkActionDefinition.js';
|
|
2
|
+
import { LinkBackActionDefinition } from '../../api/components/schemas/LinkBackActionDefinition.js';
|
|
3
|
+
import { LinkNextActionDefinition } from '../../api/components/schemas/LinkNextActionDefinition.js';
|
|
4
|
+
export const linkActions = {
|
|
5
|
+
link: LinkActionDefinition,
|
|
6
|
+
'link.back': LinkBackActionDefinition,
|
|
7
|
+
'link.next': LinkNextActionDefinition,
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=link.js.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AnalyticsActionDefinition } from '../../api/components/schemas/AnalyticsActionDefinition.js';
|
|
2
|
+
import { ConditionActionDefinition } from '../../api/components/schemas/ConditionActionDefinition.js';
|
|
3
|
+
import { ControllerActionDefinition } from '../../api/components/schemas/ControllerActionDefinition.js';
|
|
4
|
+
import { DialogActionDefinition } from '../../api/components/schemas/DialogActionDefinition.js';
|
|
5
|
+
import { DialogErrorActionDefinition } from '../../api/components/schemas/DialogErrorActionDefinition.js';
|
|
6
|
+
import { DialogOkActionDefinition } from '../../api/components/schemas/DialogOkActionDefinition.js';
|
|
7
|
+
import { DownloadActionDefinition } from '../../api/components/schemas/DownloadActionDefinition.js';
|
|
8
|
+
import { EachActionDefinition } from '../../api/components/schemas/EachActionDefinition.js';
|
|
9
|
+
import { EmailActionDefinition } from '../../api/components/schemas/EmailActionDefinition.js';
|
|
10
|
+
import { EventActionDefinition } from '../../api/components/schemas/EventActionDefinition.js';
|
|
11
|
+
import { LogActionDefinition } from '../../api/components/schemas/LogActionDefinition.js';
|
|
12
|
+
import { MatchActionDefinition } from '../../api/components/schemas/MatchActionDefinition.js';
|
|
13
|
+
import { MessageActionDefinition } from '../../api/components/schemas/MessageActionDefinition.js';
|
|
14
|
+
import { NoopActionDefinition } from '../../api/components/schemas/NoopActionDefinition.js';
|
|
15
|
+
import { NotifyActionDefinition } from '../../api/components/schemas/NotifyActionDefinition.js';
|
|
16
|
+
import { RequestActionDefinition } from '../../api/components/schemas/RequestActionDefinition.js';
|
|
17
|
+
import { ShareActionDefinition } from '../../api/components/schemas/ShareActionDefinition.js';
|
|
18
|
+
import { StaticActionDefinition } from '../../api/components/schemas/StaticActionDefinition.js';
|
|
19
|
+
import { ThrowActionDefinition } from '../../api/components/schemas/ThrowActionDefinition.js';
|
|
20
|
+
export const miscellaneousActions = {
|
|
21
|
+
analytics: AnalyticsActionDefinition,
|
|
22
|
+
condition: ConditionActionDefinition,
|
|
23
|
+
controller: ControllerActionDefinition,
|
|
24
|
+
download: DownloadActionDefinition,
|
|
25
|
+
dialog: DialogActionDefinition,
|
|
26
|
+
'dialog.ok': DialogOkActionDefinition,
|
|
27
|
+
'dialog.error': DialogErrorActionDefinition,
|
|
28
|
+
each: EachActionDefinition,
|
|
29
|
+
event: EventActionDefinition,
|
|
30
|
+
email: EmailActionDefinition,
|
|
31
|
+
log: LogActionDefinition,
|
|
32
|
+
match: MatchActionDefinition,
|
|
33
|
+
message: MessageActionDefinition,
|
|
34
|
+
noop: NoopActionDefinition,
|
|
35
|
+
notify: NotifyActionDefinition,
|
|
36
|
+
request: RequestActionDefinition,
|
|
37
|
+
share: ShareActionDefinition,
|
|
38
|
+
static: StaticActionDefinition,
|
|
39
|
+
throw: ThrowActionDefinition,
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=miscellaneous.js.map
|