ts2workflows 0.12.0 → 0.14.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.
- package/CHANGELOG.md +125 -0
- package/dist/ast/expressions.d.ts +2 -2
- package/dist/ast/expressions.d.ts.map +1 -1
- package/dist/ast/expressions.js +4 -1
- package/dist/transpiler/generated/functionMetadata.d.ts.map +1 -1
- package/dist/transpiler/generated/functionMetadata.js +267 -0
- package/dist/transpiler/linker.js +10 -6
- package/dist/transpiler/parseexpressions.d.ts.map +1 -1
- package/dist/transpiler/parseexpressions.js +10 -1
- package/dist/transpiler/transformations.js +19 -7
- package/package.json +7 -3
- package/types/workflowslib.d.ts +382 -25
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# ts2workflows changelog
|
|
2
|
+
|
|
3
|
+
## Version 0.14.0 - 2025-11-19
|
|
4
|
+
|
|
5
|
+
Fixes:
|
|
6
|
+
|
|
7
|
+
- Blocking calls and assignments were generated in a wrong order in complex expressions
|
|
8
|
+
- Don't output undefined arguments in call steps
|
|
9
|
+
- Type annotation fixes in workflowslib
|
|
10
|
+
|
|
11
|
+
## Version 0.13.0 - 2025-10-12
|
|
12
|
+
|
|
13
|
+
Fixes:
|
|
14
|
+
|
|
15
|
+
- function identifiers (e.g. in call_step and parallel) are included in the `--link` output
|
|
16
|
+
- Improve type annotations of map.\* functions
|
|
17
|
+
|
|
18
|
+
## Version 0.12.0 - 2025-08-30
|
|
19
|
+
|
|
20
|
+
New features:
|
|
21
|
+
|
|
22
|
+
- New command line option `--link` generates self-contained YAML files (all needed subworkflows in one file)
|
|
23
|
+
- Accepts Typescript's `satisfies` expression and `debugger` statement. They do not affect the YAML output.
|
|
24
|
+
|
|
25
|
+
Fixes:
|
|
26
|
+
|
|
27
|
+
- Empty body in an `if` statements generated invalid code
|
|
28
|
+
- In certain cases nested map literals generated invalid code
|
|
29
|
+
- Some expressions with many extractable sub-expressions (map literals, blocking calls) generated invalid code because a temporary variable was re-used incorrectly
|
|
30
|
+
- Empty statements are accepted at the top level
|
|
31
|
+
- Ignore extra arguments in blocking function calls in all cases. Previously, extra arguments were ignored in some cases but threw errors in other cases.
|
|
32
|
+
- Call expressions in optional chaining (`data?.getPerson()?.name`) now result in error. Previously, they were incorrectly treated as non-optional in the generated code.
|
|
33
|
+
- Fixed code generation for an object rest element nested in an array pattern: `const [{...rest}] = data`
|
|
34
|
+
|
|
35
|
+
## Version 0.11.0 - 2025-06-28
|
|
36
|
+
|
|
37
|
+
Breaking changes:
|
|
38
|
+
|
|
39
|
+
- Requires Node 20 or newer and Typescript 5.4.0 or newer
|
|
40
|
+
- retry_policy() must be called inside a try block, not after
|
|
41
|
+
- Variable declarations with `var` are not supported, only `let` and `const`
|
|
42
|
+
- Step name numbering starts from 1 at the start of each subworkflow
|
|
43
|
+
|
|
44
|
+
Fixes:
|
|
45
|
+
|
|
46
|
+
- Type annotation fixes in workflowslib
|
|
47
|
+
|
|
48
|
+
## Version 0.10.0 - 2025-04-28
|
|
49
|
+
|
|
50
|
+
- Accept binary expressions as properties in assignments: `a[i + 4] = 1` (regression in 0.9.0)
|
|
51
|
+
- Evaluate side-effects only once on the left-hand side in compound assignments: `x[f()] += 1`
|
|
52
|
+
- Fix calling `call_step()` on the right-hand side of a compound assignment: `x += call_step(sum, {a: 10, b: 11})`
|
|
53
|
+
- Output an error if a subworkflow is empty because empty body is not allowed on GCP
|
|
54
|
+
|
|
55
|
+
## Version 0.9.0 - 2025-04-23
|
|
56
|
+
|
|
57
|
+
Breaking changes:
|
|
58
|
+
|
|
59
|
+
- `True`, `TRUE`, `False` and `FALSE` no longer are synonyms for `true` and `false`
|
|
60
|
+
|
|
61
|
+
New features:
|
|
62
|
+
|
|
63
|
+
- Array and object destructuring: `const [a, b] = getArray()`
|
|
64
|
+
|
|
65
|
+
Fixes:
|
|
66
|
+
|
|
67
|
+
- Fix a deployment error caused by the same temp variable name being used inside and outside of a parallel branch
|
|
68
|
+
|
|
69
|
+
## Version 0.8.0 - 2025-03-03
|
|
70
|
+
|
|
71
|
+
- Multiple input files can be given on the command line
|
|
72
|
+
- Argument `--outdir` sets the output directory
|
|
73
|
+
- Argument `--project` defines the TSConfig location for the source files
|
|
74
|
+
- `--(no-)generated-file-comment`: optionally include a comment about the output file being generated
|
|
75
|
+
- `--version` prints the correct version number
|
|
76
|
+
- Accept instantiation expressions `func<TYPE>`
|
|
77
|
+
|
|
78
|
+
## Version 0.7.0 - 2025-02-02
|
|
79
|
+
|
|
80
|
+
- `typeof` operator
|
|
81
|
+
- `null` is allowed as interpolated value in template literal `${null}`
|
|
82
|
+
- Accept `undefined` as a function argument default argument: `func(a: number | undefined = undefined)`
|
|
83
|
+
- Optional function arguments: `func(a?: number)`
|
|
84
|
+
|
|
85
|
+
## Version 0.6.0 - 2025-01-09
|
|
86
|
+
|
|
87
|
+
Breaking changes:
|
|
88
|
+
|
|
89
|
+
- retry_policy() takes a plain policy function name instead of a {policy: ...} object
|
|
90
|
+
|
|
91
|
+
Fixes:
|
|
92
|
+
|
|
93
|
+
- The try statement supports a finally block
|
|
94
|
+
- Support empty body in a catch block
|
|
95
|
+
- retry_policy() parameter values can now be expressions in addition to number literals
|
|
96
|
+
- 0, "", false and null can now be used as subworkflow parameter default values
|
|
97
|
+
- Type annotation fixes
|
|
98
|
+
|
|
99
|
+
## Version 0.5.0 - 2024-11-09
|
|
100
|
+
|
|
101
|
+
- Move nested map expressions to assign steps where necessary
|
|
102
|
+
- Array.isArray() is transformed correcly in nested expressions
|
|
103
|
+
|
|
104
|
+
## Version 0.4.0 - 2024-11-05
|
|
105
|
+
|
|
106
|
+
- Optional chaining a?.b is converted to map.get(a, "b")
|
|
107
|
+
- Non-null assertions person!.name is accepted but ignored to the transpiler
|
|
108
|
+
- Merge a next step to a preceeding assign step
|
|
109
|
+
- Accept a single-statement body (body without braces {}) in if, while, etc
|
|
110
|
+
- Assign the result of call_step() to a member variable: obj.property = call_step()
|
|
111
|
+
- parallel() and retry_policy() special functions can only be used as statements
|
|
112
|
+
- Better error messages on RegExp, BigInt, spread syntax and other non-supported Javascript features
|
|
113
|
+
|
|
114
|
+
## Version 0.3.0 - 2024-10-19
|
|
115
|
+
|
|
116
|
+
- Function invocations no longer generate invalid empty variable names
|
|
117
|
+
- Include more utility types: ReturnType, Partial, Required, etc.
|
|
118
|
+
- Type annotation fixes
|
|
119
|
+
|
|
120
|
+
## Version 0.2.0 - 2024-10-09
|
|
121
|
+
|
|
122
|
+
- Reduce cases where maps are needlessly split off into assign statements
|
|
123
|
+
- Accept (but ignore) "declare function"
|
|
124
|
+
- Implemented Array.isArray()
|
|
125
|
+
- Fixes to type annotations
|
|
@@ -38,9 +38,9 @@ export declare function variableReferenceEx(variableName: VariableName): Variabl
|
|
|
38
38
|
export interface FunctionInvocationExpression {
|
|
39
39
|
readonly tag: 'functionInvocation';
|
|
40
40
|
readonly functionName: string;
|
|
41
|
-
readonly arguments: Expression[];
|
|
41
|
+
readonly arguments: (Expression | undefined)[];
|
|
42
42
|
}
|
|
43
|
-
export declare function functionInvocationEx(functionName: string, argumentExpressions: Expression[]): FunctionInvocationExpression;
|
|
43
|
+
export declare function functionInvocationEx(functionName: string, argumentExpressions: (Expression | undefined)[]): FunctionInvocationExpression;
|
|
44
44
|
export interface MemberExpression {
|
|
45
45
|
readonly tag: 'member';
|
|
46
46
|
readonly object: Expression;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expressions.d.ts","sourceRoot":"","sources":["../../src/ast/expressions.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,YAAY,GAAG,MAAM,CAAA;AACjC,MAAM,MAAM,cAAc,GACtB,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,IAAI,GACJ,GAAG,GACH,IAAI,GACJ,IAAI,GACJ,GAAG,GACH,IAAI,GACJ,GAAG,GACH,IAAI,GACJ,IAAI,GACJ,KAAK,GACL,IAAI,CAAA;AACR,MAAM,MAAM,aA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AC3B,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAA;IAC7B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAC3B;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,UAAU,EACpB,QAAQ,EAAE,OAAO,GAChB,gBAAgB,CAElB;AAGD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAA;IACrB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;IAChC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAA;CAC3B;AAED,wBAAgB,OAAO,CACrB,QAAQ,EAAE,aAAa,EACvB,KAAK,EAAE,UAAU,GAChB,eAAe,CAEjB;AAGD,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,UAAU,GAAG,MAAM,CAmDzD;AAoCD,wBAAgB,2CAA2C,CACzD,EAAE,EAAE,UAAU,GACb,+BAA+B,CAiCjC;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,UAAU,GAAG,OAAO,CAuBvD;AAED,wBAAgB,WAAW,CACzB,EAAE,EAAE,UAAU,GACb,EAAE,IACD,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,cAAc,CAOjB"}
|
package/dist/ast/expressions.js
CHANGED
|
@@ -89,7 +89,10 @@ export function expressionToString(ex) {
|
|
|
89
89
|
case 'variableReference':
|
|
90
90
|
return ex.variableName;
|
|
91
91
|
case 'functionInvocation':
|
|
92
|
-
return `${ex.functionName}(${ex.arguments
|
|
92
|
+
return `${ex.functionName}(${ex.arguments
|
|
93
|
+
.map((x) => x ?? nullEx)
|
|
94
|
+
.map(expressionToString)
|
|
95
|
+
.join(', ')})`;
|
|
93
96
|
case 'member':
|
|
94
97
|
if (ex.computed) {
|
|
95
98
|
return `${expressionToString(ex.object)}[${expressionToString(ex.property)}]`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"functionMetadata.d.ts","sourceRoot":"","sources":["../../../src/transpiler/generated/functionMetadata.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,
|
|
1
|
+
{"version":3,"file":"functionMetadata.d.ts","sourceRoot":"","sources":["../../../src/transpiler/generated/functionMetadata.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,uBA4kB5B,CAAA"}
|
|
@@ -320,5 +320,272 @@ export const blockingFunctions = new Map([
|
|
|
320
320
|
"pageSize",
|
|
321
321
|
"pageToken"
|
|
322
322
|
]
|
|
323
|
+
],
|
|
324
|
+
[
|
|
325
|
+
"googleapis.pubsub.v1.projects.schemas.create",
|
|
326
|
+
[
|
|
327
|
+
"parent",
|
|
328
|
+
"schemaId",
|
|
329
|
+
"body"
|
|
330
|
+
]
|
|
331
|
+
],
|
|
332
|
+
[
|
|
333
|
+
"googleapis.pubsub.v1.projects.schemas.delete",
|
|
334
|
+
[
|
|
335
|
+
"name"
|
|
336
|
+
]
|
|
337
|
+
],
|
|
338
|
+
[
|
|
339
|
+
"googleapis.pubsub.v1.projects.schemas.get",
|
|
340
|
+
[
|
|
341
|
+
"name",
|
|
342
|
+
"view"
|
|
343
|
+
]
|
|
344
|
+
],
|
|
345
|
+
[
|
|
346
|
+
"googleapis.pubsub.v1.projects.schemas.list",
|
|
347
|
+
[
|
|
348
|
+
"parent",
|
|
349
|
+
"pageSize",
|
|
350
|
+
"pageToken",
|
|
351
|
+
"view"
|
|
352
|
+
]
|
|
353
|
+
],
|
|
354
|
+
[
|
|
355
|
+
"googleapis.pubsub.v1.projects.schemas.validate",
|
|
356
|
+
[
|
|
357
|
+
"parent",
|
|
358
|
+
"body"
|
|
359
|
+
]
|
|
360
|
+
],
|
|
361
|
+
[
|
|
362
|
+
"googleapis.pubsub.v1.projects.schemas.validateMessage",
|
|
363
|
+
[
|
|
364
|
+
"parent",
|
|
365
|
+
"body"
|
|
366
|
+
]
|
|
367
|
+
],
|
|
368
|
+
[
|
|
369
|
+
"googleapis.pubsub.v1.projects.snapshots.create",
|
|
370
|
+
[
|
|
371
|
+
"name",
|
|
372
|
+
"object"
|
|
373
|
+
]
|
|
374
|
+
],
|
|
375
|
+
[
|
|
376
|
+
"googleapis.pubsub.v1.projects.snapshots.delete",
|
|
377
|
+
[
|
|
378
|
+
"snapshot"
|
|
379
|
+
]
|
|
380
|
+
],
|
|
381
|
+
[
|
|
382
|
+
"googleapis.pubsub.v1.projects.snapshots.getIamPolicy",
|
|
383
|
+
[
|
|
384
|
+
"resource",
|
|
385
|
+
"options"
|
|
386
|
+
]
|
|
387
|
+
],
|
|
388
|
+
[
|
|
389
|
+
"googleapis.pubsub.v1.projects.snapshots.list",
|
|
390
|
+
[
|
|
391
|
+
"project",
|
|
392
|
+
"pageSize",
|
|
393
|
+
"pageToken"
|
|
394
|
+
]
|
|
395
|
+
],
|
|
396
|
+
[
|
|
397
|
+
"googleapis.pubsub.v1.projects.snapshots.patch",
|
|
398
|
+
[
|
|
399
|
+
"name",
|
|
400
|
+
"body"
|
|
401
|
+
]
|
|
402
|
+
],
|
|
403
|
+
[
|
|
404
|
+
"googleapis.pubsub.v1.projects.snapshots.setIamPolicy",
|
|
405
|
+
[
|
|
406
|
+
"resource",
|
|
407
|
+
"body"
|
|
408
|
+
]
|
|
409
|
+
],
|
|
410
|
+
[
|
|
411
|
+
"googleapis.pubsub.v1.projects.snapshots.testIamPermissions",
|
|
412
|
+
[
|
|
413
|
+
"resource",
|
|
414
|
+
"body"
|
|
415
|
+
]
|
|
416
|
+
],
|
|
417
|
+
[
|
|
418
|
+
"googleapis.pubsub.v1.projects.subscriptions.acknowledge",
|
|
419
|
+
[
|
|
420
|
+
"subscription",
|
|
421
|
+
"body"
|
|
422
|
+
]
|
|
423
|
+
],
|
|
424
|
+
[
|
|
425
|
+
"googleapis.pubsub.v1.projects.subscriptions.create",
|
|
426
|
+
[
|
|
427
|
+
"name",
|
|
428
|
+
"body"
|
|
429
|
+
]
|
|
430
|
+
],
|
|
431
|
+
[
|
|
432
|
+
"googleapis.pubsub.v1.projects.subscriptions.delete",
|
|
433
|
+
[
|
|
434
|
+
"subscription"
|
|
435
|
+
]
|
|
436
|
+
],
|
|
437
|
+
[
|
|
438
|
+
"googleapis.pubsub.v1.projects.subscriptions.detach",
|
|
439
|
+
[
|
|
440
|
+
"subscription"
|
|
441
|
+
]
|
|
442
|
+
],
|
|
443
|
+
[
|
|
444
|
+
"googleapis.pubsub.v1.projects.subscriptions.get",
|
|
445
|
+
[
|
|
446
|
+
"subscription"
|
|
447
|
+
]
|
|
448
|
+
],
|
|
449
|
+
[
|
|
450
|
+
"googleapis.pubsub.v1.projects.subscriptions.getIamPolicy",
|
|
451
|
+
[
|
|
452
|
+
"resource",
|
|
453
|
+
"options"
|
|
454
|
+
]
|
|
455
|
+
],
|
|
456
|
+
[
|
|
457
|
+
"googleapis.pubsub.v1.projects.subscriptions.list",
|
|
458
|
+
[
|
|
459
|
+
"project",
|
|
460
|
+
"pageSize",
|
|
461
|
+
"pageToken"
|
|
462
|
+
]
|
|
463
|
+
],
|
|
464
|
+
[
|
|
465
|
+
"googleapis.pubsub.v1.projects.subscriptions.modifyAckDeadline",
|
|
466
|
+
[
|
|
467
|
+
"subscription",
|
|
468
|
+
"body"
|
|
469
|
+
]
|
|
470
|
+
],
|
|
471
|
+
[
|
|
472
|
+
"googleapis.pubsub.v1.projects.subscriptions.modifyPushConfig",
|
|
473
|
+
[
|
|
474
|
+
"subscription",
|
|
475
|
+
"body"
|
|
476
|
+
]
|
|
477
|
+
],
|
|
478
|
+
[
|
|
479
|
+
"googleapis.pubsub.v1.projects.subscriptions.patch",
|
|
480
|
+
[
|
|
481
|
+
"name",
|
|
482
|
+
"body"
|
|
483
|
+
]
|
|
484
|
+
],
|
|
485
|
+
[
|
|
486
|
+
"googleapis.pubsub.v1.projects.subscriptions.pull",
|
|
487
|
+
[
|
|
488
|
+
"subscription",
|
|
489
|
+
"body"
|
|
490
|
+
]
|
|
491
|
+
],
|
|
492
|
+
[
|
|
493
|
+
"googleapis.pubsub.v1.projects.subscriptions.seek",
|
|
494
|
+
[
|
|
495
|
+
"subscription",
|
|
496
|
+
"body"
|
|
497
|
+
]
|
|
498
|
+
],
|
|
499
|
+
[
|
|
500
|
+
"googleapis.pubsub.v1.projects.subscriptions.setIamPolicy",
|
|
501
|
+
[
|
|
502
|
+
"resource",
|
|
503
|
+
"body"
|
|
504
|
+
]
|
|
505
|
+
],
|
|
506
|
+
[
|
|
507
|
+
"googleapis.pubsub.v1.projects.subscriptions.testIamPermissions",
|
|
508
|
+
[
|
|
509
|
+
"resource",
|
|
510
|
+
"body"
|
|
511
|
+
]
|
|
512
|
+
],
|
|
513
|
+
[
|
|
514
|
+
"googleapis.pubsub.v1.projects.topics.create",
|
|
515
|
+
[
|
|
516
|
+
"name",
|
|
517
|
+
"body"
|
|
518
|
+
]
|
|
519
|
+
],
|
|
520
|
+
[
|
|
521
|
+
"googleapis.pubsub.v1.projects.topics.delete",
|
|
522
|
+
[
|
|
523
|
+
"topic"
|
|
524
|
+
]
|
|
525
|
+
],
|
|
526
|
+
[
|
|
527
|
+
"googleapis.pubsub.v1.projects.topics.get",
|
|
528
|
+
[
|
|
529
|
+
"topic"
|
|
530
|
+
]
|
|
531
|
+
],
|
|
532
|
+
[
|
|
533
|
+
"googleapis.pubsub.v1.projects.topics.getIamPolicy",
|
|
534
|
+
[
|
|
535
|
+
"resource",
|
|
536
|
+
"options"
|
|
537
|
+
]
|
|
538
|
+
],
|
|
539
|
+
[
|
|
540
|
+
"googleapis.pubsub.v1.projects.topics.list",
|
|
541
|
+
[
|
|
542
|
+
"project",
|
|
543
|
+
"pageSize",
|
|
544
|
+
"pageToken"
|
|
545
|
+
]
|
|
546
|
+
],
|
|
547
|
+
[
|
|
548
|
+
"googleapis.pubsub.v1.projects.topics.patch",
|
|
549
|
+
[
|
|
550
|
+
"name",
|
|
551
|
+
"body"
|
|
552
|
+
]
|
|
553
|
+
],
|
|
554
|
+
[
|
|
555
|
+
"googleapis.pubsub.v1.projects.topics.publish",
|
|
556
|
+
[
|
|
557
|
+
"topic",
|
|
558
|
+
"body"
|
|
559
|
+
]
|
|
560
|
+
],
|
|
561
|
+
[
|
|
562
|
+
"googleapis.pubsub.v1.projects.topics.setIamPolicy",
|
|
563
|
+
[
|
|
564
|
+
"resource",
|
|
565
|
+
"body"
|
|
566
|
+
]
|
|
567
|
+
],
|
|
568
|
+
[
|
|
569
|
+
"googleapis.pubsub.v1.projects.topics.testIamPermissions",
|
|
570
|
+
[
|
|
571
|
+
"resource",
|
|
572
|
+
"body"
|
|
573
|
+
]
|
|
574
|
+
],
|
|
575
|
+
[
|
|
576
|
+
"googleapis.pubsub.v1.projects.topics.snapshots.list",
|
|
577
|
+
[
|
|
578
|
+
"topic",
|
|
579
|
+
"pageSize",
|
|
580
|
+
"pageToken"
|
|
581
|
+
]
|
|
582
|
+
],
|
|
583
|
+
[
|
|
584
|
+
"googleapis.pubsub.v1.projects.topics.subscriptions.list",
|
|
585
|
+
[
|
|
586
|
+
"topic",
|
|
587
|
+
"pageSize",
|
|
588
|
+
"pageToken"
|
|
589
|
+
]
|
|
323
590
|
]
|
|
324
591
|
]);
|
|
@@ -27,15 +27,19 @@ function findFunctionsRecursively(seen, typeChecker, node) {
|
|
|
27
27
|
function findNestedFunctions(typeChecker, node) {
|
|
28
28
|
const functionDeclarations = [];
|
|
29
29
|
function visit(node) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if (decl && ts.isFunctionDeclaration(decl)) {
|
|
34
|
-
functionDeclarations.push(decl);
|
|
35
|
-
}
|
|
30
|
+
// isImportOrExportSpecifier() check ignores foo in "import { foo } from ..."
|
|
31
|
+
if (ts.isIdentifier(node) && !ts.isImportOrExportSpecifier(node.parent)) {
|
|
32
|
+
functionDeclarations.push(...functionDeclarationsForIdentifier(typeChecker, node));
|
|
36
33
|
}
|
|
37
34
|
ts.forEachChild(node, visit);
|
|
38
35
|
}
|
|
39
36
|
visit(node);
|
|
40
37
|
return functionDeclarations;
|
|
41
38
|
}
|
|
39
|
+
function functionDeclarationsForIdentifier(typeChecker, node) {
|
|
40
|
+
const symbol = typeChecker.getSymbolAtLocation(node);
|
|
41
|
+
const isAliased = symbol && symbol.flags & ts.SymbolFlags.Alias;
|
|
42
|
+
const symbol2 = isAliased ? typeChecker.getAliasedSymbol(symbol) : symbol;
|
|
43
|
+
const declarations = symbol2?.getDeclarations() ?? [];
|
|
44
|
+
return declarations.filter(ts.isFunctionDeclaration);
|
|
45
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseexpressions.d.ts","sourceRoot":"","sources":["../../src/transpiler/parseexpressions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,sCAAsC,CAAA;AAC/E,OAAO,EAGL,UAAU,EAGV,aAAa,EACb,gBAAgB,EAChB,2BAA2B,EAc5B,MAAM,uBAAuB,CAAA;AAG9B,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,UAAU,GAAG,UAAU,CAmE3E;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,GAC9B,aAAa,CA8Bf;AAmJD,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,GAC9B,gBAAgB,CAOlB;
|
|
1
|
+
{"version":3,"file":"parseexpressions.d.ts","sourceRoot":"","sources":["../../src/transpiler/parseexpressions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAkB,MAAM,sCAAsC,CAAA;AAC/E,OAAO,EAGL,UAAU,EAGV,aAAa,EACb,gBAAgB,EAChB,2BAA2B,EAc5B,MAAM,uBAAuB,CAAA;AAG9B,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,UAAU,GAAG,UAAU,CAmE3E;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,GAC9B,aAAa,CA8Bf;AAmJD,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,QAAQ,CAAC,gBAAgB,GAC9B,gBAAgB,CAOlB;AA2KD,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAGvD;AAED,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAGhE;AA8CD,wBAAgB,aAAa,CAC3B,CAAC,SACG,QAAQ,CAAC,UAAU,GACnB,QAAQ,CAAC,QAAQ,GACjB,QAAQ,CAAC,aAAa,GACtB,IAAI,EACR,KAAK,EAAE,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,aAAa,CAAC,EAAE,CAgBlD;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,QAAQ,CAAC,UAAU,GAAG,QAAQ,CAAC,iBAAiB,GACrD,QAAQ,CAAC,UAAU,CAMrB;AAED,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,QAAQ,CAAC,UAAU,GACxB,2BAA2B,GAAG,gBAAgB,CAWhD"}
|
|
@@ -286,13 +286,22 @@ function convertCallExpression(node) {
|
|
|
286
286
|
}
|
|
287
287
|
throw new WorkflowSyntaxError(msg, node.callee.loc);
|
|
288
288
|
}
|
|
289
|
-
const argumentExpressions = throwIfSpread(node.arguments).map(
|
|
289
|
+
const argumentExpressions = throwIfSpread(node.arguments).map(convertExpressionOrUndefined);
|
|
290
290
|
return functionInvocationEx(calleeName, argumentExpressions);
|
|
291
291
|
}
|
|
292
292
|
else {
|
|
293
293
|
throw new WorkflowSyntaxError('Callee should be a qualified name', node.loc);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
+
function convertExpressionOrUndefined(instance) {
|
|
297
|
+
if (instance.type === TSESTree.AST_NODE_TYPES.Identifier &&
|
|
298
|
+
instance.name === 'undefined') {
|
|
299
|
+
return undefined;
|
|
300
|
+
}
|
|
301
|
+
else {
|
|
302
|
+
return convertExpression(instance);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
296
305
|
export function isIntrinsic(calleeName) {
|
|
297
306
|
const intrinsics = ['parallel', 'retry_policy', 'call_step'];
|
|
298
307
|
return intrinsics.includes(calleeName);
|
|
@@ -8,7 +8,7 @@ import { blockingFunctions } from './generated/functionMetadata.js';
|
|
|
8
8
|
*/
|
|
9
9
|
export function transformAST(statements) {
|
|
10
10
|
const tempGen = createTempVariableGenerator();
|
|
11
|
-
const transform = R.pipe(R.chain(mapLiteralsAsAssigns(tempGen)),
|
|
11
|
+
const transform = R.pipe(R.chain(mapLiteralsAsAssigns(tempGen)), R.chain(intrinsicFunctionImplementation), R.chain(blockingCallsAsFunctionCalls(tempGen)), mergeAssigns);
|
|
12
12
|
return transform(statements.map((s) => applyNested(transformAST, s)));
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -206,7 +206,7 @@ function replaceBlockingCalls(generateName, expression) {
|
|
|
206
206
|
}
|
|
207
207
|
const blockingCallArgumentNames = blockingFunctions.get(ex.functionName);
|
|
208
208
|
if (blockingCallArgumentNames) {
|
|
209
|
-
const nameAndValue = R.zip(blockingCallArgumentNames, ex.arguments);
|
|
209
|
+
const nameAndValue = R.zip(blockingCallArgumentNames, ex.arguments).filter(isDefinedArgument);
|
|
210
210
|
const callArgs = R.fromPairs(nameAndValue);
|
|
211
211
|
const tempCallResultVariable = generateName();
|
|
212
212
|
callStatements.push(new FunctionInvocationStatement(ex.functionName, callArgs, tempCallResultVariable));
|
|
@@ -223,6 +223,9 @@ function replaceBlockingCalls(generateName, expression) {
|
|
|
223
223
|
transformExpression(replaceBlockingFunctionInvocations, expression),
|
|
224
224
|
];
|
|
225
225
|
}
|
|
226
|
+
function isDefinedArgument(x) {
|
|
227
|
+
return x[1] !== undefined;
|
|
228
|
+
}
|
|
226
229
|
/**
|
|
227
230
|
* Search for blocking calls in expressions and replace them with a call + variable.
|
|
228
231
|
*
|
|
@@ -258,6 +261,7 @@ function blockingCallsAsFunctionCalls(generateTempName) {
|
|
|
258
261
|
*/
|
|
259
262
|
function transformExpression(transform, ex) {
|
|
260
263
|
const nestedTr = (y) => transformExpression(transform, y);
|
|
264
|
+
const nestedTr2 = R.ifElse((R.isNil), () => undefined, nestedTr);
|
|
261
265
|
switch (ex.tag) {
|
|
262
266
|
case 'string':
|
|
263
267
|
case 'number':
|
|
@@ -272,7 +276,7 @@ function transformExpression(transform, ex) {
|
|
|
272
276
|
case 'binary':
|
|
273
277
|
return transform(binaryEx(nestedTr(ex.left), ex.binaryOperator, nestedTr(ex.right)));
|
|
274
278
|
case 'functionInvocation':
|
|
275
|
-
return transform(functionInvocationEx(ex.functionName, ex.arguments.map(
|
|
279
|
+
return transform(functionInvocationEx(ex.functionName, ex.arguments.map(nestedTr2)));
|
|
276
280
|
case 'member':
|
|
277
281
|
return transform(memberEx(nestedTr(ex.object), nestedTr(ex.property), ex.computed));
|
|
278
282
|
case 'unary':
|
|
@@ -375,11 +379,19 @@ function extractMapsInMap(map, generateName, nestingLevel) {
|
|
|
375
379
|
}
|
|
376
380
|
function extractNestedMapFunctionInvocation(ex, generateName, nestingLevel) {
|
|
377
381
|
const { expressions, temps } = ex.arguments.reduce((acc, arg) => {
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
382
|
+
if (arg === undefined) {
|
|
383
|
+
acc.expressions.push(undefined);
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
const { transformedExpression, tempVariables } = extractNestedMaps(arg, generateName, nestingLevel + 1);
|
|
387
|
+
acc.expressions.push(transformedExpression);
|
|
388
|
+
acc.temps.push(...tempVariables);
|
|
389
|
+
}
|
|
381
390
|
return acc;
|
|
382
|
-
}, {
|
|
391
|
+
}, {
|
|
392
|
+
expressions: [],
|
|
393
|
+
temps: [],
|
|
394
|
+
});
|
|
383
395
|
return {
|
|
384
396
|
transformedExpression: functionInvocationEx(ex.functionName, expressions),
|
|
385
397
|
tempVariables: temps,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts2workflows",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Transpile Typescript code to GCP Workflows programs",
|
|
5
5
|
"homepage": "https://github.com/aajanki/ts2workflows",
|
|
6
6
|
"repository": {
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"types",
|
|
49
49
|
"README.md",
|
|
50
50
|
"language_reference.md",
|
|
51
|
+
"CHANGELOG.md",
|
|
51
52
|
"LICENSE"
|
|
52
53
|
],
|
|
53
54
|
"author": "Antti Ajanki",
|
|
@@ -77,13 +78,16 @@
|
|
|
77
78
|
"rimraf": "^6.0.1",
|
|
78
79
|
"source-map-support": "^0.5.21",
|
|
79
80
|
"tsx": "^4.20.5",
|
|
81
|
+
"typescript": "^5.5.4",
|
|
80
82
|
"typescript-eslint": "^8.0.0"
|
|
81
83
|
},
|
|
84
|
+
"peerDependencies": {
|
|
85
|
+
"typescript": ">=5.5.4 <6.0.0"
|
|
86
|
+
},
|
|
82
87
|
"dependencies": {
|
|
83
88
|
"@typescript-eslint/typescript-estree": "^8.0.0",
|
|
84
89
|
"commander": "^14.0.0",
|
|
85
|
-
"ramda": "^0.
|
|
86
|
-
"typescript": "^5.5.4",
|
|
90
|
+
"ramda": "^0.32.0",
|
|
87
91
|
"yaml": "^2.4.2"
|
|
88
92
|
}
|
|
89
93
|
}
|
package/types/workflowslib.d.ts
CHANGED
|
@@ -37,18 +37,28 @@ type HTTPQuery = Record<
|
|
|
37
37
|
export declare function double(x: string | number): number
|
|
38
38
|
export declare function int(x: string | number): number
|
|
39
39
|
export declare function string(x: string | number | boolean): string
|
|
40
|
-
export declare function keys(map:
|
|
40
|
+
export declare function keys<T extends object>(map: T): (keyof T)[]
|
|
41
41
|
export declare function len(
|
|
42
42
|
value: unknown[] | Record<string, unknown> | string,
|
|
43
43
|
): number
|
|
44
|
-
export declare function get_type(
|
|
44
|
+
export declare function get_type(
|
|
45
|
+
value: unknown,
|
|
46
|
+
):
|
|
47
|
+
| 'boolean'
|
|
48
|
+
| 'bytes'
|
|
49
|
+
| 'double'
|
|
50
|
+
| 'integer'
|
|
51
|
+
| 'list'
|
|
52
|
+
| 'map'
|
|
53
|
+
| 'string'
|
|
54
|
+
| 'null'
|
|
45
55
|
|
|
46
56
|
// GCP Workflows standard library functions
|
|
47
57
|
// https://cloud.google.com/workflows/docs/reference/stdlib/overview
|
|
48
58
|
|
|
49
59
|
export declare namespace base64 {
|
|
50
|
-
function decode(data:
|
|
51
|
-
function encode(data:
|
|
60
|
+
function decode(data: string, padding?: boolean): bytes
|
|
61
|
+
function encode(data: bytes, padding?: boolean): string
|
|
52
62
|
}
|
|
53
63
|
|
|
54
64
|
export declare namespace events {
|
|
@@ -68,7 +78,7 @@ export declare namespace events {
|
|
|
68
78
|
received_time: string
|
|
69
79
|
type: string
|
|
70
80
|
}
|
|
71
|
-
function create_callback_endpoint(http_callback_method
|
|
81
|
+
function create_callback_endpoint(http_callback_method?: string): {
|
|
72
82
|
url: string
|
|
73
83
|
}
|
|
74
84
|
}
|
|
@@ -210,20 +220,33 @@ export declare namespace list {
|
|
|
210
220
|
function prepend<T, U>(objs: T[], val: U): (T | U)[]
|
|
211
221
|
}
|
|
212
222
|
|
|
223
|
+
// Typescript `object` is actually too liberal as it includes arrays. Workflows
|
|
224
|
+
// will throw an error if the input is an array.
|
|
213
225
|
export declare namespace map {
|
|
214
|
-
|
|
215
|
-
//
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
226
|
+
// If K is a literal key of T, return the exact type.
|
|
227
|
+
// Otherwise the best we can do is to return a Record with
|
|
228
|
+
// any of T property values.
|
|
229
|
+
function _delete<T extends object, K extends string>(
|
|
230
|
+
map: T,
|
|
231
|
+
key: K,
|
|
232
|
+
): K extends keyof T ? Omit<T, K> : Record<string, T[keyof T]>
|
|
233
|
+
// map.get() with a string key.
|
|
234
|
+
// If K is a literal key of T, this returns the exact type T[K].
|
|
235
|
+
// Otherwise returns less exact union of all T property types or null.
|
|
236
|
+
export function get<T extends object, K extends string>(
|
|
237
|
+
map: T,
|
|
238
|
+
keys: K,
|
|
239
|
+
): K extends keyof T ? T[K] : T[keyof T] | null
|
|
240
|
+
// map.get() with string[] key, the return type is not inferred
|
|
241
|
+
export function get(map: object, keys: string[]): WorkflowsValue
|
|
242
|
+
export function merge<T extends object, U extends object>(
|
|
243
|
+
first: T,
|
|
244
|
+
second: U,
|
|
245
|
+
): T & U
|
|
246
|
+
export function merge_nested<T extends object, U extends object>(
|
|
247
|
+
first: T,
|
|
248
|
+
second: U,
|
|
249
|
+
): T & U
|
|
227
250
|
export { _delete as delete }
|
|
228
251
|
}
|
|
229
252
|
|
|
@@ -296,9 +319,9 @@ export declare namespace uuid {
|
|
|
296
319
|
|
|
297
320
|
// Connectors
|
|
298
321
|
|
|
299
|
-
// Cloud Firestore API Connector
|
|
300
|
-
// https://cloud.google.com/workflows/docs/reference/googleapis/firestore/Overview
|
|
301
322
|
export declare namespace googleapis {
|
|
323
|
+
// Cloud Firestore API Connector
|
|
324
|
+
// https://cloud.google.com/workflows/docs/reference/googleapis/firestore/Overview
|
|
302
325
|
namespace firestore {
|
|
303
326
|
namespace v1 {
|
|
304
327
|
interface ArrayValue {
|
|
@@ -515,9 +538,9 @@ export declare namespace googleapis {
|
|
|
515
538
|
transaction?: string
|
|
516
539
|
}
|
|
517
540
|
interface RunQueryResponse {
|
|
518
|
-
document
|
|
541
|
+
document?: Document
|
|
519
542
|
readTime: string
|
|
520
|
-
skippedResults
|
|
543
|
+
skippedResults?: number
|
|
521
544
|
transaction?: string
|
|
522
545
|
}
|
|
523
546
|
interface Status {
|
|
@@ -666,8 +689,8 @@ export declare namespace googleapis {
|
|
|
666
689
|
): PartitionQueryResponse
|
|
667
690
|
export function patch(
|
|
668
691
|
name: string,
|
|
669
|
-
currentDocument: Precondition,
|
|
670
|
-
mask: DocumentMask,
|
|
692
|
+
currentDocument: Precondition | undefined,
|
|
693
|
+
mask: DocumentMask | undefined,
|
|
671
694
|
updateMask: DocumentMask,
|
|
672
695
|
body: Pick<Document, 'fields' | 'name'>,
|
|
673
696
|
): Document
|
|
@@ -678,7 +701,7 @@ export declare namespace googleapis {
|
|
|
678
701
|
export function runQuery(
|
|
679
702
|
parent: string,
|
|
680
703
|
body: RunQueryRequest,
|
|
681
|
-
): RunQueryResponse
|
|
704
|
+
): RunQueryResponse[]
|
|
682
705
|
export { _delete as delete }
|
|
683
706
|
}
|
|
684
707
|
namespace operations {
|
|
@@ -706,6 +729,340 @@ export declare namespace googleapis {
|
|
|
706
729
|
}
|
|
707
730
|
}
|
|
708
731
|
}
|
|
732
|
+
|
|
733
|
+
// Cloud Pub/Sub API Connector
|
|
734
|
+
// https://docs.cloud.google.com/workflows/docs/reference/googleapis/pubsub/Overview
|
|
735
|
+
namespace pubsub {
|
|
736
|
+
namespace v1 {
|
|
737
|
+
interface AcknowledgeRequest {
|
|
738
|
+
ackIds: string[]
|
|
739
|
+
}
|
|
740
|
+
interface Binding {
|
|
741
|
+
condition: Expr
|
|
742
|
+
members: string[]
|
|
743
|
+
role: string
|
|
744
|
+
}
|
|
745
|
+
interface CreateSnapshotRequest {
|
|
746
|
+
label?: Record<string, string>
|
|
747
|
+
subscription: string
|
|
748
|
+
}
|
|
749
|
+
interface DeadLetterPolicy {
|
|
750
|
+
deadLetterTopic: string
|
|
751
|
+
maxDeliveryAttempts?: number
|
|
752
|
+
}
|
|
753
|
+
interface Expr {
|
|
754
|
+
description?: string
|
|
755
|
+
expression: string
|
|
756
|
+
location?: string
|
|
757
|
+
title?: string
|
|
758
|
+
}
|
|
759
|
+
interface ExpirationPolicy {
|
|
760
|
+
ttl: string
|
|
761
|
+
}
|
|
762
|
+
interface ListSchemasResponse {
|
|
763
|
+
nextPageToken?: string
|
|
764
|
+
schemas: Schema[]
|
|
765
|
+
}
|
|
766
|
+
interface ListSnapshotsResponse {
|
|
767
|
+
nextPagetoken?: string
|
|
768
|
+
snapshots?: Snapshot[]
|
|
769
|
+
}
|
|
770
|
+
interface ListSubscriptionsResponse {
|
|
771
|
+
nextPageToken?: string
|
|
772
|
+
subscriptions?: Subscription[]
|
|
773
|
+
}
|
|
774
|
+
interface ListTopicsResponse {
|
|
775
|
+
nextPageToken?: string
|
|
776
|
+
topics?: Topic[]
|
|
777
|
+
}
|
|
778
|
+
interface ListTopicSubscriptionsResponse {
|
|
779
|
+
nextPageToken?: string
|
|
780
|
+
subscriptions?: string[]
|
|
781
|
+
}
|
|
782
|
+
interface ListTopicSnapshotsResponse {
|
|
783
|
+
nextPageToken?: string
|
|
784
|
+
snapshots?: string[]
|
|
785
|
+
}
|
|
786
|
+
interface MessageStoragePolicy {
|
|
787
|
+
allowedPersistenceRegions?: string[]
|
|
788
|
+
}
|
|
789
|
+
interface ModifyAckDeadlineRequest {
|
|
790
|
+
ackDeadlineSeconds: number
|
|
791
|
+
ackIds: string[]
|
|
792
|
+
}
|
|
793
|
+
interface ModifyPushConfigRequest {
|
|
794
|
+
pushConfig: PushConfig
|
|
795
|
+
}
|
|
796
|
+
interface OidcToken {
|
|
797
|
+
audience: string
|
|
798
|
+
serviceAccountEmail: string
|
|
799
|
+
}
|
|
800
|
+
interface Policy {
|
|
801
|
+
bindings: Binding[]
|
|
802
|
+
etag: string
|
|
803
|
+
version: number
|
|
804
|
+
}
|
|
805
|
+
interface PublishRequest {
|
|
806
|
+
messages: PubsubMessage[]
|
|
807
|
+
}
|
|
808
|
+
interface PublishResponse {
|
|
809
|
+
messageIds?: string[]
|
|
810
|
+
}
|
|
811
|
+
interface PubsubMessage {
|
|
812
|
+
attributes?: Record<string, string>
|
|
813
|
+
data?: string
|
|
814
|
+
messageId?: string
|
|
815
|
+
orderingKey?: string
|
|
816
|
+
publishTime?: string
|
|
817
|
+
}
|
|
818
|
+
interface PullRequest {
|
|
819
|
+
maxMessages: number
|
|
820
|
+
returnImmediately?: boolean
|
|
821
|
+
}
|
|
822
|
+
interface PullResponse {
|
|
823
|
+
receivedMessages: ReceivedMessage[]
|
|
824
|
+
}
|
|
825
|
+
interface PushConfig {
|
|
826
|
+
attributes: Record<string, string>
|
|
827
|
+
oidcToken: OidcToken
|
|
828
|
+
pushEndpoint: string
|
|
829
|
+
}
|
|
830
|
+
interface ReceivedMessage {
|
|
831
|
+
ackId: string
|
|
832
|
+
deliveryAttempt: number
|
|
833
|
+
message: PubsubMessage
|
|
834
|
+
}
|
|
835
|
+
interface RetryPolicy {
|
|
836
|
+
maximumBackoff?: string
|
|
837
|
+
minimumBackoff?: string
|
|
838
|
+
}
|
|
839
|
+
interface Schema {
|
|
840
|
+
definition: string
|
|
841
|
+
name: string
|
|
842
|
+
type: 'TYPE_UNSPECIFIED' | 'PROTOCOL_BUFFER' | 'AVRO'
|
|
843
|
+
}
|
|
844
|
+
interface SchemaSettings {
|
|
845
|
+
encoding?: 'ENCODING_UNSPECIFIED' | 'JSON' | 'BINARY'
|
|
846
|
+
schema: string
|
|
847
|
+
}
|
|
848
|
+
interface SeekRequest {
|
|
849
|
+
snapshot?: string
|
|
850
|
+
time?: string
|
|
851
|
+
}
|
|
852
|
+
interface SetIamPolicyRequest {
|
|
853
|
+
policy: Policy
|
|
854
|
+
}
|
|
855
|
+
interface Snapshot {
|
|
856
|
+
expireTime?: string
|
|
857
|
+
labels?: Record<string, string>
|
|
858
|
+
name?: string
|
|
859
|
+
topic?: string
|
|
860
|
+
}
|
|
861
|
+
interface Subscription {
|
|
862
|
+
ackDeadlineSeconds?: number
|
|
863
|
+
deadLetterPolicy?: DeadLetterPolicy
|
|
864
|
+
detached?: boolean
|
|
865
|
+
enableMessageOrdering?: boolean
|
|
866
|
+
expirationPolicy?: ExpirationPolicy
|
|
867
|
+
filter?: string
|
|
868
|
+
labels?: Record<string, string>
|
|
869
|
+
messageRetentionDuration?: string
|
|
870
|
+
name: string
|
|
871
|
+
pushConfig?: PushConfig
|
|
872
|
+
retainAckedMessages?: boolean
|
|
873
|
+
retryPolicy?: RetryPolicy
|
|
874
|
+
topic: string
|
|
875
|
+
topicMessageRetentionDuration?: string
|
|
876
|
+
}
|
|
877
|
+
interface TestIamPermissionsRequest {
|
|
878
|
+
permissions: string[]
|
|
879
|
+
}
|
|
880
|
+
interface TestIamPermissionsResponse {
|
|
881
|
+
permissions: string[]
|
|
882
|
+
}
|
|
883
|
+
interface Topic {
|
|
884
|
+
kmsKeyName?: string
|
|
885
|
+
labels?: Map<string, string>
|
|
886
|
+
messageRetentionDuration?: string
|
|
887
|
+
messageStoragePolicy?: MessageStoragePolicy
|
|
888
|
+
name: string
|
|
889
|
+
satisfiesPzs?: boolean
|
|
890
|
+
schemaSettings?: SchemaSettings
|
|
891
|
+
}
|
|
892
|
+
interface UpdateSnapshotRequest {
|
|
893
|
+
snapshot: Snapshot
|
|
894
|
+
updateMask: string
|
|
895
|
+
}
|
|
896
|
+
interface UpdateSubscriptionRequest {
|
|
897
|
+
subscription: Subscription
|
|
898
|
+
updateMask: string
|
|
899
|
+
}
|
|
900
|
+
interface UpdateTopicRequest {
|
|
901
|
+
topic: Topic
|
|
902
|
+
updateMask: string
|
|
903
|
+
}
|
|
904
|
+
interface ValidateMessageRequest {
|
|
905
|
+
encoding: 'ENCODING_UNSPECIFIED' | 'JSON' | 'BINARY'
|
|
906
|
+
message: string
|
|
907
|
+
name?: string
|
|
908
|
+
schema?: Schema
|
|
909
|
+
}
|
|
910
|
+
interface ValidateSchemaRequest {
|
|
911
|
+
object: Schema
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
namespace projects {
|
|
915
|
+
namespace schemas {
|
|
916
|
+
export function create(
|
|
917
|
+
parent: string,
|
|
918
|
+
schemaId: string,
|
|
919
|
+
body: Schema,
|
|
920
|
+
): Schema
|
|
921
|
+
function _delete(name: string): void
|
|
922
|
+
export { _delete as delete }
|
|
923
|
+
export function get(
|
|
924
|
+
name: string,
|
|
925
|
+
view?: 'SCHEMA_VIEW_UNSPECIFIED' | 'BASIC' | 'FULL',
|
|
926
|
+
): Schema
|
|
927
|
+
export function list(
|
|
928
|
+
parent: string,
|
|
929
|
+
pageSize?: number,
|
|
930
|
+
pageToken?: string,
|
|
931
|
+
view?: 'SCHEMA_VIEW_UNSPECIFIED' | 'BASIC' | 'FULL',
|
|
932
|
+
): ListSchemasResponse
|
|
933
|
+
export function validate(
|
|
934
|
+
parent: string,
|
|
935
|
+
body: ValidateSchemaRequest,
|
|
936
|
+
): void
|
|
937
|
+
export function validateMessage(
|
|
938
|
+
parent: string,
|
|
939
|
+
body: ValidateMessageRequest,
|
|
940
|
+
): void
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
namespace snapshots {
|
|
944
|
+
export function create(
|
|
945
|
+
name: string,
|
|
946
|
+
object: CreateSnapshotRequest,
|
|
947
|
+
): Snapshot
|
|
948
|
+
function _delete(snapshot: string): void
|
|
949
|
+
export { _delete as delete }
|
|
950
|
+
export function getIamPolicy(
|
|
951
|
+
resource: string,
|
|
952
|
+
options: { requestedPolicyVersion: number },
|
|
953
|
+
): Policy
|
|
954
|
+
export function list(
|
|
955
|
+
project: string,
|
|
956
|
+
pageSize?: number,
|
|
957
|
+
pageToken?: string,
|
|
958
|
+
): ListSnapshotsResponse
|
|
959
|
+
export function patch(
|
|
960
|
+
name: string,
|
|
961
|
+
body: UpdateSnapshotRequest,
|
|
962
|
+
): Snapshot
|
|
963
|
+
export function setIamPolicy(
|
|
964
|
+
resource: string,
|
|
965
|
+
body: SetIamPolicyRequest,
|
|
966
|
+
): Policy
|
|
967
|
+
export function testIamPermissions(
|
|
968
|
+
resource: string,
|
|
969
|
+
body: TestIamPermissionsRequest,
|
|
970
|
+
): TestIamPermissionsResponse
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
namespace subscriptions {
|
|
974
|
+
export function acknowledge(
|
|
975
|
+
subscription: string,
|
|
976
|
+
body: AcknowledgeRequest,
|
|
977
|
+
): void
|
|
978
|
+
export function create(name: string, body: Subscription): Subscription
|
|
979
|
+
function _delete(subscription: string): void
|
|
980
|
+
export { _delete as delete }
|
|
981
|
+
export function detach(subscription: string): void
|
|
982
|
+
export function get(subscription: string): Subscription
|
|
983
|
+
export function getIamPolicy(
|
|
984
|
+
resource: string,
|
|
985
|
+
options: { requestedPolicyVersion: number },
|
|
986
|
+
): Policy
|
|
987
|
+
export function list(
|
|
988
|
+
project: string,
|
|
989
|
+
pageSize?: number,
|
|
990
|
+
pageToken?: string,
|
|
991
|
+
): ListSubscriptionsResponse
|
|
992
|
+
export function modifyAckDeadline(
|
|
993
|
+
subscription: string,
|
|
994
|
+
body: ModifyAckDeadlineRequest,
|
|
995
|
+
): void
|
|
996
|
+
export function modifyPushConfig(
|
|
997
|
+
subscription: string,
|
|
998
|
+
body: ModifyPushConfigRequest,
|
|
999
|
+
): void
|
|
1000
|
+
export function patch(
|
|
1001
|
+
name: string,
|
|
1002
|
+
body: UpdateSubscriptionRequest,
|
|
1003
|
+
): Subscription
|
|
1004
|
+
export function pull(
|
|
1005
|
+
subscription: string,
|
|
1006
|
+
body: PullRequest,
|
|
1007
|
+
): PullResponse
|
|
1008
|
+
export function seek(subscription: string, body: SeekRequest): void
|
|
1009
|
+
export function setIamPolicy(
|
|
1010
|
+
resource: string,
|
|
1011
|
+
body: SetIamPolicyRequest,
|
|
1012
|
+
): Policy
|
|
1013
|
+
export function testIamPermissions(
|
|
1014
|
+
resource: string,
|
|
1015
|
+
body: TestIamPermissionsRequest,
|
|
1016
|
+
): TestIamPermissionsResponse
|
|
1017
|
+
}
|
|
1018
|
+
|
|
1019
|
+
namespace topics {
|
|
1020
|
+
export function create(name: string, body: Topic): Topic
|
|
1021
|
+
function _delete(topic: string): void
|
|
1022
|
+
export { _delete as delete }
|
|
1023
|
+
export function get(topic: string): Topic
|
|
1024
|
+
export function getIamPolicy(
|
|
1025
|
+
resource: string,
|
|
1026
|
+
options: { requestedPolicyVersion: number },
|
|
1027
|
+
): Policy
|
|
1028
|
+
export function list(
|
|
1029
|
+
project: string,
|
|
1030
|
+
pageSize?: number,
|
|
1031
|
+
pageToken?: string,
|
|
1032
|
+
): ListTopicsResponse
|
|
1033
|
+
export function patch(name: string, body: UpdateTopicRequest): Topic
|
|
1034
|
+
export function publish(
|
|
1035
|
+
topic: string,
|
|
1036
|
+
body: PublishRequest,
|
|
1037
|
+
): PublishResponse
|
|
1038
|
+
export function setIamPolicy(
|
|
1039
|
+
resource: string,
|
|
1040
|
+
body: SetIamPolicyRequest,
|
|
1041
|
+
): Policy
|
|
1042
|
+
export function testIamPermissions(
|
|
1043
|
+
resource: string,
|
|
1044
|
+
body: TestIamPermissionsRequest,
|
|
1045
|
+
): TestIamPermissionsResponse
|
|
1046
|
+
|
|
1047
|
+
namespace snapshots {
|
|
1048
|
+
export function list(
|
|
1049
|
+
topic: string,
|
|
1050
|
+
pageSize?: number,
|
|
1051
|
+
pageToken?: string,
|
|
1052
|
+
): ListTopicSnapshotsResponse
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1055
|
+
namespace subscriptions {
|
|
1056
|
+
export function list(
|
|
1057
|
+
topic: string,
|
|
1058
|
+
pageSize?: number,
|
|
1059
|
+
pageToken?: string,
|
|
1060
|
+
): ListTopicSubscriptionsResponse
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
709
1066
|
}
|
|
710
1067
|
|
|
711
1068
|
// Functionality that is not implemented by Typescript keywords
|