@fayz-ai/sdk 0.1.4 → 0.2.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/LICENSE +21 -0
- package/README.md +24 -71
- package/dist/ai-builder.cjs +20 -0
- package/dist/ai-builder.cjs.map +1 -0
- package/dist/ai-builder.d.ts +20 -0
- package/dist/ai-builder.d.ts.map +1 -0
- package/dist/ai-builder.js +3 -0
- package/dist/ai-builder.js.map +1 -0
- package/dist/{chunk-JBQDG2GN.js → chunk-6JDIFOJG.js} +226 -2
- package/dist/chunk-6JDIFOJG.js.map +1 -0
- package/dist/chunk-OXIIHQFK.cjs +63 -0
- package/dist/chunk-OXIIHQFK.cjs.map +1 -0
- package/dist/{chunk-3VVLBMKG.cjs → chunk-RCX43OHW.cjs} +226 -2
- package/dist/chunk-RCX43OHW.cjs.map +1 -0
- package/dist/chunk-UMI2WELN.js +84 -0
- package/dist/chunk-UMI2WELN.js.map +1 -0
- package/dist/chunk-VDWMKACF.cjs +88 -0
- package/dist/chunk-VDWMKACF.cjs.map +1 -0
- package/dist/chunk-VPTVRD5M.cjs +92 -0
- package/dist/chunk-VPTVRD5M.cjs.map +1 -0
- package/dist/chunk-VUSZUJX3.js +58 -0
- package/dist/chunk-VUSZUJX3.js.map +1 -0
- package/dist/chunk-W5RBGSBM.js +87 -0
- package/dist/chunk-W5RBGSBM.js.map +1 -0
- package/dist/index.cjs +38 -8
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/release-channels.cjs +5 -5
- package/dist/release-channels.js +1 -1
- package/dist/shop.cjs +3 -3
- package/dist/shop.d.ts +54 -3
- package/dist/shop.d.ts.map +1 -1
- package/dist/shop.js +1 -1
- package/dist/supported-surface.cjs +24 -0
- package/dist/supported-surface.cjs.map +1 -0
- package/dist/supported-surface.d.ts +19 -0
- package/dist/supported-surface.d.ts.map +1 -0
- package/dist/supported-surface.js +3 -0
- package/dist/supported-surface.js.map +1 -0
- package/package.json +23 -10
- package/src/ai-builder.ts +115 -0
- package/src/index.ts +17 -0
- package/src/release-channels.json +45 -3
- package/src/release-channels.test.ts +3 -4
- package/src/shop.test.ts +31 -0
- package/src/shop.ts +261 -3
- package/src/supported-surface.json +40 -0
- package/src/supported-surface.ts +33 -0
- package/dist/chunk-3VVLBMKG.cjs.map +0 -1
- package/dist/chunk-7FF2FLPG.js +0 -45
- package/dist/chunk-7FF2FLPG.js.map +0 -1
- package/dist/chunk-JBQDG2GN.js.map +0 -1
- package/dist/chunk-JXXIKYP3.cjs +0 -50
- package/dist/chunk-JXXIKYP3.cjs.map +0 -1
package/dist/shop.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shop.d.ts","sourceRoot":"","sources":["../src/shop.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"shop.d.ts","sourceRoot":"","sources":["../src/shop.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,uBAAuB;IACtC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAA;IAC5B,eAAe,CAAC,EAAE,8BAA8B,EAAE,CAAA;IAClD,OAAO,CAAC,EAAE,OAAO,KAAK,CAAA;CACvB;AAED,MAAM,WAAW,8BAA8B;IAC7C,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC;AAED,MAAM,MAAM,qBAAqB,GAAG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AAG,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;;;;;;;;;;;;;uBAe7H,MAAM;4BAGD,4BAA4B;;;;;;;;;;;;;;;;;oBAWpC,MAAM;;;;;;;;;;;;;;;;;;;;EAc/B"}
|
package/dist/shop.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkOXIIHQFK_cjs = require('./chunk-OXIIHQFK.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "fayzSupportedSurface", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () { return chunkOXIIHQFK_cjs.surface; }
|
|
10
|
+
});
|
|
11
|
+
Object.defineProperty(exports, "getInternalPackages", {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function () { return chunkOXIIHQFK_cjs.getInternalPackages; }
|
|
14
|
+
});
|
|
15
|
+
Object.defineProperty(exports, "getSupportedPackages", {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return chunkOXIIHQFK_cjs.getSupportedPackages; }
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports, "isSupportedPackage", {
|
|
20
|
+
enumerable: true,
|
|
21
|
+
get: function () { return chunkOXIIHQFK_cjs.isSupportedPackage; }
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=supported-surface.cjs.map
|
|
24
|
+
//# sourceMappingURL=supported-surface.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"supported-surface.cjs"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type FayzPackageTier = 'stable';
|
|
2
|
+
export interface FayzSupportedSurface {
|
|
3
|
+
surfaceVersion: number;
|
|
4
|
+
supported: Record<string, FayzPackageTier>;
|
|
5
|
+
internal: string[];
|
|
6
|
+
}
|
|
7
|
+
declare const surface: FayzSupportedSurface;
|
|
8
|
+
/** Every package a generated Fayz app is allowed to depend on (the public surface). */
|
|
9
|
+
export declare function getSupportedPackages(): string[];
|
|
10
|
+
/** Packages that exist but are NOT part of the public surface (deprecated/internal). */
|
|
11
|
+
export declare function getInternalPackages(): string[];
|
|
12
|
+
/**
|
|
13
|
+
* True when `packageName` is part of the supported public surface. Used by
|
|
14
|
+
* `fayz doctor` to warn (never fail) when an app depends on something off-surface.
|
|
15
|
+
* Non-Fayz packages (no `@fayz-ai/` prefix) are out of scope and return true.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isSupportedPackage(packageName: string): boolean;
|
|
18
|
+
export { surface as fayzSupportedSurface };
|
|
19
|
+
//# sourceMappingURL=supported-surface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supported-surface.d.ts","sourceRoot":"","sources":["../src/supported-surface.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAA;AAEtC,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,MAAM,CAAA;IACtB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;IAC1C,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,QAAA,MAAM,OAAO,EAAkC,oBAAoB,CAAA;AAEnE,uFAAuF;AACvF,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C;AAED,wFAAwF;AACxF,wBAAgB,mBAAmB,IAAI,MAAM,EAAE,CAE9C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAG/D;AAED,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"supported-surface.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fayz-ai/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Fayz SDK — API client, app params, runtime broker helpers, and shared types for generated Fayz projects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -38,6 +38,19 @@
|
|
|
38
38
|
"require": "./dist/release-channels.cjs"
|
|
39
39
|
},
|
|
40
40
|
"./release-channels.json": "./src/release-channels.json",
|
|
41
|
+
"./supported-surface": {
|
|
42
|
+
"source": "./src/supported-surface.ts",
|
|
43
|
+
"types": "./dist/supported-surface.d.ts",
|
|
44
|
+
"import": "./dist/supported-surface.js",
|
|
45
|
+
"require": "./dist/supported-surface.cjs"
|
|
46
|
+
},
|
|
47
|
+
"./supported-surface.json": "./src/supported-surface.json",
|
|
48
|
+
"./ai-builder": {
|
|
49
|
+
"source": "./src/ai-builder.ts",
|
|
50
|
+
"types": "./dist/ai-builder.d.ts",
|
|
51
|
+
"import": "./dist/ai-builder.js",
|
|
52
|
+
"require": "./dist/ai-builder.cjs"
|
|
53
|
+
},
|
|
41
54
|
"./runtime": {
|
|
42
55
|
"source": "./src/runtime.ts",
|
|
43
56
|
"types": "./dist/runtime.d.ts",
|
|
@@ -56,13 +69,6 @@
|
|
|
56
69
|
"src",
|
|
57
70
|
"README.md"
|
|
58
71
|
],
|
|
59
|
-
"scripts": {
|
|
60
|
-
"build": "tsup && tsc --emitDeclarationOnly --declaration --declarationMap --noEmit false",
|
|
61
|
-
"dev": "tsup --watch",
|
|
62
|
-
"typecheck": "tsc --noEmit",
|
|
63
|
-
"test": "vitest run",
|
|
64
|
-
"clean": "rm -rf dist"
|
|
65
|
-
},
|
|
66
72
|
"devDependencies": {
|
|
67
73
|
"tsup": "^8.2.0",
|
|
68
74
|
"typescript": "^5.5.0",
|
|
@@ -86,5 +92,12 @@
|
|
|
86
92
|
"fayz-sdk",
|
|
87
93
|
"runtime",
|
|
88
94
|
"api-client"
|
|
89
|
-
]
|
|
90
|
-
|
|
95
|
+
],
|
|
96
|
+
"scripts": {
|
|
97
|
+
"build": "tsup && tsc --emitDeclarationOnly --declaration --declarationMap --noEmit false",
|
|
98
|
+
"dev": "tsup --watch",
|
|
99
|
+
"typecheck": "tsc --noEmit",
|
|
100
|
+
"test": "vitest run",
|
|
101
|
+
"clean": "rm -rf dist"
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// The AI Builder request taxonomy — the contract the platform's request
|
|
2
|
+
// classifier targets. The classifier itself lives in the `fayz` platform repo;
|
|
3
|
+
// this is the canonical source of truth for the request classes and the
|
|
4
|
+
// architecture layer each is allowed to touch (docs/architecture-boundaries.md).
|
|
5
|
+
|
|
6
|
+
/** Ownership layer a request may modify. */
|
|
7
|
+
export type FayzLayer = 'app' | 'plugin-config' | 'private-extension' | 'platform' | 'none'
|
|
8
|
+
|
|
9
|
+
export type AiBuilderRequestClass =
|
|
10
|
+
| 'app-edit'
|
|
11
|
+
| 'plugin-config'
|
|
12
|
+
| 'private-extension'
|
|
13
|
+
| 'platform-or-plugin-upgrade'
|
|
14
|
+
| 'unsafe-blocked'
|
|
15
|
+
|
|
16
|
+
export interface AiBuilderRequestClassDef {
|
|
17
|
+
id: AiBuilderRequestClass
|
|
18
|
+
label: string
|
|
19
|
+
/** Which ownership layer this class is allowed to modify. */
|
|
20
|
+
layer: FayzLayer
|
|
21
|
+
/** Who may perform it. */
|
|
22
|
+
editableBy: 'ai' | 'partner' | 'fayz' | 'none'
|
|
23
|
+
needsCode: boolean
|
|
24
|
+
needsDeploy: boolean
|
|
25
|
+
description: string
|
|
26
|
+
examples: string[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export const AI_BUILDER_REQUEST_CLASSES: Record<AiBuilderRequestClass, AiBuilderRequestClassDef> = {
|
|
30
|
+
'app-edit': {
|
|
31
|
+
id: 'app-edit',
|
|
32
|
+
label: 'App edit',
|
|
33
|
+
layer: 'app',
|
|
34
|
+
editableBy: 'ai',
|
|
35
|
+
needsCode: false,
|
|
36
|
+
needsDeploy: false,
|
|
37
|
+
description:
|
|
38
|
+
'Change the generated app: pages, routes, layout, theme, copy, blocks, slots. Manifest-level edits (ladder 1–4) need no code; custom components/pages (ladder 5–6) are app-owned code.',
|
|
39
|
+
examples: [
|
|
40
|
+
'Change the brand color and headline',
|
|
41
|
+
'Add a new landing page with a hero and product grid',
|
|
42
|
+
'Reorder dashboard cards',
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
'plugin-config': {
|
|
46
|
+
id: 'plugin-config',
|
|
47
|
+
label: 'Plugin config',
|
|
48
|
+
layer: 'plugin-config',
|
|
49
|
+
editableBy: 'ai',
|
|
50
|
+
needsCode: false,
|
|
51
|
+
needsDeploy: false,
|
|
52
|
+
description:
|
|
53
|
+
'Configure an installed plugin as manifest data: enabled modules, fields, statuses, rules, feature flags, labels, currency.',
|
|
54
|
+
examples: [
|
|
55
|
+
'Enable the reconciliation module in financial',
|
|
56
|
+
'Add a "VIP" status to clients',
|
|
57
|
+
'Turn on delivery pricing in the menu',
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
'private-extension': {
|
|
61
|
+
id: 'private-extension',
|
|
62
|
+
label: 'Private extension',
|
|
63
|
+
layer: 'private-extension',
|
|
64
|
+
editableBy: 'partner',
|
|
65
|
+
needsCode: true,
|
|
66
|
+
needsDeploy: true,
|
|
67
|
+
description:
|
|
68
|
+
'Add new business behaviour as an app-local plugin (own entities, data, migrations, AI tools, connectors). The sanctioned partner/Silvio path — scaffold with `fayz create plugin`. See private-plugins.md.',
|
|
69
|
+
examples: [
|
|
70
|
+
'Build a loyalty-points engine with its own table',
|
|
71
|
+
'Add a custom importer for a legacy ERP',
|
|
72
|
+
'Integrate a provider Fayz does not support yet (adapter)',
|
|
73
|
+
],
|
|
74
|
+
},
|
|
75
|
+
'platform-or-plugin-upgrade': {
|
|
76
|
+
id: 'platform-or-plugin-upgrade',
|
|
77
|
+
label: 'Platform / plugin upgrade',
|
|
78
|
+
layer: 'platform',
|
|
79
|
+
editableBy: 'fayz',
|
|
80
|
+
needsCode: true,
|
|
81
|
+
needsDeploy: true,
|
|
82
|
+
description:
|
|
83
|
+
'Change owned by Fayz: bump SDK/plugin versions, run manifest/DB migrations, evolve an engine. Not editable from a generated app.',
|
|
84
|
+
examples: [
|
|
85
|
+
'Upgrade @fayz-ai/core across the fleet',
|
|
86
|
+
'Migrate manifests v2 → v3',
|
|
87
|
+
'Add a capability to an official plugin',
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
'unsafe-blocked': {
|
|
91
|
+
id: 'unsafe-blocked',
|
|
92
|
+
label: 'Unsafe / blocked',
|
|
93
|
+
layer: 'none',
|
|
94
|
+
editableBy: 'none',
|
|
95
|
+
needsCode: false,
|
|
96
|
+
needsDeploy: false,
|
|
97
|
+
description:
|
|
98
|
+
'Requests that would break the boundary and must be refused or rerouted: mutating SDK/runtime/plugin internals, forking an SDK page, importing a provider SDK directly into app code, or bypassing tenancy/permissions/security.',
|
|
99
|
+
examples: [
|
|
100
|
+
'Edit the code inside @fayz-ai/plugin-crm',
|
|
101
|
+
'Copy an SDK page into the app and modify it',
|
|
102
|
+
'Call the Supabase client directly from a storefront component',
|
|
103
|
+
'Disable row-level security for a tenant',
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const AI_BUILDER_REQUEST_CLASS_IDS = Object.keys(
|
|
109
|
+
AI_BUILDER_REQUEST_CLASSES,
|
|
110
|
+
) as AiBuilderRequestClass[]
|
|
111
|
+
|
|
112
|
+
/** True when a request class is permitted (anything but unsafe-blocked). */
|
|
113
|
+
export function isAllowedRequestClass(id: AiBuilderRequestClass): boolean {
|
|
114
|
+
return id !== 'unsafe-blocked'
|
|
115
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -20,6 +20,23 @@ export {
|
|
|
20
20
|
resolveFayzPackageVersions,
|
|
21
21
|
} from './release-channels'
|
|
22
22
|
export type { FayzPackageChannel, FayzPackageVersionSet } from './release-channels'
|
|
23
|
+
export {
|
|
24
|
+
getSupportedPackages,
|
|
25
|
+
getInternalPackages,
|
|
26
|
+
isSupportedPackage,
|
|
27
|
+
fayzSupportedSurface,
|
|
28
|
+
} from './supported-surface'
|
|
29
|
+
export type { FayzPackageTier, FayzSupportedSurface } from './supported-surface'
|
|
30
|
+
export {
|
|
31
|
+
AI_BUILDER_REQUEST_CLASSES,
|
|
32
|
+
AI_BUILDER_REQUEST_CLASS_IDS,
|
|
33
|
+
isAllowedRequestClass,
|
|
34
|
+
} from './ai-builder'
|
|
35
|
+
export type {
|
|
36
|
+
FayzLayer,
|
|
37
|
+
AiBuilderRequestClass,
|
|
38
|
+
AiBuilderRequestClassDef,
|
|
39
|
+
} from './ai-builder'
|
|
23
40
|
export {
|
|
24
41
|
createFayzRuntimeClient,
|
|
25
42
|
FayzRuntimeError,
|
|
@@ -1,13 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"channels": {
|
|
3
3
|
"stable": {
|
|
4
|
-
"@fayz-ai/sdk": "^0.1.
|
|
4
|
+
"@fayz-ai/sdk": "^0.1.5",
|
|
5
|
+
"@fayz-ai/core": "^0.1.6",
|
|
6
|
+
"@fayz-ai/auth": "^0.1.6",
|
|
7
|
+
"@fayz-ai/ui": "^0.1.6",
|
|
8
|
+
"@fayz-ai/saas": "^0.1.6",
|
|
9
|
+
"@fayz-ai/db": "^0.1.1",
|
|
10
|
+
"@fayz-ai/plugin-agenda": "^0.1.1",
|
|
11
|
+
"@fayz-ai/plugin-financial": "^0.1.1",
|
|
12
|
+
"@fayz-ai/plugin-inventory": "^0.1.1",
|
|
13
|
+
"@fayz-ai/plugin-crm": "^0.1.1",
|
|
14
|
+
"@fayz-ai/plugin-dashboard": "^0.1.1",
|
|
15
|
+
"@fayz-ai/plugin-marketing": "^0.1.1",
|
|
16
|
+
"@fayz-ai/plugin-forms": "^0.1.1",
|
|
17
|
+
"@fayz-ai/plugin-tasks": "^0.1.1",
|
|
18
|
+
"@fayz-ai/plugin-reports": "^0.1.1"
|
|
5
19
|
},
|
|
6
20
|
"latest": {
|
|
7
|
-
"@fayz-ai/sdk": "^0.1.
|
|
21
|
+
"@fayz-ai/sdk": "^0.1.5",
|
|
22
|
+
"@fayz-ai/core": "^0.1.6",
|
|
23
|
+
"@fayz-ai/auth": "^0.1.6",
|
|
24
|
+
"@fayz-ai/ui": "^0.1.6",
|
|
25
|
+
"@fayz-ai/saas": "^0.1.6",
|
|
26
|
+
"@fayz-ai/db": "^0.1.1",
|
|
27
|
+
"@fayz-ai/plugin-agenda": "^0.1.1",
|
|
28
|
+
"@fayz-ai/plugin-financial": "^0.1.1",
|
|
29
|
+
"@fayz-ai/plugin-inventory": "^0.1.1",
|
|
30
|
+
"@fayz-ai/plugin-crm": "^0.1.1",
|
|
31
|
+
"@fayz-ai/plugin-dashboard": "^0.1.1",
|
|
32
|
+
"@fayz-ai/plugin-marketing": "^0.1.1",
|
|
33
|
+
"@fayz-ai/plugin-forms": "^0.1.1",
|
|
34
|
+
"@fayz-ai/plugin-tasks": "^0.1.1",
|
|
35
|
+
"@fayz-ai/plugin-reports": "^0.1.1"
|
|
8
36
|
},
|
|
9
37
|
"preview": {
|
|
10
|
-
"@fayz-ai/sdk": "^0.1.
|
|
38
|
+
"@fayz-ai/sdk": "^0.1.5",
|
|
39
|
+
"@fayz-ai/core": "^0.1.6",
|
|
40
|
+
"@fayz-ai/auth": "^0.1.6",
|
|
41
|
+
"@fayz-ai/ui": "^0.1.6",
|
|
42
|
+
"@fayz-ai/saas": "^0.1.6",
|
|
43
|
+
"@fayz-ai/db": "^0.1.1",
|
|
44
|
+
"@fayz-ai/plugin-agenda": "^0.1.1",
|
|
45
|
+
"@fayz-ai/plugin-financial": "^0.1.1",
|
|
46
|
+
"@fayz-ai/plugin-inventory": "^0.1.1",
|
|
47
|
+
"@fayz-ai/plugin-crm": "^0.1.1",
|
|
48
|
+
"@fayz-ai/plugin-dashboard": "^0.1.1",
|
|
49
|
+
"@fayz-ai/plugin-marketing": "^0.1.1",
|
|
50
|
+
"@fayz-ai/plugin-forms": "^0.1.1",
|
|
51
|
+
"@fayz-ai/plugin-tasks": "^0.1.1",
|
|
52
|
+
"@fayz-ai/plugin-reports": "^0.1.1"
|
|
11
53
|
}
|
|
12
54
|
}
|
|
13
55
|
}
|
|
@@ -11,17 +11,16 @@ describe('release channels', () => {
|
|
|
11
11
|
it('keeps stable as the default channel', () => {
|
|
12
12
|
expect(resolveFayzPackageVersions()).toEqual({
|
|
13
13
|
channel: 'stable',
|
|
14
|
-
packages:
|
|
15
|
-
'@fayz-ai/sdk': '^0.1.4',
|
|
16
|
-
},
|
|
14
|
+
packages: releaseChannels.channels.stable,
|
|
17
15
|
})
|
|
16
|
+
expect(resolveFayzPackageVersions().packages['@fayz-ai/sdk']).toBe('^0.1.5')
|
|
18
17
|
})
|
|
19
18
|
|
|
20
19
|
it('returns a copy of package dependencies', () => {
|
|
21
20
|
const dependencies = resolveFayzPackageDependencies()
|
|
22
21
|
dependencies['@fayz-ai/sdk'] = 'tampered'
|
|
23
22
|
|
|
24
|
-
expect(resolveFayzPackageDependencies()['@fayz-ai/sdk']).toBe('^0.1.
|
|
23
|
+
expect(resolveFayzPackageDependencies()['@fayz-ai/sdk']).toBe('^0.1.5')
|
|
25
24
|
})
|
|
26
25
|
|
|
27
26
|
it('throws when a package is not mapped for a channel', () => {
|
package/src/shop.test.ts
CHANGED
|
@@ -24,6 +24,37 @@ function productRow(overrides: Record<string, unknown> = {}) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
describe('createFayzShopProvider', () => {
|
|
27
|
+
it('uses the Fayz broker without provider credentials when apiBaseUrl and projectId are provided', async () => {
|
|
28
|
+
const fetcher = vi.fn<typeof fetch>().mockResolvedValue(jsonResponse({
|
|
29
|
+
products: [{
|
|
30
|
+
id: 'prod-1',
|
|
31
|
+
tenantId: 'store-1',
|
|
32
|
+
name: 'Aurora Tote',
|
|
33
|
+
slug: 'aurora-tote',
|
|
34
|
+
sku: 'BAG-001',
|
|
35
|
+
price: 149.9,
|
|
36
|
+
metadata: {},
|
|
37
|
+
images: [],
|
|
38
|
+
category: { id: 'cat-1', name: 'Bags' },
|
|
39
|
+
}],
|
|
40
|
+
}))
|
|
41
|
+
|
|
42
|
+
const provider = createFayzShopProvider({
|
|
43
|
+
apiBaseUrl: 'http://localhost:5173/api',
|
|
44
|
+
projectId: 'project-1',
|
|
45
|
+
fetcher,
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const [product] = await provider.listProducts({ status: 'active', limit: 4 })
|
|
49
|
+
|
|
50
|
+
expect(fetcher).toHaveBeenCalledWith(
|
|
51
|
+
'http://localhost:5173/api/public/projects/project-1/shop/products?status=active&limit=4',
|
|
52
|
+
{},
|
|
53
|
+
)
|
|
54
|
+
expect(product?.categoryId).toBe('cat-1')
|
|
55
|
+
expect(product?.categoryName).toBe('Bags')
|
|
56
|
+
})
|
|
57
|
+
|
|
27
58
|
it('merges app-owned product metadata overlays into listed products', async () => {
|
|
28
59
|
const fetcher = vi.fn<typeof fetch>().mockResolvedValue(jsonResponse([
|
|
29
60
|
productRow({
|