@uniforge/testing 0.1.0-alpha.2

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 (85) hide show
  1. package/dist/auth/index.d.cts +177 -0
  2. package/dist/auth/index.d.ts +177 -0
  3. package/dist/auth/index.js +459 -0
  4. package/dist/auth/index.js.map +1 -0
  5. package/dist/auth/index.mjs +418 -0
  6. package/dist/auth/index.mjs.map +1 -0
  7. package/dist/billing/index.d.cts +27 -0
  8. package/dist/billing/index.d.ts +27 -0
  9. package/dist/billing/index.js +208 -0
  10. package/dist/billing/index.js.map +1 -0
  11. package/dist/billing/index.mjs +178 -0
  12. package/dist/billing/index.mjs.map +1 -0
  13. package/dist/database/index.d.cts +399 -0
  14. package/dist/database/index.d.ts +399 -0
  15. package/dist/database/index.js +19054 -0
  16. package/dist/database/index.js.map +1 -0
  17. package/dist/database/index.mjs +19046 -0
  18. package/dist/database/index.mjs.map +1 -0
  19. package/dist/graphql/index.d.cts +23 -0
  20. package/dist/graphql/index.d.ts +23 -0
  21. package/dist/graphql/index.js +18511 -0
  22. package/dist/graphql/index.js.map +1 -0
  23. package/dist/graphql/index.mjs +18505 -0
  24. package/dist/graphql/index.mjs.map +1 -0
  25. package/dist/index.d.cts +10 -0
  26. package/dist/index.d.ts +10 -0
  27. package/dist/index.js +31 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/index.mjs +6 -0
  30. package/dist/index.mjs.map +1 -0
  31. package/dist/multi-store/index.d.cts +66 -0
  32. package/dist/multi-store/index.d.ts +66 -0
  33. package/dist/multi-store/index.js +319 -0
  34. package/dist/multi-store/index.js.map +1 -0
  35. package/dist/multi-store/index.mjs +287 -0
  36. package/dist/multi-store/index.mjs.map +1 -0
  37. package/dist/multi-tenant/index.d.cts +15 -0
  38. package/dist/multi-tenant/index.d.ts +15 -0
  39. package/dist/multi-tenant/index.js +87 -0
  40. package/dist/multi-tenant/index.js.map +1 -0
  41. package/dist/multi-tenant/index.mjs +57 -0
  42. package/dist/multi-tenant/index.mjs.map +1 -0
  43. package/dist/performance/index.d.cts +60 -0
  44. package/dist/performance/index.d.ts +60 -0
  45. package/dist/performance/index.js +280 -0
  46. package/dist/performance/index.js.map +1 -0
  47. package/dist/performance/index.mjs +246 -0
  48. package/dist/performance/index.mjs.map +1 -0
  49. package/dist/platform/index.d.cts +71 -0
  50. package/dist/platform/index.d.ts +71 -0
  51. package/dist/platform/index.js +435 -0
  52. package/dist/platform/index.js.map +1 -0
  53. package/dist/platform/index.mjs +396 -0
  54. package/dist/platform/index.mjs.map +1 -0
  55. package/dist/rbac/index.d.cts +21 -0
  56. package/dist/rbac/index.d.ts +21 -0
  57. package/dist/rbac/index.js +178 -0
  58. package/dist/rbac/index.js.map +1 -0
  59. package/dist/rbac/index.mjs +150 -0
  60. package/dist/rbac/index.mjs.map +1 -0
  61. package/dist/security/index.d.cts +73 -0
  62. package/dist/security/index.d.ts +73 -0
  63. package/dist/security/index.js +246 -0
  64. package/dist/security/index.js.map +1 -0
  65. package/dist/security/index.mjs +211 -0
  66. package/dist/security/index.mjs.map +1 -0
  67. package/dist/shopify-api/index.d.cts +139 -0
  68. package/dist/shopify-api/index.d.ts +139 -0
  69. package/dist/shopify-api/index.js +469 -0
  70. package/dist/shopify-api/index.js.map +1 -0
  71. package/dist/shopify-api/index.mjs +439 -0
  72. package/dist/shopify-api/index.mjs.map +1 -0
  73. package/dist/shopify-compliance/index.d.cts +85 -0
  74. package/dist/shopify-compliance/index.d.ts +85 -0
  75. package/dist/shopify-compliance/index.js +287 -0
  76. package/dist/shopify-compliance/index.js.map +1 -0
  77. package/dist/shopify-compliance/index.mjs +259 -0
  78. package/dist/shopify-compliance/index.mjs.map +1 -0
  79. package/dist/webhooks/index.d.cts +127 -0
  80. package/dist/webhooks/index.d.ts +127 -0
  81. package/dist/webhooks/index.js +18934 -0
  82. package/dist/webhooks/index.js.map +1 -0
  83. package/dist/webhooks/index.mjs +18916 -0
  84. package/dist/webhooks/index.mjs.map +1 -0
  85. package/package.json +112 -0
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @uniforge/testing
3
+ *
4
+ * Comprehensive testing utilities, mocks, simulators, and helpers for UniForge applications.
5
+ * Provides mock Shopify API server, webhook simulators, auth flow helpers, database utilities,
6
+ * and factories for all UniForge domains.
7
+ */
8
+ declare const VERSION = "0.3.0";
9
+
10
+ export { VERSION };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @uniforge/testing
3
+ *
4
+ * Comprehensive testing utilities, mocks, simulators, and helpers for UniForge applications.
5
+ * Provides mock Shopify API server, webhook simulators, auth flow helpers, database utilities,
6
+ * and factories for all UniForge domains.
7
+ */
8
+ declare const VERSION = "0.3.0";
9
+
10
+ export { VERSION };
package/dist/index.js ADDED
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ VERSION: () => VERSION
24
+ });
25
+ module.exports = __toCommonJS(index_exports);
26
+ var VERSION = "0.3.0";
27
+ // Annotate the CommonJS export names for ESM import in node:
28
+ 0 && (module.exports = {
29
+ VERSION
30
+ });
31
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @uniforge/testing\n *\n * Comprehensive testing utilities, mocks, simulators, and helpers for UniForge applications.\n * Provides mock Shopify API server, webhook simulators, auth flow helpers, database utilities,\n * and factories for all UniForge domains.\n */\n\nexport const VERSION = '0.3.0';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO,IAAM,UAAU;","names":[]}
package/dist/index.mjs ADDED
@@ -0,0 +1,6 @@
1
+ // src/index.ts
2
+ var VERSION = "0.3.0";
3
+ export {
4
+ VERSION
5
+ };
6
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @uniforge/testing\n *\n * Comprehensive testing utilities, mocks, simulators, and helpers for UniForge applications.\n * Provides mock Shopify API server, webhook simulators, auth flow helpers, database utilities,\n * and factories for all UniForge domains.\n */\n\nexport const VERSION = '0.3.0';\n"],"mappings":";AAQO,IAAM,UAAU;","names":[]}
@@ -0,0 +1,66 @@
1
+ import { Account, AccountStore, AccountMember, AccountSharedSetting, AccountService, CreateAccountInput, UpdateAccountInput, AddStoreInput, UpdateStoreInput, AddMemberInput, UpdateMemberInput, AccountRole, SharedSettingsService, SetSharedSettingInput } from '@uniforge/platform-core/multi-store';
2
+
3
+ /**
4
+ * Test data factories for multi-store types.
5
+ *
6
+ * Each factory provides sensible defaults that can be overridden.
7
+ */
8
+
9
+ declare function createTestAccount(overrides?: Partial<Account>): Account;
10
+ declare function createTestAccountStore(overrides?: Partial<AccountStore>): AccountStore;
11
+ declare function createTestAccountMember(overrides?: Partial<AccountMember>): AccountMember;
12
+ declare function createTestAccountSharedSetting(overrides?: Partial<AccountSharedSetting>): AccountSharedSetting;
13
+
14
+ /**
15
+ * In-memory mock AccountService for testing.
16
+ */
17
+
18
+ declare class MockAccountService implements AccountService {
19
+ private accounts;
20
+ private stores;
21
+ private storesByDomain;
22
+ private members;
23
+ private membersByKey;
24
+ private nextId;
25
+ private generateId;
26
+ _reset(): void;
27
+ createAccount(input: CreateAccountInput): Promise<Account>;
28
+ getAccount(accountId: string): Promise<Account | null>;
29
+ updateAccount(accountId: string, input: UpdateAccountInput): Promise<Account>;
30
+ deleteAccount(accountId: string): Promise<void>;
31
+ addStore(input: AddStoreInput): Promise<AccountStore>;
32
+ getStore(storeId: string): Promise<AccountStore | null>;
33
+ getStoreByDomain(shopDomain: string): Promise<AccountStore | null>;
34
+ listStores(accountId: string): Promise<AccountStore[]>;
35
+ updateStore(storeId: string, input: UpdateStoreInput): Promise<AccountStore>;
36
+ removeStore(storeId: string): Promise<void>;
37
+ addMember(input: AddMemberInput): Promise<AccountMember>;
38
+ getMember(memberId: string): Promise<AccountMember | null>;
39
+ getMemberByEmail(accountId: string, userEmail: string): Promise<AccountMember | null>;
40
+ listMembers(accountId: string): Promise<AccountMember[]>;
41
+ updateMember(memberId: string, input: UpdateMemberInput): Promise<AccountMember>;
42
+ removeMember(memberId: string): Promise<void>;
43
+ canAccessStore(accountId: string, userEmail: string, storeId: string): Promise<boolean>;
44
+ isRoleAtLeast(accountId: string, userEmail: string, minimumRole: AccountRole): Promise<boolean>;
45
+ }
46
+
47
+ /**
48
+ * In-memory mock SharedSettingsService for testing.
49
+ */
50
+
51
+ declare class MockSharedSettingsService implements SharedSettingsService {
52
+ private settings;
53
+ private storeSettings;
54
+ private nextId;
55
+ private key;
56
+ _reset(): void;
57
+ /** Helper to set store-level overrides for testing cascade logic. */
58
+ _setStoreSettings(storeId: string, settings: Record<string, unknown>): void;
59
+ set(input: SetSharedSettingInput): Promise<AccountSharedSetting>;
60
+ get(accountId: string, settingKey: string): Promise<AccountSharedSetting | null>;
61
+ list(accountId: string): Promise<AccountSharedSetting[]>;
62
+ delete(accountId: string, settingKey: string): Promise<void>;
63
+ resolve<T = unknown>(accountId: string, storeId: string, settingKey: string, defaultValue: T): Promise<T>;
64
+ }
65
+
66
+ export { MockAccountService, MockSharedSettingsService, createTestAccount, createTestAccountMember, createTestAccountSharedSetting, createTestAccountStore };
@@ -0,0 +1,66 @@
1
+ import { Account, AccountStore, AccountMember, AccountSharedSetting, AccountService, CreateAccountInput, UpdateAccountInput, AddStoreInput, UpdateStoreInput, AddMemberInput, UpdateMemberInput, AccountRole, SharedSettingsService, SetSharedSettingInput } from '@uniforge/platform-core/multi-store';
2
+
3
+ /**
4
+ * Test data factories for multi-store types.
5
+ *
6
+ * Each factory provides sensible defaults that can be overridden.
7
+ */
8
+
9
+ declare function createTestAccount(overrides?: Partial<Account>): Account;
10
+ declare function createTestAccountStore(overrides?: Partial<AccountStore>): AccountStore;
11
+ declare function createTestAccountMember(overrides?: Partial<AccountMember>): AccountMember;
12
+ declare function createTestAccountSharedSetting(overrides?: Partial<AccountSharedSetting>): AccountSharedSetting;
13
+
14
+ /**
15
+ * In-memory mock AccountService for testing.
16
+ */
17
+
18
+ declare class MockAccountService implements AccountService {
19
+ private accounts;
20
+ private stores;
21
+ private storesByDomain;
22
+ private members;
23
+ private membersByKey;
24
+ private nextId;
25
+ private generateId;
26
+ _reset(): void;
27
+ createAccount(input: CreateAccountInput): Promise<Account>;
28
+ getAccount(accountId: string): Promise<Account | null>;
29
+ updateAccount(accountId: string, input: UpdateAccountInput): Promise<Account>;
30
+ deleteAccount(accountId: string): Promise<void>;
31
+ addStore(input: AddStoreInput): Promise<AccountStore>;
32
+ getStore(storeId: string): Promise<AccountStore | null>;
33
+ getStoreByDomain(shopDomain: string): Promise<AccountStore | null>;
34
+ listStores(accountId: string): Promise<AccountStore[]>;
35
+ updateStore(storeId: string, input: UpdateStoreInput): Promise<AccountStore>;
36
+ removeStore(storeId: string): Promise<void>;
37
+ addMember(input: AddMemberInput): Promise<AccountMember>;
38
+ getMember(memberId: string): Promise<AccountMember | null>;
39
+ getMemberByEmail(accountId: string, userEmail: string): Promise<AccountMember | null>;
40
+ listMembers(accountId: string): Promise<AccountMember[]>;
41
+ updateMember(memberId: string, input: UpdateMemberInput): Promise<AccountMember>;
42
+ removeMember(memberId: string): Promise<void>;
43
+ canAccessStore(accountId: string, userEmail: string, storeId: string): Promise<boolean>;
44
+ isRoleAtLeast(accountId: string, userEmail: string, minimumRole: AccountRole): Promise<boolean>;
45
+ }
46
+
47
+ /**
48
+ * In-memory mock SharedSettingsService for testing.
49
+ */
50
+
51
+ declare class MockSharedSettingsService implements SharedSettingsService {
52
+ private settings;
53
+ private storeSettings;
54
+ private nextId;
55
+ private key;
56
+ _reset(): void;
57
+ /** Helper to set store-level overrides for testing cascade logic. */
58
+ _setStoreSettings(storeId: string, settings: Record<string, unknown>): void;
59
+ set(input: SetSharedSettingInput): Promise<AccountSharedSetting>;
60
+ get(accountId: string, settingKey: string): Promise<AccountSharedSetting | null>;
61
+ list(accountId: string): Promise<AccountSharedSetting[]>;
62
+ delete(accountId: string, settingKey: string): Promise<void>;
63
+ resolve<T = unknown>(accountId: string, storeId: string, settingKey: string, defaultValue: T): Promise<T>;
64
+ }
65
+
66
+ export { MockAccountService, MockSharedSettingsService, createTestAccount, createTestAccountMember, createTestAccountSharedSetting, createTestAccountStore };
@@ -0,0 +1,319 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/multi-store/index.ts
21
+ var multi_store_exports = {};
22
+ __export(multi_store_exports, {
23
+ MockAccountService: () => MockAccountService,
24
+ MockSharedSettingsService: () => MockSharedSettingsService,
25
+ createTestAccount: () => createTestAccount,
26
+ createTestAccountMember: () => createTestAccountMember,
27
+ createTestAccountSharedSetting: () => createTestAccountSharedSetting,
28
+ createTestAccountStore: () => createTestAccountStore
29
+ });
30
+ module.exports = __toCommonJS(multi_store_exports);
31
+
32
+ // src/multi-store/factories.ts
33
+ function createTestAccount(overrides = {}) {
34
+ const now = /* @__PURE__ */ new Date();
35
+ return {
36
+ id: "acct_test_001",
37
+ name: "Test Enterprise Account",
38
+ type: "enterprise",
39
+ isActive: true,
40
+ createdAt: now,
41
+ updatedAt: now,
42
+ ...overrides
43
+ };
44
+ }
45
+ function createTestAccountStore(overrides = {}) {
46
+ const now = /* @__PURE__ */ new Date();
47
+ return {
48
+ id: "store_test_001",
49
+ accountId: "acct_test_001",
50
+ shopDomain: "test-shop.myshopify.com",
51
+ storeName: "Test Store",
52
+ region: null,
53
+ currency: null,
54
+ locale: null,
55
+ timezone: null,
56
+ storeSettings: {},
57
+ isActive: true,
58
+ isPrimary: true,
59
+ createdAt: now,
60
+ updatedAt: now,
61
+ ...overrides
62
+ };
63
+ }
64
+ function createTestAccountMember(overrides = {}) {
65
+ const now = /* @__PURE__ */ new Date();
66
+ return {
67
+ id: "member_test_001",
68
+ accountId: "acct_test_001",
69
+ userEmail: "owner@test.com",
70
+ role: "owner",
71
+ allStoresAccess: true,
72
+ allowedStoreIds: [],
73
+ permissions: [],
74
+ createdAt: now,
75
+ updatedAt: now,
76
+ ...overrides
77
+ };
78
+ }
79
+ function createTestAccountSharedSetting(overrides = {}) {
80
+ const now = /* @__PURE__ */ new Date();
81
+ return {
82
+ id: "setting_test_001",
83
+ accountId: "acct_test_001",
84
+ settingKey: "theme",
85
+ settingValue: "dark",
86
+ appliesToStores: null,
87
+ createdAt: now,
88
+ updatedAt: now,
89
+ ...overrides
90
+ };
91
+ }
92
+
93
+ // src/multi-store/mock-account-service.ts
94
+ var import_multi_store = require("@uniforge/platform-core/multi-store");
95
+ var MockAccountService = class {
96
+ accounts = /* @__PURE__ */ new Map();
97
+ stores = /* @__PURE__ */ new Map();
98
+ storesByDomain = /* @__PURE__ */ new Map();
99
+ members = /* @__PURE__ */ new Map();
100
+ membersByKey = /* @__PURE__ */ new Map();
101
+ nextId = 1;
102
+ generateId() {
103
+ return `mock_${this.nextId++}`;
104
+ }
105
+ _reset() {
106
+ this.accounts.clear();
107
+ this.stores.clear();
108
+ this.storesByDomain.clear();
109
+ this.members.clear();
110
+ this.membersByKey.clear();
111
+ this.nextId = 1;
112
+ }
113
+ async createAccount(input) {
114
+ const now = /* @__PURE__ */ new Date();
115
+ const account = {
116
+ id: this.generateId(),
117
+ name: input.name,
118
+ type: input.type,
119
+ isActive: true,
120
+ createdAt: now,
121
+ updatedAt: now
122
+ };
123
+ this.accounts.set(account.id, account);
124
+ return account;
125
+ }
126
+ async getAccount(accountId) {
127
+ return this.accounts.get(accountId) ?? null;
128
+ }
129
+ async updateAccount(accountId, input) {
130
+ const account = this.accounts.get(accountId);
131
+ if (!account) throw new Error(`Account ${accountId} not found`);
132
+ const updated = { ...account, updatedAt: /* @__PURE__ */ new Date() };
133
+ if (input.name !== void 0) updated.name = input.name;
134
+ if (input.type !== void 0) updated.type = input.type;
135
+ if (input.isActive !== void 0) updated.isActive = input.isActive;
136
+ this.accounts.set(accountId, updated);
137
+ return updated;
138
+ }
139
+ async deleteAccount(accountId) {
140
+ this.accounts.delete(accountId);
141
+ }
142
+ async addStore(input) {
143
+ const now = /* @__PURE__ */ new Date();
144
+ const store = {
145
+ id: this.generateId(),
146
+ accountId: input.accountId,
147
+ shopDomain: input.shopDomain,
148
+ storeName: input.storeName,
149
+ region: input.region ?? null,
150
+ currency: input.currency ?? null,
151
+ locale: input.locale ?? null,
152
+ timezone: input.timezone ?? null,
153
+ storeSettings: input.storeSettings ?? {},
154
+ isActive: true,
155
+ isPrimary: input.isPrimary ?? false,
156
+ createdAt: now,
157
+ updatedAt: now
158
+ };
159
+ this.stores.set(store.id, store);
160
+ this.storesByDomain.set(store.shopDomain, store);
161
+ return store;
162
+ }
163
+ async getStore(storeId) {
164
+ return this.stores.get(storeId) ?? null;
165
+ }
166
+ async getStoreByDomain(shopDomain) {
167
+ return this.storesByDomain.get(shopDomain) ?? null;
168
+ }
169
+ async listStores(accountId) {
170
+ return [...this.stores.values()].filter((s) => s.accountId === accountId);
171
+ }
172
+ async updateStore(storeId, input) {
173
+ const store = this.stores.get(storeId);
174
+ if (!store) throw new Error(`Store ${storeId} not found`);
175
+ const updated = { ...store, updatedAt: /* @__PURE__ */ new Date() };
176
+ if (input.storeName !== void 0) updated.storeName = input.storeName;
177
+ if (input.region !== void 0) updated.region = input.region;
178
+ if (input.currency !== void 0) updated.currency = input.currency;
179
+ if (input.locale !== void 0) updated.locale = input.locale;
180
+ if (input.timezone !== void 0) updated.timezone = input.timezone;
181
+ if (input.storeSettings !== void 0) updated.storeSettings = input.storeSettings;
182
+ if (input.isActive !== void 0) updated.isActive = input.isActive;
183
+ if (input.isPrimary !== void 0) updated.isPrimary = input.isPrimary;
184
+ this.stores.set(storeId, updated);
185
+ this.storesByDomain.set(updated.shopDomain, updated);
186
+ return updated;
187
+ }
188
+ async removeStore(storeId) {
189
+ const store = this.stores.get(storeId);
190
+ if (store) {
191
+ this.storesByDomain.delete(store.shopDomain);
192
+ }
193
+ this.stores.delete(storeId);
194
+ }
195
+ async addMember(input) {
196
+ const now = /* @__PURE__ */ new Date();
197
+ const member = {
198
+ id: this.generateId(),
199
+ accountId: input.accountId,
200
+ userEmail: input.userEmail,
201
+ role: input.role,
202
+ allStoresAccess: input.allStoresAccess ?? false,
203
+ allowedStoreIds: input.allowedStoreIds ?? [],
204
+ permissions: input.permissions ?? [],
205
+ createdAt: now,
206
+ updatedAt: now
207
+ };
208
+ this.members.set(member.id, member);
209
+ this.membersByKey.set(`${member.accountId}:${member.userEmail}`, member);
210
+ return member;
211
+ }
212
+ async getMember(memberId) {
213
+ return this.members.get(memberId) ?? null;
214
+ }
215
+ async getMemberByEmail(accountId, userEmail) {
216
+ return this.membersByKey.get(`${accountId}:${userEmail}`) ?? null;
217
+ }
218
+ async listMembers(accountId) {
219
+ return [...this.members.values()].filter((m) => m.accountId === accountId);
220
+ }
221
+ async updateMember(memberId, input) {
222
+ const member = this.members.get(memberId);
223
+ if (!member) throw new Error(`Member ${memberId} not found`);
224
+ const updated = { ...member, updatedAt: /* @__PURE__ */ new Date() };
225
+ if (input.role !== void 0) updated.role = input.role;
226
+ if (input.allStoresAccess !== void 0) updated.allStoresAccess = input.allStoresAccess;
227
+ if (input.allowedStoreIds !== void 0) updated.allowedStoreIds = input.allowedStoreIds;
228
+ if (input.permissions !== void 0) updated.permissions = input.permissions;
229
+ this.members.set(memberId, updated);
230
+ this.membersByKey.set(`${updated.accountId}:${updated.userEmail}`, updated);
231
+ return updated;
232
+ }
233
+ async removeMember(memberId) {
234
+ const member = this.members.get(memberId);
235
+ if (member) {
236
+ this.membersByKey.delete(`${member.accountId}:${member.userEmail}`);
237
+ }
238
+ this.members.delete(memberId);
239
+ }
240
+ async canAccessStore(accountId, userEmail, storeId) {
241
+ const member = this.membersByKey.get(`${accountId}:${userEmail}`);
242
+ if (!member) return false;
243
+ if (member.role === "owner" || member.role === "admin") return true;
244
+ if (member.allStoresAccess) return true;
245
+ return member.allowedStoreIds.includes(storeId);
246
+ }
247
+ async isRoleAtLeast(accountId, userEmail, minimumRole) {
248
+ const member = this.membersByKey.get(`${accountId}:${userEmail}`);
249
+ if (!member) return false;
250
+ return import_multi_store.ACCOUNT_ROLE_HIERARCHY[member.role] >= import_multi_store.ACCOUNT_ROLE_HIERARCHY[minimumRole];
251
+ }
252
+ };
253
+
254
+ // src/multi-store/mock-shared-settings-service.ts
255
+ var MockSharedSettingsService = class {
256
+ settings = /* @__PURE__ */ new Map();
257
+ storeSettings = /* @__PURE__ */ new Map();
258
+ nextId = 1;
259
+ key(accountId, settingKey) {
260
+ return `${accountId}:${settingKey}`;
261
+ }
262
+ _reset() {
263
+ this.settings.clear();
264
+ this.storeSettings.clear();
265
+ this.nextId = 1;
266
+ }
267
+ /** Helper to set store-level overrides for testing cascade logic. */
268
+ _setStoreSettings(storeId, settings) {
269
+ this.storeSettings.set(storeId, settings);
270
+ }
271
+ async set(input) {
272
+ const now = /* @__PURE__ */ new Date();
273
+ const k = this.key(input.accountId, input.settingKey);
274
+ const existing = this.settings.get(k);
275
+ const setting = {
276
+ id: existing?.id ?? `mock_setting_${this.nextId++}`,
277
+ accountId: input.accountId,
278
+ settingKey: input.settingKey,
279
+ settingValue: input.settingValue,
280
+ appliesToStores: input.appliesToStores ?? null,
281
+ createdAt: existing?.createdAt ?? now,
282
+ updatedAt: now
283
+ };
284
+ this.settings.set(k, setting);
285
+ return setting;
286
+ }
287
+ async get(accountId, settingKey) {
288
+ return this.settings.get(this.key(accountId, settingKey)) ?? null;
289
+ }
290
+ async list(accountId) {
291
+ return [...this.settings.values()].filter((s) => s.accountId === accountId);
292
+ }
293
+ async delete(accountId, settingKey) {
294
+ this.settings.delete(this.key(accountId, settingKey));
295
+ }
296
+ async resolve(accountId, storeId, settingKey, defaultValue) {
297
+ const storeOverrides = this.storeSettings.get(storeId);
298
+ if (storeOverrides && settingKey in storeOverrides) {
299
+ return storeOverrides[settingKey];
300
+ }
301
+ const shared = this.settings.get(this.key(accountId, settingKey));
302
+ if (shared) {
303
+ if (shared.appliesToStores === null || shared.appliesToStores.includes(storeId)) {
304
+ return shared.settingValue;
305
+ }
306
+ }
307
+ return defaultValue;
308
+ }
309
+ };
310
+ // Annotate the CommonJS export names for ESM import in node:
311
+ 0 && (module.exports = {
312
+ MockAccountService,
313
+ MockSharedSettingsService,
314
+ createTestAccount,
315
+ createTestAccountMember,
316
+ createTestAccountSharedSetting,
317
+ createTestAccountStore
318
+ });
319
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/multi-store/index.ts","../../src/multi-store/factories.ts","../../src/multi-store/mock-account-service.ts","../../src/multi-store/mock-shared-settings-service.ts"],"sourcesContent":["/**\n * @uniforge/testing - Multi-Store\n *\n * Test factories and mock services for multi-store types.\n */\n\nexport {\n createTestAccount,\n createTestAccountStore,\n createTestAccountMember,\n createTestAccountSharedSetting,\n} from './factories';\n\nexport { MockAccountService } from './mock-account-service';\nexport { MockSharedSettingsService } from './mock-shared-settings-service';\n","/**\n * Test data factories for multi-store types.\n *\n * Each factory provides sensible defaults that can be overridden.\n */\n\nimport type {\n Account,\n AccountStore,\n AccountMember,\n AccountSharedSetting,\n} from '@uniforge/platform-core/multi-store';\n\nexport function createTestAccount(overrides: Partial<Account> = {}): Account {\n const now = new Date();\n return {\n id: 'acct_test_001',\n name: 'Test Enterprise Account',\n type: 'enterprise',\n isActive: true,\n createdAt: now,\n updatedAt: now,\n ...overrides,\n };\n}\n\nexport function createTestAccountStore(\n overrides: Partial<AccountStore> = {},\n): AccountStore {\n const now = new Date();\n return {\n id: 'store_test_001',\n accountId: 'acct_test_001',\n shopDomain: 'test-shop.myshopify.com',\n storeName: 'Test Store',\n region: null,\n currency: null,\n locale: null,\n timezone: null,\n storeSettings: {},\n isActive: true,\n isPrimary: true,\n createdAt: now,\n updatedAt: now,\n ...overrides,\n };\n}\n\nexport function createTestAccountMember(\n overrides: Partial<AccountMember> = {},\n): AccountMember {\n const now = new Date();\n return {\n id: 'member_test_001',\n accountId: 'acct_test_001',\n userEmail: 'owner@test.com',\n role: 'owner',\n allStoresAccess: true,\n allowedStoreIds: [],\n permissions: [],\n createdAt: now,\n updatedAt: now,\n ...overrides,\n };\n}\n\nexport function createTestAccountSharedSetting(\n overrides: Partial<AccountSharedSetting> = {},\n): AccountSharedSetting {\n const now = new Date();\n return {\n id: 'setting_test_001',\n accountId: 'acct_test_001',\n settingKey: 'theme',\n settingValue: 'dark',\n appliesToStores: null,\n createdAt: now,\n updatedAt: now,\n ...overrides,\n };\n}\n","/**\n * In-memory mock AccountService for testing.\n */\n\nimport type {\n Account,\n AccountStore,\n AccountMember,\n AccountRole,\n AccountService,\n CreateAccountInput,\n UpdateAccountInput,\n AddStoreInput,\n UpdateStoreInput,\n AddMemberInput,\n UpdateMemberInput,\n} from '@uniforge/platform-core/multi-store';\nimport { ACCOUNT_ROLE_HIERARCHY } from '@uniforge/platform-core/multi-store';\n\nexport class MockAccountService implements AccountService {\n private accounts = new Map<string, Account>();\n private stores = new Map<string, AccountStore>();\n private storesByDomain = new Map<string, AccountStore>();\n private members = new Map<string, AccountMember>();\n private membersByKey = new Map<string, AccountMember>();\n private nextId = 1;\n\n private generateId(): string {\n return `mock_${this.nextId++}`;\n }\n\n _reset(): void {\n this.accounts.clear();\n this.stores.clear();\n this.storesByDomain.clear();\n this.members.clear();\n this.membersByKey.clear();\n this.nextId = 1;\n }\n\n async createAccount(input: CreateAccountInput): Promise<Account> {\n const now = new Date();\n const account: Account = {\n id: this.generateId(),\n name: input.name,\n type: input.type,\n isActive: true,\n createdAt: now,\n updatedAt: now,\n };\n this.accounts.set(account.id, account);\n return account;\n }\n\n async getAccount(accountId: string): Promise<Account | null> {\n return this.accounts.get(accountId) ?? null;\n }\n\n async updateAccount(accountId: string, input: UpdateAccountInput): Promise<Account> {\n const account = this.accounts.get(accountId);\n if (!account) throw new Error(`Account ${accountId} not found`);\n const updated: Account = { ...account, updatedAt: new Date() };\n if (input.name !== undefined) updated.name = input.name;\n if (input.type !== undefined) updated.type = input.type;\n if (input.isActive !== undefined) updated.isActive = input.isActive;\n this.accounts.set(accountId, updated);\n return updated;\n }\n\n async deleteAccount(accountId: string): Promise<void> {\n this.accounts.delete(accountId);\n }\n\n async addStore(input: AddStoreInput): Promise<AccountStore> {\n const now = new Date();\n const store: AccountStore = {\n id: this.generateId(),\n accountId: input.accountId,\n shopDomain: input.shopDomain,\n storeName: input.storeName,\n region: input.region ?? null,\n currency: input.currency ?? null,\n locale: input.locale ?? null,\n timezone: input.timezone ?? null,\n storeSettings: input.storeSettings ?? {},\n isActive: true,\n isPrimary: input.isPrimary ?? false,\n createdAt: now,\n updatedAt: now,\n };\n this.stores.set(store.id, store);\n this.storesByDomain.set(store.shopDomain, store);\n return store;\n }\n\n async getStore(storeId: string): Promise<AccountStore | null> {\n return this.stores.get(storeId) ?? null;\n }\n\n async getStoreByDomain(shopDomain: string): Promise<AccountStore | null> {\n return this.storesByDomain.get(shopDomain) ?? null;\n }\n\n async listStores(accountId: string): Promise<AccountStore[]> {\n return [...this.stores.values()].filter((s) => s.accountId === accountId);\n }\n\n async updateStore(storeId: string, input: UpdateStoreInput): Promise<AccountStore> {\n const store = this.stores.get(storeId);\n if (!store) throw new Error(`Store ${storeId} not found`);\n const updated: AccountStore = { ...store, updatedAt: new Date() };\n if (input.storeName !== undefined) updated.storeName = input.storeName;\n if (input.region !== undefined) updated.region = input.region;\n if (input.currency !== undefined) updated.currency = input.currency;\n if (input.locale !== undefined) updated.locale = input.locale;\n if (input.timezone !== undefined) updated.timezone = input.timezone;\n if (input.storeSettings !== undefined) updated.storeSettings = input.storeSettings;\n if (input.isActive !== undefined) updated.isActive = input.isActive;\n if (input.isPrimary !== undefined) updated.isPrimary = input.isPrimary;\n this.stores.set(storeId, updated);\n this.storesByDomain.set(updated.shopDomain, updated);\n return updated;\n }\n\n async removeStore(storeId: string): Promise<void> {\n const store = this.stores.get(storeId);\n if (store) {\n this.storesByDomain.delete(store.shopDomain);\n }\n this.stores.delete(storeId);\n }\n\n async addMember(input: AddMemberInput): Promise<AccountMember> {\n const now = new Date();\n const member: AccountMember = {\n id: this.generateId(),\n accountId: input.accountId,\n userEmail: input.userEmail,\n role: input.role,\n allStoresAccess: input.allStoresAccess ?? false,\n allowedStoreIds: input.allowedStoreIds ?? [],\n permissions: input.permissions ?? [],\n createdAt: now,\n updatedAt: now,\n };\n this.members.set(member.id, member);\n this.membersByKey.set(`${member.accountId}:${member.userEmail}`, member);\n return member;\n }\n\n async getMember(memberId: string): Promise<AccountMember | null> {\n return this.members.get(memberId) ?? null;\n }\n\n async getMemberByEmail(accountId: string, userEmail: string): Promise<AccountMember | null> {\n return this.membersByKey.get(`${accountId}:${userEmail}`) ?? null;\n }\n\n async listMembers(accountId: string): Promise<AccountMember[]> {\n return [...this.members.values()].filter((m) => m.accountId === accountId);\n }\n\n async updateMember(memberId: string, input: UpdateMemberInput): Promise<AccountMember> {\n const member = this.members.get(memberId);\n if (!member) throw new Error(`Member ${memberId} not found`);\n const updated: AccountMember = { ...member, updatedAt: new Date() };\n if (input.role !== undefined) updated.role = input.role;\n if (input.allStoresAccess !== undefined) updated.allStoresAccess = input.allStoresAccess;\n if (input.allowedStoreIds !== undefined) updated.allowedStoreIds = input.allowedStoreIds;\n if (input.permissions !== undefined) updated.permissions = input.permissions;\n this.members.set(memberId, updated);\n this.membersByKey.set(`${updated.accountId}:${updated.userEmail}`, updated);\n return updated;\n }\n\n async removeMember(memberId: string): Promise<void> {\n const member = this.members.get(memberId);\n if (member) {\n this.membersByKey.delete(`${member.accountId}:${member.userEmail}`);\n }\n this.members.delete(memberId);\n }\n\n async canAccessStore(accountId: string, userEmail: string, storeId: string): Promise<boolean> {\n const member = this.membersByKey.get(`${accountId}:${userEmail}`);\n if (!member) return false;\n if (member.role === 'owner' || member.role === 'admin') return true;\n if (member.allStoresAccess) return true;\n return member.allowedStoreIds.includes(storeId);\n }\n\n async isRoleAtLeast(accountId: string, userEmail: string, minimumRole: AccountRole): Promise<boolean> {\n const member = this.membersByKey.get(`${accountId}:${userEmail}`);\n if (!member) return false;\n return ACCOUNT_ROLE_HIERARCHY[member.role] >= ACCOUNT_ROLE_HIERARCHY[minimumRole];\n }\n}\n","/**\n * In-memory mock SharedSettingsService for testing.\n */\n\nimport type {\n AccountSharedSetting,\n SetSharedSettingInput,\n SharedSettingsService,\n} from '@uniforge/platform-core/multi-store';\n\nexport class MockSharedSettingsService implements SharedSettingsService {\n private settings = new Map<string, AccountSharedSetting>();\n private storeSettings = new Map<string, Record<string, unknown>>();\n private nextId = 1;\n\n private key(accountId: string, settingKey: string): string {\n return `${accountId}:${settingKey}`;\n }\n\n _reset(): void {\n this.settings.clear();\n this.storeSettings.clear();\n this.nextId = 1;\n }\n\n /** Helper to set store-level overrides for testing cascade logic. */\n _setStoreSettings(storeId: string, settings: Record<string, unknown>): void {\n this.storeSettings.set(storeId, settings);\n }\n\n async set(input: SetSharedSettingInput): Promise<AccountSharedSetting> {\n const now = new Date();\n const k = this.key(input.accountId, input.settingKey);\n const existing = this.settings.get(k);\n const setting: AccountSharedSetting = {\n id: existing?.id ?? `mock_setting_${this.nextId++}`,\n accountId: input.accountId,\n settingKey: input.settingKey,\n settingValue: input.settingValue,\n appliesToStores: input.appliesToStores ?? null,\n createdAt: existing?.createdAt ?? now,\n updatedAt: now,\n };\n this.settings.set(k, setting);\n return setting;\n }\n\n async get(accountId: string, settingKey: string): Promise<AccountSharedSetting | null> {\n return this.settings.get(this.key(accountId, settingKey)) ?? null;\n }\n\n async list(accountId: string): Promise<AccountSharedSetting[]> {\n return [...this.settings.values()].filter((s) => s.accountId === accountId);\n }\n\n async delete(accountId: string, settingKey: string): Promise<void> {\n this.settings.delete(this.key(accountId, settingKey));\n }\n\n async resolve<T = unknown>(\n accountId: string,\n storeId: string,\n settingKey: string,\n defaultValue: T,\n ): Promise<T> {\n // 1. Store-specific override\n const storeOverrides = this.storeSettings.get(storeId);\n if (storeOverrides && settingKey in storeOverrides) {\n return storeOverrides[settingKey] as T;\n }\n\n // 2. Account shared setting\n const shared = this.settings.get(this.key(accountId, settingKey));\n if (shared) {\n if (shared.appliesToStores === null || shared.appliesToStores.includes(storeId)) {\n return shared.settingValue as T;\n }\n }\n\n // 3. Default value\n return defaultValue;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACaO,SAAS,kBAAkB,YAA8B,CAAC,GAAY;AAC3E,QAAM,MAAM,oBAA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