@memberjunction/work-queue-base 0.0.1-seed.1 → 6.2.0-edge.3

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.
Files changed (51) hide show
  1. package/LICENSE +183 -0
  2. package/dist/WorkQueueEngineBase.d.ts +40 -0
  3. package/dist/WorkQueueEngineBase.d.ts.map +1 -0
  4. package/dist/WorkQueueEngineBase.js +87 -0
  5. package/dist/WorkQueueEngineBase.js.map +1 -0
  6. package/dist/constants.d.ts +12 -0
  7. package/dist/constants.d.ts.map +1 -0
  8. package/dist/constants.js +12 -0
  9. package/dist/constants.js.map +1 -0
  10. package/dist/entities/validation.d.ts +14 -0
  11. package/dist/entities/validation.d.ts.map +1 -0
  12. package/dist/entities/validation.js +70 -0
  13. package/dist/entities/validation.js.map +1 -0
  14. package/dist/index.d.ts +9 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +9 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/json.d.ts +4 -0
  19. package/dist/json.d.ts.map +1 -0
  20. package/dist/json.js +17 -0
  21. package/dist/json.js.map +1 -0
  22. package/dist/testing/SeededWorkQueueEngineBase.d.ts +22 -0
  23. package/dist/testing/SeededWorkQueueEngineBase.d.ts.map +1 -0
  24. package/dist/testing/SeededWorkQueueEngineBase.js +42 -0
  25. package/dist/testing/SeededWorkQueueEngineBase.js.map +1 -0
  26. package/dist/testing/index.d.ts +3 -0
  27. package/dist/testing/index.d.ts.map +1 -0
  28. package/dist/testing/index.js +3 -0
  29. package/dist/testing/index.js.map +1 -0
  30. package/dist/testing/rowFixtures.d.ts +6 -0
  31. package/dist/testing/rowFixtures.d.ts.map +1 -0
  32. package/dist/testing/rowFixtures.js +15 -0
  33. package/dist/testing/rowFixtures.js.map +1 -0
  34. package/dist/topology/bindings.d.ts +30 -0
  35. package/dist/topology/bindings.d.ts.map +1 -0
  36. package/dist/topology/bindings.js +68 -0
  37. package/dist/topology/bindings.js.map +1 -0
  38. package/dist/topology/manifest.d.ts +21 -0
  39. package/dist/topology/manifest.d.ts.map +1 -0
  40. package/dist/topology/manifest.js +76 -0
  41. package/dist/topology/manifest.js.map +1 -0
  42. package/dist/topology/rows.d.ts +41 -0
  43. package/dist/topology/rows.d.ts.map +1 -0
  44. package/dist/topology/rows.js +2 -0
  45. package/dist/topology/rows.js.map +1 -0
  46. package/dist/topology/validateTopology.d.ts +10 -0
  47. package/dist/topology/validateTopology.d.ts.map +1 -0
  48. package/dist/topology/validateTopology.js +82 -0
  49. package/dist/topology/validateTopology.js.map +1 -0
  50. package/package.json +39 -5
  51. package/README.md +0 -4
