ts2workflows 0.13.0 → 0.15.0

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.
@@ -32,23 +32,43 @@ type HTTPQuery = Record<
32
32
  string | number | boolean | (string | number | boolean)[]
33
33
  >
34
34
 
35
+ type RetryPolicy = {
36
+ predicate?: (errormap: Record<string, any>) => boolean
37
+ max_retries?: number | string | null
38
+ backoff: {
39
+ initial_delay?: number | string | null
40
+ max_delay?: number | string | null
41
+ multiplier?: number | string | null
42
+ }
43
+ }
44
+
35
45
  // GCP Workflows expression helpers
36
46
 
37
47
  export declare function double(x: string | number): number
38
48
  export declare function int(x: string | number): number
39
49
  export declare function string(x: string | number | boolean): string
40
- export declare function keys(map: Record<string, unknown>): string[]
50
+ export declare function keys<T extends object>(map: T): (keyof T)[]
41
51
  export declare function len(
42
52
  value: unknown[] | Record<string, unknown> | string,
43
53
  ): number
44
- export declare function get_type(value: unknown): string
54
+ export declare function get_type(
55
+ value: unknown,
56
+ ):
57
+ | 'boolean'
58
+ | 'bytes'
59
+ | 'double'
60
+ | 'integer'
61
+ | 'list'
62
+ | 'map'
63
+ | 'string'
64
+ | 'null'
45
65
 
46
66
  // GCP Workflows standard library functions
47
67
  // https://cloud.google.com/workflows/docs/reference/stdlib/overview
48
68
 
49
69
  export declare namespace base64 {
50
- function decode(data: bytes, padding?: boolean): string
51
- function encode(data: string, padding?: boolean): bytes
70
+ function decode(data: string, padding?: boolean): bytes
71
+ function encode(data: bytes, padding?: boolean): string
52
72
  }
53
73
 
