@openhi/constructs 0.0.160 → 0.0.161
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/{chunk-HQ67J7BP.mjs → chunk-5S6VFBLT.mjs} +12 -70
- package/lib/chunk-5S6VFBLT.mjs.map +1 -0
- package/lib/{chunk-MVQWAIMC.mjs → chunk-6BB4CRSS.mjs} +3 -312
- package/lib/chunk-6BB4CRSS.mjs.map +1 -0
- package/lib/{chunk-WPCBVDFZ.mjs → chunk-76UM2LQ5.mjs} +2 -2
- package/lib/{chunk-QFHYTCVY.mjs → chunk-7TRO2STL.mjs} +7 -7
- package/lib/chunk-BUAYVN3C.mjs +87 -0
- package/lib/chunk-BUAYVN3C.mjs.map +1 -0
- package/lib/{chunk-23PUSHBV.mjs → chunk-D2Y6DDOC.mjs} +2 -2
- package/lib/chunk-DWSWCUZR.mjs +123 -0
- package/lib/chunk-DWSWCUZR.mjs.map +1 -0
- package/lib/{chunk-VZCPGQXA.mjs → chunk-EUIP2U5F.mjs} +69 -1
- package/lib/{chunk-VZCPGQXA.mjs.map → chunk-EUIP2U5F.mjs.map} +1 -1
- package/lib/chunk-GJTPXJKD.mjs +46 -0
- package/lib/chunk-GJTPXJKD.mjs.map +1 -0
- package/lib/chunk-I6LUPJUY.mjs +61 -0
- package/lib/chunk-I6LUPJUY.mjs.map +1 -0
- package/lib/{chunk-KR2Y2CVQ.mjs → chunk-KA3OMP3X.mjs} +2 -2
- package/lib/{chunk-ZM4GDHHC.mjs → chunk-KMEWULMX.mjs} +51 -3
- package/lib/chunk-KMEWULMX.mjs.map +1 -0
- package/lib/chunk-LKKLO66E.mjs +25 -0
- package/lib/chunk-LKKLO66E.mjs.map +1 -0
- package/lib/{chunk-CFJDATDK.mjs → chunk-MLFMW5IF.mjs} +43 -9
- package/lib/chunk-MLFMW5IF.mjs.map +1 -0
- package/lib/chunk-O5VQWB6U.mjs +315 -0
- package/lib/chunk-O5VQWB6U.mjs.map +1 -0
- package/lib/{chunk-7BQHLC7U.mjs → chunk-P3CTZWC2.mjs} +8 -40
- package/lib/chunk-P3CTZWC2.mjs.map +1 -0
- package/lib/{chunk-EFB5OFM7.mjs → chunk-P3NFCKTZ.mjs} +6 -4
- package/lib/{chunk-EFB5OFM7.mjs.map → chunk-P3NFCKTZ.mjs.map} +1 -1
- package/lib/{chunk-M7Y3BOQW.mjs → chunk-Q3MKITPY.mjs} +5 -5
- package/lib/chunk-Q64MOYJ7.mjs +218 -0
- package/lib/chunk-Q64MOYJ7.mjs.map +1 -0
- package/lib/chunk-RQKJNMX5.mjs +89 -0
- package/lib/chunk-RQKJNMX5.mjs.map +1 -0
- package/lib/{chunk-ZWSGM6PZ.mjs → chunk-SD7J3N3C.mjs} +2 -2
- package/lib/{chunk-7RZHFI77.mjs → chunk-VESULYQQ.mjs} +2 -2
- package/lib/{chunk-AOSEKL7U.mjs → chunk-WOTU36P3.mjs} +6 -103
- package/lib/chunk-WOTU36P3.mjs.map +1 -0
- package/lib/{chunk-X5E4YJGZ.mjs → chunk-YPTJJ35S.mjs} +2 -2
- package/lib/counter-apply-operation-DZM3MIDm.d.mts +63 -0
- package/lib/counter-apply-operation-DZM3MIDm.d.ts +63 -0
- package/lib/counter-maintenance.handler.d.mts +38 -0
- package/lib/counter-maintenance.handler.d.ts +38 -0
- package/lib/counter-maintenance.handler.js +2885 -0
- package/lib/counter-maintenance.handler.js.map +1 -0
- package/lib/counter-maintenance.handler.mjs +180 -0
- package/lib/counter-maintenance.handler.mjs.map +1 -0
- package/lib/counter-reconciliation.handler.d.mts +116 -0
- package/lib/counter-reconciliation.handler.d.ts +116 -0
- package/lib/counter-reconciliation.handler.js +3324 -0
- package/lib/counter-reconciliation.handler.js.map +1 -0
- package/lib/counter-reconciliation.handler.mjs +295 -0
- package/lib/counter-reconciliation.handler.mjs.map +1 -0
- package/lib/data-store-postgres-replication.handler.js +50 -2
- package/lib/data-store-postgres-replication.handler.js.map +1 -1
- package/lib/data-store-postgres-replication.handler.mjs +2 -2
- package/lib/delete-chunk.handler.js +118 -2
- package/lib/delete-chunk.handler.js.map +1 -1
- package/lib/delete-chunk.handler.mjs +3 -3
- package/lib/finalize.handler.js +50 -2
- package/lib/finalize.handler.js.map +1 -1
- package/lib/finalize.handler.mjs +4 -4
- package/lib/firehose-archive-transform.handler.js +50 -2
- package/lib/firehose-archive-transform.handler.js.map +1 -1
- package/lib/firehose-archive-transform.handler.mjs +2 -2
- package/lib/index.d.mts +140 -2
- package/lib/index.d.ts +143 -5
- package/lib/index.js +493 -196
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +360 -193
- package/lib/index.mjs.map +1 -1
- package/lib/list-chunks.handler.js +118 -2
- package/lib/list-chunks.handler.js.map +1 -1
- package/lib/list-chunks.handler.mjs +3 -3
- package/lib/platform-deploy-bridge.handler.js +50 -2
- package/lib/platform-deploy-bridge.handler.js.map +1 -1
- package/lib/platform-deploy-bridge.handler.mjs +1 -1
- package/lib/pre-token-generation.handler.js +68 -0
- package/lib/pre-token-generation.handler.js.map +1 -1
- package/lib/pre-token-generation.handler.mjs +9 -5
- package/lib/pre-token-generation.handler.mjs.map +1 -1
- package/lib/provision-default-workspace.handler.js +883 -0
- package/lib/provision-default-workspace.handler.js.map +1 -1
- package/lib/provision-default-workspace.handler.mjs +10 -5
- package/lib/provision-default-workspace.handler.mjs.map +1 -1
- package/lib/rename-finalize.handler.js +50 -2
- package/lib/rename-finalize.handler.js.map +1 -1
- package/lib/rename-finalize.handler.mjs +2 -2
- package/lib/rename-list-targets.handler.js +118 -2
- package/lib/rename-list-targets.handler.js.map +1 -1
- package/lib/rename-list-targets.handler.mjs +11 -9
- package/lib/rename-list-targets.handler.mjs.map +1 -1
- package/lib/rename-rewrite-chunk.handler.js +68 -0
- package/lib/rename-rewrite-chunk.handler.js.map +1 -1
- package/lib/rename-rewrite-chunk.handler.mjs +2 -2
- package/lib/rest-api-lambda.handler.js +1454 -251
- package/lib/rest-api-lambda.handler.js.map +1 -1
- package/lib/rest-api-lambda.handler.mjs +415 -291
- package/lib/rest-api-lambda.handler.mjs.map +1 -1
- package/lib/seed-demo-data.handler.js +205 -8
- package/lib/seed-demo-data.handler.js.map +1 -1
- package/lib/seed-demo-data.handler.mjs +10 -7
- package/lib/seed-system-data.handler.js +118 -2
- package/lib/seed-system-data.handler.js.map +1 -1
- package/lib/seed-system-data.handler.mjs +5 -5
- package/package.json +1 -1
- package/lib/chunk-7BQHLC7U.mjs.map +0 -1
- package/lib/chunk-AOSEKL7U.mjs.map +0 -1
- package/lib/chunk-CFJDATDK.mjs.map +0 -1
- package/lib/chunk-HQ67J7BP.mjs.map +0 -1
- package/lib/chunk-MVQWAIMC.mjs.map +0 -1
- package/lib/chunk-ZM4GDHHC.mjs.map +0 -1
- /package/lib/{chunk-WPCBVDFZ.mjs.map → chunk-76UM2LQ5.mjs.map} +0 -0
- /package/lib/{chunk-QFHYTCVY.mjs.map → chunk-7TRO2STL.mjs.map} +0 -0
- /package/lib/{chunk-23PUSHBV.mjs.map → chunk-D2Y6DDOC.mjs.map} +0 -0
- /package/lib/{chunk-KR2Y2CVQ.mjs.map → chunk-KA3OMP3X.mjs.map} +0 -0
- /package/lib/{chunk-M7Y3BOQW.mjs.map → chunk-Q3MKITPY.mjs.map} +0 -0
- /package/lib/{chunk-ZWSGM6PZ.mjs.map → chunk-SD7J3N3C.mjs.map} +0 -0
- /package/lib/{chunk-7RZHFI77.mjs.map → chunk-VESULYQQ.mjs.map} +0 -0
- /package/lib/{chunk-X5E4YJGZ.mjs.map → chunk-YPTJJ35S.mjs.map} +0 -0
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
6
11
|
var __export = (target, all) => {
|
|
7
12
|
for (var name in all)
|
|
8
13
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -15,8 +20,737 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
20
|
}
|
|
16
21
|
return to;
|
|
17
22
|
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
18
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
32
|
|
|
33
|
+
// ../workflows/lib/envelope-version.js
|
|
34
|
+
var require_envelope_version = __commonJS({
|
|
35
|
+
"../workflows/lib/envelope-version.js"(exports2) {
|
|
36
|
+
"use strict";
|
|
37
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
38
|
+
exports2.ENVELOPE_VERSION = void 0;
|
|
39
|
+
exports2.isSupportedEnvelopeVersion = isSupportedEnvelopeVersion;
|
|
40
|
+
exports2.ENVELOPE_VERSION = "1.0";
|
|
41
|
+
var ENVELOPE_VERSION_PATTERN = /^\d+\.\d+$/;
|
|
42
|
+
var MIN_SUPPORTED_MAJOR = 1;
|
|
43
|
+
var MAX_SUPPORTED_MAJOR = 1;
|
|
44
|
+
function isSupportedEnvelopeVersion(version) {
|
|
45
|
+
if (!ENVELOPE_VERSION_PATTERN.test(version)) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
const major = Number.parseInt(version.split(".")[0], 10);
|
|
49
|
+
return major >= MIN_SUPPORTED_MAJOR && major <= MAX_SUPPORTED_MAJOR;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// ../workflows/lib/envelope.js
|
|
55
|
+
var require_envelope = __commonJS({
|
|
56
|
+
"../workflows/lib/envelope.js"(exports2) {
|
|
57
|
+
"use strict";
|
|
58
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
59
|
+
exports2.MissingActorContextError = void 0;
|
|
60
|
+
exports2.isWorkflowUserActor = isWorkflowUserActor;
|
|
61
|
+
exports2.isWorkflowSystemActor = isWorkflowSystemActor;
|
|
62
|
+
exports2.workflowUserActorFromClaims = workflowUserActorFromClaims;
|
|
63
|
+
function isWorkflowUserActor(actor) {
|
|
64
|
+
return actor.ohi_uid !== void 0;
|
|
65
|
+
}
|
|
66
|
+
function isWorkflowSystemActor(actor) {
|
|
67
|
+
return actor.system !== void 0;
|
|
68
|
+
}
|
|
69
|
+
function workflowUserActorFromClaims(claims) {
|
|
70
|
+
if (claims.ohi_tid === void 0 || claims.ohi_wid === void 0) {
|
|
71
|
+
throw new MissingActorContextError("workflowUserActorFromClaims: ohi_tid and ohi_wid are required on the workflow user-actor; the caller's JWT is missing one or both. Use a system-actor for pre-provisioning bootstrap workflows.");
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
ohi_tid: claims.ohi_tid,
|
|
75
|
+
ohi_wid: claims.ohi_wid,
|
|
76
|
+
ohi_uid: claims.ohi_uid,
|
|
77
|
+
ohi_uname: claims.ohi_uname
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
var MissingActorContextError = class extends Error {
|
|
81
|
+
/** @param message - human-readable description of the missing claim. */
|
|
82
|
+
constructor(message) {
|
|
83
|
+
super(message);
|
|
84
|
+
this.name = "MissingActorContextError";
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
exports2.MissingActorContextError = MissingActorContextError;
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// ../workflows/lib/sources.js
|
|
92
|
+
var require_sources = __commonJS({
|
|
93
|
+
"../workflows/lib/sources.js"(exports2) {
|
|
94
|
+
"use strict";
|
|
95
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
96
|
+
exports2.DEFAULT_BUS_NAME_BY_SOURCE = exports2.OPENHI_OPS_SOURCE = exports2.OPENHI_DATA_SOURCE = exports2.OPENHI_CONTROL_SOURCE = void 0;
|
|
97
|
+
exports2.OPENHI_CONTROL_SOURCE = "openhi.control";
|
|
98
|
+
exports2.OPENHI_DATA_SOURCE = "openhi.data";
|
|
99
|
+
exports2.OPENHI_OPS_SOURCE = "openhi.ops";
|
|
100
|
+
exports2.DEFAULT_BUS_NAME_BY_SOURCE = {
|
|
101
|
+
[exports2.OPENHI_CONTROL_SOURCE]: "openhi-control-event-bus",
|
|
102
|
+
[exports2.OPENHI_DATA_SOURCE]: "openhi-data-event-bus",
|
|
103
|
+
[exports2.OPENHI_OPS_SOURCE]: "openhi-ops-event-bus"
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// ../workflows/lib/detail-types/registry.js
|
|
109
|
+
var require_registry = __commonJS({
|
|
110
|
+
"../workflows/lib/detail-types/registry.js"(exports2) {
|
|
111
|
+
"use strict";
|
|
112
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
113
|
+
exports2.InvalidDetailTypeRegistrationError = void 0;
|
|
114
|
+
exports2.defineDetailType = defineDetailType;
|
|
115
|
+
exports2.isWellFormedDetailType = isWellFormedDetailType;
|
|
116
|
+
function defineDetailType(entry) {
|
|
117
|
+
if (!isWellFormedDetailType(entry.detailType)) {
|
|
118
|
+
throw new InvalidDetailTypeRegistrationError(`Detail-type "${entry.detailType}" does not match the platform-wide format <area>.<event>.v<integer>. See TR-016 \xA7Open Items #2.`);
|
|
119
|
+
}
|
|
120
|
+
return entry;
|
|
121
|
+
}
|
|
122
|
+
var DETAIL_TYPE_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*\.[a-z0-9]+(?:-[a-z0-9]+)*\.v\d+$/;
|
|
123
|
+
function isWellFormedDetailType(detailType) {
|
|
124
|
+
return DETAIL_TYPE_PATTERN.test(detailType);
|
|
125
|
+
}
|
|
126
|
+
var InvalidDetailTypeRegistrationError = class extends Error {
|
|
127
|
+
/** @param message - human-readable description of the violation. */
|
|
128
|
+
constructor(message) {
|
|
129
|
+
super(message);
|
|
130
|
+
this.name = "InvalidDetailTypeRegistrationError";
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
exports2.InvalidDetailTypeRegistrationError = InvalidDetailTypeRegistrationError;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
// ../workflows/lib/detail-types/control-plane.js
|
|
138
|
+
var require_control_plane = __commonJS({
|
|
139
|
+
"../workflows/lib/detail-types/control-plane.js"(exports2) {
|
|
140
|
+
"use strict";
|
|
141
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
142
|
+
exports2.ControlPlaneWorkspaceDeletedV1 = exports2.ControlPlaneWorkspaceCreatedV1 = exports2.ControlPlaneRoleAssignmentDeletedV1 = exports2.ControlPlaneRoleAssignmentCreatedV1 = exports2.ControlPlaneMembershipDeletedV1 = exports2.ControlPlaneMembershipCreatedV1 = exports2.ControlPlaneRenameFailedV1 = exports2.ControlPlaneRenameCompleteV1 = exports2.ControlPlaneRenameV1 = exports2.RENAMABLE_ENTITY_TYPE = exports2.ControlPlaneOwningDeleteFailedV1 = exports2.ControlPlaneOwningDeleteCompleteV1 = exports2.ControlPlaneOwningDeleteV1 = exports2.OWNING_ENTITY_TYPE = void 0;
|
|
143
|
+
var sources_1 = require_sources();
|
|
144
|
+
var registry_1 = require_registry();
|
|
145
|
+
exports2.OWNING_ENTITY_TYPE = {
|
|
146
|
+
Workspace: "Workspace",
|
|
147
|
+
User: "User"
|
|
148
|
+
};
|
|
149
|
+
exports2.ControlPlaneOwningDeleteV1 = (0, registry_1.defineDetailType)({
|
|
150
|
+
detailType: "control-plane.owning-delete.v1",
|
|
151
|
+
source: sources_1.OPENHI_DATA_SOURCE,
|
|
152
|
+
dedupRequired: true
|
|
153
|
+
});
|
|
154
|
+
exports2.ControlPlaneOwningDeleteCompleteV1 = (0, registry_1.defineDetailType)({
|
|
155
|
+
detailType: "control-plane.owning-delete-complete.v1",
|
|
156
|
+
source: sources_1.OPENHI_OPS_SOURCE,
|
|
157
|
+
dedupRequired: true
|
|
158
|
+
});
|
|
159
|
+
exports2.ControlPlaneOwningDeleteFailedV1 = (0, registry_1.defineDetailType)({
|
|
160
|
+
detailType: "control-plane.owning-delete-failed.v1",
|
|
161
|
+
source: sources_1.OPENHI_OPS_SOURCE,
|
|
162
|
+
dedupRequired: true
|
|
163
|
+
});
|
|
164
|
+
exports2.RENAMABLE_ENTITY_TYPE = {
|
|
165
|
+
Tenant: "Tenant",
|
|
166
|
+
User: "User",
|
|
167
|
+
Role: "Role"
|
|
168
|
+
};
|
|
169
|
+
exports2.ControlPlaneRenameV1 = (0, registry_1.defineDetailType)({
|
|
170
|
+
detailType: "control-plane.rename.v1",
|
|
171
|
+
source: sources_1.OPENHI_DATA_SOURCE,
|
|
172
|
+
dedupRequired: true
|
|
173
|
+
});
|
|
174
|
+
exports2.ControlPlaneRenameCompleteV1 = (0, registry_1.defineDetailType)({
|
|
175
|
+
detailType: "control-plane.rename-complete.v1",
|
|
176
|
+
source: sources_1.OPENHI_OPS_SOURCE,
|
|
177
|
+
dedupRequired: true
|
|
178
|
+
});
|
|
179
|
+
exports2.ControlPlaneRenameFailedV1 = (0, registry_1.defineDetailType)({
|
|
180
|
+
detailType: "control-plane.rename-failed.v1",
|
|
181
|
+
source: sources_1.OPENHI_OPS_SOURCE,
|
|
182
|
+
dedupRequired: true
|
|
183
|
+
});
|
|
184
|
+
exports2.ControlPlaneMembershipCreatedV1 = (0, registry_1.defineDetailType)({
|
|
185
|
+
detailType: "control-plane.membership-created.v1",
|
|
186
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
187
|
+
dedupRequired: true
|
|
188
|
+
});
|
|
189
|
+
exports2.ControlPlaneMembershipDeletedV1 = (0, registry_1.defineDetailType)({
|
|
190
|
+
detailType: "control-plane.membership-deleted.v1",
|
|
191
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
192
|
+
dedupRequired: true
|
|
193
|
+
});
|
|
194
|
+
exports2.ControlPlaneRoleAssignmentCreatedV1 = (0, registry_1.defineDetailType)({
|
|
195
|
+
detailType: "control-plane.role-assignment-created.v1",
|
|
196
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
197
|
+
dedupRequired: true
|
|
198
|
+
});
|
|
199
|
+
exports2.ControlPlaneRoleAssignmentDeletedV1 = (0, registry_1.defineDetailType)({
|
|
200
|
+
detailType: "control-plane.role-assignment-deleted.v1",
|
|
201
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
202
|
+
dedupRequired: true
|
|
203
|
+
});
|
|
204
|
+
exports2.ControlPlaneWorkspaceCreatedV1 = (0, registry_1.defineDetailType)({
|
|
205
|
+
detailType: "control-plane.workspace-created.v1",
|
|
206
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
207
|
+
dedupRequired: true
|
|
208
|
+
});
|
|
209
|
+
exports2.ControlPlaneWorkspaceDeletedV1 = (0, registry_1.defineDetailType)({
|
|
210
|
+
detailType: "control-plane.workspace-deleted.v1",
|
|
211
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
212
|
+
dedupRequired: true
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// ../workflows/lib/detail-types/platform.js
|
|
218
|
+
var require_platform = __commonJS({
|
|
219
|
+
"../workflows/lib/detail-types/platform.js"(exports2) {
|
|
220
|
+
"use strict";
|
|
221
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
222
|
+
exports2.PlatformSystemDataSeededV1 = exports2.PlatformDeploymentCompletedV1 = void 0;
|
|
223
|
+
var sources_1 = require_sources();
|
|
224
|
+
var registry_1 = require_registry();
|
|
225
|
+
exports2.PlatformDeploymentCompletedV1 = (0, registry_1.defineDetailType)({
|
|
226
|
+
detailType: "platform.deployment-completed.v1",
|
|
227
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
228
|
+
dedupRequired: true
|
|
229
|
+
});
|
|
230
|
+
exports2.PlatformSystemDataSeededV1 = (0, registry_1.defineDetailType)({
|
|
231
|
+
detailType: "platform.system-data-seeded.v1",
|
|
232
|
+
source: sources_1.OPENHI_CONTROL_SOURCE,
|
|
233
|
+
dedupRequired: true
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
// ../workflows/lib/detail-types/index.js
|
|
239
|
+
var require_detail_types = __commonJS({
|
|
240
|
+
"../workflows/lib/detail-types/index.js"(exports2) {
|
|
241
|
+
"use strict";
|
|
242
|
+
var __createBinding = exports2 && exports2.__createBinding || (Object.create ? (function(o, m, k, k2) {
|
|
243
|
+
if (k2 === void 0) k2 = k;
|
|
244
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
245
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
246
|
+
desc = { enumerable: true, get: function() {
|
|
247
|
+
return m[k];
|
|
248
|
+
} };
|
|
249
|
+
}
|
|
250
|
+
Object.defineProperty(o, k2, desc);
|
|
251
|
+
}) : (function(o, m, k, k2) {
|
|
252
|
+
if (k2 === void 0) k2 = k;
|
|
253
|
+
o[k2] = m[k];
|
|
254
|
+
}));
|
|
255
|
+
var __exportStar = exports2 && exports2.__exportStar || function(m, exports3) {
|
|
256
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports3, p)) __createBinding(exports3, m, p);
|
|
257
|
+
};
|
|
258
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
259
|
+
__exportStar(require_control_plane(), exports2);
|
|
260
|
+
__exportStar(require_platform(), exports2);
|
|
261
|
+
__exportStar(require_registry(), exports2);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
// ../workflows/lib/publisher.js
|
|
266
|
+
var require_publisher = __commonJS({
|
|
267
|
+
"../workflows/lib/publisher.js"(exports2) {
|
|
268
|
+
"use strict";
|
|
269
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
270
|
+
exports2.WorkflowPublishError = void 0;
|
|
271
|
+
exports2.workflowsClient = workflowsClient;
|
|
272
|
+
exports2.publishWorkflowEvent = publishWorkflowEvent2;
|
|
273
|
+
var node_crypto_1 = require("crypto");
|
|
274
|
+
var client_eventbridge_1 = require("@aws-sdk/client-eventbridge");
|
|
275
|
+
var envelope_version_1 = require_envelope_version();
|
|
276
|
+
var sources_1 = require_sources();
|
|
277
|
+
function workflowsClient(bridge, options = {}) {
|
|
278
|
+
return {
|
|
279
|
+
publish: (entry, payload, ctx) => publishWorkflowEvent2(bridge, entry, payload, ctx, options)
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
async function publishWorkflowEvent2(bridge, entry, payload, ctx, options = {}) {
|
|
283
|
+
const eventIdGenerator = options.eventIdGenerator ?? (() => (0, node_crypto_1.randomUUID)());
|
|
284
|
+
const correlationIdGenerator = options.correlationIdGenerator ?? (() => (0, node_crypto_1.randomUUID)());
|
|
285
|
+
const now = options.now ?? (() => /* @__PURE__ */ new Date());
|
|
286
|
+
const envelope = {
|
|
287
|
+
eventId: eventIdGenerator(),
|
|
288
|
+
attempt: 1,
|
|
289
|
+
correlationId: ctx.correlationId ?? correlationIdGenerator(),
|
|
290
|
+
causationId: ctx.causationId ?? null,
|
|
291
|
+
actor: ctx.actor,
|
|
292
|
+
occurredAt: now().toISOString(),
|
|
293
|
+
envelopeVersion: envelope_version_1.ENVELOPE_VERSION,
|
|
294
|
+
payload
|
|
295
|
+
};
|
|
296
|
+
const busName = options.busNameByPlane?.[entry.source] ?? sources_1.DEFAULT_BUS_NAME_BY_SOURCE[entry.source];
|
|
297
|
+
const result = await bridge.send(new client_eventbridge_1.PutEventsCommand({
|
|
298
|
+
Entries: [
|
|
299
|
+
{
|
|
300
|
+
EventBusName: busName,
|
|
301
|
+
Source: entry.source,
|
|
302
|
+
DetailType: entry.detailType,
|
|
303
|
+
Detail: JSON.stringify(envelope)
|
|
304
|
+
}
|
|
305
|
+
]
|
|
306
|
+
}));
|
|
307
|
+
if ((result.FailedEntryCount ?? 0) > 0) {
|
|
308
|
+
const first = result.Entries?.[0];
|
|
309
|
+
throw new WorkflowPublishError(`EventBridge rejected ${entry.detailType} publish on bus ${busName}: ${first?.ErrorCode ?? "unknown"} \u2014 ${first?.ErrorMessage ?? "no error message"}`);
|
|
310
|
+
}
|
|
311
|
+
return { eventId: envelope.eventId };
|
|
312
|
+
}
|
|
313
|
+
var WorkflowPublishError = class extends Error {
|
|
314
|
+
/** @param message - human-readable description of the failed publish. */
|
|
315
|
+
constructor(message) {
|
|
316
|
+
super(message);
|
|
317
|
+
this.name = "WorkflowPublishError";
|
|
318
|
+
}
|
|
319
|
+
};
|
|
320
|
+
exports2.WorkflowPublishError = WorkflowPublishError;
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
// ../workflows/lib/consumer.js
|
|
325
|
+
var require_consumer = __commonJS({
|
|
326
|
+
"../workflows/lib/consumer.js"(exports2) {
|
|
327
|
+
"use strict";
|
|
328
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
329
|
+
exports2.UnsupportedEnvelopeVersionError = exports2.InvalidWorkflowEventError = void 0;
|
|
330
|
+
exports2.parseWorkflowEvent = parseWorkflowEvent;
|
|
331
|
+
var envelope_version_1 = require_envelope_version();
|
|
332
|
+
function parseWorkflowEvent(event, expected) {
|
|
333
|
+
if (event.source !== expected.source) {
|
|
334
|
+
throw new InvalidWorkflowEventError(`EventBridge source "${event.source}" does not match expected detail-type's source "${expected.source}".`);
|
|
335
|
+
}
|
|
336
|
+
if (event["detail-type"] !== expected.detailType) {
|
|
337
|
+
throw new InvalidWorkflowEventError(`EventBridge detail-type "${event["detail-type"]}" does not match expected "${expected.detailType}".`);
|
|
338
|
+
}
|
|
339
|
+
const candidate = asEnvelopeCandidate(event.detail);
|
|
340
|
+
if (!(0, envelope_version_1.isSupportedEnvelopeVersion)(candidate.envelopeVersion)) {
|
|
341
|
+
throw new UnsupportedEnvelopeVersionError(`Envelope version "${candidate.envelopeVersion}" is outside the SDK's supported range.`);
|
|
342
|
+
}
|
|
343
|
+
const envelope = {
|
|
344
|
+
eventId: candidate.eventId,
|
|
345
|
+
attempt: candidate.attempt,
|
|
346
|
+
correlationId: candidate.correlationId,
|
|
347
|
+
causationId: candidate.causationId,
|
|
348
|
+
actor: candidate.actor,
|
|
349
|
+
occurredAt: candidate.occurredAt,
|
|
350
|
+
envelopeVersion: candidate.envelopeVersion,
|
|
351
|
+
payload: candidate.payload
|
|
352
|
+
};
|
|
353
|
+
return {
|
|
354
|
+
envelope,
|
|
355
|
+
dedupKey: { eventId: envelope.eventId, attempt: envelope.attempt }
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function asEnvelopeCandidate(detail) {
|
|
359
|
+
if (detail === null || typeof detail !== "object") {
|
|
360
|
+
throw new InvalidWorkflowEventError("EventBridge detail is not a non-null object.");
|
|
361
|
+
}
|
|
362
|
+
const obj = detail;
|
|
363
|
+
assertString(obj, "eventId");
|
|
364
|
+
assertPositiveInteger(obj, "attempt");
|
|
365
|
+
assertString(obj, "correlationId");
|
|
366
|
+
assertCausationId(obj);
|
|
367
|
+
assertActor(obj);
|
|
368
|
+
assertString(obj, "occurredAt");
|
|
369
|
+
assertString(obj, "envelopeVersion");
|
|
370
|
+
if (!("payload" in obj)) {
|
|
371
|
+
throw new InvalidWorkflowEventError("Envelope is missing required field: payload.");
|
|
372
|
+
}
|
|
373
|
+
return obj;
|
|
374
|
+
}
|
|
375
|
+
function assertString(obj, field) {
|
|
376
|
+
const value = obj[field];
|
|
377
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
378
|
+
throw new InvalidWorkflowEventError(`Envelope field "${field}" must be a non-empty string.`);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
function assertPositiveInteger(obj, field) {
|
|
382
|
+
const value = obj[field];
|
|
383
|
+
if (typeof value !== "number" || !Number.isInteger(value) || value < 1) {
|
|
384
|
+
throw new InvalidWorkflowEventError(`Envelope field "${field}" must be a 1-indexed integer.`);
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function assertCausationId(obj) {
|
|
388
|
+
if (!("causationId" in obj)) {
|
|
389
|
+
throw new InvalidWorkflowEventError("Envelope is missing required field: causationId.");
|
|
390
|
+
}
|
|
391
|
+
const value = obj.causationId;
|
|
392
|
+
if (value !== null && (typeof value !== "string" || value.length === 0)) {
|
|
393
|
+
throw new InvalidWorkflowEventError('Envelope field "causationId" must be a non-empty string or null.');
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
function assertActor(obj) {
|
|
397
|
+
const actor = obj.actor;
|
|
398
|
+
if (actor === null || typeof actor !== "object") {
|
|
399
|
+
throw new InvalidWorkflowEventError('Envelope field "actor" must be an object.');
|
|
400
|
+
}
|
|
401
|
+
const actorObj = actor;
|
|
402
|
+
const isUserActor = typeof actorObj.ohi_uid === "string" && typeof actorObj.ohi_uname === "string" && typeof actorObj.ohi_tid === "string" && typeof actorObj.ohi_wid === "string";
|
|
403
|
+
const isSystemActor = typeof actorObj.system === "string";
|
|
404
|
+
if (!isUserActor && !isSystemActor) {
|
|
405
|
+
throw new InvalidWorkflowEventError('Envelope field "actor" must be either a user-actor (ohi_tid, ohi_wid, ohi_uid, ohi_uname) or a system-actor ({ system: string }).');
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
var InvalidWorkflowEventError = class extends Error {
|
|
409
|
+
/** @param message - human-readable description of the validation failure. */
|
|
410
|
+
constructor(message) {
|
|
411
|
+
super(message);
|
|
412
|
+
this.name = "InvalidWorkflowEventError";
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
exports2.InvalidWorkflowEventError = InvalidWorkflowEventError;
|
|
416
|
+
var UnsupportedEnvelopeVersionError = class extends Error {
|
|
417
|
+
/** @param message - human-readable description of the unsupported version. */
|
|
418
|
+
constructor(message) {
|
|
419
|
+
super(message);
|
|
420
|
+
this.name = "UnsupportedEnvelopeVersionError";
|
|
421
|
+
}
|
|
422
|
+
};
|
|
423
|
+
exports2.UnsupportedEnvelopeVersionError = UnsupportedEnvelopeVersionError;
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
// ../workflows/lib/dedup/env.js
|
|
428
|
+
var require_env = __commonJS({
|
|
429
|
+
"../workflows/lib/dedup/env.js"(exports2) {
|
|
430
|
+
"use strict";
|
|
431
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
432
|
+
exports2.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH = exports2.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS = exports2.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR = void 0;
|
|
433
|
+
exports2.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR = "OPENHI_WORKFLOW_DEDUP_TABLE_NAME";
|
|
434
|
+
exports2.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS = 14 * 24 * 60 * 60;
|
|
435
|
+
exports2.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH = 64;
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
|
|
439
|
+
// ../workflows/lib/dedup/workflow-dedup-client.js
|
|
440
|
+
var require_workflow_dedup_client = __commonJS({
|
|
441
|
+
"../workflows/lib/dedup/workflow-dedup-client.js"(exports2) {
|
|
442
|
+
"use strict";
|
|
443
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
444
|
+
exports2.WorkflowDedupInvalidInputError = exports2.WorkflowDedupTableNameMissingError = void 0;
|
|
445
|
+
exports2.workflowDedupClient = workflowDedupClient;
|
|
446
|
+
exports2.recordIfAbsent = recordIfAbsent;
|
|
447
|
+
exports2.markFailed = markFailed;
|
|
448
|
+
exports2.encodeSortKey = encodeSortKey;
|
|
449
|
+
var client_dynamodb_1 = require("@aws-sdk/client-dynamodb");
|
|
450
|
+
var env_1 = require_env();
|
|
451
|
+
function workflowDedupClient(dynamodb, options = {}) {
|
|
452
|
+
return {
|
|
453
|
+
recordIfAbsent: (input) => recordIfAbsent(dynamodb, input, options),
|
|
454
|
+
markFailed: (input) => markFailed(dynamodb, input, options)
|
|
455
|
+
};
|
|
456
|
+
}
|
|
457
|
+
async function recordIfAbsent(dynamodb, input, options = {}) {
|
|
458
|
+
assertConsumerName(input.consumerName);
|
|
459
|
+
assertPositiveInteger(input.attempt, "attempt");
|
|
460
|
+
const ttlSeconds = input.ttlSeconds ?? options.defaultTtlSeconds ?? env_1.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS;
|
|
461
|
+
if (!Number.isInteger(ttlSeconds) || ttlSeconds <= 0) {
|
|
462
|
+
throw new WorkflowDedupInvalidInputError(`ttlSeconds must be a positive integer; got ${ttlSeconds}.`);
|
|
463
|
+
}
|
|
464
|
+
const tableName = resolveTableName(options.tableName);
|
|
465
|
+
const now = (options.now ?? defaultNow)();
|
|
466
|
+
const sk = encodeSortKey(input.eventId, input.attempt);
|
|
467
|
+
const expiresAt = Math.floor(now.getTime() / 1e3) + ttlSeconds;
|
|
468
|
+
try {
|
|
469
|
+
await dynamodb.send(new client_dynamodb_1.PutItemCommand({
|
|
470
|
+
TableName: tableName,
|
|
471
|
+
Item: {
|
|
472
|
+
consumerName: { S: input.consumerName },
|
|
473
|
+
sk: { S: sk },
|
|
474
|
+
eventId: { S: input.eventId },
|
|
475
|
+
attempt: { N: String(input.attempt) },
|
|
476
|
+
recordedAt: { S: now.toISOString() },
|
|
477
|
+
expiresAt: { N: String(expiresAt) }
|
|
478
|
+
},
|
|
479
|
+
ConditionExpression: "attribute_not_exists(consumerName) AND attribute_not_exists(sk)"
|
|
480
|
+
}));
|
|
481
|
+
return { recorded: true };
|
|
482
|
+
} catch (err) {
|
|
483
|
+
if (err instanceof client_dynamodb_1.ConditionalCheckFailedException) {
|
|
484
|
+
return { recorded: false, alreadyProcessed: true };
|
|
485
|
+
}
|
|
486
|
+
throw err;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
async function markFailed(dynamodb, input, options = {}) {
|
|
490
|
+
assertConsumerName(input.consumerName);
|
|
491
|
+
assertPositiveInteger(input.attempt, "attempt");
|
|
492
|
+
if (input.reason.length === 0) {
|
|
493
|
+
throw new WorkflowDedupInvalidInputError("reason must be non-empty.");
|
|
494
|
+
}
|
|
495
|
+
const tableName = resolveTableName(options.tableName);
|
|
496
|
+
const now = (options.now ?? defaultNow)();
|
|
497
|
+
const sk = encodeSortKey(input.eventId, input.attempt);
|
|
498
|
+
await dynamodb.send(new client_dynamodb_1.UpdateItemCommand({
|
|
499
|
+
TableName: tableName,
|
|
500
|
+
Key: {
|
|
501
|
+
consumerName: { S: input.consumerName },
|
|
502
|
+
sk: { S: sk }
|
|
503
|
+
},
|
|
504
|
+
UpdateExpression: "SET #failed = :failed, #failureReason = :reason, #failedAt = :failedAt",
|
|
505
|
+
ExpressionAttributeNames: {
|
|
506
|
+
"#failed": "failed",
|
|
507
|
+
"#failureReason": "failureReason",
|
|
508
|
+
"#failedAt": "failedAt"
|
|
509
|
+
},
|
|
510
|
+
ExpressionAttributeValues: {
|
|
511
|
+
":failed": { BOOL: true },
|
|
512
|
+
":reason": { S: input.reason },
|
|
513
|
+
":failedAt": { S: now.toISOString() }
|
|
514
|
+
}
|
|
515
|
+
}));
|
|
516
|
+
}
|
|
517
|
+
function encodeSortKey(eventId, attempt) {
|
|
518
|
+
if (eventId.length === 0) {
|
|
519
|
+
throw new WorkflowDedupInvalidInputError("eventId must be non-empty.");
|
|
520
|
+
}
|
|
521
|
+
return `${eventId}#${attempt}`;
|
|
522
|
+
}
|
|
523
|
+
function resolveTableName(explicit) {
|
|
524
|
+
const name = explicit ?? process.env[env_1.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR];
|
|
525
|
+
if (!name) {
|
|
526
|
+
throw new WorkflowDedupTableNameMissingError(`Workflow dedup table name not set. Pass options.tableName or set ${env_1.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR}.`);
|
|
527
|
+
}
|
|
528
|
+
return name;
|
|
529
|
+
}
|
|
530
|
+
function assertConsumerName(consumerName) {
|
|
531
|
+
if (consumerName.length === 0) {
|
|
532
|
+
throw new WorkflowDedupInvalidInputError("consumerName must be non-empty.");
|
|
533
|
+
}
|
|
534
|
+
if (consumerName.length > env_1.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH) {
|
|
535
|
+
throw new WorkflowDedupInvalidInputError(`consumerName must be \u2264${env_1.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH} chars; got ${consumerName.length}.`);
|
|
536
|
+
}
|
|
537
|
+
if (/\s/.test(consumerName)) {
|
|
538
|
+
throw new WorkflowDedupInvalidInputError("consumerName must not contain whitespace.");
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function assertPositiveInteger(value, field) {
|
|
542
|
+
if (!Number.isInteger(value) || value < 1) {
|
|
543
|
+
throw new WorkflowDedupInvalidInputError(`${field} must be a 1-indexed integer; got ${value}.`);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
function defaultNow() {
|
|
547
|
+
return /* @__PURE__ */ new Date();
|
|
548
|
+
}
|
|
549
|
+
var WorkflowDedupTableNameMissingError = class extends Error {
|
|
550
|
+
/** @param message - human-readable description. */
|
|
551
|
+
constructor(message) {
|
|
552
|
+
super(message);
|
|
553
|
+
this.name = "WorkflowDedupTableNameMissingError";
|
|
554
|
+
}
|
|
555
|
+
};
|
|
556
|
+
exports2.WorkflowDedupTableNameMissingError = WorkflowDedupTableNameMissingError;
|
|
557
|
+
var WorkflowDedupInvalidInputError = class extends Error {
|
|
558
|
+
/** @param message - human-readable description. */
|
|
559
|
+
constructor(message) {
|
|
560
|
+
super(message);
|
|
561
|
+
this.name = "WorkflowDedupInvalidInputError";
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
exports2.WorkflowDedupInvalidInputError = WorkflowDedupInvalidInputError;
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
|
|
568
|
+
// ../workflows/lib/dedup/index.js
|
|
569
|
+
var require_dedup = __commonJS({
|
|
570
|
+
"../workflows/lib/dedup/index.js"(exports2) {
|
|
571
|
+
"use strict";
|
|
572
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
573
|
+
exports2.workflowDedupClient = exports2.recordIfAbsent = exports2.markFailed = exports2.encodeSortKey = exports2.WorkflowDedupTableNameMissingError = exports2.WorkflowDedupInvalidInputError = exports2.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR = exports2.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH = exports2.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS = void 0;
|
|
574
|
+
var env_1 = require_env();
|
|
575
|
+
Object.defineProperty(exports2, "WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS", { enumerable: true, get: function() {
|
|
576
|
+
return env_1.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS;
|
|
577
|
+
} });
|
|
578
|
+
Object.defineProperty(exports2, "WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH", { enumerable: true, get: function() {
|
|
579
|
+
return env_1.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH;
|
|
580
|
+
} });
|
|
581
|
+
Object.defineProperty(exports2, "WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR", { enumerable: true, get: function() {
|
|
582
|
+
return env_1.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR;
|
|
583
|
+
} });
|
|
584
|
+
var workflow_dedup_client_1 = require_workflow_dedup_client();
|
|
585
|
+
Object.defineProperty(exports2, "WorkflowDedupInvalidInputError", { enumerable: true, get: function() {
|
|
586
|
+
return workflow_dedup_client_1.WorkflowDedupInvalidInputError;
|
|
587
|
+
} });
|
|
588
|
+
Object.defineProperty(exports2, "WorkflowDedupTableNameMissingError", { enumerable: true, get: function() {
|
|
589
|
+
return workflow_dedup_client_1.WorkflowDedupTableNameMissingError;
|
|
590
|
+
} });
|
|
591
|
+
Object.defineProperty(exports2, "encodeSortKey", { enumerable: true, get: function() {
|
|
592
|
+
return workflow_dedup_client_1.encodeSortKey;
|
|
593
|
+
} });
|
|
594
|
+
Object.defineProperty(exports2, "markFailed", { enumerable: true, get: function() {
|
|
595
|
+
return workflow_dedup_client_1.markFailed;
|
|
596
|
+
} });
|
|
597
|
+
Object.defineProperty(exports2, "recordIfAbsent", { enumerable: true, get: function() {
|
|
598
|
+
return workflow_dedup_client_1.recordIfAbsent;
|
|
599
|
+
} });
|
|
600
|
+
Object.defineProperty(exports2, "workflowDedupClient", { enumerable: true, get: function() {
|
|
601
|
+
return workflow_dedup_client_1.workflowDedupClient;
|
|
602
|
+
} });
|
|
603
|
+
}
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
// ../workflows/lib/index.js
|
|
607
|
+
var require_lib = __commonJS({
|
|
608
|
+
"../workflows/lib/index.js"(exports2) {
|
|
609
|
+
"use strict";
|
|
610
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
611
|
+
exports2.workflowDedupClient = exports2.recordIfAbsent = exports2.markFailed = exports2.encodeSortKey = exports2.WorkflowDedupTableNameMissingError = exports2.WorkflowDedupInvalidInputError = exports2.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR = exports2.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH = exports2.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS = exports2.parseWorkflowEvent = exports2.UnsupportedEnvelopeVersionError = exports2.InvalidWorkflowEventError = exports2.workflowsClient = exports2.publishWorkflowEvent = exports2.WorkflowPublishError = exports2.isWellFormedDetailType = exports2.defineDetailType = exports2.RENAMABLE_ENTITY_TYPE = exports2.PlatformSystemDataSeededV1 = exports2.PlatformDeploymentCompletedV1 = exports2.OWNING_ENTITY_TYPE = exports2.InvalidDetailTypeRegistrationError = exports2.ControlPlaneWorkspaceDeletedV1 = exports2.ControlPlaneWorkspaceCreatedV1 = exports2.ControlPlaneRoleAssignmentDeletedV1 = exports2.ControlPlaneRoleAssignmentCreatedV1 = exports2.ControlPlaneRenameV1 = exports2.ControlPlaneRenameFailedV1 = exports2.ControlPlaneRenameCompleteV1 = exports2.ControlPlaneOwningDeleteV1 = exports2.ControlPlaneOwningDeleteFailedV1 = exports2.ControlPlaneOwningDeleteCompleteV1 = exports2.ControlPlaneMembershipDeletedV1 = exports2.ControlPlaneMembershipCreatedV1 = exports2.OPENHI_OPS_SOURCE = exports2.OPENHI_DATA_SOURCE = exports2.OPENHI_CONTROL_SOURCE = exports2.DEFAULT_BUS_NAME_BY_SOURCE = exports2.workflowUserActorFromClaims = exports2.isWorkflowUserActor = exports2.isWorkflowSystemActor = exports2.MissingActorContextError = exports2.isSupportedEnvelopeVersion = exports2.ENVELOPE_VERSION = void 0;
|
|
612
|
+
var envelope_version_1 = require_envelope_version();
|
|
613
|
+
Object.defineProperty(exports2, "ENVELOPE_VERSION", { enumerable: true, get: function() {
|
|
614
|
+
return envelope_version_1.ENVELOPE_VERSION;
|
|
615
|
+
} });
|
|
616
|
+
Object.defineProperty(exports2, "isSupportedEnvelopeVersion", { enumerable: true, get: function() {
|
|
617
|
+
return envelope_version_1.isSupportedEnvelopeVersion;
|
|
618
|
+
} });
|
|
619
|
+
var envelope_1 = require_envelope();
|
|
620
|
+
Object.defineProperty(exports2, "MissingActorContextError", { enumerable: true, get: function() {
|
|
621
|
+
return envelope_1.MissingActorContextError;
|
|
622
|
+
} });
|
|
623
|
+
Object.defineProperty(exports2, "isWorkflowSystemActor", { enumerable: true, get: function() {
|
|
624
|
+
return envelope_1.isWorkflowSystemActor;
|
|
625
|
+
} });
|
|
626
|
+
Object.defineProperty(exports2, "isWorkflowUserActor", { enumerable: true, get: function() {
|
|
627
|
+
return envelope_1.isWorkflowUserActor;
|
|
628
|
+
} });
|
|
629
|
+
Object.defineProperty(exports2, "workflowUserActorFromClaims", { enumerable: true, get: function() {
|
|
630
|
+
return envelope_1.workflowUserActorFromClaims;
|
|
631
|
+
} });
|
|
632
|
+
var sources_1 = require_sources();
|
|
633
|
+
Object.defineProperty(exports2, "DEFAULT_BUS_NAME_BY_SOURCE", { enumerable: true, get: function() {
|
|
634
|
+
return sources_1.DEFAULT_BUS_NAME_BY_SOURCE;
|
|
635
|
+
} });
|
|
636
|
+
Object.defineProperty(exports2, "OPENHI_CONTROL_SOURCE", { enumerable: true, get: function() {
|
|
637
|
+
return sources_1.OPENHI_CONTROL_SOURCE;
|
|
638
|
+
} });
|
|
639
|
+
Object.defineProperty(exports2, "OPENHI_DATA_SOURCE", { enumerable: true, get: function() {
|
|
640
|
+
return sources_1.OPENHI_DATA_SOURCE;
|
|
641
|
+
} });
|
|
642
|
+
Object.defineProperty(exports2, "OPENHI_OPS_SOURCE", { enumerable: true, get: function() {
|
|
643
|
+
return sources_1.OPENHI_OPS_SOURCE;
|
|
644
|
+
} });
|
|
645
|
+
var detail_types_1 = require_detail_types();
|
|
646
|
+
Object.defineProperty(exports2, "ControlPlaneMembershipCreatedV1", { enumerable: true, get: function() {
|
|
647
|
+
return detail_types_1.ControlPlaneMembershipCreatedV1;
|
|
648
|
+
} });
|
|
649
|
+
Object.defineProperty(exports2, "ControlPlaneMembershipDeletedV1", { enumerable: true, get: function() {
|
|
650
|
+
return detail_types_1.ControlPlaneMembershipDeletedV1;
|
|
651
|
+
} });
|
|
652
|
+
Object.defineProperty(exports2, "ControlPlaneOwningDeleteCompleteV1", { enumerable: true, get: function() {
|
|
653
|
+
return detail_types_1.ControlPlaneOwningDeleteCompleteV1;
|
|
654
|
+
} });
|
|
655
|
+
Object.defineProperty(exports2, "ControlPlaneOwningDeleteFailedV1", { enumerable: true, get: function() {
|
|
656
|
+
return detail_types_1.ControlPlaneOwningDeleteFailedV1;
|
|
657
|
+
} });
|
|
658
|
+
Object.defineProperty(exports2, "ControlPlaneOwningDeleteV1", { enumerable: true, get: function() {
|
|
659
|
+
return detail_types_1.ControlPlaneOwningDeleteV1;
|
|
660
|
+
} });
|
|
661
|
+
Object.defineProperty(exports2, "ControlPlaneRenameCompleteV1", { enumerable: true, get: function() {
|
|
662
|
+
return detail_types_1.ControlPlaneRenameCompleteV1;
|
|
663
|
+
} });
|
|
664
|
+
Object.defineProperty(exports2, "ControlPlaneRenameFailedV1", { enumerable: true, get: function() {
|
|
665
|
+
return detail_types_1.ControlPlaneRenameFailedV1;
|
|
666
|
+
} });
|
|
667
|
+
Object.defineProperty(exports2, "ControlPlaneRenameV1", { enumerable: true, get: function() {
|
|
668
|
+
return detail_types_1.ControlPlaneRenameV1;
|
|
669
|
+
} });
|
|
670
|
+
Object.defineProperty(exports2, "ControlPlaneRoleAssignmentCreatedV1", { enumerable: true, get: function() {
|
|
671
|
+
return detail_types_1.ControlPlaneRoleAssignmentCreatedV1;
|
|
672
|
+
} });
|
|
673
|
+
Object.defineProperty(exports2, "ControlPlaneRoleAssignmentDeletedV1", { enumerable: true, get: function() {
|
|
674
|
+
return detail_types_1.ControlPlaneRoleAssignmentDeletedV1;
|
|
675
|
+
} });
|
|
676
|
+
Object.defineProperty(exports2, "ControlPlaneWorkspaceCreatedV1", { enumerable: true, get: function() {
|
|
677
|
+
return detail_types_1.ControlPlaneWorkspaceCreatedV1;
|
|
678
|
+
} });
|
|
679
|
+
Object.defineProperty(exports2, "ControlPlaneWorkspaceDeletedV1", { enumerable: true, get: function() {
|
|
680
|
+
return detail_types_1.ControlPlaneWorkspaceDeletedV1;
|
|
681
|
+
} });
|
|
682
|
+
Object.defineProperty(exports2, "InvalidDetailTypeRegistrationError", { enumerable: true, get: function() {
|
|
683
|
+
return detail_types_1.InvalidDetailTypeRegistrationError;
|
|
684
|
+
} });
|
|
685
|
+
Object.defineProperty(exports2, "OWNING_ENTITY_TYPE", { enumerable: true, get: function() {
|
|
686
|
+
return detail_types_1.OWNING_ENTITY_TYPE;
|
|
687
|
+
} });
|
|
688
|
+
Object.defineProperty(exports2, "PlatformDeploymentCompletedV1", { enumerable: true, get: function() {
|
|
689
|
+
return detail_types_1.PlatformDeploymentCompletedV1;
|
|
690
|
+
} });
|
|
691
|
+
Object.defineProperty(exports2, "PlatformSystemDataSeededV1", { enumerable: true, get: function() {
|
|
692
|
+
return detail_types_1.PlatformSystemDataSeededV1;
|
|
693
|
+
} });
|
|
694
|
+
Object.defineProperty(exports2, "RENAMABLE_ENTITY_TYPE", { enumerable: true, get: function() {
|
|
695
|
+
return detail_types_1.RENAMABLE_ENTITY_TYPE;
|
|
696
|
+
} });
|
|
697
|
+
Object.defineProperty(exports2, "defineDetailType", { enumerable: true, get: function() {
|
|
698
|
+
return detail_types_1.defineDetailType;
|
|
699
|
+
} });
|
|
700
|
+
Object.defineProperty(exports2, "isWellFormedDetailType", { enumerable: true, get: function() {
|
|
701
|
+
return detail_types_1.isWellFormedDetailType;
|
|
702
|
+
} });
|
|
703
|
+
var publisher_1 = require_publisher();
|
|
704
|
+
Object.defineProperty(exports2, "WorkflowPublishError", { enumerable: true, get: function() {
|
|
705
|
+
return publisher_1.WorkflowPublishError;
|
|
706
|
+
} });
|
|
707
|
+
Object.defineProperty(exports2, "publishWorkflowEvent", { enumerable: true, get: function() {
|
|
708
|
+
return publisher_1.publishWorkflowEvent;
|
|
709
|
+
} });
|
|
710
|
+
Object.defineProperty(exports2, "workflowsClient", { enumerable: true, get: function() {
|
|
711
|
+
return publisher_1.workflowsClient;
|
|
712
|
+
} });
|
|
713
|
+
var consumer_1 = require_consumer();
|
|
714
|
+
Object.defineProperty(exports2, "InvalidWorkflowEventError", { enumerable: true, get: function() {
|
|
715
|
+
return consumer_1.InvalidWorkflowEventError;
|
|
716
|
+
} });
|
|
717
|
+
Object.defineProperty(exports2, "UnsupportedEnvelopeVersionError", { enumerable: true, get: function() {
|
|
718
|
+
return consumer_1.UnsupportedEnvelopeVersionError;
|
|
719
|
+
} });
|
|
720
|
+
Object.defineProperty(exports2, "parseWorkflowEvent", { enumerable: true, get: function() {
|
|
721
|
+
return consumer_1.parseWorkflowEvent;
|
|
722
|
+
} });
|
|
723
|
+
var dedup_1 = require_dedup();
|
|
724
|
+
Object.defineProperty(exports2, "WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS", { enumerable: true, get: function() {
|
|
725
|
+
return dedup_1.WORKFLOW_DEDUP_DEFAULT_TTL_SECONDS;
|
|
726
|
+
} });
|
|
727
|
+
Object.defineProperty(exports2, "WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH", { enumerable: true, get: function() {
|
|
728
|
+
return dedup_1.WORKFLOW_DEDUP_MAX_CONSUMER_NAME_LENGTH;
|
|
729
|
+
} });
|
|
730
|
+
Object.defineProperty(exports2, "WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR", { enumerable: true, get: function() {
|
|
731
|
+
return dedup_1.WORKFLOW_DEDUP_TABLE_NAME_ENV_VAR;
|
|
732
|
+
} });
|
|
733
|
+
Object.defineProperty(exports2, "WorkflowDedupInvalidInputError", { enumerable: true, get: function() {
|
|
734
|
+
return dedup_1.WorkflowDedupInvalidInputError;
|
|
735
|
+
} });
|
|
736
|
+
Object.defineProperty(exports2, "WorkflowDedupTableNameMissingError", { enumerable: true, get: function() {
|
|
737
|
+
return dedup_1.WorkflowDedupTableNameMissingError;
|
|
738
|
+
} });
|
|
739
|
+
Object.defineProperty(exports2, "encodeSortKey", { enumerable: true, get: function() {
|
|
740
|
+
return dedup_1.encodeSortKey;
|
|
741
|
+
} });
|
|
742
|
+
Object.defineProperty(exports2, "markFailed", { enumerable: true, get: function() {
|
|
743
|
+
return dedup_1.markFailed;
|
|
744
|
+
} });
|
|
745
|
+
Object.defineProperty(exports2, "recordIfAbsent", { enumerable: true, get: function() {
|
|
746
|
+
return dedup_1.recordIfAbsent;
|
|
747
|
+
} });
|
|
748
|
+
Object.defineProperty(exports2, "workflowDedupClient", { enumerable: true, get: function() {
|
|
749
|
+
return dedup_1.workflowDedupClient;
|
|
750
|
+
} });
|
|
751
|
+
}
|
|
752
|
+
});
|
|
753
|
+
|
|
20
754
|
// src/workflows/control-plane/user-onboarding/provision-default-workspace.handler.ts
|
|
21
755
|
var provision_default_workspace_handler_exports = {};
|
|
22
756
|
__export(provision_default_workspace_handler_exports, {
|
|
@@ -1470,6 +2204,24 @@ var TenantEntity = new import_electrodb11.Entity({
|
|
|
1470
2204
|
type: "string",
|
|
1471
2205
|
required: true
|
|
1472
2206
|
},
|
|
2207
|
+
/**
|
|
2208
|
+
* ADR-028 denormalized counter — number of tenant-scoped Memberships
|
|
2209
|
+
* (users) in this tenant. Maintained by the counter-maintenance
|
|
2210
|
+
* consumer via atomic ADD; absent/0 until first event or reconciliation.
|
|
2211
|
+
*/
|
|
2212
|
+
usersInTenant: {
|
|
2213
|
+
type: "number",
|
|
2214
|
+
required: false
|
|
2215
|
+
},
|
|
2216
|
+
/**
|
|
2217
|
+
* ADR-028 denormalized counter — number of Workspaces in this tenant.
|
|
2218
|
+
* Maintained by the counter-maintenance consumer via atomic ADD;
|
|
2219
|
+
* absent/0 until first event or reconciliation.
|
|
2220
|
+
*/
|
|
2221
|
+
workspacesInTenant: {
|
|
2222
|
+
type: "number",
|
|
2223
|
+
required: false
|
|
2224
|
+
},
|
|
1473
2225
|
gsi1Shard: gsi1ShardAttribute,
|
|
1474
2226
|
/** Derived GSI1 sort key — name-based when extractable; else `<lastUpdated>#<id>`. */
|
|
1475
2227
|
gsi1sk: gsi1skAttribute,
|
|
@@ -1574,6 +2326,26 @@ var UserEntity = new import_electrodb12.Entity({
|
|
|
1574
2326
|
type: "string",
|
|
1575
2327
|
required: true
|
|
1576
2328
|
},
|
|
2329
|
+
/**
|
|
2330
|
+
* ADR-028 denormalized counter — number of tenant-scoped Memberships
|
|
2331
|
+
* (tenants) this user belongs to. Maintained by the
|
|
2332
|
+
* counter-maintenance consumer via atomic ADD; absent/0 until first
|
|
2333
|
+
* event or reconciliation.
|
|
2334
|
+
*/
|
|
2335
|
+
tenantsForUser: {
|
|
2336
|
+
type: "number",
|
|
2337
|
+
required: false
|
|
2338
|
+
},
|
|
2339
|
+
/**
|
|
2340
|
+
* ADR-028 denormalized counter — number of workspace-scoped
|
|
2341
|
+
* Memberships (workspaces) this user belongs to. Maintained by the
|
|
2342
|
+
* counter-maintenance consumer via atomic ADD; absent/0 until first
|
|
2343
|
+
* event or reconciliation.
|
|
2344
|
+
*/
|
|
2345
|
+
workspacesForUser: {
|
|
2346
|
+
type: "number",
|
|
2347
|
+
required: false
|
|
2348
|
+
},
|
|
1577
2349
|
gsi1Shard: gsi1ShardAttribute,
|
|
1578
2350
|
/** Derived GSI1 sort key — name-based when extractable; else `<lastUpdated>#<id>`. */
|
|
1579
2351
|
gsi1sk: gsi1skAttribute,
|
|
@@ -1718,6 +2490,36 @@ var WorkspaceEntity = new import_electrodb13.Entity({
|
|
|
1718
2490
|
type: "string",
|
|
1719
2491
|
required: true
|
|
1720
2492
|
},
|
|
2493
|
+
/**
|
|
2494
|
+
* ADR-028 denormalized counter — number of workspace-scoped
|
|
2495
|
+
* Memberships (users) in this workspace. Maintained by the
|
|
2496
|
+
* counter-maintenance consumer via atomic ADD; absent/0 until first
|
|
2497
|
+
* event or reconciliation.
|
|
2498
|
+
*/
|
|
2499
|
+
usersInWorkspace: {
|
|
2500
|
+
type: "number",
|
|
2501
|
+
required: false
|
|
2502
|
+
},
|
|
2503
|
+
/**
|
|
2504
|
+
* ADR-028 denormalized counter — number of workspace-scoped
|
|
2505
|
+
* RoleAssignments classified as admin-tier in this workspace.
|
|
2506
|
+
* Maintained by the counter-maintenance consumer via atomic ADD;
|
|
2507
|
+
* absent/0 until first event or reconciliation.
|
|
2508
|
+
*/
|
|
2509
|
+
adminUsersInWorkspace: {
|
|
2510
|
+
type: "number",
|
|
2511
|
+
required: false
|
|
2512
|
+
},
|
|
2513
|
+
/**
|
|
2514
|
+
* ADR-028 denormalized counter — number of workspace-scoped
|
|
2515
|
+
* RoleAssignments classified as non-admin in this workspace.
|
|
2516
|
+
* Maintained by the counter-maintenance consumer via atomic ADD;
|
|
2517
|
+
* absent/0 until first event or reconciliation.
|
|
2518
|
+
*/
|
|
2519
|
+
normalUsersInWorkspace: {
|
|
2520
|
+
type: "number",
|
|
2521
|
+
required: false
|
|
2522
|
+
},
|
|
1721
2523
|
gsi1Shard: gsi1ShardAttribute,
|
|
1722
2524
|
/** Derived GSI1 sort key — name-based when extractable; else `<lastUpdated>#<id>`. */
|
|
1723
2525
|
gsi1sk: gsi1skAttribute,
|
|
@@ -1940,6 +2742,63 @@ var ConflictError = class extends DomainError {
|
|
|
1940
2742
|
}
|
|
1941
2743
|
};
|
|
1942
2744
|
|
|
2745
|
+
// src/data/operations/control/control-event-publisher.ts
|
|
2746
|
+
var import_client_eventbridge = require("@aws-sdk/client-eventbridge");
|
|
2747
|
+
var import_workflows = __toESM(require_lib());
|
|
2748
|
+
var CONTROL_EVENT_BUS_NAME_ENV_VAR = "CONTROL_EVENT_BUS_NAME";
|
|
2749
|
+
var cachedClient;
|
|
2750
|
+
function getClient() {
|
|
2751
|
+
if (!cachedClient) {
|
|
2752
|
+
cachedClient = new import_client_eventbridge.EventBridgeClient({
|
|
2753
|
+
region: process.env.AWS_REGION ?? "us-east-1"
|
|
2754
|
+
});
|
|
2755
|
+
}
|
|
2756
|
+
return cachedClient;
|
|
2757
|
+
}
|
|
2758
|
+
function actorFromContext(context) {
|
|
2759
|
+
return {
|
|
2760
|
+
ohi_tid: context.tenantId,
|
|
2761
|
+
ohi_wid: context.workspaceId,
|
|
2762
|
+
ohi_uid: context.actorId,
|
|
2763
|
+
ohi_uname: context.actorName
|
|
2764
|
+
};
|
|
2765
|
+
}
|
|
2766
|
+
async function publishControlEvent(entry, payload, context) {
|
|
2767
|
+
const busName = process.env[CONTROL_EVENT_BUS_NAME_ENV_VAR];
|
|
2768
|
+
if (!busName) {
|
|
2769
|
+
return;
|
|
2770
|
+
}
|
|
2771
|
+
try {
|
|
2772
|
+
await (0, import_workflows.publishWorkflowEvent)(
|
|
2773
|
+
getClient(),
|
|
2774
|
+
entry,
|
|
2775
|
+
payload,
|
|
2776
|
+
{ actor: actorFromContext(context) },
|
|
2777
|
+
{ busNameByPlane: { [import_workflows.OPENHI_CONTROL_SOURCE]: busName } }
|
|
2778
|
+
);
|
|
2779
|
+
} catch (err) {
|
|
2780
|
+
console.error(`control-event publish failed for ${entry.detailType}:`, err);
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
async function publishMembershipCreated(context, detail) {
|
|
2784
|
+
await publishControlEvent(import_workflows.ControlPlaneMembershipCreatedV1, detail, context);
|
|
2785
|
+
}
|
|
2786
|
+
async function publishRoleAssignmentCreated(context, detail) {
|
|
2787
|
+
await publishControlEvent(
|
|
2788
|
+
import_workflows.ControlPlaneRoleAssignmentCreatedV1,
|
|
2789
|
+
detail,
|
|
2790
|
+
context
|
|
2791
|
+
);
|
|
2792
|
+
}
|
|
2793
|
+
async function publishWorkspaceCreated(context, detail) {
|
|
2794
|
+
await publishControlEvent(import_workflows.ControlPlaneWorkspaceCreatedV1, detail, context);
|
|
2795
|
+
}
|
|
2796
|
+
function extractRoleLevel(resource) {
|
|
2797
|
+
const code = resource?.code;
|
|
2798
|
+
const first = code?.coding?.[0]?.code;
|
|
2799
|
+
return typeof first === "string" && first.length > 0 ? first : void 0;
|
|
2800
|
+
}
|
|
2801
|
+
|
|
1943
2802
|
// src/data/operations/control/denormalized-display-names.ts
|
|
1944
2803
|
function extractDenormalizedReferenceDisplay(resource, fieldName) {
|
|
1945
2804
|
const field = resource[fieldName];
|
|
@@ -2173,6 +3032,14 @@ async function createMembershipOperation(params) {
|
|
|
2173
3032
|
});
|
|
2174
3033
|
}
|
|
2175
3034
|
await executeMultiWrite({ service, triples });
|
|
3035
|
+
await publishMembershipCreated(context, {
|
|
3036
|
+
membershipId: id,
|
|
3037
|
+
tenantId: context.tenantId,
|
|
3038
|
+
...userIdFromResource !== void 0 && { userId: userIdFromResource },
|
|
3039
|
+
...workspaceIdFromResource !== void 0 && {
|
|
3040
|
+
workspaceId: workspaceIdFromResource
|
|
3041
|
+
}
|
|
3042
|
+
});
|
|
2176
3043
|
return {
|
|
2177
3044
|
id,
|
|
2178
3045
|
resource,
|
|
@@ -2401,6 +3268,18 @@ async function createRoleAssignmentOperation(params) {
|
|
|
2401
3268
|
});
|
|
2402
3269
|
}
|
|
2403
3270
|
await executeMultiWrite({ service, triples });
|
|
3271
|
+
await publishRoleAssignmentCreated(context, {
|
|
3272
|
+
roleAssignmentId: id,
|
|
3273
|
+
tenantId: context.tenantId,
|
|
3274
|
+
...userIdFromResource !== void 0 && { userId: userIdFromResource },
|
|
3275
|
+
...workspaceIdFromResource !== void 0 && {
|
|
3276
|
+
workspaceId: workspaceIdFromResource
|
|
3277
|
+
},
|
|
3278
|
+
...roleIdFromResource !== void 0 && { roleId: roleIdFromResource },
|
|
3279
|
+
...extractRoleLevel(resourceRecord) !== void 0 && {
|
|
3280
|
+
roleLevel: extractRoleLevel(resourceRecord)
|
|
3281
|
+
}
|
|
3282
|
+
});
|
|
2404
3283
|
return {
|
|
2405
3284
|
id,
|
|
2406
3285
|
resource,
|
|
@@ -3639,6 +4518,10 @@ async function createWorkspaceOperation(params) {
|
|
|
3639
4518
|
workspaceName,
|
|
3640
4519
|
tableName
|
|
3641
4520
|
});
|
|
4521
|
+
await publishWorkspaceCreated(context, {
|
|
4522
|
+
workspaceId: id,
|
|
4523
|
+
tenantId
|
|
4524
|
+
});
|
|
3642
4525
|
return { id, resource, meta: { lastUpdated, versionId: vid } };
|
|
3643
4526
|
}
|
|
3644
4527
|
|