@happyvertical/smrt-tenancy 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +71 -0
- package/CLAUDE.md +1 -0
- package/LICENSE +7 -0
- package/README.md +122 -0
- package/dist/__smrt-register__.d.ts +2 -0
- package/dist/__smrt-register__.d.ts.map +1 -0
- package/dist/adapters/cli.d.ts +178 -0
- package/dist/adapters/cli.d.ts.map +1 -0
- package/dist/adapters/express.d.ts +115 -0
- package/dist/adapters/express.d.ts.map +1 -0
- package/dist/adapters/index.d.ts +22 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +7 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/sveltekit.d.ts +123 -0
- package/dist/adapters/sveltekit.d.ts.map +1 -0
- package/dist/chunks/context-B5CKsmMi.js +190 -0
- package/dist/chunks/context-B5CKsmMi.js.map +1 -0
- package/dist/chunks/sveltekit-9eRH1RLw.js +153 -0
- package/dist/chunks/sveltekit-9eRH1RLw.js.map +1 -0
- package/dist/chunks/testing-C_tV23JW.js +487 -0
- package/dist/chunks/testing-C_tV23JW.js.map +1 -0
- package/dist/context.d.ts +435 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/decorators.d.ts +126 -0
- package/dist/decorators.d.ts.map +1 -0
- package/dist/enabled-state.d.ts +25 -0
- package/dist/enabled-state.d.ts.map +1 -0
- package/dist/entry-point.d.ts +83 -0
- package/dist/entry-point.d.ts.map +1 -0
- package/dist/fields.d.ts +104 -0
- package/dist/fields.d.ts.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +108 -0
- package/dist/index.js.map +1 -0
- package/dist/interceptor.d.ts +156 -0
- package/dist/interceptor.d.ts.map +1 -0
- package/dist/manifest.json +11 -0
- package/dist/playground.d.ts +2 -0
- package/dist/playground.d.ts.map +1 -0
- package/dist/playground.js +80 -0
- package/dist/playground.js.map +1 -0
- package/dist/registry.d.ts +145 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +65 -0
- package/dist/svelte/components/TenantCard.svelte +272 -0
- package/dist/svelte/components/TenantCard.svelte.d.ts +18 -0
- package/dist/svelte/components/TenantCard.svelte.d.ts.map +1 -0
- package/dist/svelte/components/TenantSwitcher.svelte +68 -0
- package/dist/svelte/components/TenantSwitcher.svelte.d.ts +11 -0
- package/dist/svelte/components/TenantSwitcher.svelte.d.ts.map +1 -0
- package/dist/svelte/i18n.d.ts +5 -0
- package/dist/svelte/i18n.d.ts.map +1 -0
- package/dist/svelte/i18n.js +9 -0
- package/dist/svelte/index.d.ts +15 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +19 -0
- package/dist/svelte/playground.d.ts +70 -0
- package/dist/svelte/playground.d.ts.map +1 -0
- package/dist/svelte/playground.js +75 -0
- package/dist/testing.d.ts +145 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +11 -0
- package/dist/testing.js.map +1 -0
- package/dist/ui.d.ts +21 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +33 -0
- package/dist/ui.js.map +1 -0
- package/package.json +99 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
packageName: string;
|
|
3
|
+
displayName: string;
|
|
4
|
+
description: string | undefined;
|
|
5
|
+
moduleMeta: import("@happyvertical/smrt-types").SmrtModuleMeta;
|
|
6
|
+
entries: ({
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
loadComponent: () => Promise<typeof import("./components/TenantCard.svelte")>;
|
|
11
|
+
order: number;
|
|
12
|
+
props: {
|
|
13
|
+
tenant: {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
slug: string;
|
|
17
|
+
status: string;
|
|
18
|
+
};
|
|
19
|
+
memberCount: number;
|
|
20
|
+
selected: boolean;
|
|
21
|
+
actions: boolean;
|
|
22
|
+
onclick: () => void;
|
|
23
|
+
onedit: () => void;
|
|
24
|
+
ondelete: () => void;
|
|
25
|
+
memberships?: undefined;
|
|
26
|
+
tenants?: undefined;
|
|
27
|
+
currentTenantId?: undefined;
|
|
28
|
+
onchange?: undefined;
|
|
29
|
+
};
|
|
30
|
+
modes: {
|
|
31
|
+
mock: {
|
|
32
|
+
label: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
} | {
|
|
36
|
+
id: string;
|
|
37
|
+
title: string;
|
|
38
|
+
description: string;
|
|
39
|
+
loadComponent: () => Promise<typeof import("./components/TenantSwitcher.svelte")>;
|
|
40
|
+
order: number;
|
|
41
|
+
props: {
|
|
42
|
+
memberships: {
|
|
43
|
+
id: string;
|
|
44
|
+
tenantId: string;
|
|
45
|
+
}[];
|
|
46
|
+
tenants: Map<string, {
|
|
47
|
+
id: string;
|
|
48
|
+
name: string;
|
|
49
|
+
slug: string;
|
|
50
|
+
status: string;
|
|
51
|
+
}>;
|
|
52
|
+
currentTenantId: string;
|
|
53
|
+
onchange: () => void;
|
|
54
|
+
tenant?: undefined;
|
|
55
|
+
memberCount?: undefined;
|
|
56
|
+
selected?: undefined;
|
|
57
|
+
actions?: undefined;
|
|
58
|
+
onclick?: undefined;
|
|
59
|
+
onedit?: undefined;
|
|
60
|
+
ondelete?: undefined;
|
|
61
|
+
};
|
|
62
|
+
modes: {
|
|
63
|
+
mock: {
|
|
64
|
+
label: string;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
})[];
|
|
68
|
+
};
|
|
69
|
+
export default _default;
|
|
70
|
+
//# sourceMappingURL=playground.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../../src/svelte/playground.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,wBAgDE"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { TENANCY_MODULE_META } from '../ui.js';
|
|
2
|
+
const noop = () => { };
|
|
3
|
+
const sampleTenants = [
|
|
4
|
+
{
|
|
5
|
+
id: 'tenant-riverstone',
|
|
6
|
+
name: 'Riverstone Newsroom',
|
|
7
|
+
slug: 'riverstone-newsroom',
|
|
8
|
+
status: 'active',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: 'tenant-harbor',
|
|
12
|
+
name: 'Harbor Labs',
|
|
13
|
+
slug: 'harbor-labs',
|
|
14
|
+
status: 'suspended',
|
|
15
|
+
},
|
|
16
|
+
];
|
|
17
|
+
const sampleMemberships = [
|
|
18
|
+
{
|
|
19
|
+
id: 'membership-riverstone',
|
|
20
|
+
tenantId: 'tenant-riverstone',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'membership-harbor',
|
|
24
|
+
tenantId: 'tenant-harbor',
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
const loadTenantCard = () => import('./components/TenantCard.svelte');
|
|
28
|
+
const loadTenantSwitcher = () => import('./components/TenantSwitcher.svelte');
|
|
29
|
+
export default {
|
|
30
|
+
packageName: '@happyvertical/smrt-tenancy',
|
|
31
|
+
displayName: TENANCY_MODULE_META.displayName,
|
|
32
|
+
description: TENANCY_MODULE_META.description,
|
|
33
|
+
moduleMeta: TENANCY_MODULE_META,
|
|
34
|
+
entries: [
|
|
35
|
+
{
|
|
36
|
+
id: 'tenant-card',
|
|
37
|
+
title: 'Tenant Card',
|
|
38
|
+
description: 'Tenant identity and status card with optional membership count and actions.',
|
|
39
|
+
loadComponent: loadTenantCard,
|
|
40
|
+
order: 1,
|
|
41
|
+
props: {
|
|
42
|
+
tenant: sampleTenants[0],
|
|
43
|
+
memberCount: 18,
|
|
44
|
+
selected: true,
|
|
45
|
+
actions: true,
|
|
46
|
+
onclick: noop,
|
|
47
|
+
onedit: noop,
|
|
48
|
+
ondelete: noop,
|
|
49
|
+
},
|
|
50
|
+
modes: {
|
|
51
|
+
mock: {
|
|
52
|
+
label: 'Mock',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'tenant-switcher',
|
|
58
|
+
title: 'Tenant Switcher',
|
|
59
|
+
description: 'Membership-aware tenant selector used for multi-tenant application shells.',
|
|
60
|
+
loadComponent: loadTenantSwitcher,
|
|
61
|
+
order: 2,
|
|
62
|
+
props: {
|
|
63
|
+
memberships: sampleMemberships,
|
|
64
|
+
tenants: new Map(sampleTenants.map((tenant) => [tenant.id, tenant])),
|
|
65
|
+
currentTenantId: 'tenant-riverstone',
|
|
66
|
+
onchange: noop,
|
|
67
|
+
},
|
|
68
|
+
modes: {
|
|
69
|
+
mock: {
|
|
70
|
+
label: 'Mock',
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { MinimalTenantContext, TenantContextData } from './context.js';
|
|
2
|
+
/**
|
|
3
|
+
* Reset all tenancy state (for use in beforeEach/afterEach)
|
|
4
|
+
*
|
|
5
|
+
* This clears:
|
|
6
|
+
* - Registered interceptors
|
|
7
|
+
* - Tenant-scoped class registry
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* afterEach(() => {
|
|
12
|
+
* resetTenancy();
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export declare function resetTenancy(): void;
|
|
17
|
+
/**
|
|
18
|
+
* Create a test tenant context and run code within it
|
|
19
|
+
*
|
|
20
|
+
* Convenience wrapper around withTenant() with sensible defaults for testing.
|
|
21
|
+
*
|
|
22
|
+
* @param context - Tenant context (can be minimal, just tenantId)
|
|
23
|
+
* @param fn - Async function to run in the context
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* await createTestTenantContext({ tenantId: 'test-tenant' }, async () => {
|
|
28
|
+
* const product = await collection.create({ name: 'Test' });
|
|
29
|
+
* expect(product.tenantId).toBe('test-tenant');
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare function createTestTenantContext<T>(context: MinimalTenantContext | TenantContextData, fn: () => Promise<T>): Promise<T>;
|
|
34
|
+
/**
|
|
35
|
+
* Create multiple tenant contexts for isolation testing
|
|
36
|
+
*
|
|
37
|
+
* @param tenantIds - Array of tenant IDs to create contexts for
|
|
38
|
+
* @param fn - Function that receives an object mapping tenant IDs to context runners
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* await testTenantIsolation(['tenant-a', 'tenant-b'], async (tenants) => {
|
|
43
|
+
* // Create in tenant A
|
|
44
|
+
* const docA = await tenants['tenant-a'](async () => {
|
|
45
|
+
* return collection.create({ title: 'A doc' });
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* // Verify not visible in tenant B
|
|
49
|
+
* await tenants['tenant-b'](async () => {
|
|
50
|
+
* const found = await collection.get(docA.id);
|
|
51
|
+
* expect(found).toBeNull();
|
|
52
|
+
* });
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
export declare function testTenantIsolation<T>(tenantIds: string[], fn: (tenants: Record<string, <R>(runner: () => Promise<R>) => Promise<R>>) => Promise<T>): Promise<T>;
|
|
57
|
+
/**
|
|
58
|
+
* Options for `setupTestTenancy()`.
|
|
59
|
+
*
|
|
60
|
+
* @see setupTestTenancy
|
|
61
|
+
*/
|
|
62
|
+
export interface SetupTestTenancyOptions {
|
|
63
|
+
/**
|
|
64
|
+
* Enable tenancy interceptors
|
|
65
|
+
* @default true
|
|
66
|
+
*/
|
|
67
|
+
enableInterceptors?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Raw query policy for tests
|
|
70
|
+
* @default 'throw'
|
|
71
|
+
*/
|
|
72
|
+
rawQueryPolicy?: 'throw' | 'warn' | 'allow';
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Set up tenancy for a test suite
|
|
76
|
+
*
|
|
77
|
+
* Call in beforeAll or at the start of tests to configure tenancy.
|
|
78
|
+
*
|
|
79
|
+
* @param options - Setup options
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* beforeAll(() => {
|
|
84
|
+
* setupTestTenancy({ enableInterceptors: true });
|
|
85
|
+
* });
|
|
86
|
+
*
|
|
87
|
+
* afterAll(() => {
|
|
88
|
+
* resetTenancy();
|
|
89
|
+
* });
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare function setupTestTenancy(options?: SetupTestTenancyOptions): void;
|
|
93
|
+
/**
|
|
94
|
+
* Assert that executing `fn` throws a `TenantContextError`.
|
|
95
|
+
*
|
|
96
|
+
* Fails with a descriptive message if `fn` completes without throwing, or if
|
|
97
|
+
* it throws a different error type. Optionally verifies that the error message
|
|
98
|
+
* contains a specific substring.
|
|
99
|
+
*
|
|
100
|
+
* Useful for testing that business-logic code correctly rejects calls that are
|
|
101
|
+
* made outside a tenant context.
|
|
102
|
+
*
|
|
103
|
+
* @param fn - Async function that should throw `TenantContextError`.
|
|
104
|
+
* @param messageContains - Optional substring the error message must include.
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* await assertTenantContextRequired(async () => {
|
|
109
|
+
* // No withTenant() in scope
|
|
110
|
+
* await documentCollection.list({});
|
|
111
|
+
* });
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @see assertTenantIsolationViolation
|
|
115
|
+
* @see TenantContextError
|
|
116
|
+
*/
|
|
117
|
+
export declare function assertTenantContextRequired(fn: () => Promise<unknown>, messageContains?: string): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Assert that executing `fn` throws a `TenantIsolationError`.
|
|
120
|
+
*
|
|
121
|
+
* Fails with a descriptive message if `fn` completes without throwing, or if
|
|
122
|
+
* it throws a different error type. Optionally verifies that the error message
|
|
123
|
+
* contains a specific substring.
|
|
124
|
+
*
|
|
125
|
+
* Use this to verify that cross-tenant data access attempts are correctly
|
|
126
|
+
* blocked by the interceptor.
|
|
127
|
+
*
|
|
128
|
+
* @param fn - Async function that should throw `TenantIsolationError`.
|
|
129
|
+
* @param messageContains - Optional substring the error message must include.
|
|
130
|
+
*
|
|
131
|
+
* @example
|
|
132
|
+
* ```typescript
|
|
133
|
+
* await withTenant({ tenantId: 'tenant-a' }, async () => {
|
|
134
|
+
* await assertTenantIsolationViolation(async () => {
|
|
135
|
+
* // Attempt to filter by a different tenant
|
|
136
|
+
* await collection.list({ where: { tenantId: 'tenant-b' } });
|
|
137
|
+
* });
|
|
138
|
+
* });
|
|
139
|
+
* ```
|
|
140
|
+
*
|
|
141
|
+
* @see assertTenantContextRequired
|
|
142
|
+
* @see TenantIsolationError
|
|
143
|
+
*/
|
|
144
|
+
export declare function assertTenantIsolationViolation(fn: () => Promise<unknown>, messageContains?: string): Promise<void>;
|
|
145
|
+
//# sourceMappingURL=testing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../src/testing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EAEvB,MAAM,cAAc,CAAC;AAItB;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAGnC;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,uBAAuB,CAAC,CAAC,EAC7C,OAAO,EAAE,oBAAoB,GAAG,iBAAiB,EACjD,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GACnB,OAAO,CAAC,CAAC,CAAC,CAEZ;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,EACzC,SAAS,EAAE,MAAM,EAAE,EACnB,EAAE,EAAE,CACF,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAC,KACjE,OAAO,CAAC,CAAC,CAAC,GACd,OAAO,CAAC,CAAC,CAAC,CAWZ;AAED;;;;GAIG;AACH,MAAM,WAAW,uBAAuB;IACtC;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,GAAE,uBAA4B,GAAG,IAAI,CAU5E;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAsB,2BAA2B,CAC/C,EAAE,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,EAC1B,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAiBf;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,8BAA8B,CAClD,EAAE,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,EAC1B,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAiBf"}
|
package/dist/testing.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import "./chunks/context-B5CKsmMi.js";
|
|
2
|
+
import { a, b, e, l, s, t } from "./chunks/testing-C_tV23JW.js";
|
|
3
|
+
export {
|
|
4
|
+
a as assertTenantContextRequired,
|
|
5
|
+
b as assertTenantIsolationViolation,
|
|
6
|
+
e as createTestTenantContext,
|
|
7
|
+
l as resetTenancy,
|
|
8
|
+
s as setupTestTenancy,
|
|
9
|
+
t as testTenantIsolation
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"testing.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ModuleUISlot, SmrtModuleMeta } from '@happyvertical/smrt-types';
|
|
2
|
+
/**
|
|
3
|
+
* UI slot definitions for the tenancy module.
|
|
4
|
+
*
|
|
5
|
+
* Keyed by slot ID. Each entry describes a named extension point where a
|
|
6
|
+
* host application can render a tenancy UI component (e.g., tenant card,
|
|
7
|
+
* tenant switcher). Components are implemented in the `./svelte` subpath.
|
|
8
|
+
*
|
|
9
|
+
* @see TENANCY_MODULE_META
|
|
10
|
+
*/
|
|
11
|
+
export declare const TENANCY_UI_SLOTS: Record<string, ModuleUISlot>;
|
|
12
|
+
/**
|
|
13
|
+
* Module metadata for `@happyvertical/smrt-tenancy`.
|
|
14
|
+
*
|
|
15
|
+
* Consumed by the SMRT module system to register this package's display name,
|
|
16
|
+
* description, data models, collections, and UI slots with the host application.
|
|
17
|
+
*
|
|
18
|
+
* @see TENANCY_UI_SLOTS
|
|
19
|
+
*/
|
|
20
|
+
export declare const TENANCY_MODULE_META: SmrtModuleMeta;
|
|
21
|
+
//# sourceMappingURL=ui.d.ts.map
|
package/dist/ui.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE9E;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAmBzD,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAE,cAOjC,CAAC"}
|
package/dist/ui.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
const TENANCY_UI_SLOTS = {
|
|
2
|
+
"tenant-card": {
|
|
3
|
+
id: "tenant-card",
|
|
4
|
+
label: "Tenant Card",
|
|
5
|
+
description: "Tenant information and management card",
|
|
6
|
+
icon: "building",
|
|
7
|
+
category: "display",
|
|
8
|
+
order: 1,
|
|
9
|
+
propsInterface: "TenantCardProps"
|
|
10
|
+
},
|
|
11
|
+
"tenant-switcher": {
|
|
12
|
+
id: "tenant-switcher",
|
|
13
|
+
label: "Tenant Switcher",
|
|
14
|
+
description: "Dropdown for switching between tenants",
|
|
15
|
+
icon: "switch",
|
|
16
|
+
category: "form",
|
|
17
|
+
order: 2,
|
|
18
|
+
propsInterface: "TenantSwitcherProps"
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const TENANCY_MODULE_META = {
|
|
22
|
+
name: "@happyvertical/smrt-tenancy",
|
|
23
|
+
displayName: "Tenancy",
|
|
24
|
+
description: "Multi-tenancy framework with automatic tenant isolation",
|
|
25
|
+
uiSlots: TENANCY_UI_SLOTS,
|
|
26
|
+
models: ["Tenant", "TenantContext"],
|
|
27
|
+
collections: ["TenantCollection"]
|
|
28
|
+
};
|
|
29
|
+
export {
|
|
30
|
+
TENANCY_MODULE_META,
|
|
31
|
+
TENANCY_UI_SLOTS
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=ui.js.map
|
package/dist/ui.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sources":["../src/ui.ts"],"sourcesContent":["/**\n * Tenancy Module UI Slot Declarations\n *\n * This file defines the UI extension points for the tenancy module.\n * UI components are implemented in the ./svelte subpath.\n */\n\nimport type { ModuleUISlot, SmrtModuleMeta } from '@happyvertical/smrt-types';\n\n/**\n * UI slot definitions for the tenancy module.\n *\n * Keyed by slot ID. Each entry describes a named extension point where a\n * host application can render a tenancy UI component (e.g., tenant card,\n * tenant switcher). Components are implemented in the `./svelte` subpath.\n *\n * @see TENANCY_MODULE_META\n */\nexport const TENANCY_UI_SLOTS: Record<string, ModuleUISlot> = {\n 'tenant-card': {\n id: 'tenant-card',\n label: 'Tenant Card',\n description: 'Tenant information and management card',\n icon: 'building',\n category: 'display',\n order: 1,\n propsInterface: 'TenantCardProps',\n },\n 'tenant-switcher': {\n id: 'tenant-switcher',\n label: 'Tenant Switcher',\n description: 'Dropdown for switching between tenants',\n icon: 'switch',\n category: 'form',\n order: 2,\n propsInterface: 'TenantSwitcherProps',\n },\n};\n\n/**\n * Module metadata for `@happyvertical/smrt-tenancy`.\n *\n * Consumed by the SMRT module system to register this package's display name,\n * description, data models, collections, and UI slots with the host application.\n *\n * @see TENANCY_UI_SLOTS\n */\nexport const TENANCY_MODULE_META: SmrtModuleMeta = {\n name: '@happyvertical/smrt-tenancy',\n displayName: 'Tenancy',\n description: 'Multi-tenancy framework with automatic tenant isolation',\n uiSlots: TENANCY_UI_SLOTS,\n models: ['Tenant', 'TenantContext'],\n collections: ['TenantCollection'],\n};\n"],"names":[],"mappings":"AAkBO,MAAM,mBAAiD;AAAA,EAC5D,eAAe;AAAA,IACb,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,aAAa;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,IACV,OAAO;AAAA,IACP,gBAAgB;AAAA,EAAA;AAAA,EAElB,mBAAmB;AAAA,IACjB,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,aAAa;AAAA,IACb,MAAM;AAAA,IACN,UAAU;AAAA,IACV,OAAO;AAAA,IACP,gBAAgB;AAAA,EAAA;AAEpB;AAUO,MAAM,sBAAsC;AAAA,EACjD,MAAM;AAAA,EACN,aAAa;AAAA,EACb,aAAa;AAAA,EACb,SAAS;AAAA,EACT,QAAQ,CAAC,UAAU,eAAe;AAAA,EAClC,aAAa,CAAC,kBAAkB;AAClC;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@happyvertical/smrt-tenancy",
|
|
3
|
+
"version": "0.30.0",
|
|
4
|
+
"description": "Production-ready multi-tenancy framework for SMRT with automatic tenant isolation and enforcement",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"CLAUDE.md",
|
|
11
|
+
"AGENTS.md"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./adapters": {
|
|
19
|
+
"types": "./dist/adapters/index.d.ts",
|
|
20
|
+
"import": "./dist/adapters/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./testing": {
|
|
23
|
+
"types": "./dist/testing.d.ts",
|
|
24
|
+
"import": "./dist/testing.js"
|
|
25
|
+
},
|
|
26
|
+
"./ui": {
|
|
27
|
+
"types": "./dist/ui.d.ts",
|
|
28
|
+
"import": "./dist/ui.js"
|
|
29
|
+
},
|
|
30
|
+
"./manifest": "./dist/manifest.json",
|
|
31
|
+
"./manifest.json": "./dist/manifest.json",
|
|
32
|
+
"./playground": {
|
|
33
|
+
"types": "./dist/playground.d.ts",
|
|
34
|
+
"import": "./dist/playground.js"
|
|
35
|
+
},
|
|
36
|
+
"./svelte": {
|
|
37
|
+
"types": "./dist/svelte/index.d.ts",
|
|
38
|
+
"svelte": "./dist/svelte/index.js",
|
|
39
|
+
"import": "./dist/svelte/index.js"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@happyvertical/logger": "^0.74.7",
|
|
44
|
+
"@happyvertical/sql": "^0.74.7",
|
|
45
|
+
"@happyvertical/utils": "^0.74.7",
|
|
46
|
+
"@happyvertical/smrt-core": "0.30.0",
|
|
47
|
+
"@happyvertical/smrt-types": "0.30.0",
|
|
48
|
+
"@happyvertical/smrt-ui": "0.30.0"
|
|
49
|
+
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"svelte": "^5.46.4"
|
|
52
|
+
},
|
|
53
|
+
"peerDependenciesMeta": {
|
|
54
|
+
"svelte": {
|
|
55
|
+
"optional": true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@sveltejs/package": "^2.5.7",
|
|
60
|
+
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
61
|
+
"@types/node": "25.0.9",
|
|
62
|
+
"svelte": "^5.46.4",
|
|
63
|
+
"svelte-check": "^4.3.5",
|
|
64
|
+
"typescript": "^5.9.3",
|
|
65
|
+
"vite": "^7.3.1",
|
|
66
|
+
"vitest": "^4.0.17",
|
|
67
|
+
"@happyvertical/smrt-vitest": "0.30.0"
|
|
68
|
+
},
|
|
69
|
+
"keywords": [
|
|
70
|
+
"ai",
|
|
71
|
+
"agents",
|
|
72
|
+
"multi-tenancy",
|
|
73
|
+
"tenancy",
|
|
74
|
+
"isolation",
|
|
75
|
+
"smrt"
|
|
76
|
+
],
|
|
77
|
+
"author": "HappyVertical",
|
|
78
|
+
"license": "MIT",
|
|
79
|
+
"publishConfig": {
|
|
80
|
+
"registry": "https://registry.npmjs.org",
|
|
81
|
+
"access": "public"
|
|
82
|
+
},
|
|
83
|
+
"repository": {
|
|
84
|
+
"type": "git",
|
|
85
|
+
"url": "https://github.com/happyvertical/smrt.git",
|
|
86
|
+
"directory": "packages/tenancy"
|
|
87
|
+
},
|
|
88
|
+
"scripts": {
|
|
89
|
+
"build": "vite build --mode library && svelte-package -i src/svelte -o dist/svelte --tsconfig tsconfig.svelte.json",
|
|
90
|
+
"build:watch": "vite build --mode library --watch",
|
|
91
|
+
"clean": "rm -rf dist",
|
|
92
|
+
"dev": "npm run build:watch",
|
|
93
|
+
"test": "vitest run",
|
|
94
|
+
"test:watch": "vitest",
|
|
95
|
+
"check": "pnpm exec svelte-check --tsconfig ./tsconfig.svelte.json",
|
|
96
|
+
"typecheck": "tsc --noEmit && node ../../scripts/svelte-check-a11y.mjs --tsconfig ./tsconfig.svelte.json",
|
|
97
|
+
"verify:pack": "node ../../scripts/verify-package-types-exports.js ."
|
|
98
|
+
}
|
|
99
|
+
}
|