54
74
  export declare namespace events {
@@ -68,7 +88,7 @@ export declare namespace events {
68
88
  received_time: string
69
89
  type: string
70
90
  }
71
- function create_callback_endpoint(http_callback_method: string): {
91
+ function create_callback_endpoint(http_callback_method?: string): {
72
92
  url: string
73
93
  }
74
94
  }
@@ -83,10 +103,8 @@ export declare namespace hash {
83
103
  }
84
104
 
85
105
  export declare namespace http {
86
- export function default_retry(errormap: Record<string, any>): void
87
- export function default_retry_non_idempotent(
88
- errormap: Record<string, any>,
89
- ): void
106
+ export const default_retry: RetryPolicy
107
+ export const default_retry_non_idempotent: RetryPolicy
90
108
  export function default_retry_predicate(
91
109
  errormap: Record<string, any>,
92
110
  ): boolean
@@ -309,9 +327,9 @@ export declare namespace uuid {
309
327
 
310
328
  // Connectors
311
329
 
312
- // Cloud Firestore API Connector
313
- // https://cloud.google.com/workflows/docs/reference/googleapis/firestore/Overview
314
330
  export declare namespace googleapis {
331
+ // Cloud Firestore API Connector
332
+ // https://cloud.google.com/workflows/docs/reference/googleapis/firestore/Overview
315
333
  namespace firestore {
316
334
  namespace v1 {
317
335
  interface ArrayValue {
@@ -528,9 +546,9 @@ export declare namespace googleapis {
528
546
  transaction?: string
529
547
  }
530
548
  interface RunQueryResponse {
531
- document: Document
549
+ document?: Document
532
550
  readTime: string
533
- skippedResults: number
551
+ skippedResults?: number
534
552
  transaction?: string
535
553
  }
536
554
  interface Status {
@@ -679,8 +697,8 @@ export declare namespace googleapis {
679
697
  ): PartitionQueryResponse
680
698
  export function patch(
681
699
  name: string,
682
- currentDocument: Precondition,
683
- mask: DocumentMask,
700
+ currentDocument: Precondition | undefined,
701
+ mask: DocumentMask | undefined,
684
702
  updateMask: DocumentMask,
685
703
  body: Pick<Document, 'fields' | 'name'>,
686
704
  ): Document
@@ -691,7 +709,7 @@ export declare namespace googleapis {
691
709
  export function runQuery(
692
710
  parent: string,
693
711
  body: RunQueryRequest,
694
- ): RunQueryResponse
712
+ ): RunQueryResponse[]
695
713
  export { _delete as delete }
696
714
  }
697
715
  namespace operations {
@@ -719,6 +737,340 @@ export declare namespace googleapis {
719
737
  }
720
738
  }
721
739
  }
740
+
741
+ // Cloud Pub/Sub API Connector
742
+ // https://docs.cloud.google.com/workflows/docs/reference/googleapis/pubsub/Overview
743
+ namespace pubsub {
744
+ namespace v1 {
745
+ interface AcknowledgeRequest {
746
+ ackIds: string[]
747
+ }
748
+ interface Binding {
749
+ condition: Expr
750
+ members: string[]
751
+ role: string
752
+ }
753
+ interface CreateSnapshotRequest {
754
+ label?: Record<string, string>
755
+ subscription: string
756
+ }
757
+ interface DeadLetterPolicy {
758
+ deadLetterTopic: string
759
+ maxDeliveryAttempts?: number
760
+ }
761
+ interface Expr {
762
+ description?: string
763
+ expression: string
764
+ location?: string
765
+ title?: string
766
+ }
767
+ interface ExpirationPolicy {
768
+ ttl: string
769
+ }
770
+ interface ListSchemasResponse {
771
+ nextPageToken?: string
772
+ schemas: Schema[]
773
+ }
774
+ interface ListSnapshotsResponse {
775
+ nextPagetoken?: string
776
+ snapshots?: Snapshot[]
777
+ }
778
+ interface ListSubscriptionsResponse {
779
+ nextPageToken?: string
780
+ subscriptions?: Subscription[]
781
+ }
782
+ interface ListTopicsResponse {
783
+ nextPageToken?: string
784
+ topics?: Topic[]
785
+ }
786
+ interface ListTopicSubscriptionsResponse {
787
+ nextPageToken?: string
788
+ subscriptions?: string[]
789
+ }
790
+ interface ListTopicSnapshotsResponse {
791
+ nextPageToken?: string
792
+ snapshots?: string[]
793
+ }
794
+ interface MessageStoragePolicy {
795
+ allowedPersistenceRegions?: string[]
796
+ }
797
+ interface ModifyAckDeadlineRequest {
798
+ ackDeadlineSeconds: number
799
+ ackIds: string[]
800
+ }
801
+ interface ModifyPushConfigRequest {
802
+ pushConfig: PushConfig
803
+ }
804
+ interface OidcToken {
805
+ audience: string
806
+ serviceAccountEmail: string
807
+ }
808
+ interface Policy {
809
+ bindings: Binding[]
810
+ etag: string
811
+ version: number
812
+ }
813
+ interface PublishRequest {
814
+ messages: PubsubMessage[]
815
+ }
816
+ interface PublishResponse {
817
+ messageIds?: string[]
818
+ }
819
+ interface PubsubMessage {
820
+ attributes?: Record<string, string>
821
+ data?: string
822
+ messageId?: string
823
+ orderingKey?: string
824
+ publishTime?: string
825
+ }
826
+ interface PullRequest {
827
+ maxMessages: number
828
+ returnImmediately?: boolean
829
+ }
830
+ interface PullResponse {
831
+ receivedMessages: ReceivedMessage[]
832
+ }
833
+ interface PushConfig {
834
+ attributes: Record<string, string>
835
+ oidcToken: OidcToken
836
+ pushEndpoint: string
837
+ }
838
+ interface ReceivedMessage {
839
+ ackId: string
840
+ deliveryAttempt: number
841
+ message: PubsubMessage
842
+ }
843
+ interface RetryPolicy {
844
+ maximumBackoff?: string
845
+ minimumBackoff?: string
846
+ }
847
+ interface Schema {
848
+ definition: string
849
+ name: string
850
+ type: 'TYPE_UNSPECIFIED' | 'PROTOCOL_BUFFER' | 'AVRO'
851
+ }
852
+ interface SchemaSettings {
853
+ encoding?: 'ENCODING_UNSPECIFIED' | 'JSON' | 'BINARY'
854
+ schema: string
855
+ }
856
+ interface SeekRequest {
857
+ snapshot?: string
858
+ time?: string
859
+ }
860
+ interface SetIamPolicyRequest {
861
+ policy: Policy
862
+ }
863
+ interface Snapshot {
864
+ expireTime?: string
865
+ labels?: Record<string, string>
866
+ name?: string
867
+ topic?: string
868
+ }
869
+ interface Subscription {
870
+ ackDeadlineSeconds?: number
871
+ deadLetterPolicy?: DeadLetterPolicy
872
+ detached?: boolean
873
+ enableMessageOrdering?: boolean
874
+ expirationPolicy?: ExpirationPolicy
875
+ filter?: string
876
+ labels?: Record<string, string>
877
+ messageRetentionDuration?: string
878
+ name: string
879
+ pushConfig?: PushConfig
880
+ retainAckedMessages?: boolean
881
+ retryPolicy?: RetryPolicy
882
+ topic: string
883
+ topicMessageRetentionDuration?: string
884
+ }
885
+ interface TestIamPermissionsRequest {
886
+ permissions: string[]
887
+ }
888
+ interface TestIamPermissionsResponse {
889
+ permissions: string[]
890
+ }
891
+ interface Topic {
892
+ kmsKeyName?: string
893
+ labels?: Map<string, string>
894
+ messageRetentionDuration?: string
895
+ messageStoragePolicy?: MessageStoragePolicy
896
+ name: string
897
+ satisfiesPzs?: boolean
898
+ schemaSettings?: SchemaSettings
899
+ }
900
+ interface UpdateSnapshotRequest {
901
+ snapshot: Snapshot
902
+ updateMask: string
903
+ }
904
+ interface UpdateSubscriptionRequest {
905
+ subscription: Subscription
906
+ updateMask: string
907
+ }
908
+ interface UpdateTopicRequest {
909
+ topic: Topic
910
+ updateMask: string
911
+ }
912
+ interface ValidateMessageRequest {
913
+ encoding: 'ENCODING_UNSPECIFIED' | 'JSON' | 'BINARY'
914
+ message: string
915
+ name?: string
916
+ schema?: Schema
917
+ }
918
+ interface ValidateSchemaRequest {
919
+ object: Schema
920
+ }
921
+
922
+ namespace projects {
923
+ namespace schemas {
924
+ export function create(
925
+ parent: string,
926
+ schemaId: string,
927
+ body: Schema,
928
+ ): Schema
929
+ function _delete(name: string): void
930
+ export { _delete as delete }
931
+ export function get(
932
+ name: string,
933
+ view?: 'SCHEMA_VIEW_UNSPECIFIED' | 'BASIC' | 'FULL',
934
+ ): Schema
935
+ export function list(
936
+ parent: string,
937
+ pageSize?: number,
938
+ pageToken?: string,
939
+ view?: 'SCHEMA_VIEW_UNSPECIFIED' | 'BASIC' | 'FULL',
940
+ ): ListSchemasResponse
941
+ export function validate(
942
+ parent: string,
943
+ body: ValidateSchemaRequest,
944
+ ): void
945
+ export function validateMessage(
946
+ parent: string,
947
+ body: ValidateMessageRequest,
948
+ ): void
949
+ }
950
+
951
+ namespace snapshots {
952
+ export function create(
953
+ name: string,
954
+ object: CreateSnapshotRequest,
955
+ ): Snapshot
956
+ function _delete(snapshot: string): void
957
+ export { _delete as delete }
958
+ export function getIamPolicy(
959
+ resource: string,
960
+ options: { requestedPolicyVersion: number },
961
+ ): Policy
962
+ export function list(
963
+ project: string,
964
+ pageSize?: number,
965
+ pageToken?: string,
966
+ ): ListSnapshotsResponse
967
+ export function patch(
968
+ name: string,
969
+ body: UpdateSnapshotRequest,
970
+ ): Snapshot
971
+ export function setIamPolicy(
972
+ resource: string,
973
+ body: SetIamPolicyRequest,
974
+ ): Policy
975
+ export function testIamPermissions(
976
+ resource: string,
977
+ body: TestIamPermissionsRequest,
978
+ ): TestIamPermissionsResponse
979
+ }
980
+
981
+ namespace subscriptions {
982
+ export function acknowledge(
983
+ subscription: string,
984
+ body: AcknowledgeRequest,
985
+ ): void
986
+ export function create(name: string, body: Subscription): Subscription
987
+ function _delete(subscription: string): void
988
+ export { _delete as delete }
989
+ export function detach(subscription: string): void
990
+ export function get(subscription: string): Subscription
991
+ export function getIamPolicy(
992
+ resource: string,
993
+ options: { requestedPolicyVersion: number },
994
+ ): Policy
995
+ export function list(
996
+ project: string,
997
+ pageSize?: number,
998
+ pageToken?: string,
999
+ ): ListSubscriptionsResponse
1000
+ export function modifyAckDeadline(
1001
+ subscription: string,
1002
+ body: ModifyAckDeadlineRequest,
1003
+ ): void
1004
+ export function modifyPushConfig(
1005
+ subscription: string,
1006
+ body: ModifyPushConfigRequest,
1007
+ ): void
1008
+ export function patch(
1009
+ name: string,
1010
+ body: UpdateSubscriptionRequest,
1011
+ ): Subscription
1012
+ export function pull(
1013
+ subscription: string,
1014
+ body: PullRequest,
1015
+ ): PullResponse
1016
+ export function seek(subscription: string, body: SeekRequest): void
1017
+ export function setIamPolicy(
1018
+ resource: string,
1019
+ body: SetIamPolicyRequest,
1020
+ ): Policy
1021
+ export function testIamPermissions(
1022
+ resource: string,
1023
+ body: TestIamPermissionsRequest,
1024
+ ): TestIamPermissionsResponse
1025
+ }
1026
+
1027
+ namespace topics {
1028
+ export function create(name: string, body: Topic): Topic
1029
+ function _delete(topic: string): void
1030
+ export { _delete as delete }
1031
+ export function get(topic: string): Topic
1032
+ export function getIamPolicy(
1033
+ resource: string,
1034
+ options: { requestedPolicyVersion: number },
1035
+ ): Policy
1036
+ export function list(
1037
+ project: string,
1038
+ pageSize?: number,
1039
+ pageToken?: string,
1040
+ ): ListTopicsResponse
1041
+ export function patch(name: string, body: UpdateTopicRequest): Topic
1042
+ export function publish(
1043
+ topic: string,
1044
+ body: PublishRequest,
1045
+ ): PublishResponse
1046
+ export function setIamPolicy(
1047
+ resource: string,
1048
+ body: SetIamPolicyRequest,
1049
+ ): Policy
1050
+ export function testIamPermissions(
1051
+ resource: string,
1052
+ body: TestIamPermissionsRequest,
1053
+ ): TestIamPermissionsResponse
1054
+
1055
+ namespace snapshots {
1056
+ export function list(
1057
+ topic: string,
1058
+ pageSize?: number,
1059
+ pageToken?: string,
1060
+ ): ListTopicSnapshotsResponse
1061
+ }
1062
+
1063
+ namespace subscriptions {
1064
+ export function list(
1065
+ topic: string,
1066
+ pageSize?: number,
1067
+ pageToken?: string,
1068
+ ): ListTopicSubscriptionsResponse
1069
+ }
1070
+ }
1071
+ }
1072
+ }
1073
+ }
722
1074
  }
723
1075
 
724
1076
  // Functionality that is not implemented by Typescript keywords
@@ -732,19 +1084,7 @@ export declare function parallel(
732
1084
  },
733
1085
  ): void
734
1086
 
735
- export declare function retry_policy(
736
- params:
737
- | ((errormap: Record<string, any>) => void)
738
- | {
739
- predicate?: (errormap: Record<string, any>) => boolean
740
- max_retries?: number | string | null
741
- backoff: {
742
- initial_delay?: number | string | null
743
- max_delay?: number | string | null
744
- multiplier?: number | string | null
745
- }
746
- },
747
- ): void
1087
+ export declare function retry_policy(params: RetryPolicy): void
748
1088
 
749
1089
  export declare function call_step<T, A extends any[]>(
750
1090
  func: (...args: A) => T,