@fayz-ai/core 0.8.1 → 0.8.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.
- package/dist/access/denial.d.ts +21 -0
- package/dist/access/denial.d.ts.map +1 -0
- package/dist/access/engine.d.ts +63 -0
- package/dist/access/engine.d.ts.map +1 -0
- package/dist/access/index.cjs +60 -0
- package/dist/access/index.cjs.map +1 -0
- package/dist/access/index.d.ts +6 -0
- package/dist/access/index.d.ts.map +1 -0
- package/dist/access/index.js +51 -0
- package/dist/access/index.js.map +1 -0
- package/dist/access/limits.d.ts +10 -0
- package/dist/access/limits.d.ts.map +1 -0
- package/dist/address/index.d.ts +52 -0
- package/dist/address/index.d.ts.map +1 -0
- package/dist/{chunk-QR7U2URY.cjs → chunk-CATASHPK.cjs} +345 -4
- package/dist/chunk-CATASHPK.cjs.map +1 -0
- package/dist/{chunk-WKZVSKEU.js → chunk-CU64QI4A.js} +2 -2
- package/dist/chunk-CU64QI4A.js.map +1 -0
- package/dist/{chunk-KNIVT6XZ.js → chunk-DZALZ6Q6.js} +345 -4
- package/dist/chunk-DZALZ6Q6.js.map +1 -0
- package/dist/{chunk-54SRL7AJ.cjs → chunk-KSI2L3E4.cjs} +145 -86
- package/dist/chunk-KSI2L3E4.cjs.map +1 -0
- package/dist/{chunk-ZBIWYDAR.js → chunk-TYPVSWLG.js} +144 -87
- package/dist/chunk-TYPVSWLG.js.map +1 -0
- package/dist/{chunk-2NTHNWEH.cjs → chunk-UKU4RIWM.cjs} +2 -2
- package/dist/chunk-UKU4RIWM.cjs.map +1 -0
- package/dist/{chunk-CHGX6UYR.js → chunk-YH25Y4FW.js} +6 -3
- package/dist/chunk-YH25Y4FW.js.map +1 -0
- package/dist/{chunk-5X2VX3RQ.cjs → chunk-ZOPJB5FN.cjs} +6 -3
- package/dist/chunk-ZOPJB5FN.cjs.map +1 -0
- package/dist/data/archetype.d.ts.map +1 -1
- package/dist/data/count.d.ts +34 -0
- package/dist/data/count.d.ts.map +1 -0
- package/dist/data/index.cjs +18 -10
- package/dist/data/index.d.ts +2 -0
- package/dist/data/index.d.ts.map +1 -1
- package/dist/data/index.js +1 -1
- package/dist/data/refresh.d.ts +36 -0
- package/dist/data/refresh.d.ts.map +1 -0
- package/dist/data/resolve.d.ts.map +1 -1
- package/dist/data/supabase.d.ts.map +1 -1
- package/dist/data/types.d.ts +6 -0
- package/dist/data/types.d.ts.map +1 -1
- package/dist/entity/index.cjs +6 -6
- package/dist/entity/index.js +1 -1
- package/dist/entity/registry.d.ts +9 -0
- package/dist/entity/registry.d.ts.map +1 -1
- package/dist/i18n/index.cjs +10 -10
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/shell-translations.d.ts.map +1 -1
- package/dist/index.cjs +1517 -180
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1412 -110
- package/dist/index.js.map +1 -1
- package/dist/manifest/index.d.ts +109 -3
- package/dist/manifest/index.d.ts.map +1 -1
- package/dist/manifest/serialize.d.ts +14 -0
- package/dist/manifest/serialize.d.ts.map +1 -0
- package/dist/plugin/index.cjs +7 -7
- package/dist/plugin/index.js +1 -1
- package/dist/plugin/runtime.d.ts.map +1 -1
- package/dist/search/engine.d.ts +12 -0
- package/dist/search/engine.d.ts.map +1 -0
- package/dist/search/index.d.ts +5 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/text.d.ts +37 -0
- package/dist/search/text.d.ts.map +1 -0
- package/dist/search/types.d.ts +72 -0
- package/dist/search/types.d.ts.map +1 -0
- package/dist/types/billing.d.ts +20 -0
- package/dist/types/billing.d.ts.map +1 -1
- package/dist/types/crud.d.ts +47 -1
- package/dist/types/crud.d.ts.map +1 -1
- package/dist/types/entitlements.d.ts +45 -0
- package/dist/types/entitlements.d.ts.map +1 -0
- package/dist/types/index.d.ts +4 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/org.d.ts +28 -0
- package/dist/types/org.d.ts.map +1 -1
- package/dist/types/plugins.d.ts +88 -0
- package/dist/types/plugins.d.ts.map +1 -1
- package/package.json +14 -4
- package/src/access/denial.ts +33 -0
- package/src/access/engine.test.ts +48 -0
- package/src/access/engine.ts +121 -0
- package/src/access/index.ts +13 -0
- package/src/access/limits.ts +18 -0
- package/src/address/index.ts +188 -0
- package/src/data/archetype.ts +4 -2
- package/src/data/count.test.ts +152 -0
- package/src/data/count.ts +131 -0
- package/src/data/index.ts +2 -0
- package/src/data/refresh.ts +105 -0
- package/src/data/resolve.ts +7 -1
- package/src/data/supabase.ts +3 -1
- package/src/data/types.ts +6 -0
- package/src/entity/registry.ts +7 -0
- package/src/i18n/shell-translations.ts +345 -2
- package/src/index.ts +37 -4
- package/src/manifest/app-manifest.schema.json +618 -45
- package/src/manifest/index.ts +127 -3
- package/src/manifest/serialize.ts +52 -0
- package/src/plugin/runtime.ts +5 -1
- package/src/search/engine.ts +551 -0
- package/src/search/index.ts +25 -0
- package/src/search/text.ts +206 -0
- package/src/search/types.ts +75 -0
- package/src/types/billing.ts +22 -0
- package/src/types/crud.ts +48 -1
- package/src/types/entitlements.ts +45 -0
- package/src/types/index.ts +4 -3
- package/src/types/org.ts +29 -0
- package/src/types/plugins.ts +83 -0
- package/dist/chunk-2NTHNWEH.cjs.map +0 -1
- package/dist/chunk-54SRL7AJ.cjs.map +0 -1
- package/dist/chunk-5X2VX3RQ.cjs.map +0 -1
- package/dist/chunk-CHGX6UYR.js.map +0 -1
- package/dist/chunk-KNIVT6XZ.js.map +0 -1
- package/dist/chunk-QR7U2URY.cjs.map +0 -1
- package/dist/chunk-WKZVSKEU.js.map +0 -1
- package/dist/chunk-ZBIWYDAR.js.map +0 -1
package/dist/manifest/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { EntityDef } from '../types/crud';
|
|
2
2
|
import type { LocaleConfig } from '../types/i18n';
|
|
3
|
-
import type { PermissionsConfig } from '../types/permissions';
|
|
3
|
+
import type { PermissionsConfig, FeatureDeclaration } from '../types/permissions';
|
|
4
4
|
import type { BillingConfig } from '../types/billing';
|
|
5
|
+
import type { LimitDeclaration } from '../types/entitlements';
|
|
6
|
+
import type { AIToolParameters, AIToolExecution, AgentRpcDeclaration } from '../types/plugins';
|
|
5
7
|
import type { BlockNode } from '../blocks';
|
|
6
|
-
export declare const CURRENT_MANIFEST_VERSION =
|
|
8
|
+
export declare const CURRENT_MANIFEST_VERSION = 3;
|
|
7
9
|
export type BackendProvider = 'supabase' | 'fayz-api' | 'fayz-shop' | 'mock' | 'custom';
|
|
8
10
|
export interface BackendRef {
|
|
9
11
|
provider: BackendProvider;
|
|
@@ -50,6 +52,104 @@ export interface SurfaceManifest {
|
|
|
50
52
|
* manifest-version bump for additive fields. */
|
|
51
53
|
options?: Record<string, unknown>;
|
|
52
54
|
}
|
|
55
|
+
/** JSON-safe projection of an EntityDef — schema only, no components/closures.
|
|
56
|
+
* `data` mirrors EntityDef.data: everything the server-plane read executor
|
|
57
|
+
* needs (tenant scoping, search/select column allowlists, fixed filters). */
|
|
58
|
+
export interface EntityContract {
|
|
59
|
+
key: string;
|
|
60
|
+
label: string;
|
|
61
|
+
labelPlural?: string;
|
|
62
|
+
/** Plan-limit key rows of this entity consume (EntityDef.limitKey). */
|
|
63
|
+
limitKey?: string;
|
|
64
|
+
/** Permission to READ via the generic data primitives (EntityDef.permission). */
|
|
65
|
+
permission?: {
|
|
66
|
+
feature: string;
|
|
67
|
+
action: string;
|
|
68
|
+
};
|
|
69
|
+
data: {
|
|
70
|
+
table: string;
|
|
71
|
+
schema?: string;
|
|
72
|
+
tenantScoped?: boolean;
|
|
73
|
+
tenantIdColumn?: string;
|
|
74
|
+
searchColumns?: string[];
|
|
75
|
+
selectColumns?: string;
|
|
76
|
+
columnMap?: Record<string, string>;
|
|
77
|
+
archetype?: string;
|
|
78
|
+
archetypeKind?: string;
|
|
79
|
+
filters?: Record<string, string>;
|
|
80
|
+
};
|
|
81
|
+
fields: Array<{
|
|
82
|
+
key: string;
|
|
83
|
+
label: string;
|
|
84
|
+
type: string;
|
|
85
|
+
required?: boolean;
|
|
86
|
+
searchable?: boolean;
|
|
87
|
+
/** FieldDef.hint — the field's helper text. Carried into the contract
|
|
88
|
+
* because it is what tells the agent what a non-obvious column expects:
|
|
89
|
+
* an id to look up, a default it should not restate, a format. */
|
|
90
|
+
hint?: string;
|
|
91
|
+
/** Allowed values for select-like fields. */
|
|
92
|
+
options?: string[];
|
|
93
|
+
/** Table the relation field points at (FieldRelation.table). */
|
|
94
|
+
relationTable?: string;
|
|
95
|
+
}>;
|
|
96
|
+
}
|
|
97
|
+
/** JSON-safe projection of a PluginAITool + its owning plugin. */
|
|
98
|
+
export interface AIToolContract {
|
|
99
|
+
id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
description: string;
|
|
102
|
+
mode: 'read' | 'persist';
|
|
103
|
+
parameters?: AIToolParameters;
|
|
104
|
+
permission?: {
|
|
105
|
+
feature: string;
|
|
106
|
+
action: string;
|
|
107
|
+
};
|
|
108
|
+
limitKey?: string;
|
|
109
|
+
execution?: AIToolExecution;
|
|
110
|
+
requiresConfirmation?: boolean;
|
|
111
|
+
pluginId?: string;
|
|
112
|
+
category?: string;
|
|
113
|
+
}
|
|
114
|
+
/** A tenant-scoped pool RPC the server-plane executor may call. Canonical
|
|
115
|
+
* definition lives with the plugin types (plugins declare these). */
|
|
116
|
+
export type { AgentRpcDeclaration as RpcContract } from '../types/plugins';
|
|
117
|
+
/** Structured domain knowledge rendered into the agent's prompt as labelled
|
|
118
|
+
* sections — statuses with transitions, scheduling defaults, free-form rules. */
|
|
119
|
+
export interface AgentDomainKnowledge {
|
|
120
|
+
statuses?: Record<string, Array<{
|
|
121
|
+
id: string;
|
|
122
|
+
label: string;
|
|
123
|
+
availableWhen?: unknown;
|
|
124
|
+
}>>;
|
|
125
|
+
scheduleDefaults?: Record<string, unknown>;
|
|
126
|
+
businessRules?: Array<{
|
|
127
|
+
id: string;
|
|
128
|
+
description: string;
|
|
129
|
+
}>;
|
|
130
|
+
}
|
|
131
|
+
export interface AgentContract {
|
|
132
|
+
persona?: {
|
|
133
|
+
name?: string;
|
|
134
|
+
systemPrompt?: string;
|
|
135
|
+
icon?: string;
|
|
136
|
+
};
|
|
137
|
+
/** When 'server', surfaces stop shipping data-tool executors: the broker
|
|
138
|
+
* executes reads/writes server-plane and the surface only handles
|
|
139
|
+
* client-plane tools. Flipped per app — no lockstep release. */
|
|
140
|
+
executionPlane?: 'client' | 'server';
|
|
141
|
+
entities?: EntityContract[];
|
|
142
|
+
tools?: AIToolContract[];
|
|
143
|
+
registries?: Array<{
|
|
144
|
+
pluginId: string;
|
|
145
|
+
id: string;
|
|
146
|
+
entityKey?: string;
|
|
147
|
+
readOnly?: boolean;
|
|
148
|
+
}>;
|
|
149
|
+
declaredFeatures?: FeatureDeclaration[];
|
|
150
|
+
rpcs?: AgentRpcDeclaration[];
|
|
151
|
+
domainKnowledge?: AgentDomainKnowledge;
|
|
152
|
+
}
|
|
53
153
|
export interface AppManifest {
|
|
54
154
|
manifestVersion: number;
|
|
55
155
|
id: string;
|
|
@@ -65,6 +165,13 @@ export interface AppManifest {
|
|
|
65
165
|
entities?: EntityDef[];
|
|
66
166
|
permissions?: PermissionsConfig;
|
|
67
167
|
billing?: BillingConfig;
|
|
168
|
+
/** The RESOLVED limit declarations (4-layer merge: core < entity-derived <
|
|
169
|
+
* plugin < app), so a server runtime counts exactly what the client counts. */
|
|
170
|
+
limitDeclarations?: LimitDeclaration[];
|
|
171
|
+
/** v3: the agent contract — see the section comment above. */
|
|
172
|
+
agent?: AgentContract;
|
|
173
|
+
/** sha256 of the canonical serialization (excluding this field). */
|
|
174
|
+
contractHash?: string;
|
|
68
175
|
}
|
|
69
176
|
type AnyManifest = Record<string, any>;
|
|
70
177
|
export type ManifestMigration = (m: AnyManifest) => AnyManifest;
|
|
@@ -76,5 +183,4 @@ export declare function migrateManifest(input: AnyManifest): AppManifest;
|
|
|
76
183
|
/** Validate the structural invariants the JSON Schema can't fully express.
|
|
77
184
|
* Returns a list of human-readable problems (empty = valid). */
|
|
78
185
|
export declare function validateManifest(m: AppManifest): string[];
|
|
79
|
-
export {};
|
|
80
186
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/manifest/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC9F,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAgB1C,eAAO,MAAM,wBAAwB,IAAI,CAAA;AAEzC,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAA;AAEvF,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,eAAe,CAAA;IACzB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAA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
2
|
+
/** Canonical JSON of a manifest (contractHash excluded, keys sorted). */
|
|
3
|
+
export declare function serializeManifest(manifest: AppManifest): string;
|
|
4
|
+
/**
|
|
5
|
+
* sha256 (hex) of the canonical serialization. Async because it runs on
|
|
6
|
+
* WebCrypto (`globalThis.crypto.subtle`), which exists in every runtime we
|
|
7
|
+
* target (browsers, Node ≥ 18, edge) — no node:crypto import, keeping this
|
|
8
|
+
* module bundleable everywhere.
|
|
9
|
+
*/
|
|
10
|
+
export declare function computeContractHash(manifest: AppManifest): Promise<string>;
|
|
11
|
+
/** Serialize WITH the freshly computed contractHash embedded — what
|
|
12
|
+
* `fayz manifest emit` writes to app.manifest.json. */
|
|
13
|
+
export declare function serializeManifestWithHash(manifest: AppManifest): Promise<string>;
|
|
14
|
+
//# sourceMappingURL=serialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.d.ts","sourceRoot":"","sources":["../../src/manifest/serialize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAyB1C,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,WAAW,GAAG,MAAM,CAG/D;AAED;;;;;GAKG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAMhF;AAED;wDACwD;AACxD,wBAAsB,yBAAyB,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAItF"}
|
package/dist/plugin/index.cjs
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkZOPJB5FN_cjs = require('../chunk-ZOPJB5FN.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "PluginRuntimeProvider", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkZOPJB5FN_cjs.PluginRuntimeProvider; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "definePlugin", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunkZOPJB5FN_cjs.definePlugin; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "getWidgetsForZone", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunkZOPJB5FN_cjs.getWidgetsForZone; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "resolvePluginRuntime", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunkZOPJB5FN_cjs.resolvePluginRuntime; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "usePluginRuntime", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunkZOPJB5FN_cjs.usePluginRuntime; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "usePluginRuntimeOptional", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunkZOPJB5FN_cjs.usePluginRuntimeOptional; }
|
|
30
30
|
});
|
|
31
31
|
//# sourceMappingURL=index.cjs.map
|
|
32
32
|
//# sourceMappingURL=index.cjs.map
|
package/dist/plugin/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { PluginRuntimeProvider, definePlugin, getWidgetsForZone, resolvePluginRuntime, usePluginRuntime, usePluginRuntimeOptional } from '../chunk-
|
|
1
|
+
export { PluginRuntimeProvider, definePlugin, getWidgetsForZone, resolvePluginRuntime, usePluginRuntime, usePluginRuntimeOptional } from '../chunk-YH25Y4FW.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/plugin/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,oBAAoB,EAKpB,gBAAgB,EAEhB,oBAAoB,EACpB,mBAAmB,EAMnB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/plugin/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,oBAAoB,EAKpB,gBAAgB,EAEhB,oBAAoB,EACpB,mBAAmB,EAMnB,uBAAuB,EACvB,gBAAgB,EACjB,MAAM,kBAAkB,CAAA;AAGzB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAG1D;8DAC8D;AAC9D,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC;+EAC+E;AAC/E,wBAAgB,sBAAsB,CACpC,GAAG,EAAE;IAAE,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACtE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,SAAS,CAI1C;AAED,UAAU,2BAA2B;IACnC,OAAO,CAAC,EAAE,cAAc,EAAE,CAAA;IAC1B,aAAa,CAAC,EAAE,mBAAmB,EAAE,CAAA;IACrC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,OAAO,EAAE,oBAAoB,CAAA;CAC9B;AAyED,wBAAgB,YAAY,CAAC,CAAC,SAAS,cAAc,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAEnE;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAY,EACZ,aAAkB,EAClB,iBAAiB,EACjB,OAAO,GACR,EAAE,2BAA2B,GAAG,aAAa,CAmK7C;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,gBAAgB,EACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAC/C,oBAAoB,EAAE,CAGxB;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE;IAAE,OAAO,EAAE,gBAAgB,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAA;CAAE,GACxG,uBAAuB,EAAE,CAU3B;AAED,QAAA,MAAM,oBAAoB,qCAAkD,CAAA;AAC5E,eAAO,MAAM,qBAAqB,sCAAgC,CAAA;AAElE,wBAAgB,gBAAgB,IAAI,aAAa,CAEhD;AAED,wBAAgB,wBAAwB,IAAI,aAAa,GAAG,IAAI,CAE/D;AAED,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAElF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { GlobalSearchResult, SearchOptions } from './types';
|
|
2
|
+
/** Nothing shorter is worth a round-trip. */
|
|
3
|
+
export declare const MIN_QUERY_LENGTH = 2;
|
|
4
|
+
/** Test seam / manual override. */
|
|
5
|
+
export declare function setSearchIndexAvailable(value: boolean | null): void;
|
|
6
|
+
export declare function isSearchIndexAvailable(): boolean | null;
|
|
7
|
+
/** Drop every cached answer. Call on tenant switch and after writes. */
|
|
8
|
+
export declare function clearSearchCache(): void;
|
|
9
|
+
/** Search every target at once. Never throws for data reasons — a target that
|
|
10
|
+
* errors lands in `failed` and the rest of the answer still ships. */
|
|
11
|
+
export declare function searchEverything(rawQuery: string, options: SearchOptions): Promise<GlobalSearchResult>;
|
|
12
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../src/search/engine.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,kBAAkB,EAGlB,aAAa,EAGd,MAAM,SAAS,CAAA;AAQhB,6CAA6C;AAC7C,eAAO,MAAM,gBAAgB,IAAI,CAAA;AAiBjC,mCAAmC;AACnC,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAEnE;AAED,wBAAgB,sBAAsB,IAAI,OAAO,GAAG,IAAI,CAEvD;AAwOD,wEAAwE;AACxE,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AAmLD;uEACuE;AACvE,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,kBAAkB,CAAC,CAgF7B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { searchEverything, clearSearchCache, setSearchIndexAvailable, isSearchIndexAvailable, MIN_QUERY_LENGTH, } from './engine';
|
|
2
|
+
export { foldText, foldWithMap, digitsOf, normalizeQuery, similarity, scoreCandidate, highlightRanges, } from './text';
|
|
3
|
+
export type { NormalizedQuery, RankCandidate } from './text';
|
|
4
|
+
export type { SearchTarget, SearchHit, SearchGroup, SearchPath, SearchOptions, GlobalSearchResult, } from './types';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,cAAc,EACd,UAAU,EACV,cAAc,EACd,eAAe,GAChB,MAAM,QAAQ,CAAA;AACf,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAA;AAC5D,YAAY,EACV,YAAY,EACZ,SAAS,EACT,WAAW,EACX,UAAU,EACV,aAAa,EACb,kBAAkB,GACnB,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** Strip diacritics, lowercase, collapse non-alphanumerics to single spaces. */
|
|
2
|
+
export declare function foldText(value: unknown): string;
|
|
3
|
+
/** Fold, keeping each folded char's index in the source — used for highlighting. */
|
|
4
|
+
export declare function foldWithMap(value: string): {
|
|
5
|
+
folded: string;
|
|
6
|
+
map: number[];
|
|
7
|
+
};
|
|
8
|
+
/** Digits only — phone numbers, CPF/CNPJ, SKUs typed with separators. */
|
|
9
|
+
export declare function digitsOf(value: unknown): string;
|
|
10
|
+
export interface NormalizedQuery {
|
|
11
|
+
/** What the user typed, untouched. */
|
|
12
|
+
raw: string;
|
|
13
|
+
/** Folded form of the whole query — the "phrase". */
|
|
14
|
+
folded: string;
|
|
15
|
+
/** Folded query split on whitespace. */
|
|
16
|
+
tokens: string[];
|
|
17
|
+
/** Digits the user typed, when they typed enough of them to mean a number. */
|
|
18
|
+
digits: string;
|
|
19
|
+
/** The longest token — the most selective thing to send to a `%LIKE%` backend. */
|
|
20
|
+
anchor: string;
|
|
21
|
+
}
|
|
22
|
+
export declare function normalizeQuery(raw: string): NormalizedQuery;
|
|
23
|
+
/** 0 (nothing in common) … 1 (identical). Both inputs must already be folded. */
|
|
24
|
+
export declare function similarity(a: string, b: string): number;
|
|
25
|
+
export interface RankCandidate {
|
|
26
|
+
/** Folded display name — what the user is most likely aiming at. */
|
|
27
|
+
title: string;
|
|
28
|
+
/** Folded concatenation of every searchable value on the record. */
|
|
29
|
+
haystack: string;
|
|
30
|
+
/** Digits of every phone/document-ish value on the record. */
|
|
31
|
+
digits?: string;
|
|
32
|
+
}
|
|
33
|
+
/** Score a candidate 0…1. Zero means "not a match" — the score is also the filter. */
|
|
34
|
+
export declare function scoreCandidate(query: NormalizedQuery, candidate: RankCandidate): number;
|
|
35
|
+
/** Ranges in the ORIGINAL text covered by the query, merged and sorted. */
|
|
36
|
+
export declare function highlightRanges(text: string, query: NormalizedQuery): Array<[number, number]>;
|
|
37
|
+
//# sourceMappingURL=text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../src/search/text.ts"],"names":[],"mappings":"AAMA,gFAAgF;AAChF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAQ/C;AAED,oFAAoF;AACpF,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,EAAE,CAAA;CAAE,CAgB5E;AAED,yEAAyE;AACzE,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAE/C;AAED,MAAM,WAAW,eAAe;IAC9B,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAA;IACX,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAA;IACd,wCAAwC;IACxC,MAAM,EAAE,MAAM,EAAE,CAAA;IAChB,8EAA8E;IAC9E,MAAM,EAAE,MAAM,CAAA;IACd,kFAAkF;IAClF,MAAM,EAAE,MAAM,CAAA;CACf;AAKD,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAa3D;AAYD,iFAAiF;AACjF,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAcvD;AAiBD,MAAM,WAAW,aAAa;IAC5B,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAA;IACb,oEAAoE;IACpE,QAAQ,EAAE,MAAM,CAAA;IAChB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAKD,sFAAsF;AACtF,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,CAgDvF;AAED,2EAA2E;AAC3E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,KAAK,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CA2B7F"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { EntityDef } from '../types/crud';
|
|
2
|
+
/** One searchable thing — declaring an entity is all it takes to be findable. */
|
|
3
|
+
export interface SearchTarget {
|
|
4
|
+
/** Stable entity key (`deriveEntityKey`): 'person:client', 'product', … */
|
|
5
|
+
key: string;
|
|
6
|
+
/** Plural human label; becomes the result group heading. */
|
|
7
|
+
label: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
entity: EntityDef;
|
|
10
|
+
mockData?: Array<{
|
|
11
|
+
id: string;
|
|
12
|
+
}>;
|
|
13
|
+
/** Multiplies the final score. Default 1. */
|
|
14
|
+
boost?: number;
|
|
15
|
+
}
|
|
16
|
+
export interface SearchHit {
|
|
17
|
+
/** `${target.key}:${record id}` — stable across both search paths. */
|
|
18
|
+
uid: string;
|
|
19
|
+
id: string;
|
|
20
|
+
/** Target key this record came from. */
|
|
21
|
+
key: string;
|
|
22
|
+
/** Group heading (the target's plural label). */
|
|
23
|
+
group: string;
|
|
24
|
+
icon?: string;
|
|
25
|
+
title: string;
|
|
26
|
+
subtitle?: string;
|
|
27
|
+
/** 0 … 1 (times the target boost). Higher is better. */
|
|
28
|
+
score: number;
|
|
29
|
+
archetype?: string;
|
|
30
|
+
archetypeKind?: string;
|
|
31
|
+
table?: string;
|
|
32
|
+
/** The row, when the path that found it had one. The index path returns
|
|
33
|
+
* titles only. */
|
|
34
|
+
record?: Record<string, unknown>;
|
|
35
|
+
}
|
|
36
|
+
export interface SearchGroup {
|
|
37
|
+
key: string;
|
|
38
|
+
label: string;
|
|
39
|
+
icon?: string;
|
|
40
|
+
hits: SearchHit[];
|
|
41
|
+
/** True when this group hit its per-target cap — more matches exist. */
|
|
42
|
+
hasMore: boolean;
|
|
43
|
+
}
|
|
44
|
+
export type SearchPath = 'index' | 'scan' | 'cache';
|
|
45
|
+
export interface GlobalSearchResult {
|
|
46
|
+
query: string;
|
|
47
|
+
hits: SearchHit[];
|
|
48
|
+
groups: SearchGroup[];
|
|
49
|
+
/** Which path produced this result — surfaced for diagnostics, not for UI. */
|
|
50
|
+
via: SearchPath;
|
|
51
|
+
/** Targets whose query failed. Never fatal: a broken table cannot blind the box. */
|
|
52
|
+
failed: string[];
|
|
53
|
+
/** Wall-clock milliseconds. */
|
|
54
|
+
elapsedMs: number;
|
|
55
|
+
/** True while a better (network) answer is still on its way. */
|
|
56
|
+
partial: boolean;
|
|
57
|
+
}
|
|
58
|
+
export interface SearchOptions {
|
|
59
|
+
/** Permission filtering is the caller's job — the engine searches what it's handed. */
|
|
60
|
+
targets: SearchTarget[];
|
|
61
|
+
/** Max hits returned overall. Default 30. */
|
|
62
|
+
limit?: number;
|
|
63
|
+
/** Max hits per target. Default 5. */
|
|
64
|
+
perTarget?: number;
|
|
65
|
+
/** Fired with early/partial answers before the authoritative one resolves. */
|
|
66
|
+
onPartial?: (result: GlobalSearchResult) => void;
|
|
67
|
+
/** Discard the result if this aborts. */
|
|
68
|
+
signal?: AbortSignal;
|
|
69
|
+
/** Skip the server index and force the per-entity scan (tests, diagnostics). */
|
|
70
|
+
forceScan?: boolean;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/search/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAE9C,iFAAiF;AACjF,MAAM,WAAW,YAAY;IAC3B,2EAA2E;IAC3E,GAAG,EAAE,MAAM,CAAA;IACX,4DAA4D;IAC5D,KAAK,EAAE,MAAM,CAAA;IACb,IAA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AS,EAAE,MAAM,CAAA;IACjB,gEAAgE;IAChE,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,uFAAuF;IACvF,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,IAAI,CAAA;IAChD,yCAAyC;IACzC,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,gFAAgF;IAChF,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB"}
|
package/dist/types/billing.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PlanEntitlements } from './entitlements';
|
|
1
2
|
export interface Plan {
|
|
2
3
|
id: string;
|
|
3
4
|
name: string;
|
|
@@ -5,13 +6,32 @@ export interface Plan {
|
|
|
5
6
|
price: number;
|
|
6
7
|
currency: string;
|
|
7
8
|
interval: 'month' | 'year';
|
|
9
|
+
/** Marketing bullets shown on the pricing page (display only). */
|
|
8
10
|
features: string[];
|
|
9
11
|
highlighted?: boolean;
|
|
10
12
|
stripePriceId?: string;
|
|
13
|
+
/**
|
|
14
|
+
* Structured access grants for this plan (feature gates + quantity caps). This
|
|
15
|
+
* is the enforcement source of truth — distinct from `features` (display
|
|
16
|
+
* bullets). See {@link PlanEntitlements}.
|
|
17
|
+
*/
|
|
18
|
+
entitlements?: PlanEntitlements;
|
|
11
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Signature of the checkout seam. When `BillingConfig.onCheckout` is defined the
|
|
22
|
+
* shell's Subscription page calls it (passing the target plan id) INSTEAD of
|
|
23
|
+
* writing `plan` straight onto the org via `adapter.updateOrg`. This is where a
|
|
24
|
+
* real payment gateway (Stripe Checkout, Pix, Mercado Pago, …) plugs in: return
|
|
25
|
+
* once the user is redirected / the intent is created, and let the webhook be the
|
|
26
|
+
* source of truth for the persisted plan. Left undefined, the shell mutates the
|
|
27
|
+
* plan optimistically (dev / self-serve / free-tier flows).
|
|
28
|
+
*/
|
|
29
|
+
export type BillingCheckoutFn = (planId: string) => Promise<void> | void;
|
|
12
30
|
export interface BillingConfig {
|
|
13
31
|
plans: Plan[];
|
|
14
32
|
stripePublishableKey?: string;
|
|
15
33
|
portalUrl?: string;
|
|
34
|
+
/** Payment-gateway seam — see {@link BillingCheckoutFn}. */
|
|
35
|
+
onCheckout?: BillingCheckoutFn;
|
|
16
36
|
}
|
|
17
37
|
//# sourceMappingURL=billing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/types/billing.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAA;IAC1B,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,aAAa,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"billing.d.ts","sourceRoot":"","sources":["../../src/types/billing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,MAAM,WAAW,IAAI;IACnB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAA;IAC1B,kEAAkE;IAClE,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAA;CAChC;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;AAExE,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,IAAI,EAAE,CAAA;IACb,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,iBAAiB,CAAA;CAC/B"}
|
package/dist/types/crud.d.ts
CHANGED
|
@@ -71,7 +71,8 @@ export interface FieldGroup {
|
|
|
71
71
|
label: string;
|
|
72
72
|
description?: string;
|
|
73
73
|
columns?: 1 | 2 | 3;
|
|
74
|
-
/** Renders
|
|
74
|
+
/** Renders an image slot to the left of the group's fields. Functional when
|
|
75
|
+
* the EntityDef supplies `image`; a plain placeholder otherwise. */
|
|
75
76
|
imageSlot?: boolean;
|
|
76
77
|
}
|
|
77
78
|
export interface DetailTab {
|
|
@@ -97,6 +98,24 @@ export interface DetailTab {
|
|
|
97
98
|
requiresWidgetZone?: string;
|
|
98
99
|
}
|
|
99
100
|
export type FormLayout = 'person' | 'product' | 'service' | 'location' | 'order' | 'subject' | 'generic';
|
|
101
|
+
/**
|
|
102
|
+
* Makes a field group's `imageSlot` functional. Without this the slot renders as
|
|
103
|
+
* a decorative placeholder — it always did, which is why product forms showed an
|
|
104
|
+
* empty thumbnail even for products that have images.
|
|
105
|
+
*
|
|
106
|
+
* Upload needs the record to exist (the file is attached to its id), so the slot
|
|
107
|
+
* stays read-only in create mode and becomes editable after the first save.
|
|
108
|
+
*/
|
|
109
|
+
export interface EntityImageConfig {
|
|
110
|
+
/** Current image URL for this record, if any. */
|
|
111
|
+
get: (row: Record<string, any>) => string | undefined;
|
|
112
|
+
/** Persist a new image and return its URL. Omit to keep the slot read-only. */
|
|
113
|
+
upload?: (file: File, row: Record<string, any>) => Promise<string>;
|
|
114
|
+
/** Remove the current image. Omit to hide the remove affordance. */
|
|
115
|
+
remove?: (row: Record<string, any>) => Promise<void>;
|
|
116
|
+
/** Accepted mime types. Defaults to image/*. */
|
|
117
|
+
accept?: string;
|
|
118
|
+
}
|
|
100
119
|
export interface EntityDef<T = Record<string, unknown>> {
|
|
101
120
|
name: string;
|
|
102
121
|
namePlural?: string;
|
|
@@ -104,6 +123,8 @@ export interface EntityDef<T = Record<string, unknown>> {
|
|
|
104
123
|
layout?: FormLayout;
|
|
105
124
|
fields: FieldDef[];
|
|
106
125
|
fieldGroups?: FieldGroup[];
|
|
126
|
+
/** Wiring for the `imageSlot` of whichever field group declares one. */
|
|
127
|
+
image?: EntityImageConfig;
|
|
107
128
|
detailTabs?: DetailTab[];
|
|
108
129
|
data?: {
|
|
109
130
|
table: string;
|
|
@@ -130,5 +151,30 @@ export interface EntityDef<T = Record<string, unknown>> {
|
|
|
130
151
|
field: string;
|
|
131
152
|
allLabel?: string;
|
|
132
153
|
}[];
|
|
154
|
+
/**
|
|
155
|
+
* Plan quantity-limit key gating creation of this entity (matches a
|
|
156
|
+
* `PlanEntitlements.limits` key + a `LimitDeclaration`). When set, the CRUD
|
|
157
|
+
* engine gates the "+ New" button (LimitGate), guards the create-form submit
|
|
158
|
+
* and the CSV import (useLimitGuard) against the plan cap, and invalidates the
|
|
159
|
+
* live count after a successful create. Absent ⇒ no plan gating (RBAC only).
|
|
160
|
+
*/
|
|
161
|
+
limitKey?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Permission required to READ this entity through the agent's generic data
|
|
164
|
+
* primitives (searchRecords/queryData) — checked per TARGET at execution
|
|
165
|
+
* time, so one generic tool still honors per-user access. Absent ⇒ readable
|
|
166
|
+
* by any signed-in member (same as the CRUD list today).
|
|
167
|
+
*/
|
|
168
|
+
permission?: {
|
|
169
|
+
feature: string;
|
|
170
|
+
action: string;
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* Exclude this entity from the agent's data primitives. For entities whose
|
|
174
|
+
* table is an extension/join shape the generic provider can't read usefully
|
|
175
|
+
* (e.g. staff_members without a name column) — expose a queryEntities
|
|
176
|
+
* read-model instead and hide the raw one here.
|
|
177
|
+
*/
|
|
178
|
+
agentHidden?: boolean;
|
|
133
179
|
}
|
|
134
180
|
//# sourceMappingURL=crud.d.ts.map
|
package/dist/types/crud.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crud.d.ts","sourceRoot":"","sources":["../../src/types/crud.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAEjD,MAAM,MAAM,SAAS,GACjB,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAC5C,QAAQ,GAAG,UAAU,GACrB,QAAQ,GAAG,aAAa,GAAG,WAAW,GACtC,UAAU,GACV,MAAM,GAAG,UAAU,GAAG,MAAM,GAC5B,SAAS,GAAG,UAAU,GAAG,UAAU,GACnC,OAAO,GAAG,UAAU,CAAA;AAExB;;;iFAGiF;AACjF,MAAM,WAAW,aAAa;IAC5B,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAA;IACb,sDAAsD;IACtD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,sEAAsE;IACtE,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,uFAAuF;IACvF,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACjC;AAED,sEAAsE;AACtE,MAAM,WAAW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AC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;QAClC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,CAAA;IACD,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,KAAK,GAAG,MAAM,CAAA;IAC/B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;mFAC+E;IAC/E,MAAM,CAAC,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;IAC/C;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;;;OAKG;IACH,UAAU,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IAChD;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entitlements — the plan side of the access decision (the role side lives in
|
|
3
|
+
* permissions.ts). A plan grants FEATURES (gate a page/module) and caps LIMITS
|
|
4
|
+
* (quantity ceilings). Feature ids are the SAME id space as RBAC/nav
|
|
5
|
+
* (`permission.feature`), so a single id threads role → nav → plan.
|
|
6
|
+
*/
|
|
7
|
+
export interface PlanEntitlements {
|
|
8
|
+
/**
|
|
9
|
+
* feature id (same id as RBAC/nav) → whether the plan grants it. Absent = the
|
|
10
|
+
* plan does not gate the feature (allowed). Only an explicit `false` denies —
|
|
11
|
+
* this keeps plans additive: features unknown to a plan stay open.
|
|
12
|
+
*/
|
|
13
|
+
features?: Record<string, boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* limitKey → cap. `-1` = unlimited. Keys are app/plugin-defined (e.g.
|
|
16
|
+
* `clients`, `users`, `locations`, `bookings_month`). A key absent here means
|
|
17
|
+
* "no cap on this plan" (unlimited). See {@link LimitDeclaration} for how a
|
|
18
|
+
* key is bound to a countable table.
|
|
19
|
+
*/
|
|
20
|
+
limits?: Record<string, number>;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Declares HOW a limit key is counted. Contributed by plugins via
|
|
24
|
+
* `PluginManifest.declaredLimits` (aggregated by the plugin runtime) and/or
|
|
25
|
+
* overridden per-app via `billing.limitDeclarations`. The access engine reads a
|
|
26
|
+
* declaration to resolve a `limitKey` → a live `count(*)` against `table` for
|
|
27
|
+
* the active tenant, with no per-entity code.
|
|
28
|
+
*/
|
|
29
|
+
export interface LimitDeclaration {
|
|
30
|
+
/** Limit key — matches a key in {@link PlanEntitlements.limits}. */
|
|
31
|
+
key: string;
|
|
32
|
+
/** Human label for paywalls / usage banners (e.g. "Patients"). */
|
|
33
|
+
label: string;
|
|
34
|
+
/** Table the count runs against (tenant-scoped via `tenant_id`). */
|
|
35
|
+
table: string;
|
|
36
|
+
/** Optional `kind` column filter for tables that hold several entity kinds. */
|
|
37
|
+
kindFilter?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Counting window. `'month'` counts rows created since the start of the
|
|
40
|
+
* current month (recurring quotas like bookings/month); `'total'` (default)
|
|
41
|
+
* counts every row (stock quantities like clients/users).
|
|
42
|
+
*/
|
|
43
|
+
period?: 'month' | 'total';
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=entitlements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entitlements.d.ts","sourceRoot":"","sources":["../../src/types/entitlements.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAClC;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAChC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,oEAAoE;IACpE,GAAG,EAAE,MAAM,CAAA;IACX,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAA;IACb,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAA;IACb,+EAA+E;IAC/E,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;CAC3B"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export type { EntityArchetype, BaseEntity, PersonEntity, ProductEntity, ServiceEntity, OrderEntity, TransactionEntity, LocationEntity, ScheduleEntity, CategoryEntity } from './entities';
|
|
2
2
|
export type { EntityDef, FieldDef, FieldType, FieldRelation, FieldGroup, DetailTab, FormLayout, ComputedFieldValue } from './crud';
|
|
3
|
-
export type { PluginManifest, PluginScope, PluginStatus, ResolvedPluginManifest, PluginRuntime, PluginRuntimeContext, PluginWidgetZone, PluginWidgetDefinition, PluginNavigationEntry, PluginSettingsTab, PluginRouteDefinition, PluginAITool, PluginRegistryDef, PluginMigration, PluginDiagnostic, VerticalId, ScaffoldType } from './plugins';
|
|
3
|
+
export type { PluginManifest, PluginScope, PluginStatus, ResolvedPluginManifest, PluginRuntime, PluginRuntimeContext, PluginWidgetZone, PluginWidgetDefinition, PluginNavigationEntry, PluginSettingsTab, PluginRouteDefinition, PluginAITool, AIToolMode, AIToolExecution, AgentRpcDeclaration, AIToolParameterProperty, AIToolParameters, AIToolSuggestion, PluginRegistryDef, PluginMigration, PluginDiagnostic, VerticalId, ScaffoldType } from './plugins';
|
|
4
4
|
export type { AuthAdapter, AuthUser, AuthSession } from './auth';
|
|
5
5
|
export type { OrgAdapter, Organization, OrgMember } from './org';
|
|
6
|
-
export type { PermissionsConfig, FeatureDeclaration, PermissionAction } from './permissions';
|
|
7
|
-
export type { Plan, BillingConfig } from './billing';
|
|
6
|
+
export type { PermissionsConfig, FeatureDeclaration, PermissionAction, PermissionProfile, SystemPermission } from './permissions';
|
|
7
|
+
export type { Plan, BillingConfig, BillingCheckoutFn } from './billing';
|
|
8
|
+
export type { PlanEntitlements, LimitDeclaration } from './entitlements';
|
|
8
9
|
export type { ThemeBrand, ThemeRadius, ThemeMode } from './theme';
|
|
9
10
|
export type { LocaleConfig } from './i18n';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACzL,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAClI,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,sBAAsB,EAAE,aAAa,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,gBAAgB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACzL,YAAY,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,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