@temporalio/proto 0.19.0 → 0.22.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/lib/patch-protobuf-root.d.ts +8 -0
- package/lib/patch-protobuf-root.js +57 -0
- package/lib/patch-protobuf-root.js.map +1 -0
- package/package.json +8 -4
- package/{lib → protos}/index.d.ts +11 -13
- package/protos/index.js +1 -0
- package/protos/json-module.js +7603 -0
- package/{lib/temporal.d.ts → protos/root.d.ts} +16039 -7671
- package/protos/root.js +3 -0
- package/lib/coresdk.d.ts +0 -10435
- package/lib/coresdk.js +0 -15144
- package/lib/index.js +0 -2
- package/lib/temporal.js +0 -31751
- package/scripts/compile-proto.js +0 -103
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Create a version of `root` with non-nested namespaces to match the generated types.
|
|
3
|
+
* For more information, see:
|
|
4
|
+
* https://github.com/temporalio/sdk-typescript/blob/main/docs/protobuf-libraries.md#current-solution
|
|
5
|
+
* @param root Generated by `pbjs -t json-module -w commonjs -o json-module.js *.proto`
|
|
6
|
+
* @returns A new patched `root`
|
|
7
|
+
*/
|
|
8
|
+
export declare function patchProtobufRoot<T extends Record<string, unknown>>(root: T): T;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.patchProtobufRoot = void 0;
|
|
4
|
+
const ROOT_PROPS = [
|
|
5
|
+
'options',
|
|
6
|
+
'parsedOptions',
|
|
7
|
+
'name',
|
|
8
|
+
'parent',
|
|
9
|
+
'resolved',
|
|
10
|
+
'comment',
|
|
11
|
+
'filename',
|
|
12
|
+
'nested',
|
|
13
|
+
'_nestedArray',
|
|
14
|
+
];
|
|
15
|
+
/**
|
|
16
|
+
* Create a version of `root` with non-nested namespaces to match the generated types.
|
|
17
|
+
* For more information, see:
|
|
18
|
+
* https://github.com/temporalio/sdk-typescript/blob/main/docs/protobuf-libraries.md#current-solution
|
|
19
|
+
* @param root Generated by `pbjs -t json-module -w commonjs -o json-module.js *.proto`
|
|
20
|
+
* @returns A new patched `root`
|
|
21
|
+
*/
|
|
22
|
+
function patchProtobufRoot(root) {
|
|
23
|
+
return _patchProtobufRoot(root);
|
|
24
|
+
}
|
|
25
|
+
exports.patchProtobufRoot = patchProtobufRoot;
|
|
26
|
+
function _patchProtobufRoot(root, name) {
|
|
27
|
+
const newRoot = new root.constructor(isNamespace(root) ? name : {});
|
|
28
|
+
for (const key in root) {
|
|
29
|
+
newRoot[key] = root[key];
|
|
30
|
+
}
|
|
31
|
+
if (isRecord(root.nested)) {
|
|
32
|
+
for (const typeOrNamespace in root.nested) {
|
|
33
|
+
const value = root.nested[typeOrNamespace];
|
|
34
|
+
if (ROOT_PROPS.includes(typeOrNamespace)) {
|
|
35
|
+
console.log(`patchProtobufRoot warning: overriding property '${typeOrNamespace}' that is used by protobufjs with the '${typeOrNamespace}' protobuf ${isNamespace(value) ? 'namespace' : 'type'}. This may result in protobufjs not working property.`);
|
|
36
|
+
}
|
|
37
|
+
if (isNamespace(value)) {
|
|
38
|
+
newRoot[typeOrNamespace] = _patchProtobufRoot(value, typeOrNamespace);
|
|
39
|
+
}
|
|
40
|
+
else if (isType(value)) {
|
|
41
|
+
newRoot[typeOrNamespace] = value;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return newRoot;
|
|
46
|
+
}
|
|
47
|
+
function isType(value) {
|
|
48
|
+
return isRecord(value) && value.constructor.name === 'Type';
|
|
49
|
+
}
|
|
50
|
+
function isNamespace(value) {
|
|
51
|
+
return isRecord(value) && value.constructor.name === 'Namespace';
|
|
52
|
+
}
|
|
53
|
+
// Duplicate from type-helpers instead of importing in order to avoid circular dependency
|
|
54
|
+
function isRecord(value) {
|
|
55
|
+
return typeof value === 'object' && value !== null;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=patch-protobuf-root.js.map
|
|
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E;gBACxB,OAAO,CAAC,eAAe,CAAC,GAAG,KAAK,CAAC;aAClC;SACF;KACF;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAKD,SAAS,MAAM,CAAC,KAAc;IAC5B,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,MAAM,CAAC;AAC9D,CAAC;AAED,SAAS,WAAW,CAAC,KAAc;IACjC,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,WAAW,CAAC,IAAI,KAAK,WAAW,CAAC;AACnE,CAAC;AAED,yFAAyF;AACzF,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC;AACrD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@temporalio/proto",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Temporal.io SDK compiled protobuf definitions",
|
|
5
|
-
"main": "
|
|
6
|
-
"types": "
|
|
5
|
+
"main": "protos/index.js",
|
|
6
|
+
"types": "protos/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"protos/",
|
|
9
|
+
"lib/"
|
|
10
|
+
],
|
|
7
11
|
"scripts": {
|
|
8
12
|
"build": "node ./scripts/compile-proto.js"
|
|
9
13
|
},
|
|
@@ -29,5 +33,5 @@
|
|
|
29
33
|
"publishConfig": {
|
|
30
34
|
"access": "public"
|
|
31
35
|
},
|
|
32
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "3aa1f14982bd170d21b728cbf016dc4f1b595a76"
|
|
33
37
|
}
|
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* This package contains code generated from the Temporal `sdk-core` protobuf definitions using [protobufjs](https://www.npmjs.com/package/protobufjs), it is used by the Temporal worker and client packages.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
4
|
* You will most likely never import this package directly.
|
|
5
|
-
*
|
|
5
|
+
*
|
|
6
6
|
* ### Core SDK API
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
8
|
* [Core SDK](https://github.com/temporalio/sdk-core) interfaces can be accessed in the `coresdk` namespace.
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* ```ts
|
|
11
11
|
* import { coresdk } from '@temporalio/proto';
|
|
12
12
|
* const activityTask: coresdk.activity_task.IActivityTask = { ... };
|
|
13
13
|
* ```
|
|
14
|
-
*
|
|
14
|
+
*
|
|
15
15
|
* The source protos are in the [sdk-core repo](https://github.com/temporalio/sdk-core/tree/ts-release/protos/local/temporal/sdk/core), for example [`ActivityTask` in `activity_task.proto`](https://github.com/temporalio/sdk-core/blob/85454935e39f789aaaa81f8a05773f8e2cdbcde2/protos/local/temporal/sdk/core/activity_task/activity_task.proto#L12).
|
|
16
|
-
*
|
|
16
|
+
*
|
|
17
17
|
* ### Temporal Service API
|
|
18
|
-
*
|
|
18
|
+
*
|
|
19
19
|
* Temporal API interfaces - used to communicate with the Temporal service - can be accessed in the `temporal` namespace.
|
|
20
|
-
*
|
|
20
|
+
*
|
|
21
21
|
* ```ts
|
|
22
22
|
* import { temporal } from '@temporalio/proto';
|
|
23
23
|
* const retryPolicy: temporal.api.common.v1.IRetryPolicy = { ... };
|
|
24
24
|
* ```
|
|
25
|
-
*
|
|
25
|
+
*
|
|
26
26
|
* The source protos are in [sdk-core/protos/api_upstream/temporal/api/](https://github.com/temporalio/sdk-core/tree/ts-release/protos/api_upstream/temporal/api), for example [`RetryPolicy` in `temporal/api/common/v1/message.proto`](https://github.com/temporalio/sdk-core/blob/85454935e39f789aaaa81f8a05773f8e2cdbcde2/protos/api_upstream/temporal/api/common/v1/message.proto#L96).
|
|
27
|
-
*
|
|
27
|
+
*
|
|
28
28
|
* The gRPC service methods are documented in the proto comments and in the corresponding [`tctl` docs](https://docs.temporal.io/docs/tctl/).
|
|
29
29
|
* @module
|
|
30
30
|
*/
|
|
31
31
|
|
|
32
|
-
export
|
|
33
|
-
export * from './temporal';
|
|
34
|
-
|
|
32
|
+
export * from './root';
|
package/protos/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./root');
|