@stallforge/cli 0.1.0 → 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/README.md +5 -4
- package/package.json +26 -27
- package/src/commands/publish.mjs +1 -0
- package/src/lib/bundle.mjs +27 -2
- package/src/lib/check.mjs +10 -2
- package/src/lib/names.mjs +0 -1
- package/src/lib/templates.mjs +3 -4
- package/template/src/index.mjs +69 -0
- package/template/templates/_common/README.md.tpl +11 -0
- package/template/templates/_common/gitignore.tpl +2 -0
- package/template/templates/_common/package.json.tpl +18 -0
- package/template/templates/_common/test/manifest.test.ts.tpl +15 -0
- package/template/templates/_common/tsconfig.json.tpl +15 -0
- package/template/templates/example/plugin.json.tpl +13 -0
- package/template/templates/example/src/index.ts.tpl +15 -0
- package/template/templates/example/test/plugin.test.ts.tpl +23 -0
- package/template/templates/payment/plugin.json.tpl +136 -0
- package/template/templates/payment/src/index.ts.tpl +248 -0
- package/types/bundle.d.ts +3 -2
- package/types/index.d.ts +2 -2
- package/types/shims/contracts.d.ts +4 -0
- package/types/shims/sdk-scan.d.ts +1 -1
- package/types/shims/slot-shapes.d.ts +2 -0
- package/types/shims/validate.d.ts +1 -0
package/README.md
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @stallforge/cli
|
|
2
2
|
|
|
3
3
|
Author tooling for creating, testing, validating and publishing plugins.
|
|
4
4
|
|
|
5
|
-
Shared check tools live in the sibling `contracts` repository.
|
|
6
|
-
|
|
7
5
|
The SDK scan used by validate is a guardrail and not a sandbox.
|
|
8
6
|
|
|
9
7
|
## Commands
|
|
@@ -33,7 +31,10 @@ dist/NAME-VERSION/
|
|
|
33
31
|
|
|
34
32
|
- `npm test`
|
|
35
33
|
- `npm run lint`
|
|
36
|
-
- `npm run format`
|
|
37
34
|
- `npm run typecheck`
|
|
38
35
|
- `npm run brand:check`
|
|
39
36
|
- `npm run plan-ids:check`
|
|
37
|
+
|
|
38
|
+
## About the name
|
|
39
|
+
|
|
40
|
+
Stallforge is a placeholder product name until the owner confirms it is final.
|
package/package.json
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stallforge/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Author tooling: create, dev, test, validate, publish and doctor for plugins.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=24.15.0"
|
|
9
9
|
},
|
|
10
|
+
"files": [
|
|
11
|
+
"bin",
|
|
12
|
+
"src",
|
|
13
|
+
"template",
|
|
14
|
+
"template/templates/_common/test",
|
|
15
|
+
"template/templates/example/test",
|
|
16
|
+
"types"
|
|
17
|
+
],
|
|
10
18
|
"exports": {
|
|
11
19
|
".": {
|
|
12
20
|
"types": "./types/index.d.ts",
|
|
@@ -18,28 +26,6 @@
|
|
|
18
26
|
},
|
|
19
27
|
"./package.json": "./package.json"
|
|
20
28
|
},
|
|
21
|
-
"files": [
|
|
22
|
-
"bin",
|
|
23
|
-
"src",
|
|
24
|
-
"types"
|
|
25
|
-
],
|
|
26
|
-
"scripts": {
|
|
27
|
-
"test": "node --test \"test/**/*.test.mjs\"",
|
|
28
|
-
"lint": "biome check .",
|
|
29
|
-
"format": "biome check --write .",
|
|
30
|
-
"typecheck": "tsc -p tsconfig.json",
|
|
31
|
-
"brand:check": "node ../contracts/tools/brand-check.mjs --root .",
|
|
32
|
-
"plan-ids:check": "node ../contracts/tools/no-plan-ids.mjs --root .",
|
|
33
|
-
"prepare": "husky"
|
|
34
|
-
},
|
|
35
|
-
"devDependencies": {
|
|
36
|
-
"@biomejs/biome": "2.6.9",
|
|
37
|
-
"@commitlint/cli": "21.3.0",
|
|
38
|
-
"@commitlint/config-conventional": "21.3.0",
|
|
39
|
-
"@types/node": "26.6.11",
|
|
40
|
-
"husky": "9.1.7",
|
|
41
|
-
"typescript": "7.0.2"
|
|
42
|
-
},
|
|
43
29
|
"bin": {
|
|
44
30
|
"stallforge": "./bin/cli.mjs"
|
|
45
31
|
},
|
|
@@ -48,14 +34,27 @@
|
|
|
48
34
|
"#sdk": "@stallforge/plugin-sdk",
|
|
49
35
|
"#sdk/*": "@stallforge/plugin-sdk/*"
|
|
50
36
|
},
|
|
37
|
+
"publishConfig": {
|
|
38
|
+
"access": "public",
|
|
39
|
+
"provenance": false
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"lint": "biome check --error-on-warnings .",
|
|
43
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
44
|
+
"templates:check": "node tools/sync-template.mjs --check",
|
|
45
|
+
"templates:write": "node tools/sync-template.mjs --write",
|
|
46
|
+
"test": "node --test \"test/**/*.test.mjs\"",
|
|
47
|
+
"brand:check": "node ../../scripts/brand-check.mjs --root ../..",
|
|
48
|
+
"plan-ids:check": "node ../../scripts/no-plan-ids.mjs --root ../.."
|
|
49
|
+
},
|
|
51
50
|
"dependencies": {
|
|
52
|
-
"@stallforge/contracts": "0.
|
|
53
|
-
"@stallforge/plugin-sdk": "0.
|
|
54
|
-
"@stallforge/plugin-template": "0.1.0",
|
|
51
|
+
"@stallforge/contracts": "0.4.0",
|
|
52
|
+
"@stallforge/plugin-sdk": "0.4.0",
|
|
55
53
|
"rolldown": "1.3.4"
|
|
56
54
|
},
|
|
57
55
|
"repository": {
|
|
58
56
|
"type": "git",
|
|
59
|
-
"url": "https://github.com/stallforge/
|
|
57
|
+
"url": "git+https://github.com/stallforge/stallforge-monorepo.git",
|
|
58
|
+
"directory": "packages/cli"
|
|
60
59
|
}
|
|
61
60
|
}
|
package/src/commands/publish.mjs
CHANGED
package/src/lib/bundle.mjs
CHANGED
|
@@ -36,9 +36,26 @@ export function registryEntry({ manifest, bundle, manifestBytes, sourceTag = nul
|
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
/** Copies each publishable route's allow-list file from the plugin source into the bundle folder. */
|
|
40
|
+
function copyPublicFieldFiles(manifest, sourceDir, dir) {
|
|
41
|
+
if (typeof sourceDir !== 'string' || sourceDir === '') return;
|
|
42
|
+
const base = fs.realpathSync(sourceDir);
|
|
43
|
+
for (const route of manifest.routes ?? []) {
|
|
44
|
+
if (route.policy !== 'publishable' || typeof route.public_fields !== 'string') continue;
|
|
45
|
+
const from = path.join(base, route.public_fields);
|
|
46
|
+
const real = fs.realpathSync(from);
|
|
47
|
+
if (real !== base && !real.startsWith(base + path.sep)) {
|
|
48
|
+
throw new Error(`public_fields ${route.public_fields} leaves the plugin folder`);
|
|
49
|
+
}
|
|
50
|
+
const to = path.join(dir, route.public_fields);
|
|
51
|
+
fs.mkdirSync(path.dirname(to), { recursive: true });
|
|
52
|
+
fs.copyFileSync(real, to);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
39
56
|
// Replaces only outRoot/NAME-VERSION. Nothing is sent anywhere.
|
|
40
|
-
/** @param {{ outRoot: string, raw: any, manifest: any, bundle: Uint8Array, sourceTag?: string | null }} input */
|
|
41
|
-
export function writeBundle({ outRoot, raw, manifest, bundle, sourceTag = null }) {
|
|
57
|
+
/** @param {{ outRoot: string, raw: any, manifest: any, bundle: Uint8Array, sourceTag?: string | null, sourceDir?: string | null }} input */
|
|
58
|
+
export function writeBundle({ outRoot, raw, manifest, bundle, sourceTag = null, sourceDir = null }) {
|
|
42
59
|
const dir = path.join(outRoot, bundleDirName(manifest));
|
|
43
60
|
fs.rmSync(dir, { recursive: true, force: true });
|
|
44
61
|
fs.mkdirSync(dir, { recursive: true });
|
|
@@ -47,6 +64,7 @@ export function writeBundle({ outRoot, raw, manifest, bundle, sourceTag = null }
|
|
|
47
64
|
fs.writeFileSync(path.join(dir, BUNDLE_FILES.bundle), bundle);
|
|
48
65
|
fs.writeFileSync(path.join(dir, BUNDLE_FILES.manifest), manifestBytes);
|
|
49
66
|
fs.writeFileSync(path.join(dir, BUNDLE_FILES.entry), `${JSON.stringify(entry, null, 2)}\n`);
|
|
67
|
+
copyPublicFieldFiles(manifest, sourceDir, dir);
|
|
50
68
|
return { dir, entry };
|
|
51
69
|
}
|
|
52
70
|
|
|
@@ -101,6 +119,13 @@ export function verifyBundle(dir) {
|
|
|
101
119
|
);
|
|
102
120
|
if (JSON.stringify(entry.capabilities) !== JSON.stringify([...manifest.capabilities].sort(byText)))
|
|
103
121
|
problems.push(`${BUNDLE_FILES.entry}: capabilities differ from ${BUNDLE_FILES.manifest}`);
|
|
122
|
+
for (const route of manifest.routes ?? []) {
|
|
123
|
+
if (route.policy !== 'publishable' || typeof route.public_fields !== 'string') continue;
|
|
124
|
+
const fieldsPath = path.join(dir, route.public_fields);
|
|
125
|
+
if (!fs.existsSync(fieldsPath) || !fs.statSync(fieldsPath).isFile()) {
|
|
126
|
+
problems.push(`${route.public_fields}: allow-list file is missing from the bundle`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
104
129
|
}
|
|
105
130
|
}
|
|
106
131
|
return { ok: problems.length === 0, problems: problems.map((problem) => `${label}: ${problem}`), entry };
|
package/src/lib/check.mjs
CHANGED
|
@@ -16,15 +16,23 @@ export function rebuildProblem(name, hashes) {
|
|
|
16
16
|
: null;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
/** Scan profile for official plugin kinds that need Node built-ins beyond the default set. */
|
|
20
|
+
function scanProfile(manifest) {
|
|
21
|
+
if (manifest?.type === 'database') return 'database-driver';
|
|
22
|
+
if (manifest?.type === 'file-storage') return 'storage';
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
// Scans the built bundle (what ships) and, when given, the source entry (capability use survives there in full).
|
|
20
27
|
// Capability findings are derived here so every message names the capability.
|
|
21
28
|
/** @param {{ name: string, manifest: any, bundleText: string, sourceText?: string | null }} input */
|
|
22
29
|
export function scanBundle({ name, manifest, bundleText, sourceText = null }) {
|
|
23
30
|
const declared = manifest.capabilities;
|
|
24
|
-
const
|
|
31
|
+
const profile = scanProfile(manifest);
|
|
32
|
+
const bundle = scan(bundleText, { capabilities: declared, profile });
|
|
25
33
|
const used = new Set(bundle.used_capabilities);
|
|
26
34
|
if (sourceText !== null)
|
|
27
|
-
for (const item of scan(sourceText, { capabilities: declared, allowRelative: true }).used_capabilities)
|
|
35
|
+
for (const item of scan(sourceText, { capabilities: declared, allowRelative: true, profile }).used_capabilities)
|
|
28
36
|
used.add(item);
|
|
29
37
|
const errors = bundle.errors
|
|
30
38
|
.filter((finding) => !CAPABILITY_RULES.has(finding.rule))
|
package/src/lib/names.mjs
CHANGED
|
@@ -2,6 +2,5 @@
|
|
|
2
2
|
import { brand } from '#contracts/brand';
|
|
3
3
|
|
|
4
4
|
export const SDK_PACKAGE = `${brand.packageScope}/plugin-sdk`;
|
|
5
|
-
export const TEMPLATE_PACKAGE = `${brand.packageScope}/plugin-template`;
|
|
6
5
|
export const CLI_PACKAGE = `${brand.packageScope}/cli`;
|
|
7
6
|
export const CLI_NAME = brand.cliName;
|
package/src/lib/templates.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
// The template package is a dependency; its folder is found with import.meta.resolve, never by a relative path.
|
|
1
|
+
// The templates ship inside this package (the template folder, kept equal to its source by tools/sync-template.mjs),
|
|
2
|
+
// so an installed copy needs no other package to scaffold a plugin.
|
|
4
3
|
export async function loadTemplates() {
|
|
5
|
-
return import(import.meta.
|
|
4
|
+
return import(new URL('../../template/src/index.mjs', import.meta.url).href);
|
|
6
5
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
export const TEMPLATES_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', 'templates');
|
|
6
|
+
|
|
7
|
+
export function templatesRoot() {
|
|
8
|
+
return TEMPLATES_ROOT;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const COMMON = '_common';
|
|
12
|
+
export const PLACEHOLDERS = Object.freeze([
|
|
13
|
+
'PLUGIN_NAME',
|
|
14
|
+
'LICENSE',
|
|
15
|
+
'SDK_PACKAGE',
|
|
16
|
+
'SDK_RANGE',
|
|
17
|
+
'CLI_PACKAGE',
|
|
18
|
+
'CLI_RANGE',
|
|
19
|
+
'CLI_NAME',
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
export function listTemplates() {
|
|
23
|
+
return fs
|
|
24
|
+
.readdirSync(TEMPLATES_ROOT, { withFileTypes: true })
|
|
25
|
+
.filter((entry) => entry.isDirectory() && !entry.name.startsWith('_'))
|
|
26
|
+
.map((entry) => entry.name)
|
|
27
|
+
.sort();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// A template file ends in .tpl so lint and type checks of this repository skip it; gitignore gets its dot back
|
|
31
|
+
// (a package manager drops files named .gitignore from published packages).
|
|
32
|
+
export function outputName(relative) {
|
|
33
|
+
const parts = relative.split(path.sep).join('/').split('/');
|
|
34
|
+
let base = parts.pop() ?? '';
|
|
35
|
+
if (base.endsWith('.tpl')) base = base.slice(0, -4);
|
|
36
|
+
if (base === 'gitignore') base = '.gitignore';
|
|
37
|
+
return [...parts, base].join('/');
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const filesOf = (dir) =>
|
|
41
|
+
fs.existsSync(dir)
|
|
42
|
+
? fs
|
|
43
|
+
.readdirSync(dir, { recursive: true })
|
|
44
|
+
.map(String)
|
|
45
|
+
.filter((relative) => fs.statSync(path.join(dir, relative)).isFile())
|
|
46
|
+
.sort()
|
|
47
|
+
: [];
|
|
48
|
+
|
|
49
|
+
export function templateFiles(name) {
|
|
50
|
+
const known = listTemplates();
|
|
51
|
+
if (!known.includes(name)) throw new Error(`unknown template "${name}"; available: ${known.join(', ')}`);
|
|
52
|
+
const merged = new Map();
|
|
53
|
+
for (const folder of [COMMON, name]) {
|
|
54
|
+
for (const relative of filesOf(path.join(TEMPLATES_ROOT, folder))) {
|
|
55
|
+
merged.set(outputName(relative), fs.readFileSync(path.join(TEMPLATES_ROOT, folder, relative), 'utf8'));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return [...merged]
|
|
59
|
+
.map(([file, text]) => ({ path: file, text }))
|
|
60
|
+
.sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function renderTemplate(text, values) {
|
|
64
|
+
return text.replace(/__([A-Z][A-Z_]*[A-Z])__/g, (whole, key) => {
|
|
65
|
+
if (!PLACEHOLDERS.includes(key)) throw new Error(`unknown placeholder ${whole}`);
|
|
66
|
+
if (typeof values[key] !== 'string') throw new Error(`no value for placeholder ${whole}`);
|
|
67
|
+
return values[key];
|
|
68
|
+
});
|
|
69
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# __PLUGIN_NAME__
|
|
2
|
+
|
|
3
|
+
A plugin made with `__CLI_NAME__ create`. `plugin.json` is the manifest and `src/index.ts` is the code.
|
|
4
|
+
|
|
5
|
+
- `npm test` runs the unit tests, then the slot suite of every slot this plugin claims.
|
|
6
|
+
- `npm run validate` checks the manifest, the SDK range, the bundle scan and capability use.
|
|
7
|
+
- `npm run dev` loads the plugin in the test host and reloads it when a file changes.
|
|
8
|
+
- `npm run build` writes `dist/NAME-VERSION/` with the bundle, the manifest and the registry entry.
|
|
9
|
+
|
|
10
|
+
Import only types from the SDK in plugin code (`import type`); the host passes the SDK in through `ctx`. Declare every
|
|
11
|
+
capability in `plugin.json`: `validate` fails on a capability the code uses but the manifest does not declare.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__PLUGIN_NAME__",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "__LICENSE__",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "__CLI_NAME__ dev",
|
|
9
|
+
"test": "__CLI_NAME__ test",
|
|
10
|
+
"validate": "__CLI_NAME__ validate",
|
|
11
|
+
"build": "__CLI_NAME__ publish"
|
|
12
|
+
},
|
|
13
|
+
"devDependencies": {
|
|
14
|
+
"@types/node": "26.6.11",
|
|
15
|
+
"__SDK_PACKAGE__": "__SDK_RANGE__",
|
|
16
|
+
"__CLI_PACKAGE__": "__CLI_RANGE__"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import test from 'node:test';
|
|
5
|
+
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
6
|
+
|
|
7
|
+
const dir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
8
|
+
const manifest = JSON.parse(fs.readFileSync(path.join(dir, 'plugin.json'), 'utf8'));
|
|
9
|
+
|
|
10
|
+
test('the entry exports activate and every handler the manifest names', async () => {
|
|
11
|
+
const mod = await import(pathToFileURL(path.join(dir, manifest.entry)).href);
|
|
12
|
+
assert.equal(typeof mod.default?.activate, 'function');
|
|
13
|
+
const named = [...(manifest.routes ?? []), ...(manifest.webhooks ?? []), ...(manifest.jobs ?? [])].map((item) => item.handler);
|
|
14
|
+
for (const name of named) assert.equal(typeof mod.handlers?.[name], 'function', `handler ${name} is not exported`);
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2023",
|
|
4
|
+
"module": "nodenext",
|
|
5
|
+
"moduleResolution": "nodenext",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"skipLibCheck": true,
|
|
9
|
+
"allowImportingTsExtensions": true,
|
|
10
|
+
"erasableSyntaxOnly": true,
|
|
11
|
+
"verbatimModuleSyntax": true,
|
|
12
|
+
"types": ["node"]
|
|
13
|
+
},
|
|
14
|
+
"include": ["src", "test"]
|
|
15
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 0,
|
|
3
|
+
"name": "__PLUGIN_NAME__",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"license": "__LICENSE__",
|
|
6
|
+
"type": "example",
|
|
7
|
+
"sdk": "__SDK_RANGE__",
|
|
8
|
+
"entry": "src/index.ts",
|
|
9
|
+
"capabilities": ["events:emit"],
|
|
10
|
+
"events": { "emits": ["example.greeted"] },
|
|
11
|
+
"policies": [{ "resource": "example", "operations": ["read"] }],
|
|
12
|
+
"routes": [{ "method": "GET", "path": "/hello", "handler": "hello", "policy": "example:read" }]
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Handlers, PluginContext, PluginModule } from '__SDK_PACKAGE__';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
async activate(_ctx: PluginContext) {},
|
|
5
|
+
async dispose() {},
|
|
6
|
+
} satisfies PluginModule;
|
|
7
|
+
|
|
8
|
+
export const handlers: Handlers = {
|
|
9
|
+
async hello(request, ctx) {
|
|
10
|
+
const asked = request?.query?.name;
|
|
11
|
+
const who = typeof asked === 'string' && asked !== '' ? asked : 'world';
|
|
12
|
+
await ctx.sdk.events.emit('example.greeted', { who });
|
|
13
|
+
return { status: 200, body: { greeting: `Hello, ${who}.` } };
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import test from 'node:test';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { createTestkitAdapter } from '__SDK_PACKAGE__/conformance';
|
|
6
|
+
|
|
7
|
+
const dir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
|
|
8
|
+
|
|
9
|
+
test('the hello route greets by name and emits one event', async () => {
|
|
10
|
+
const host = await createTestkitAdapter().create();
|
|
11
|
+
try {
|
|
12
|
+
const loaded = await host.load(dir);
|
|
13
|
+
assert.equal(loaded.state, 'active', loaded.errors.join('; '));
|
|
14
|
+
const answer = await host.callRoute('__PLUGIN_NAME__', { method: 'GET', path: '/hello', params: {}, query: { name: 'Ada' }, headers: {}, body: null });
|
|
15
|
+
assert.equal(answer.status, 200);
|
|
16
|
+
assert.deepEqual(answer.body, { greeting: 'Hello, Ada.' });
|
|
17
|
+
const event = (await host.emitted()).find((item) => item.name === 'example.greeted');
|
|
18
|
+
assert.deepEqual(event?.payload, { who: 'Ada' });
|
|
19
|
+
assert.equal((await host.audit()).filter((row) => row.outcome === 'denied').length, 0);
|
|
20
|
+
} finally {
|
|
21
|
+
await host.close();
|
|
22
|
+
}
|
|
23
|
+
});
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
{
|
|
2
|
+
"manifest_version": 0,
|
|
3
|
+
"name": "__PLUGIN_NAME__",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"license": "__LICENSE__",
|
|
6
|
+
"type": "payment",
|
|
7
|
+
"sdk": "__SDK_RANGE__",
|
|
8
|
+
"entry": "src/index.ts",
|
|
9
|
+
"capabilities": [
|
|
10
|
+
"data:own",
|
|
11
|
+
"events:emit",
|
|
12
|
+
"crypto:use"
|
|
13
|
+
],
|
|
14
|
+
"slots": [
|
|
15
|
+
{
|
|
16
|
+
"slot": "payment",
|
|
17
|
+
"mode": "multi"
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"settings": [
|
|
21
|
+
{
|
|
22
|
+
"key": "webhook_secret",
|
|
23
|
+
"type": "secret",
|
|
24
|
+
"label": "Webhook secret",
|
|
25
|
+
"required": true
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"tables": [
|
|
29
|
+
{
|
|
30
|
+
"name": "sessions",
|
|
31
|
+
"columns": [
|
|
32
|
+
{
|
|
33
|
+
"name": "session_id",
|
|
34
|
+
"type": "text"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "order_id",
|
|
38
|
+
"type": "text"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "status",
|
|
42
|
+
"type": "text"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "amount",
|
|
46
|
+
"type": "money"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"name": "currency",
|
|
50
|
+
"type": "text"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "capture_method",
|
|
54
|
+
"type": "text"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"name": "captured",
|
|
58
|
+
"type": "money"
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"unique": [
|
|
62
|
+
[
|
|
63
|
+
"session_id"
|
|
64
|
+
],
|
|
65
|
+
[
|
|
66
|
+
"order_id"
|
|
67
|
+
]
|
|
68
|
+
],
|
|
69
|
+
"indexes": [
|
|
70
|
+
{
|
|
71
|
+
"columns": [
|
|
72
|
+
"order_id"
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "refunds",
|
|
79
|
+
"columns": [
|
|
80
|
+
{
|
|
81
|
+
"name": "refund_key",
|
|
82
|
+
"type": "text"
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "session_id",
|
|
86
|
+
"type": "text"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "amount",
|
|
90
|
+
"type": "money"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "status",
|
|
94
|
+
"type": "text"
|
|
95
|
+
}
|
|
96
|
+
],
|
|
97
|
+
"unique": [
|
|
98
|
+
[
|
|
99
|
+
"refund_key"
|
|
100
|
+
]
|
|
101
|
+
],
|
|
102
|
+
"indexes": [
|
|
103
|
+
{
|
|
104
|
+
"columns": [
|
|
105
|
+
"session_id"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"name": "events",
|
|
112
|
+
"columns": [
|
|
113
|
+
{
|
|
114
|
+
"name": "event_id",
|
|
115
|
+
"type": "text"
|
|
116
|
+
}
|
|
117
|
+
],
|
|
118
|
+
"unique": [
|
|
119
|
+
[
|
|
120
|
+
"event_id"
|
|
121
|
+
]
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
],
|
|
125
|
+
"events": {
|
|
126
|
+
"emits": [
|
|
127
|
+
"payment.status_changed"
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
"webhooks": [
|
|
131
|
+
{
|
|
132
|
+
"name": "provider",
|
|
133
|
+
"handler": "handleWebhook"
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
}
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// A fake payment provider plugin. It stores sessions in its own table and shows the patterns the payment
|
|
2
|
+
// contract asks for: the signature checked with hmac, a duplicate event removed by one batch, status events.
|
|
3
|
+
// It implements the payment contract, not the provider's own vocabulary. How the fake provider's behaviour maps:
|
|
4
|
+
// token tok_ok -> automatic capture gives status captured with the whole amount in captured (provider
|
|
5
|
+
// succeeded); manual capture gives authorized (provider requires_capture)
|
|
6
|
+
// token tok_decline -> a declined result with code card_declined (the provider answers 402 card_declined; a
|
|
7
|
+
// decline is a result here, not an error)
|
|
8
|
+
// token tok_3ds -> status requires_action and redirect_url set to the relative path
|
|
9
|
+
// /fake-payment/return/<session_id>; completeAction settles it like tok_ok and is refused
|
|
10
|
+
// in any other status
|
|
11
|
+
// token pending -> status pending (asynchronous acceptance; neither authorized nor captured)
|
|
12
|
+
// provider_payload -> same settlement as tok_ok when the map is present
|
|
13
|
+
// order_id no-void -> voidPayment answers not_supported
|
|
14
|
+
// a new session -> created (provider requires_confirmation) plus a public client map
|
|
15
|
+
// refund over the captured amount, or on a session that is not captured -> the error code refund_rejected
|
|
16
|
+
// (provider 422 refund_exceeds_captured)
|
|
17
|
+
// a webhook event -> carries the contract status directly; a captured event also sets captured
|
|
18
|
+
const STATUSES = [
|
|
19
|
+
'created',
|
|
20
|
+
'requires_action',
|
|
21
|
+
'pending',
|
|
22
|
+
'authorized',
|
|
23
|
+
'captured',
|
|
24
|
+
'declined',
|
|
25
|
+
'canceled',
|
|
26
|
+
'refunded',
|
|
27
|
+
];
|
|
28
|
+
const MINOR = /^(0|[1-9][0-9]{0,18})$/;
|
|
29
|
+
const fail = (code, message) => Object.assign(new Error(message), { code });
|
|
30
|
+
const minor = (value, label) => {
|
|
31
|
+
if (typeof value !== 'string' || !MINOR.test(value))
|
|
32
|
+
throw fail('bad_input', `${label} must be a string of minor units`);
|
|
33
|
+
return BigInt(value);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
async function load(ctx, sessionId) {
|
|
37
|
+
const page = await ctx.sdk.data.list({ table: 'sessions', where: { session_id: String(sessionId) }, limit: 1 });
|
|
38
|
+
if (page.items.length === 0) throw fail('not_found', `session ${sessionId} was not found`);
|
|
39
|
+
return page.items[0];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function setStatus(ctx, row, patch) {
|
|
43
|
+
const next = await ctx.sdk.data.update({ table: 'sessions', id: row.id, patch, expected_version: row.version });
|
|
44
|
+
await ctx.sdk.events.emit('payment.status_changed', { session_id: next.session_id, status: next.status });
|
|
45
|
+
return next;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// A token that works: automatic capture captures the whole amount, manual capture only authorizes.
|
|
49
|
+
async function settle(ctx, row) {
|
|
50
|
+
const patch =
|
|
51
|
+
row.capture_method === 'manual' ? { status: 'authorized' } : { status: 'captured', captured: row.amount };
|
|
52
|
+
const next = await setStatus(ctx, row, patch);
|
|
53
|
+
return { status: next.status, code: null, redirect_url: null };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// The row patch for a provider event. A captured event also sets the captured amount (the event may carry a
|
|
57
|
+
// smaller one as a string of minor units, never more than the amount), so a later refund is checked against it.
|
|
58
|
+
function patchFor(row, event) {
|
|
59
|
+
if (event.status !== 'captured') return { status: event.status };
|
|
60
|
+
const captured = event.captured === undefined ? row.amount : event.captured;
|
|
61
|
+
if (minor(captured, 'captured') > minor(row.amount, 'amount'))
|
|
62
|
+
throw fail('bad_input', 'captured is more than the amount');
|
|
63
|
+
return { status: 'captured', captured };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async function refundedSoFar(ctx, sessionId) {
|
|
67
|
+
let total = 0n;
|
|
68
|
+
let cursor = null;
|
|
69
|
+
do {
|
|
70
|
+
const page = await ctx.sdk.data.list({ table: 'refunds', where: { session_id: sessionId }, limit: 200, cursor });
|
|
71
|
+
for (const item of page.items) total += BigInt(String(item.amount));
|
|
72
|
+
cursor = page.next_cursor;
|
|
73
|
+
} while (cursor);
|
|
74
|
+
return total;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default {
|
|
78
|
+
async activate() {},
|
|
79
|
+
async dispose() {},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export const handlers = {
|
|
83
|
+
async createSession(input, ctx) {
|
|
84
|
+
minor(input.amount, 'amount');
|
|
85
|
+
if (input.test_mode === true) {
|
|
86
|
+
// Sandbox credentials are always available for this fixture.
|
|
87
|
+
}
|
|
88
|
+
const suffix = (await ctx.sdk.crypto.random_bytes({ length: 9 })).replace(/[^A-Za-z0-9]/g, 'x');
|
|
89
|
+
const orderId = String(input.order_id);
|
|
90
|
+
const currency = String(input.currency);
|
|
91
|
+
const captureMethod = input.capture_method === 'manual' ? 'manual' : 'automatic';
|
|
92
|
+
const made = await ctx.sdk.data.insert_if_absent({
|
|
93
|
+
table: 'sessions',
|
|
94
|
+
key: ['order_id'],
|
|
95
|
+
row: {
|
|
96
|
+
session_id: `ps_${suffix}`,
|
|
97
|
+
order_id: orderId,
|
|
98
|
+
status: 'created',
|
|
99
|
+
amount: input.amount,
|
|
100
|
+
currency,
|
|
101
|
+
capture_method: captureMethod,
|
|
102
|
+
captured: '0',
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
const row = made.row;
|
|
106
|
+
if (row.amount !== input.amount || row.currency !== currency) {
|
|
107
|
+
throw fail('conflict', 'this order already has a payment session with different details');
|
|
108
|
+
}
|
|
109
|
+
if (made.inserted) {
|
|
110
|
+
await ctx.sdk.events.emit('payment.status_changed', { session_id: row.session_id, status: 'created' });
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
session_id: row.session_id,
|
|
114
|
+
status: row.status,
|
|
115
|
+
client: { order_id: `prov_${orderId}`, key_id: 'pk_test' },
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
async authorize(input, ctx) {
|
|
119
|
+
const row = await load(ctx, input.session_id);
|
|
120
|
+
const hasToken = typeof input.token === 'string' && input.token.length > 0;
|
|
121
|
+
const hasPayload = input.provider_payload !== undefined && input.provider_payload !== null;
|
|
122
|
+
if (!hasToken && !hasPayload) throw fail('bad_input', 'authorize needs token or provider_payload');
|
|
123
|
+
if (hasPayload) return settle(ctx, row);
|
|
124
|
+
if (input.token === 'pending') {
|
|
125
|
+
await setStatus(ctx, row, { status: 'pending' });
|
|
126
|
+
return { status: 'pending', code: null, redirect_url: null };
|
|
127
|
+
}
|
|
128
|
+
if (input.token === 'tok_3ds') {
|
|
129
|
+
await setStatus(ctx, row, { status: 'requires_action' });
|
|
130
|
+
return { status: 'requires_action', code: null, redirect_url: `/fake-payment/return/${row.session_id}` };
|
|
131
|
+
}
|
|
132
|
+
if (input.token !== 'tok_ok') {
|
|
133
|
+
await setStatus(ctx, row, { status: 'declined' });
|
|
134
|
+
return { status: 'declined', code: 'card_declined', redirect_url: null };
|
|
135
|
+
}
|
|
136
|
+
return settle(ctx, row);
|
|
137
|
+
},
|
|
138
|
+
async completeAction(input, ctx) {
|
|
139
|
+
const row = await load(ctx, input.session_id);
|
|
140
|
+
if (row.status !== 'requires_action') throw fail('bad_input', 'the session is not waiting for an action');
|
|
141
|
+
const settled = await settle(ctx, row);
|
|
142
|
+
return { status: settled.status };
|
|
143
|
+
},
|
|
144
|
+
async capture(input, ctx) {
|
|
145
|
+
const row = await load(ctx, input.session_id);
|
|
146
|
+
if (row.status !== 'authorized') throw fail('bad_input', 'only an authorized session can be captured');
|
|
147
|
+
const amount = input.amount === undefined ? row.amount : input.amount;
|
|
148
|
+
if (minor(amount, 'amount') > minor(row.amount, 'amount'))
|
|
149
|
+
throw fail('bad_input', 'capture is more than the authorized amount');
|
|
150
|
+
const next = await setStatus(ctx, row, { status: 'captured', captured: amount });
|
|
151
|
+
return { status: next.status, captured: next.captured };
|
|
152
|
+
},
|
|
153
|
+
async voidPayment(input, ctx) {
|
|
154
|
+
const row = await load(ctx, input.session_id);
|
|
155
|
+
if (row.order_id === 'no-void') throw fail('not_supported', 'this provider cannot void a payment');
|
|
156
|
+
const next = await setStatus(ctx, row, { status: 'canceled' });
|
|
157
|
+
return { status: next.status };
|
|
158
|
+
},
|
|
159
|
+
async refund(input, ctx) {
|
|
160
|
+
const row = await load(ctx, input.session_id);
|
|
161
|
+
const amount = String(input.amount);
|
|
162
|
+
const refundKey = String(input.refund_key);
|
|
163
|
+
if (refundKey === '') throw fail('bad_input', 'refund needs a refund_key');
|
|
164
|
+
const prior = await ctx.sdk.data.list({ table: 'refunds', where: { refund_key: refundKey }, limit: 1 });
|
|
165
|
+
if (prior.items.length > 0) {
|
|
166
|
+
const first = prior.items[0];
|
|
167
|
+
if (first.session_id !== row.session_id || first.amount !== amount) {
|
|
168
|
+
throw fail('conflict', 'this refund_key was already used for another refund');
|
|
169
|
+
}
|
|
170
|
+
return { status: first.status, refunded: first.amount };
|
|
171
|
+
}
|
|
172
|
+
if (row.status !== 'captured' && row.status !== 'refunded') {
|
|
173
|
+
throw fail('refund_rejected', 'only a captured session can be refunded');
|
|
174
|
+
}
|
|
175
|
+
const wanted = minor(amount, 'amount');
|
|
176
|
+
const already = await refundedSoFar(ctx, row.session_id);
|
|
177
|
+
if (wanted + already > minor(row.captured, 'captured')) {
|
|
178
|
+
throw fail('refund_rejected', 'the refund is more than the captured amount');
|
|
179
|
+
}
|
|
180
|
+
const nextStatus = wanted + already >= minor(row.captured, 'captured') ? 'refunded' : row.status;
|
|
181
|
+
const made = await ctx.sdk.data.insert_if_absent({
|
|
182
|
+
table: 'refunds',
|
|
183
|
+
key: ['refund_key'],
|
|
184
|
+
row: {
|
|
185
|
+
refund_key: refundKey,
|
|
186
|
+
session_id: row.session_id,
|
|
187
|
+
amount,
|
|
188
|
+
status: nextStatus,
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
if (!made.inserted) {
|
|
192
|
+
const existing = made.row;
|
|
193
|
+
if (existing.session_id !== row.session_id || existing.amount !== amount) {
|
|
194
|
+
throw fail('conflict', 'this refund_key was already used for another refund');
|
|
195
|
+
}
|
|
196
|
+
return { status: existing.status, refunded: existing.amount };
|
|
197
|
+
}
|
|
198
|
+
const next = nextStatus === row.status ? row : await setStatus(ctx, row, { status: nextStatus });
|
|
199
|
+
return { status: next.status, refunded: amount };
|
|
200
|
+
},
|
|
201
|
+
async getStatus(input, ctx) {
|
|
202
|
+
const row = await load(ctx, input.session_id);
|
|
203
|
+
return {
|
|
204
|
+
session_id: row.session_id,
|
|
205
|
+
order_id: row.order_id,
|
|
206
|
+
status: row.status,
|
|
207
|
+
amount: row.amount,
|
|
208
|
+
currency: row.currency,
|
|
209
|
+
captured: row.captured,
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
async handleWebhook(input, ctx) {
|
|
213
|
+
const expected = await ctx.sdk.crypto.hmac({ secret: 'webhook_secret', data_text: input.body_text });
|
|
214
|
+
if (!(await ctx.sdk.crypto.compare({ a: expected, b: input.headers['x-signature'] ?? '' }))) {
|
|
215
|
+
return { status: 401, body_text: '{"error":"bad_signature"}' };
|
|
216
|
+
}
|
|
217
|
+
let event;
|
|
218
|
+
try {
|
|
219
|
+
event = JSON.parse(input.body_text);
|
|
220
|
+
} catch {
|
|
221
|
+
return { status: 400, body_text: '{"error":"bad_json"}' };
|
|
222
|
+
}
|
|
223
|
+
if (typeof event?.id !== 'string' || typeof event.session_id !== 'string' || !STATUSES.includes(event.status)) {
|
|
224
|
+
return { status: 400, body_text: '{"error":"bad_event"}' };
|
|
225
|
+
}
|
|
226
|
+
const row = await load(ctx, event.session_id);
|
|
227
|
+
let patch;
|
|
228
|
+
try {
|
|
229
|
+
patch = patchFor(row, event);
|
|
230
|
+
} catch {
|
|
231
|
+
return { status: 400, body_text: '{"error":"bad_event"}' };
|
|
232
|
+
}
|
|
233
|
+
try {
|
|
234
|
+
await ctx.sdk.data.batch({
|
|
235
|
+
preconditions: [{ kind: 'row_absent', table: 'events', key: { event_id: event.id } }],
|
|
236
|
+
operations: [
|
|
237
|
+
{ op: 'insert', table: 'events', row: { event_id: event.id } },
|
|
238
|
+
{ op: 'update', table: 'sessions', id: row.id, patch, expected_version: row.version },
|
|
239
|
+
],
|
|
240
|
+
});
|
|
241
|
+
} catch (error) {
|
|
242
|
+
if (error.code === 'precondition_failed') return { status: 200, body_text: '{"duplicate":true}' };
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
await ctx.sdk.events.emit('payment.status_changed', { session_id: event.session_id, status: event.status });
|
|
246
|
+
return { status: 200, body_text: '{"duplicate":false}' };
|
|
247
|
+
},
|
|
248
|
+
};
|
package/types/bundle.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface RegistryEntry {
|
|
|
23
23
|
source_tag: string | null;
|
|
24
24
|
}
|
|
25
25
|
export declare function registryEntry(input: {
|
|
26
|
-
manifest: Record<string,
|
|
26
|
+
manifest: Record<string, unknown>;
|
|
27
27
|
bundle: Uint8Array;
|
|
28
28
|
manifestBytes: Uint8Array;
|
|
29
29
|
sourceTag?: string | null;
|
|
@@ -31,8 +31,9 @@ export declare function registryEntry(input: {
|
|
|
31
31
|
export declare function writeBundle(input: {
|
|
32
32
|
outRoot: string;
|
|
33
33
|
raw: Record<string, unknown>;
|
|
34
|
-
manifest: Record<string,
|
|
34
|
+
manifest: Record<string, unknown>;
|
|
35
35
|
bundle: Uint8Array;
|
|
36
36
|
sourceTag?: string | null;
|
|
37
|
+
sourceDir?: string | null;
|
|
37
38
|
}): { dir: string; entry: RegistryEntry };
|
|
38
39
|
export declare function verifyBundle(dir: string): { ok: boolean; problems: string[]; entry: RegistryEntry | null };
|
package/types/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface CommandContext {
|
|
|
7
7
|
export interface PluginCheck {
|
|
8
8
|
name: string;
|
|
9
9
|
raw: Record<string, unknown> | null;
|
|
10
|
-
manifest: Record<string,
|
|
10
|
+
manifest: Record<string, unknown> | null;
|
|
11
11
|
errors: string[];
|
|
12
12
|
warnings: string[];
|
|
13
13
|
bundle: Buffer | null;
|
|
@@ -19,6 +19,6 @@ export declare function checkPlugin(dir: string, options?: { builds?: number }):
|
|
|
19
19
|
export declare function readManifest(dir: string): {
|
|
20
20
|
name: string;
|
|
21
21
|
raw: Record<string, unknown> | null;
|
|
22
|
-
manifest: Record<string,
|
|
22
|
+
manifest: Record<string, unknown> | null;
|
|
23
23
|
errors: string[];
|
|
24
24
|
};
|
|
@@ -6,9 +6,13 @@ export function explainRange(range: string, version: string): string;
|
|
|
6
6
|
export function validateManifestText(text: string): {
|
|
7
7
|
ok: boolean;
|
|
8
8
|
errors: string[];
|
|
9
|
+
// Shim for checkJs only; real contracts types are richer.
|
|
10
|
+
// biome-ignore lint/suspicious/noExplicitAny: checkJs shim for sibling contracts surface
|
|
9
11
|
manifest?: any;
|
|
10
12
|
};
|
|
13
|
+
// biome-ignore lint/suspicious/noExplicitAny: checkJs shim for sibling contracts surface
|
|
11
14
|
export function getShape(slot: string): any;
|
|
15
|
+
// biome-ignore lint/suspicious/noExplicitAny: checkJs shim for sibling contracts surface
|
|
12
16
|
export function exampleOf(slot: string, handler: string): any;
|
|
13
17
|
export const brand: {
|
|
14
18
|
displayName: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export function scan(
|
|
2
2
|
text: string,
|
|
3
|
-
options?: { capabilities?: string[]; allowRelative?: boolean },
|
|
3
|
+
options?: { capabilities?: string[]; allowRelative?: boolean; profile?: 'database-driver' | 'storage' },
|
|
4
4
|
): {
|
|
5
5
|
errors: { line: number; column: number; rule: string; message: string }[];
|
|
6
6
|
used_capabilities: string[];
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
// biome-ignore lint/suspicious/noExplicitAny: checkJs shim for sibling contracts surface
|
|
1
2
|
export function getShape(slot: string): any;
|
|
3
|
+
// biome-ignore lint/suspicious/noExplicitAny: checkJs shim for sibling contracts surface
|
|
2
4
|
export function exampleOf(slot: string, handler: string): any;
|