package/LICENSE ADDED
@@ -0,0 +1,183 @@
1
+ Business Source License 1.1
2
+
3
+ License text copyright (c) 2024 MariaDB plc, All Rights Reserved.
4
+ "Business Source License" is a trademark of MariaDB plc.
5
+
6
+ -----------------------------------------------------------------------------
7
+
8
+ Parameters
9
+
10
+ Licensor: Blue Cypress, Inc.
11
+
12
+ Licensed Work: MemberJunction.
13
+ The Licensed Work is (c) 2023-2026 Blue Cypress, Inc.
14
+
15
+ Additional Use Grant: Subject to the terms of this License, Licensor grants
16
+ you the following additional rights to make Production
17
+ Use of the Licensed Work.
18
+
19
+ 1. Internal Use
20
+
21
+ You may make production use of the Licensed Work for
22
+ your own internal business or organizational operations.
23
+
24
+ 2. Nonprofit Use
25
+
26
+ If you are a Nonprofit, you may make production use of
27
+ the Licensed Work for the operations and activities of
28
+ your Organizational Family.
29
+
30
+ 3. MemberJunction Certified Program Use
31
+
32
+ If you are authorized by Licensor under the
33
+ MemberJunction Certified Program to provide professional
34
+ services using the Licensed Work, you may make
35
+ production use of the Licensed Work in providing such
36
+ professional services to a client, provided that:
37
+
38
+ (a) the Licensed Work is deployed in, and the applicable
39
+ production use occurs within, an environment owned,
40
+ leased, licensed, subscribed to, or otherwise controlled
41
+ by that client; and
42
+
43
+ (b) the production use is for that client's own internal
44
+ business or organizational operations or is otherwise
45
+ independently permitted to that client under this
46
+ Additional Use Grant.
47
+
48
+ 4. Definitions Applicable to the Additional Use Grant
49
+
50
+ "Affiliate" means, with respect to a specified Person,
51
+ any other Person that directly or indirectly Controls,
52
+ is Controlled by, or is under common Control with such
53
+ specified Person.
54
+
55
+ "Control" (including the terms "Controls," "Controlled
56
+ by," and "under common Control with") means the direct
57
+ or indirect possession of the power to direct or cause
58
+ the direction of the management and policies of a
59
+ Person, whether through ownership of voting interests,
60
+ by contract, or otherwise.
61
+
62
+ "Organizational Family" means, with respect to a Person,
63
+ (a) such Person and its Affiliates, and (b) any
64
+ nonprofit organization, governmental entity, chapter,
65
+ division, local affiliate, regional affiliate, state
66
+ affiliate, national affiliate, or other entity that is
67
+ formally affiliated with such Person through governing
68
+ documents, a charter, bylaws, a membership agreement, or
69
+ another written organizational instrument, and is
70
+ recognized under such documents as part of the same
71
+ organizational structure.
72
+
73
+ "Nonprofit" means a Person recognized by the Internal
74
+ Revenue Service as exempt from federal income taxation
75
+ under Section 501(c)(3), 501(c)(4), 501(c)(5), or
76
+ 501(c)(6) of the Internal Revenue Code, or a foreign
77
+ organization recognized under substantially equivalent
78
+ laws.
79
+
80
+ A Person claiming eligibility as a Nonprofit shall, upon
81
+ Licensor's reasonable request, provide documentation
82
+ reasonably sufficient to demonstrate that it qualifies
83
+ as a Nonprofit. If such Person materially misrepresents,
84
+ or is unable to demonstrate, its qualification as a
85
+ Nonprofit, the rights granted to such Person under
86
+ Section 2 of this Additional Use Grant shall terminate.
87
+
88
+ "MemberJunction Certified Program" means Licensor's
89
+ then-current program for certifying and authorizing a
90
+ Person to provide professional services using the
91
+ Licensed Work.
92
+
93
+ "Person" means any individual, corporation, limited
94
+ liability company, partnership, association, nonprofit
95
+ organization, governmental entity, or other legal or
96
+ organizational entity.
97
+
98
+ Change Date: Four (4) years from the date the Licensed Work is first
99
+ made available.
100
+
101
+ Change License: MIT License.
102
+
103
+ For information about alternative licensing arrangements for the Licensed
104
+ Work, please contact Blue Cypress, Inc.
105
+
106
+ -----------------------------------------------------------------------------
107
+
108
+ Terms
109
+
110
+ The Licensor hereby grants you the right to copy, modify, create derivative
111
+ works, redistribute, and make non-production use of the Licensed Work. The
112
+ Licensor may make an Additional Use Grant, above, permitting limited
113
+ production use.
114
+
115
+ Effective on the Change Date, or the fourth anniversary of the first publicly
116
+ available distribution of a specific version of the Licensed Work under this
117
+ License, whichever comes first, the Licensor hereby grants you rights under
118
+ the terms of the Change License, and the rights granted in the paragraph
119
+ above terminate.
120
+
121
+ If your use of the Licensed Work does not comply with the requirements
122
+ currently in effect as described in this License, you must purchase a
123
+ commercial license from the Licensor, its affiliated entities, or authorized
124
+ resellers, or you must refrain from using the Licensed Work.
125
+
126
+ All copies of the original and modified Licensed Work, and derivative works
127
+ of the Licensed Work, are subject to this License. This License applies
128
+ separately for each version of the Licensed Work and the Change Date may vary
129
+ for each version of the Licensed Work released by Licensor.
130
+
131
+ You must conspicuously display this License on each original or modified copy
132
+ of the Licensed Work. If you receive the Licensed Work in original or
133
+ modified form from a third party, the terms and conditions set forth in this
134
+ License apply to your use of that work.
135
+
136
+ Any use of the Licensed Work in violation of this License will automatically
137
+ terminate your rights under this License for the current and all other
138
+ versions of the Licensed Work.
139
+
140
+ This License does not grant you any right in any trademark or logo of
141
+ Licensor or its affiliates (provided that you may use a trademark or logo of
142
+ Licensor as expressly required by this License).
143
+
144
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
145
+ AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
146
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
147
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
148
+ TITLE.
149
+
150
+ MariaDB hereby grants you permission to use this License's text to license
151
+ your works, and to refer to it using the trademark "Business Source License",
152
+ as long as you comply with the Covenants of Licensor below.
153
+
154
+ -----------------------------------------------------------------------------
155
+
156
+ Covenants of Licensor
157
+
158
+ In consideration of the right to use this License's text and the "Business
159
+ Source License" name and trademark, Licensor covenants to MariaDB, and to all
160
+ other recipients of the licensed work to be provided by Licensor:
161
+
162
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
163
+ or a license that is compatible with GPL Version 2.0 or a later version,
164
+ where "compatible" means that software provided under the Change License
165
+ can be included in a program with software provided under GPL Version 2.0
166
+ or a later version. Licensor may specify additional Change Licenses without
167
+ limitation.
168
+
169
+ 2. To either: (a) specify an additional grant of rights to use that does not
170
+ impose any additional restriction on the right granted in this License, as
171
+ the Additional Use Grant; or (b) insert the text "None".
172
+
173
+ 3. To specify a Change Date.
174
+
175
+ 4. Not to modify this License in any other way.
176
+
177
+ -----------------------------------------------------------------------------
178
+
179
+ Notice
180
+
181
+ The Business Source License (this document, or the "License") is not an Open
182
+ Source license. However, the Licensed Work will eventually be made available
183
+ under an Open Source License, as stated in this License.
@@ -0,0 +1,40 @@
1
+ import { BaseEngine } from '@memberjunction/core';
2
+ import type { IMetadataProvider, UserInfo } from '@memberjunction/core';
3
+ import type { MJWorkQueueSubscriptionEntity, MJWorkQueueTopicEntity, MJWorkQueueTransportEntity } from '@memberjunction/core-entities';
4
+ import type { BindingValidationIssue, FilterSupport, SubscriptionBinding, SubscriptionFilter, SubscriptionPolicy, TopicBinding, TransportCapabilities } from '@memberjunction/work-queue-core';
5
+ import type { TopologySnapshot } from './topology/bindings.js';
6
+ /**
7
+ * Browser-safe metadata tier for the work queue (03 §11): the cached topology plus the pure derivations over it.
8
+ * The server tier (`WorkQueueEngine` in @memberjunction/work-queue-engine) delegates to this instance; Explorer and
9
+ * the operator dashboard use it directly, with no drivers, SQL or Node dependencies.
10
+ */
11
+ export declare class WorkQueueEngineBase extends BaseEngine<WorkQueueEngineBase> {
12
+ static get Instance(): WorkQueueEngineBase;
13
+ private _transports;
14
+ private _topics;
15
+ private _subscriptions;
16
+ Config(forceRefresh?: boolean, contextUser?: UserInfo, provider?: IMetadataProvider): Promise<void>;
17
+ get Transports(): MJWorkQueueTransportEntity[];
18
+ get Topics(): MJWorkQueueTopicEntity[];
19
+ get Subscriptions(): MJWorkQueueSubscriptionEntity[];
20
+ /** The row view the pure topology helpers work over. */
21
+ get Snapshot(): TopologySnapshot;
22
+ /** Trimmed, case-insensitive. */
23
+ GetTopicByName(name: string): MJWorkQueueTopicEntity | undefined;
24
+ GetSubscriptionByName(name: string): MJWorkQueueSubscriptionEntity | undefined;
25
+ SubscriptionsForTopic(topicID: string): MJWorkQueueSubscriptionEntity[];
26
+ TopicOf(subscription: MJWorkQueueSubscriptionEntity): MJWorkQueueTopicEntity | undefined;
27
+ TransportOf(topic: MJWorkQueueTopicEntity): MJWorkQueueTransportEntity | undefined;
28
+ BuildTopicBinding(topic: MJWorkQueueTopicEntity): TopicBinding;
29
+ BuildSubscriptionBinding(subscription: MJWorkQueueSubscriptionEntity, support?: FilterSupport): SubscriptionBinding;
30
+ BuildSubscriptionPolicy(subscription: MJWorkQueueSubscriptionEntity): SubscriptionPolicy;
31
+ /** Parses the subscription's CompositeFilterDescriptor JSON against the transport's supported subset (03 §4). */
32
+ ParseFilter(subscription: MJWorkQueueSubscriptionEntity, support: FilterSupport): SubscriptionFilter | null;
33
+ /**
34
+ * Validates the cached topology against capabilities supplied per `Transport.DriverClass` (03 §11). A browser
35
+ * caller passes a static table; the server engine passes what its resolved drivers report.
36
+ */
37
+ ValidateTopologyRows(capabilitiesByDriverClass: Record<string, TransportCapabilities>): BindingValidationIssue[];
38
+ private requireTopic;
39
+ }
40
+ //# sourceMappingURL=WorkQueueEngineBase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkQueueEngineBase.d.ts","sourceRoot":"","sources":["../src/WorkQueueEngineBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,EAA4B,iBAAiB,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAClG,OAAO,K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,6BAA6B,EAC3C,OAAO,GAAE,aAAyC,GAAG,mBAAmB;IAIjG,uBAAuB,CAAC,YAAY,EAAE,6BAA6B,GAAG,kBAAkB;IAI/F,iHAAiH;IAC1G,WAAW,CAAC,YAAY,EAAE,6BAA6B,EAAE,OAAO,EAAE,aAAa,GAAG,kBAAkB,GAAG,IAAI;IAIlH;;;OAGG;IACI,oBAAoB,CAAC,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,GAAG,sBAAsB,EAAE;IAIvH,OAAO,CAAC,YAAY;CAOvB"}
@@ -0,0 +1,87 @@
1
+ import { BaseEngine } from '@memberjunction/core';
2
+ import { UUIDsEqual } from '@memberjunction/global';
3
+ import { WORK_QUEUE_FILTER_SUPPORT, WorkQueueConfigurationError } from '@memberjunction/work-queue-core';
4
+ import { WorkQueueEntityNames } from './constants.js';
5
+ import { FindByID, FindByName, ToSubscriptionBinding, ToSubscriptionPolicy, ToTopicBinding } from './topology/bindings.js';
6
+ import { ValidateTopologyRows } from './topology/validateTopology.js';
7
+ /**
8
+ * Browser-safe metadata tier for the work queue (03 §11): the cached topology plus the pure derivations over it.
9
+ * The server tier (`WorkQueueEngine` in @memberjunction/work-queue-engine) delegates to this instance; Explorer and
10
+ * the operator dashboard use it directly, with no drivers, SQL or Node dependencies.
11
+ */
12
+ export class WorkQueueEngineBase extends BaseEngine {
13
+ constructor() {
14
+ super(...arguments);
15
+ this._transports = [];
16
+ this._topics = [];
17
+ this._subscriptions = [];
18
+ }
19
+ static get Instance() {
20
+ return super.getInstance();
21
+ }
22
+ async Config(forceRefresh, contextUser, provider) {
23
+ const configs = [
24
+ { Type: 'entity', EntityName: WorkQueueEntityNames.Transports, PropertyName: '_transports', CacheLocal: true },
25
+ { Type: 'entity', EntityName: WorkQueueEntityNames.Topics, PropertyName: '_topics', CacheLocal: true },
26
+ { Type: 'entity', EntityName: WorkQueueEntityNames.Subscriptions, PropertyName: '_subscriptions', CacheLocal: true },
27
+ ];
28
+ await this.Load(configs, provider, forceRefresh, contextUser);
29
+ }
30
+ get Transports() {
31
+ return this.GetConfigData('_transports');
32
+ }
33
+ get Topics() {
34
+ return this.GetConfigData('_topics');
35
+ }
36
+ get Subscriptions() {
37
+ return this.GetConfigData('_subscriptions');
38
+ }
39
+ /** The row view the pure topology helpers work over. */
40
+ get Snapshot() {
41
+ return { Transports: this.Transports, Topics: this.Topics, Subscriptions: this.Subscriptions };
42
+ }
43
+ /** Trimmed, case-insensitive. */
44
+ GetTopicByName(name) {
45
+ return FindByName(this.Topics, name);
46
+ }
47
+ GetSubscriptionByName(name) {
48
+ return FindByName(this.Subscriptions, name);
49
+ }
50
+ SubscriptionsForTopic(topicID) {
51
+ return this.Subscriptions.filter(s => UUIDsEqual(s.TopicID, topicID));
52
+ }
53
+ TopicOf(subscription) {
54
+ return FindByID(this.Topics, subscription.TopicID);
55
+ }
56
+ TransportOf(topic) {
57
+ return FindByID(this.Transports, topic.TransportID);
58
+ }
59
+ BuildTopicBinding(topic) {
60
+ return ToTopicBinding(topic);
61
+ }
62
+ BuildSubscriptionBinding(subscription, support = WORK_QUEUE_FILTER_SUPPORT) {
63
+ return ToSubscriptionBinding(subscription, this.requireTopic(subscription), support);
64
+ }
65
+ BuildSubscriptionPolicy(subscription) {
66
+ return ToSubscriptionPolicy(subscription, this.requireTopic(subscription));
67
+ }
68
+ /** Parses the subscription's CompositeFilterDescriptor JSON against the transport's supported subset (03 §4). */
69
+ ParseFilter(subscription, support) {
70
+ return this.BuildSubscriptionBinding(subscription, support).Filter;
71
+ }
72
+ /**
73
+ * Validates the cached topology against capabilities supplied per `Transport.DriverClass` (03 §11). A browser
74
+ * caller passes a static table; the server engine passes what its resolved drivers report.
75
+ */
76
+ ValidateTopologyRows(capabilitiesByDriverClass) {
77
+ return ValidateTopologyRows(this.Snapshot, capabilitiesByDriverClass);
78
+ }
79
+ requireTopic(subscription) {
80
+ const topic = this.TopicOf(subscription);
81
+ if (!topic) {
82
+ throw new WorkQueueConfigurationError(`Subscription '${subscription.Name}' references a topic that does not exist`);
83
+ }
84
+ return topic;
85
+ }
86
+ }
87
+ //# sourceMappingURL=WorkQueueEngineBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkQueueEngineBase.js","sourceRoot":"","sources":["../src/WorkQueueEngineBase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAKzG,OAAO,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAExH,OAAO,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAEnE;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,UAA+B;IAAxE;;QAKY,gBAAW,GAAiC,EAAE,CAAC;QAC/C,YAAO,GAA6B,EAAE,CAAC;QACvC,mBAAc,GAAoC,EAAE,CAAC;IAkFjE,CAAC;IAxFU,MAAM,KAAK,QAAQ;QACtB,OAAO,KAAK,CAAC,WAAW,EAAuB,CAAC;IACpD,CAAC;IAMM,KAAK,CAAC,MAAM,CAAC,YAAsB,EAAE,WAAsB,EAAE,QAA4B;QAC5F,MAAM,OAAO,GAAwC;YACjD,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,oBAAoB,CAAC,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,IAAI,EAAE;YAC9G,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE;YACtG,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,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,CAAC,CAAC;IACxD,CAAC;IAEM,iBAAiB,CAAC,KAA6B;QAClD,OAAO,cAAc,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;IAEM,wBAAwB,CAAC,YAA2C,EAC3C,UAAyB,yBAAyB;QAC9E,OAAO,qBAAqB,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC;IACzF,CAAC;IAEM,uBAAuB,CAAC,YAA2C;QACtE,OAAO,oBAAoB,CAAC,YAAY,EAAE,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;IAC/E,CAAC;IAED,iHAAiH;IAC1G,WAAW,CAAC,YAA2C,EAAE,OAAsB;QAClF,OAAO,IAAI,CAAC,wBAAwB,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC;IACvE,CAAC;IAED;;;OAGG;IACI,oBAAoB,CAAC,yBAAgE;QACxF,OAAO,oBAAoB,CAAC,IAAI,CAAC,QAAQ,EAAE,yBAAyB,CAAC,CAAC;IAC1E,CAAC;IAEO,YAAY,CAAC,YAA2C;QAC5D,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;QACzC,IAAI,CAAC,KAAK,EAAE,CAAC;YACT,MAAM,IAAI,2BAA2B,CAAC,iBAAiB,YAAY,CAAC,IAAI,0CAA0C,CAAC,CAAC;QACxH,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ"}
@@ -0,0 +1,12 @@
1
+ /** Generated entity names for the work-queue tables (Task 1). Verify against the generated entity subclasses. */
2
+ export declare const WorkQueueEntityNames: {
3
+ readonly Transports: "MJ: Work Queue Transports";
4
+ readonly Topics: "MJ: Work Queue Topics";
5
+ readonly Subscriptions: "MJ: Work Queue Subscriptions";
6
+ readonly Messages: "MJ: Work Queue Messages";
7
+ readonly Deliveries: "MJ: Work Queue Deliveries";
8
+ readonly Deduplications: "MJ: Work Queue Deduplications";
9
+ };
10
+ /** Transport.DriverClass of the built-in Database transport. */
11
+ export declare const DATABASE_DRIVER_CLASS = "Database";
12
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,eAAO,MAAM,oBAAoB;;;;;;;CAOvB,CAAC;AAEX,gEAAgE;AAChE,eAAO,MAAM,qBAAqB,aAAa,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** Generated entity names for the work-queue tables (Task 1). Verify against the generated entity subclasses. */
2
+ export const WorkQueueEntityNames = {
3
+ Transports: 'MJ: Work Queue Transports',
4
+ Topics: 'MJ: Work Queue Topics',
5
+ Subscriptions: 'MJ: Work Queue Subscriptions',
6
+ Messages: 'MJ: Work Queue Messages',
7
+ Deliveries: 'MJ: Work Queue Deliveries',
8
+ Deduplications: 'MJ: Work Queue Deduplications',
9
+ };
10
+ /** Transport.DriverClass of the built-in Database transport. */
11
+ export const DATABASE_DRIVER_CLASS = 'Database';
12
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAChC,UAAU,EAAE,2BAA2B;IACvC,MAAM,EAAE,uBAAuB;IAC/B,aAAa,EAAE,8BAA8B;IAC7C,QAAQ,EAAE,yBAAyB;IACnC,UAAU,EAAE,2BAA2B;IACvC,cAAc,EAAE,+BAA+B;CACzC,CAAC;AAEX,gEAAgE;AAChE,MAAM,CAAC,MAAM,qBAAqB,GAAG,UAAU,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { WorkJson } from '@memberjunction/work-queue-core';
2
+ import type { SubscriptionRow, TopicRow, TransportRow } from '../topology/rows.js';
3
+ export interface FieldIssue {
4
+ Field: string;
5
+ Message: string;
6
+ Value: string | number | null;
7
+ }
8
+ /** Parses a JSON-object column. Null or blank text is an empty object. */
9
+ export declare function ParseJsonObject(json: string | null, subject: string): Record<string, WorkJson>;
10
+ /** Field rules that need no transport driver; everything that does is `WorkQueueEngine.ValidateTopology`. */
11
+ export declare function ValidateTransportFields(row: TransportRow): FieldIssue[];
12
+ export declare function ValidateTopicFields(row: TopicRow): FieldIssue[];
13
+ export declare function ValidateSubscriptionFields(row: SubscriptionRow): FieldIssue[];
14
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/entities/validation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhF,MAAM,WAAW,UAAU;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACjC;AAID,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAoB9F;AAED,6GAA6G;AAC7G,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,YAAY,GAAG,UAAU,EAAE,CAEvE;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,QAAQ,GAAG,UAAU,EAAE,CAO/D;AAED,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,eAAe,GAAG,UAAU,EAAE,CAoB7E"}
@@ -0,0 +1,70 @@
1
+ import { ParseSubscriptionFilter, WORK_QUEUE_FILTER_SUPPORT, WorkQueueConfigurationError } from '@memberjunction/work-queue-core';
2
+ import { IsWorkJson } from '../json.js';
3
+ const TOPIC_NAME_PATTERN = /^[a-z0-9]+([._-][a-z0-9]+)*$/;
4
+ /** Parses a JSON-object column. Null or blank text is an empty object. */
5
+ export function ParseJsonObject(json, subject) {
6
+ if (json === null || json.trim() === '') {
7
+ return {};
8
+ }
9
+ let parsed;
10
+ try {
11
+ parsed = JSON.parse(json);
12
+ }
13
+ catch (error) {
14
+ throw new WorkQueueConfigurationError(`${subject} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
15
+ }
16
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed) || !IsWorkJson(parsed)) {
17
+ throw new WorkQueueConfigurationError(`${subject} must be a JSON object`);
18
+ }
19
+ const result = {};
20
+ for (const [key, value] of Object.entries(parsed)) {
21
+ if (IsWorkJson(value)) {
22
+ result[key] = value;
23
+ }
24
+ }
25
+ return result;
26
+ }
27
+ /** Field rules that need no transport driver; everything that does is `WorkQueueEngine.ValidateTopology`. */
28
+ export function ValidateTransportFields(row) {
29
+ return JsonObjectIssue('Configuration', row.Configuration, `Transport ${row.Name} Configuration`);
30
+ }
31
+ export function ValidateTopicFields(row) {
32
+ const issues = [];
33
+ if (!TOPIC_NAME_PATTERN.test(row.Name ?? '')) {
34
+ issues.push({ Field: 'Name', Message: 'Topic names are dotted lowercase words, for example email.events', Value: row.Name });
35
+ }
36
+ issues.push(...JsonObjectIssue('BindingConfig', row.BindingConfig, `Topic ${row.Name} BindingConfig`));
37
+ return issues;
38
+ }
39
+ export function ValidateSubscriptionFields(row) {
40
+ const issues = [];
41
+ if (row.HostType === 'MJWorker' && (row.HandlerKey ?? '').trim() === '') {
42
+ issues.push({ Field: 'HandlerKey', Message: 'MJWorker subscriptions require a HandlerKey', Value: row.HandlerKey });
43
+ }
44
+ try {
45
+ // Structural check only: the whole queue-wide subset (03 §4.1). ValidateTopologyRows re-parses with the
46
+ // target transport's FilterSupport, so a filter the broker cannot express is caught there, not here.
47
+ ParseSubscriptionFilter(row.Filter, WORK_QUEUE_FILTER_SUPPORT);
48
+ }
49
+ catch (error) {
50
+ issues.push({ Field: 'Filter', Message: error instanceof Error ? error.message : String(error), Value: row.Filter });
51
+ }
52
+ if (row.BackoffMaxSeconds < row.BackoffBaseSeconds) {
53
+ issues.push({ Field: 'BackoffMaxSeconds', Message: 'BackoffMaxSeconds must be at least BackoffBaseSeconds', Value: row.BackoffMaxSeconds });
54
+ }
55
+ if (row.MaxProcessingSeconds !== null && row.MaxProcessingSeconds <= 0) {
56
+ issues.push({ Field: 'MaxProcessingSeconds', Message: 'MaxProcessingSeconds must be positive when set', Value: row.MaxProcessingSeconds });
57
+ }
58
+ issues.push(...JsonObjectIssue('BindingConfig', row.BindingConfig, `Subscription ${row.Name} BindingConfig`));
59
+ return issues;
60
+ }
61
+ function JsonObjectIssue(field, json, subject) {
62
+ try {
63
+ ParseJsonObject(json, subject);
64
+ return [];
65
+ }
66
+ catch (error) {
67
+ return [{ Field: field, Message: error instanceof Error ? error.message : String(error), Value: json }];
68
+ }
69
+ }
70
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/entities/validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAElI,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AASrC,MAAM,kBAAkB,GAAG,8BAA8B,CAAC;AAE1D,0EAA0E;AAC1E,MAAM,UAAU,eAAe,CAAC,IAAmB,EAAE,OAAe;IAChE,IAAI,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC;QACtC,OAAO,EAAE,CAAC;IACd,CAAC;IACD,IAAI,MAAe,CAAC;IACpB,IAAI,CAAC;QACD,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,MAAM,IAAI,2BAA2B,CAAC,GAAG,OAAO,u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AK,EAAE,GAAG,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAC/I,CAAC;IACD,MAAM,CAAC,IAAI,CAAC,GAAG,eAAe,CAAC,eAAe,EAAE,GAAG,CAAC,aAAa,EAAE,gBAAgB,GAAG,CAAC,IAAI,gBAAgB,CAAC,CAAC,CAAC;IAC9G,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,eAAe,CAAC,KAAa,EAAE,IAAmB,EAAE,OAAe;IACxE,IAAI,CAAC;QACD,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,EAAE,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,OAAO,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5G,CAAC;AACL,CAAC"}
@@ -0,0 +1,9 @@
1
+ export * from './constants.js';
2
+ export * from './json.js';
3
+ export * from './topology/rows.js';
4
+ export * from './entities/validation.js';
5
+ export * from './topology/bindings.js';
6
+ export * from './topology/validateTopology.js';
7
+ export * from './topology/manifest.js';
8
+ export * from './WorkQueueEngineBase.js';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,9 @@
1
+ export * from './constants.js';
2
+ export * from './json.js';
3
+ export * from './topology/rows.js';
4
+ export * from './entities/validation.js';
5
+ export * from './topology/bindings.js';
6
+ export * from './topology/validateTopology.js';
7
+ export * from './topology/manifest.js';
8
+ export * from './WorkQueueEngineBase.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC"}
package/dist/json.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import type { WorkJson } from '@memberjunction/work-queue-core';
2
+ /** True when a parsed value is JSON-safe for a work-queue payload or config column. */
3
+ export declare function IsWorkJson(value: unknown): value is WorkJson;
4
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iCAAiC,CAAC;AAEhE,uFAAuF;AACvF,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,QAAQ,CAc5D"}
package/dist/json.js ADDED
@@ -0,0 +1,17 @@
1
+ /** True when a parsed value is JSON-safe for a work-queue payload or config column. */
2
+ export function IsWorkJson(value) {
3
+ if (value === null || typeof value === 'string' || typeof value === 'boolean') {
4
+ return true;
5
+ }
6
+ if (typeof value === 'number') {
7
+ return Number.isFinite(value);
8
+ }
9
+ if (Array.isArray(value)) {
10
+ return value.every(IsWorkJson);
11
+ }
12
+ if (typeof value === 'object') {
13
+ return Object.values(value).every(IsWorkJson);
14
+ }
15
+ return false;
16
+ }
17
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAEA,uFAAuF;AACvF,MAAM,UAAU,UAAU,CAAC,KAAc;IACrC,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;QAC5E,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACnC,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { UserInfo } from '@memberjunction/core';
2
+ import type { MJWorkQueueSubscriptionEntity, MJWorkQueueTopicEntity, MJWorkQueueTransportEntity } from '@memberjunction/core-entities';
3
+ import type { TopologySnapshot } from '../topology/bindings.js';
4
+ import { WorkQueueEngineBase } from '../WorkQueueEngineBase.js';
5
+ /**
6
+ * TEST ONLY. Serves seeded rows instead of loading entities. The row fixtures are structural stand-ins for the
7
+ * generated entities — every derivation in WorkQueueEngineBase reads row fields only — which is why the three getters
8
+ * carry the one cast in this package.
9
+ */
10
+ export declare class SeededWorkQueueEngineBase extends WorkQueueEngineBase {
11
+ static get Instance(): SeededWorkQueueEngineBase;
12
+ private seeded;
13
+ private seededUser;
14
+ Seed(snapshot: TopologySnapshot, contextUser: UserInfo): void;
15
+ Config(): Promise<void>;
16
+ get Loaded(): boolean;
17
+ get ContextUser(): UserInfo;
18
+ get Transports(): MJWorkQueueTransportEntity[];
19
+ get Topics(): MJWorkQueueTopicEntity[];
20
+ get Subscriptions(): MJWorkQueueSubscriptionEntity[];
21
+ }
22
+ //# sourceMappingURL=SeededWorkQueueEngineBase.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SeededWorkQueueEngineBase.d.ts","sourceRoot":"","sources":["../../src/testing/SeededWorkQueueEngineBase.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,KAAK,EAAE,6BAA6B,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AACvI,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,mBAAmB;IAC9D,WAA2B,QAAQ,IAAI,yBAAyB,CAE/D;IAED,OAAO,CAAC,MAAM,CAAuE;IACrF,OAAO,CAAC,UAAU,CAAyB;IAEpC,IAAI,CAAC,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,GAAG,IAAI;IAK9C,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7C,IAAoB,MAAM,IAAI,OAAO,CAEpC;IAED,IAAoB,WAAW,IAAI,QAAQ,CAK1C;IAED,IAAoB,UAAU,IAAI,0BAA0B,EAAE,CAE7D;IAED,IAAoB,MAAM,IAAI,sBAAsB,EAAE,CAErD;IAED,IAAoB,aAAa,IAAI,6BAA6B,EAAE,CAEnE;CACJ"}
@@ -0,0 +1,42 @@
1
+ import { WorkQueueEngineBase } from '../WorkQueueEngineBase.js';
2
+ /**
3
+ * TEST ONLY. Serves seeded rows instead of loading entities. The row fixtures are structural stand-ins for the
4
+ * generated entities — every derivation in WorkQueueEngineBase reads row fields only — which is why the three getters
5
+ * carry the one cast in this package.
6
+ */
7
+ export class SeededWorkQueueEngineBase extends WorkQueueEngineBase {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.seeded = { Transports: [], Topics: [], Subscriptions: [] };
11
+ this.seededUser = null;
12
+ }
13
+ static get Instance() {
14
+ return super.getInstance();
15
+ }
16
+ Seed(snapshot, contextUser) {
17
+ this.seeded = snapshot;
18
+ this.seededUser = contextUser;
19
+ }
20
+ async Config() {
21
+ // Nothing to load: Seed() is the data source.
22
+ }
23
+ get Loaded() {
24
+ return true;
25
+ }
26
+ get ContextUser() {
27
+ if (!this.seededUser) {
28
+ throw new Error('SeededWorkQueueEngineBase.Seed() has not been called');
29
+ }
30
+ return this.seededUser;
31
+ }
32
+ get Transports() {
33
+ return this.seeded.Transports;
34
+ }
35
+ get Topics() {
36
+ return this.seeded.Topics;
37
+ }
38
+ get Subscriptions() {
39
+ return this.seeded.Subscriptions;
40
+ }
41
+ }
42
+ //# sourceMappingURL=SeededWorkQueueEngineBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SeededWorkQueueEngineBase.js","sourceRoot":"","sources":["../../src/testing/SeededWorkQueueEngineBase.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;;GAIG;AACH,MAAM,OAAO,yBAA0B,SAAQ,mBAAmB;IAAlE;;QAKY,WAAM,GAAqB,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC;QAC7E,eAAU,GAAoB,IAAI,CAAC;IAiC/C,CAAC;IAtCU,MAAM,KAAc,QAAQ;QAC/B,OAAO,KAAK,CAAC,WAAW,EAA6B,CAAC;IAC1D,CAAC;IAKM,IAAI,CAAC,QAA0B,EAAE,WAAqB;QACzD,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;QACvB,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC;IAClC,CAAC;IAEe,KAAK,CAAC,MAAM;QACxB,8CAA8C;IAClD,CAAC;IAED,IAAoB,MAAM;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAoB,WAAW;QAC3B,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;QAC5E,CAAC;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED,IAAoB,UAAU;QAC1B,OAAO,IAAI,CAAC,MAAM,CAAC,UAAqD,CAAC;IAC7E,CAAC;IAED,IAAoB,MAAM;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,MAA6C,CAAC;IACrE,CAAC;IAED,IAAoB,aAAa;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,aAA2D,CAAC;IACnF,CAAC;CACJ"}
@@ -0,0 +1,3 @@
1
+ export * from './rowFixtures.js';
2
+ export * from './SeededWorkQueueEngineBase.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './rowFixtures.js';
2
+ export * from './SeededWorkQueueEngineBase.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,6BAA6B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import type { SubscriptionRow, TopicRow, TransportRow } from '../topology/rows.js';
2
+ /** Row fixtures shared by the base, engine and runtime suites. Reachable only through `@memberjunction/work-queue-base/testing`. */
3
+ export declare const TRANSPORT_ROW_FIXTURE: TransportRow;
4
+ export declare const TOPIC_ROW_FIXTURE: TopicRow;
5
+ export declare const SUBSCRIPTION_ROW_FIXTURE: SubscriptionRow;
6
+ //# sourceMappingURL=rowFixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rowFixtures.d.ts","sourceRoot":"","sources":["../../src/testing/rowFixtures.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhF,oIAAoI;AACpI,eAAO,MAAM,qBAAqB,EAAE,YAEnC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,QAI/B,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,eAItC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /** Row fixtures shared by the base, engine and runtime suites. Reachable only through `@memberjunction/work-queue-base/testing`. */
2
+ export const TRANSPORT_ROW_FIXTURE = {
3
+ ID: 'D1ED3F08-7008-4DA8-BA2B-7CD6A820AEB5', Name: 'Database', DriverClass: 'Database', Configuration: null, CredentialID: null, Status: 'Active',
4
+ };
5
+ export const TOPIC_ROW_FIXTURE = {
6
+ ID: 'AAAAAAAA-0000-0000-0000-000000000001', Name: 'import.ready', TransportID: TRANSPORT_ROW_FIXTURE.ID,
7
+ IsFifo: false, AllowExternalPublish: false, MaxPayloadBytes: 262144, DefaultDeduplicationTTLSeconds: 86400, RetentionDays: 7,
8
+ BindingConfig: null, Status: 'Active',
9
+ };
10
+ export const SUBSCRIPTION_ROW_FIXTURE = {
11
+ ID: 'BBBBBBBB-0000-0000-0000-000000000001', TopicID: TOPIC_ROW_FIXTURE.ID, Name: 'venue-import', Filter: null, PartitionMode: 'Ordered',
12
+ MaxAttempts: 5, BackoffBaseSeconds: 10, BackoffMaxSeconds: 900, LeaseSeconds: 60, HeartbeatMode: 'Auto', MaxProcessingSeconds: null,
13
+ HostType: 'MJWorker', HandlerKey: 'VenueImport', ExternalRef: null, BindingConfig: null, Status: 'Active',
14
+ };
15
+ //# sourceMappingURL=rowFixtures.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rowFixtures.js","sourceRoot":"","sources":["../../src/testing/rowFixtures.ts"],"names":[],"mappings":"AAEA,oIAAoI;AACpI,MAAM,CAAC,MAAM,qBAAqB,GAAiB;IAC/C,EAAE,EAAE,sCAAsC,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ;CACnJ,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAa;IACvC,EAAE,EAAE,sCAAsC,EAAE,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,qBAAqB,CAAC,EAAE;IACvG,MAAM,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,8BAA8B,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;IAC5H,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ;CACxC,CAAC;AAEF,MAAM,CAAC,MAAM,wBAAwB,GAAoB;IACrD,EAAE,EAAE,sCAAsC,EAAE,OAAO,EAAE,iBAAiB,CAAC,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS;IACvI,WAAW,EAAE,CAAC,EAAE,kBAAkB,EAAE,EAAE,EAAE,iBAAiB,EAAE,GAAG,EAAE,YAAY,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,oBAAoB,EAAE,IAAI;IACnI,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ;CAC5G,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { FilterSupport, SubscriptionBinding, SubscriptionPolicy, TopicBinding } from '@memberjunction/work-queue-core';
2
+ import type { SubscriptionRow, TopicRow, TransportRow } from './rows.js';
3
+ export interface TopologySnapshot {
4
+ Transports: TransportRow[];
5
+ Topics: TopicRow[];
6
+ Subscriptions: SubscriptionRow[];
7
+ }
8
+ export interface ResolvedTopic {
9
+ Topic: TopicRow;
10
+ Transport: TransportRow;
11
+ Binding: TopicBinding;
12
+ Subscriptions: SubscriptionBinding[];
13
+ }
14
+ export declare function FindByName<T extends {
15
+ Name: string;
16
+ }>(rows: T[], name: string): T | undefined;
17
+ export declare function FindByID<T extends {
18
+ ID: string;
19
+ }>(rows: T[], id: string): T | undefined;
20
+ /** Binding convention: Config always carries the row ID (cloud drivers ignore it; the Database driver requires it). */
21
+ export declare function ToTopicBinding(topic: TopicRow): TopicBinding;
22
+ export declare function ToSubscriptionPolicy(subscription: SubscriptionRow, topic: TopicRow): SubscriptionPolicy;
23
+ /**
24
+ * `support` defaults to the queue-wide subset (03 §4.1) so callers that only need the shape need not know the
25
+ * transport. `ValidateTopologyRows` passes the transport's own `FilterSupport` to catch filters a broker cannot express.
26
+ */
27
+ export declare function ToSubscriptionBinding(subscription: SubscriptionRow, topic: TopicRow, support?: FilterSupport): SubscriptionBinding;
28
+ /** Resolves a topic for publishing. Throws WorkQueueConfigurationError when its transport or a subscription is misconfigured. */
29
+ export declare function ResolveTopic(snapshot: TopologySnapshot, topicName: string): ResolvedTopic | undefined;
30
+ //# sourceMappingURL=bindings.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../src/topology/bindings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE5H,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC7B,UAAU,EAAE,YAAY,EAAE,CAAC;IAC3B,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,aAAa,EAAE,eAAe,EAAE,CAAC;CACpC;AAED,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,QAAQ,CAAC;IAChB,SAAS,EAAE,YAAY,CAAC;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB,aAAa,EAAE,mBAAmB,EAAE,CAAC;CACxC;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAG7F;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,IAAI,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAGvF;AAED,uHAAuH;AACvH,wBAAgB,cAAc,CAAC,KAAK,EAAE,QAAQ,GAAG,YAAY,CAO5D;AAED,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,GAAG,kBAAkB,CAevG;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,EAC9C,OAAO,GAAE,aAAyC,GAAG,mBAAmB,CAW7G;AAED,iIAAiI;AACjI,wBAAgB,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAarG"}
@@ -0,0 +1,68 @@
1
+ import { NormalizeUUID, UUIDsEqual } from '@memberjunction/global';
2
+ import { ParseSubscriptionFilter, WORK_QUEUE_FILTER_SUPPORT, WorkQueueConfigurationError } from '@memberjunction/work-queue-core';
3
+ import { ParseJsonObject } from '../entities/validation.js';
4
+ export function FindByName(rows, name) {
5
+ const wanted = name.trim().toLowerCase();
6
+ return rows.find(r => r.Name.trim().toLowerCase() === wanted);
7
+ }
8
+ export function FindByID(rows, id) {
9
+ const wanted = NormalizeUUID(id);
10
+ return rows.find(r => NormalizeUUID(r.ID) === wanted);
11
+ }
12
+ /** Binding convention: Config always carries the row ID (cloud drivers ignore it; the Database driver requires it). */
13
+ export function ToTopicBinding(topic) {
14
+ return {
15
+ TopicName: topic.Name,
16
+ IsFifo: topic.IsFifo,
17
+ MaxPayloadBytes: topic.MaxPayloadBytes,
18
+ Config: { ...ParseJsonObject(topic.BindingConfig, `Topic ${topic.Name} BindingConfig`), TopicID: topic.ID },
19
+ };
20
+ }
21
+ export function ToSubscriptionPolicy(subscription, topic) {
22
+ const policy = {
23
+ SubscriptionName: subscription.Name,
24
+ TopicName: topic.Name,
25
+ PartitionMode: subscription.PartitionMode,
26
+ MaxAttempts: subscription.MaxAttempts,
27
+ BackoffBaseSeconds: subscription.BackoffBaseSeconds,
28
+ BackoffMaxSeconds: subscription.BackoffMaxSeconds,
29
+ LeaseSeconds: subscription.LeaseSeconds,
30
+ HeartbeatMode: subscription.HeartbeatMode,
31
+ };
32
+ if (subscription.MaxProcessingSeconds !== null) {
33
+ policy.MaxProcessingSeconds = subscription.MaxProcessingSeconds;
34
+ }
35
+ return policy;
36
+ }
37
+ /**
38
+ * `support` defaults to the queue-wide subset (03 §4.1) so callers that only need the shape need not know the
39
+ * transport. `ValidateTopologyRows` passes the transport's own `FilterSupport` to catch filters a broker cannot express.
40
+ */
41
+ export function ToSubscriptionBinding(subscription, topic, support = WORK_QUEUE_FILTER_SUPPORT) {
42
+ return {
43
+ Policy: ToSubscriptionPolicy(subscription, topic),
44
+ Filter: ParseSubscriptionFilter(subscription.Filter, support),
45
+ HostType: subscription.HostType,
46
+ Config: {
47
+ ...ParseJsonObject(subscription.BindingConfig, `Subscription ${subscription.Name} BindingConfig`),
48
+ SubscriptionID: subscription.ID,
49
+ TopicID: topic.ID,
50
+ },
51
+ };
52
+ }
53
+ /** Resolves a topic for publishing. Throws WorkQueueConfigurationError when its transport or a subscription is misconfigured. */
54
+ export function ResolveTopic(snapshot, topicName) {
55
+ const topic = FindByName(snapshot.Topics, topicName);
56
+ if (!topic) {
57
+ return undefined;
58
+ }
59
+ const transport = FindByID(snapshot.Transports, topic.TransportID);
60
+ if (!transport) {
61
+ throw new WorkQueueConfigurationError(`Topic '${topic.Name}' references a transport that does not exist`);
62
+ }
63
+ const subscriptions = snapshot.Subscriptions
64
+ .filter(s => UUIDsEqual(s.TopicID, topic.ID) && s.Status !== 'Disabled')
65
+ .map(s => ToSubscriptionBinding(s, topic));
66
+ return { Topic: topic, Transport: transport, Binding: ToTopicBinding(topic), Subscriptions: subscriptions };
67
+ }
68
+ //# sourceMappingURL=bindings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bindings.js","sourceRoot":"","sources":["../../src/topology/bindings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAElI,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAgBzD,MAAM,UAAU,UAAU,CAA6B,IAAS,EAAE,IAAY;IAC1E,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,UAAU,QAAQ,CAA2B,IAAS,EAAE,EAAU;IACpE,MAAM,MAAM,GAAG,aAAa,CAAC,EAAE,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,MAAM,CAAC,CAAC;AAC1D,CAAC;AAED,uHAAuH;AACvH,MAAM,UAAU,cAAc,CAAC,KAAe;IAC1C,OAAO;QACH,SAAS,EAAE,KAAK,CAAC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AAK,CAAC,EAAE;SACpB;KACJ,CAAC;AACN,CAAC;AAED,iIAAiI;AACjI,MAAM,UAAU,YAAY,CAAC,QAA0B,EAAE,SAAiB;IACtE,MAAM,KAAK,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IACrD,IAAI,CAAC,KAAK,EAAE,CAAC;QACT,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,MAAM,SAAS,GAAG,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;IACnE,IAAI,CAAC,SAAS,EAAE,CAAC;QACb,MAAM,IAAI,2BAA2B,CAAC,UAAU,KAAK,CAAC,IAAI,8CAA8C,CAAC,CAAC;IAC9G,CAAC;IACD,MAAM,aAAa,GAAG,QAAQ,CAAC,aAAa;SACvC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,UAAU,CAAC;SACvE,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;IAC/C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,cAAc,CAAC,KAAK,CAAC,EAAE,aAAa,EAAE,aAAa,EAAE,CAAC;AAChH,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { BindingImport, BindingValidationIssue, TopologyManifest } from '@memberjunction/work-queue-core';
2
+ import type { TopologySnapshot } from './bindings.js';
3
+ export interface BindingUpdate {
4
+ ID: string;
5
+ Name: string;
6
+ BindingConfig: string;
7
+ }
8
+ export interface BindingImportPlan {
9
+ TopicUpdates: BindingUpdate[];
10
+ SubscriptionUpdates: BindingUpdate[];
11
+ Issues: BindingValidationIssue[];
12
+ }
13
+ /**
14
+ * Exports one transport's active topics and non-disabled subscriptions (03 §10), sorted by name for stable diffs.
15
+ * Transport-neutral: it never renders a broker-specific field. `ManifestSubscription.DriverArtifacts` (CD8) is added
16
+ * by the transport's driver at export time (the engine's ExportManifest, Task 12).
17
+ */
18
+ export declare function BuildTopologyManifest(snapshot: TopologySnapshot, transportName: string, generatedAt: Date): TopologyManifest;
19
+ /** Turns `terraform output` bindings into entity updates; unknown names become issues. */
20
+ export declare function PlanBindingImport(snapshot: TopologySnapshot, bindings: BindingImport): BindingImportPlan;
21
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/topology/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAsB,EAAwB,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAGrI,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD,MAAM,WAAW,aAAa;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,iBAAiB;IAC9B,YAAY,EAAE,aAAa,EAAE,CAAC;IAC9B,mBAAmB,EAAE,aAAa,EAAE,CAAC;IACrC,MAAM,EAAE,sBAAsB,EAAE,CAAC;CACpC;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,GAAG,gBAAgB,CA2B5H;AAcD,0FAA0F;AAC1F,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,EAAE,aAAa,GAAG,iBAAiB,CAuBxG"}
@@ -0,0 +1,76 @@
1
+ import { UUIDsEqual } from '@memberjunction/global';
2
+ import { ParseSubscriptionFilter, WORK_QUEUE_FILTER_SUPPORT, WorkQueueConfigurationError } from '@memberjunction/work-queue-core';
3
+ import { ParseJsonObject } from '../entities/validation.js';
4
+ import { FindByName, ToSubscriptionPolicy } from './bindings.js';
5
+ /**
6
+ * Exports one transport's active topics and non-disabled subscriptions (03 §10), sorted by name for stable diffs.
7
+ * Transport-neutral: it never renders a broker-specific field. `ManifestSubscription.DriverArtifacts` (CD8) is added
8
+ * by the transport's driver at export time (the engine's ExportManifest, Task 12).
9
+ */
10
+ export function BuildTopologyManifest(snapshot, transportName, generatedAt) {
11
+ const transport = FindByName(snapshot.Transports, transportName);
12
+ if (!transport) {
13
+ throw new WorkQueueConfigurationError(`Transport '${transportName}' does not exist`);
14
+ }
15
+ const topics = snapshot.Topics
16
+ .filter(t => UUIDsEqual(t.TransportID, transport.ID) && t.Status === 'Active')
17
+ .sort((a, b) => a.Name.localeCompare(b.Name))
18
+ .map(topic => ({
19
+ Name: topic.Name,
20
+ IsFifo: topic.IsFifo,
21
+ MaxPayloadBytes: topic.MaxPayloadBytes,
22
+ Subscriptions: snapshot.Subscriptions
23
+ .filter(s => UUIDsEqual(s.TopicID, topic.ID) && s.Status !== 'Disabled')
24
+ .sort((a, b) => a.Name.localeCompare(b.Name))
25
+ .map(s => ToManifestSubscription(s, topic)),
26
+ }));
27
+ return {
28
+ ManifestVersion: 1,
29
+ GeneratedAt: generatedAt.toISOString(),
30
+ Transport: {
31
+ Name: transport.Name,
32
+ DriverClass: transport.DriverClass,
33
+ Configuration: ParseJsonObject(transport.Configuration, `Transport ${transport.Name} Configuration`),
34
+ },
35
+ Topics: topics,
36
+ };
37
+ }
38
+ function ToManifestSubscription(subscription, topic) {
39
+ return {
40
+ Name: subscription.Name,
41
+ Filter: ParseSubscriptionFilter(subscription.Filter, WORK_QUEUE_FILTER_SUPPORT),
42
+ Policy: ToSubscriptionPolicy(subscription, topic),
43
+ HostType: subscription.HostType,
44
+ // Terraform maps Paused to the Lambda event source's `enabled = false` (03 §10). Disabled rows are not exported.
45
+ Status: subscription.Status,
46
+ ExternalRef: subscription.ExternalRef,
47
+ };
48
+ }
49
+ /** Turns `terraform output` bindings into entity updates; unknown names become issues. */
50
+ export function PlanBindingImport(snapshot, bindings) {
51
+ const plan = { TopicUpdates: [], SubscriptionUpdates: [], Issues: [] };
52
+ if (bindings.ManifestVersion !== 1) {
53
+ plan.Issues.push({ Severity: 'Error', Subject: 'BindingImport', Message: `Unsupported ManifestVersion ${String(bindings.ManifestVersion)}` });
54
+ return plan;
55
+ }
56
+ for (const entry of bindings.Topics) {
57
+ const topic = FindByName(snapshot.Topics, entry.Name);
58
+ if (topic) {
59
+ plan.TopicUpdates.push({ ID: topic.ID, Name: topic.Name, BindingConfig: JSON.stringify(entry.BindingConfig) });
60
+ }
61
+ else {
62
+ plan.Issues.push({ Severity: 'Error', Subject: entry.Name, Message: `No topic named ${entry.Name} exists` });
63
+ }
64
+ }
65
+ for (const entry of bindings.Subscriptions) {
66
+ const subscription = FindByName(snapshot.Subscriptions, entry.Name);
67
+ if (subscription) {
68
+ plan.SubscriptionUpdates.push({ ID: subscription.ID, Name: subscription.Name, BindingConfig: JSON.stringify(entry.BindingConfig) });
69
+ }
70
+ else {
71
+ plan.Issues.push({ Severity: 'Error', Subject: entry.Name, Message: `No subscription named ${entry.Name} exists` });
72
+ }
73
+ }
74
+ return plan;
75
+ }
76
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../src/topology/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAElI,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAgB9D;;;;GAIG;AACH,MAAM,UAAU,qBAAqB,CAAC,QAA0B,EAAE,aAAqB,EAAE,WAAiB;IACtG,MAAM,S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AE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACnH,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,kBAAkB,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC;QACjH,CAAC;IACL,CAAC;IACD,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,aAAa,EAAE,CAAC;QACzC,MAAM,YAAY,GAAG,UAAU,CAAC,QAAQ,CAAC,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACpE,IAAI,YAAY,EAAE,CAAC;YACf,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,YAAY,CAAC,EAAE,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;QACxI,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,yBAAyB,KAAK,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC;QACxH,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { HeartbeatMode, HostType, PartitionMode } from '@memberjunction/work-queue-core';
2
+ /** Structural views of the topology entities. The generated entity classes satisfy them directly. */
3
+ export interface TransportRow {
4
+ ID: string;
5
+ Name: string;
6
+ DriverClass: string;
7
+ Configuration: string | null;
8
+ CredentialID: string | null;
9
+ Status: 'Active' | 'Disabled';
10
+ }
11
+ export interface TopicRow {
12
+ ID: string;
13
+ Name: string;
14
+ TransportID: string;
15
+ IsFifo: boolean;
16
+ AllowExternalPublish: boolean;
17
+ MaxPayloadBytes: number;
18
+ DefaultDeduplicationTTLSeconds: number;
19
+ RetentionDays: number;
20
+ BindingConfig: string | null;
21
+ Status: 'Active' | 'Disabled';
22
+ }
23
+ export interface SubscriptionRow {
24
+ ID: string;
25
+ TopicID: string;
26
+ Name: string;
27
+ Filter: string | null;
28
+ PartitionMode: PartitionMode;
29
+ MaxAttempts: number;
30
+ BackoffBaseSeconds: number;
31
+ BackoffMaxSeconds: number;
32
+ LeaseSeconds: number;
33
+ HeartbeatMode: HeartbeatMode;
34
+ MaxProcessingSeconds: number | null;
35
+ HostType: HostType;
36
+ HandlerKey: string | null;
37
+ ExternalRef: string | null;
38
+ BindingConfig: string | null;
39
+ Status: 'Active' | 'Paused' | 'Disabled';
40
+ }
41
+ //# sourceMappingURL=rows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../src/topology/rows.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAE9F,qGAAqG;AACrG,MAAM,WAAW,YAAY;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;CACjC;AAED,MAAM,WAAW,QAAQ;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,8BAA8B,EAAE,MAAM,CAAC;IACvC,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,aAAa,EAAE,aAAa,CAAC;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,aAAa,CAAC;IAC7B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,EAAE,QAAQ,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;CAC5C"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=rows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rows.js","sourceRoot":"","sources":["../../src/topology/rows.ts"],"names":[],"mappings":""}
@@ -0,0 +1,10 @@
1
+ import type { BindingValidationIssue, HostType, TransportCapabilities } from '@memberjunction/work-queue-core';
2
+ import type { TopologySnapshot } from './bindings.js';
3
+ /** Known maximum handler run time per host type (null = no known ceiling). External = AWS Lambda's 900 s. */
4
+ export declare const KNOWN_HOST_CEILING_SECONDS: Record<HostType, number | null>;
5
+ /**
6
+ * Validates topology rows against transport capabilities, keyed by `Transport.DriverClass` (03 §11). Capabilities are
7
+ * a property of the driver class, not of one transport row, so the browser tier can validate with a static table.
8
+ */
9
+ export declare function ValidateTopologyRows(snapshot: TopologySnapshot, capabilitiesByDriverClass: Record<string, TransportCapabilities>): BindingValidationIssue[];
10
+ //# sourceMappingURL=validateTopology.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateTopology.d.ts","sourceRoot":"","sources":["../../src/topology/validateTopology.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAG/G,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGnD,6GAA6G;AAC7G,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAGtE,CAAC;AAEF;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC,GAAG,sBAAsB,EAAE,CAM3J"}
@@ -0,0 +1,82 @@
1
+ import { UUIDsEqual } from '@memberjunction/global';
2
+ import { SubscriptionUnsupportedReason } from '@memberjunction/work-queue-core';
3
+ import { DATABASE_DRIVER_CLASS } from '../constants.js';
4
+ import { FindByID, ToSubscriptionBinding, ToTopicBinding } from './bindings.js';
5
+ /** Known maximum handler run time per host type (null = no known ceiling). External = AWS Lambda's 900 s. */
6
+ export const KNOWN_HOST_CEILING_SECONDS = {
7
+ MJWorker: null,
8
+ External: 900,
9
+ };
10
+ /**
11
+ * Validates topology rows against transport capabilities, keyed by `Transport.DriverClass` (03 §11). Capabilities are
12
+ * a property of the driver class, not of one transport row, so the browser tier can validate with a static table.
13
+ */
14
+ export function ValidateTopologyRows(snapshot, capabilitiesByDriverClass) {
15
+ const issues = [];
16
+ for (const topic of snapshot.Topics.filter(t => t.Status === 'Active')) {
17
+ issues.push(...ValidateTopic(snapshot, topic, capabilitiesByDriverClass));
18
+ }
19
+ return issues;
20
+ }
21
+ function ValidateTopic(snapshot, topic, capabilitiesByDriverClass) {
22
+ const transport = FindByID(snapshot.Transports, topic.TransportID);
23
+ if (!transport) {
24
+ return [Issue('Error', topic.Name, 'Topic references a transport that does not exist')];
25
+ }
26
+ const issues = [];
27
+ if (transport.Status === 'Disabled') {
28
+ issues.push(Issue('Warning', topic.Name, `Transport '${transport.Name}' is disabled; publishes will be rejected`));
29
+ }
30
+ const caps = Object.hasOwn(capabilitiesByDriverClass, transport.DriverClass) ? capabilitiesByDriverClass[transport.DriverClass] : undefined;
31
+ if (!caps) {
32
+ issues.push(Issue('Error', topic.Name, `Transport '${transport.Name}' driver is unavailable: no driver is registered for DriverClass '${transport.DriverClass}'`));
33
+ return issues;
34
+ }
35
+ const subscriptions = snapshot.Subscriptions.filter(s => UUIDsEqual(s.TopicID, topic.ID) && s.Status !== 'Disabled');
36
+ issues.push(...FifoIssues(topic, transport, subscriptions));
37
+ try {
38
+ ToTopicBinding(topic);
39
+ }
40
+ catch (error) {
41
+ issues.push(Issue('Error', topic.Name, error instanceof Error ? error.message : String(error)));
42
+ }
43
+ for (const subscription of subscriptions) {
44
+ issues.push(...ValidateSubscription(topic, subscription, caps));
45
+ }
46
+ return issues;
47
+ }
48
+ function FifoIssues(topic, transport, subscriptions) {
49
+ const isDatabase = transport.DriverClass === DATABASE_DRIVER_CLASS;
50
+ if (isDatabase) {
51
+ return topic.IsFifo ? [Issue('Warning', topic.Name, 'IsFifo has no effect on the Database transport')] : [];
52
+ }
53
+ // W7. Ordered is not listed: no cloud transport supports it, and SubscriptionUnsupportedReason says so per subscription.
54
+ const needsFifo = subscriptions.some(s => s.PartitionMode === 'Exclusive');
55
+ return needsFifo && !topic.IsFifo
56
+ ? [Issue('Error', topic.Name, 'IsFifo must be true on cloud topics that have Exclusive subscriptions')]
57
+ : [];
58
+ }
59
+ function ValidateSubscription(topic, subscription, caps) {
60
+ const issues = [];
61
+ let reason;
62
+ try {
63
+ // Re-parsing with the transport's own FilterSupport is what rejects `startswith`, cross-field OR and the rest
64
+ // on a cloud topic: the thrown message names the offending field and operator (03 §4.1).
65
+ reason = SubscriptionUnsupportedReason(ToSubscriptionBinding(subscription, topic, caps.Filters), caps);
66
+ }
67
+ catch (error) {
68
+ return [Issue('Error', subscription.Name, error instanceof Error ? error.message : String(error))];
69
+ }
70
+ if (reason) {
71
+ issues.push(Issue('Error', subscription.Name, reason));
72
+ }
73
+ const ceiling = KNOWN_HOST_CEILING_SECONDS[subscription.HostType];
74
+ if (ceiling !== null && subscription.MaxProcessingSeconds !== null && subscription.MaxProcessingSeconds > ceiling) {
75
+ issues.push(Issue('Warning', subscription.Name, `MaxProcessingSeconds ${subscription.MaxProcessingSeconds} exceeds the ${subscription.HostType} host ceiling of ${ceiling} seconds`));
76
+ }
77
+ return issues;
78
+ }
79
+ function Issue(severity, subject, message) {
80
+ return { Severity: severity, Subject: subject, Message: message };
81
+ }
82
+ //# sourceMappingURL=validateTopology.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validateTopology.js","sourceRoot":"","sources":["../../src/topology/validateTopology.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAC;AAEhF,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAI7E,6GAA6G;AAC7G,MAAM,CAAC,MAAM,0BAA0B,GAAoC;IACvE,QAAQ,EAAE,IAAI;IACd,QAAQ,EAAE,GAAG;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAA0B,EAAE,yBAAgE;IAC7H,MAAM,MAAM,GAA6B,EAAE,CAAC;IAC5C,KAAK,MAAM,KAAK,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAA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AAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACtE,CAAC"}
package/package.json CHANGED
@@ -1,10 +1,44 @@
1
1
  {
2
2
  "name": "@memberjunction/work-queue-base",
3
- "version": "0.0.1-seed.1",
4
- "description": "Trusted-publishing seed. Proves OIDC is configured; contains no code.",
5
- "license": "ISC",
3
+ "type": "module",
4
+ "version": "6.2.0-edge.3",
5
+ "description": "MemberJunction: durable work queue — browser-safe metadata tier (topology cache, bindings, validation)",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./testing": {
14
+ "types": "./dist/testing/index.d.ts",
15
+ "default": "./dist/testing/index.js"
16
+ }
17
+ },
18
+ "files": [
19
+ "/dist"
20
+ ],
21
+ "author": "MemberJunction.com",
22
+ "license": "BUSL-1.1",
23
+ "dependencies": {
24
+ "@memberjunction/core": "6.2.0-edge.3",
25
+ "@memberjunction/core-entities": "6.2.0-edge.3",
26
+ "@memberjunction/global": "6.2.0-edge.3",
27
+ "@memberjunction/work-queue-core": "6.2.0-edge.3"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "24.10.11",
31
+ "typescript": "^5.9.3",
32
+ "vitest": "^4.0.18"
33
+ },
6
34
  "repository": {
7
35
  "type": "git",
8
- "url": "git+https://github.com/MemberJunction/MJ.git"
36
+ "url": "https://github.com/MemberJunction/MJ"
37
+ },
38
+ "scripts": {
39
+ "build": "tsc && tsc-alias -f",
40
+ "watch": "tsc --watch",
41
+ "test": "vitest run",
42
+ "test:watch": "vitest"
9
43
  }
10
- }
44
+ }
package/README.md DELETED
@@ -1,4 +0,0 @@
1
- # @memberjunction/work-queue-base
2
- Seed release published over OIDC to prove trusted publishing is configured for
3
- this package. It contains no code and is tagged `seed`, never `latest`.
4
- Real releases are published by .github/workflows/publish.yml.