@s2script/sdk 0.27.0 → 0.28.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 +51 -0
- package/config.d.ts +2 -2
- package/contracts/workshop.d.ts +1 -1
- package/db.d.ts +18 -4
- package/dist/cli.js +415 -133
- package/events.d.ts +1 -1
- package/http.d.ts +3 -1
- package/interfaces.d.ts +4 -2
- package/menu.d.ts +6 -3
- package/package.json +1 -1
- package/plugin.d.ts +12 -7
- package/topmenu.d.ts +1 -1
- package/unsafe.d.ts +1 -1
- package/usercmd.d.ts +4 -4
- package/ws.d.ts +4 -1
package/README.md
CHANGED
|
@@ -115,6 +115,57 @@ what lets a workspace hold a large first-party or in-house plugin suite that mus
|
|
|
115
115
|
public registry — build it, drop the `.s2sp`s into your own server, never `s2s deploy` it. (`s2s
|
|
116
116
|
deploy <dir>` on a single private plugin outside a workspace refuses the same way.)
|
|
117
117
|
|
|
118
|
+
### Bundles
|
|
119
|
+
|
|
120
|
+
A workspace whose plugins only make sense together (a game mode split into several plugins) can
|
|
121
|
+
publish as one **bundle**: the registry lists it as a single entry, installs it with one command,
|
|
122
|
+
and records which member versions each release pinned. Make the workspace root the bundle:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"name": "@edge/jailbreak",
|
|
127
|
+
"version": "1.0.0",
|
|
128
|
+
"workspaces": ["plugins/*"],
|
|
129
|
+
"s2script": {
|
|
130
|
+
"kind": "bundle",
|
|
131
|
+
"workspace": { "plugins": ["plugins/*"] },
|
|
132
|
+
"bundle": { "optional": ["@edge/jailbreak-gangperks"] }
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
- **Members** are the workspace's non-private plugins, and must share the bundle's scope. A bundle
|
|
138
|
+
has no code of its own, so the root has no `main` and must not be `private`.
|
|
139
|
+
- **`s2s deploy`** at the root publishes the members first, each claiming the bundle, then the
|
|
140
|
+
bundle itself, pinning every member to the version just built. The plan shows it as the last row.
|
|
141
|
+
A bundle version already published with different member versions is refused before anything
|
|
142
|
+
uploads — bump it.
|
|
143
|
+
- **`s2s version`** bumps the bundle whenever a member is released, by the largest member bump.
|
|
144
|
+
- **`s2s install @edge/jailbreak`** installs the required members (and whatever they depend on);
|
|
145
|
+
`--with @edge/jailbreak-gangperks` adds an optional one. `s2s add` refuses a bundle: depend on a
|
|
146
|
+
member's interface instead.
|
|
147
|
+
- A plugin already published **before** it joined a bundle must be republished at a new version
|
|
148
|
+
from the bundle's workspace, so that its registry entry carries the claim.
|
|
149
|
+
|
|
150
|
+
The membership claim travels in the registry upload only — the `.s2sp` manifest the runtime loads
|
|
151
|
+
is unchanged, and the runtime has no notion of bundles.
|
|
152
|
+
|
|
153
|
+
## Publishing
|
|
154
|
+
|
|
155
|
+
`s2s deploy` builds the package and publishes it to the registry. Its page on s2script.com
|
|
156
|
+
is filled in from what you already keep beside your code:
|
|
157
|
+
|
|
158
|
+
- **README:** `README.md` next to `package.json` (found the way npm finds one, up to 100,000
|
|
159
|
+
characters). Each deploy that carries one replaces the page's README.
|
|
160
|
+
- **Source link:** package.json's standard `repository` field, in any npm form.
|
|
161
|
+
`{ "url": …, "directory": … }` links straight into a monorepo directory.
|
|
162
|
+
- **Config:** the `s2script.config` block, shown as a table of options with their defaults.
|
|
163
|
+
Options marked `"sensitive": true` keep their default off the page.
|
|
164
|
+
|
|
165
|
+
The README and `repository` travel with the deploy, not inside the `.s2sp`: the runtime never sees
|
|
166
|
+
them. A deploy without them leaves what the page already shows, so a README or link set on the
|
|
167
|
+
site stays until a deploy replaces it.
|
|
168
|
+
|
|
118
169
|
## Docs
|
|
119
170
|
|
|
120
171
|
**[s2script.com/docs](https://s2script.com/docs)** — getting started, guides, and the full API
|
package/config.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** @s2script/config — typed access to the plugin's materialized config. NO runtime code. */
|
|
2
2
|
/** A materialized config value: a scalar, or a nested section object of further values. */
|
|
3
3
|
export type ConfigValue = string | number | boolean | { [k: string]: ConfigValue };
|
|
4
|
-
/** The whole materialized config: top-level keys to {@link ConfigValue}s. Passed to `
|
|
4
|
+
/** The whole materialized config: top-level keys to {@link ConfigValue}s. Passed to `config.onChange` handlers. */
|
|
5
5
|
export type Config = Record<string, ConfigValue>;
|
|
6
6
|
/**
|
|
7
7
|
* Typed access to this plugin's materialized config values (declared under `s2script.config` in the manifest).
|
|
@@ -25,7 +25,7 @@ export declare const config: {
|
|
|
25
25
|
writeFile(name: string, content: string): void;
|
|
26
26
|
/**
|
|
27
27
|
* Fires when this plugin's config file is re-materialized on disk. Ledgered per plugin.
|
|
28
|
-
* Not load-window-gated (safe from `OnPluginStart` or from `
|
|
28
|
+
* Not load-window-gated (safe from `OnPluginStart` or from a `config.onChange` handler).
|
|
29
29
|
*/
|
|
30
30
|
onChange(handler: (cfg: Config) => void): void;
|
|
31
31
|
};
|
package/contracts/workshop.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* @example
|
|
12
12
|
* import type { WorkshopService } from "@s2script/sdk/contracts/workshop";
|
|
13
|
-
* const ws =
|
|
13
|
+
* const ws = tryUse<WorkshopService>("workshop"); // in OnPluginStart
|
|
14
14
|
* if (ws) {
|
|
15
15
|
* const map = await ws.currentMap();
|
|
16
16
|
* console.log(map ? `${map.title} (${map.id})` : "not a workshop map");
|
package/db.d.ts
CHANGED
|
@@ -15,9 +15,16 @@ export interface ExecuteResult {
|
|
|
15
15
|
|
|
16
16
|
/** A driver-owned connection — what a {@link Driver} hands back from {@link Driver.connect}. */
|
|
17
17
|
export interface DriverConnection {
|
|
18
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Run a SELECT and resolve every result {@link Row}; `params` bind `?` placeholders. Rejects
|
|
20
|
+
* with `AsyncQueueFull` or `AsyncPayloadTooLarge` before acceptance; `DatabaseResultTooLarge`
|
|
21
|
+
* when rows or retained bytes exceed the configured limit.
|
|
22
|
+
*/
|
|
19
23
|
query(sql: string, params?: SqlValue[]): Promise<Row[]>;
|
|
20
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Run a non-SELECT statement and resolve its {@link ExecuteResult}; `params` bind `?`
|
|
26
|
+
* placeholders. Rejects with `AsyncQueueFull` or `AsyncPayloadTooLarge` before acceptance.
|
|
27
|
+
*/
|
|
21
28
|
execute(sql: string, params?: SqlValue[]): Promise<ExecuteResult>;
|
|
22
29
|
/** Close the underlying connection. */
|
|
23
30
|
close(): Promise<void>;
|
|
@@ -40,9 +47,16 @@ export interface Driver {
|
|
|
40
47
|
}
|
|
41
48
|
/** A live database connection (delegates to its driver). */
|
|
42
49
|
export interface Database {
|
|
43
|
-
/**
|
|
50
|
+
/**
|
|
51
|
+
* Run a SELECT and resolve every result {@link Row}; `params` bind `?` placeholders. Rejects
|
|
52
|
+
* with `AsyncQueueFull` or `AsyncPayloadTooLarge` before acceptance; `DatabaseResultTooLarge`
|
|
53
|
+
* when rows or retained bytes exceed the configured limit.
|
|
54
|
+
*/
|
|
44
55
|
query(sql: string, params?: SqlValue[]): Promise<Row[]>;
|
|
45
|
-
/**
|
|
56
|
+
/**
|
|
57
|
+
* Run a non-SELECT statement and resolve its {@link ExecuteResult}; `params` bind `?`
|
|
58
|
+
* placeholders. Rejects with `AsyncQueueFull` or `AsyncPayloadTooLarge` before acceptance.
|
|
59
|
+
*/
|
|
46
60
|
execute(sql: string, params?: SqlValue[]): Promise<ExecuteResult>;
|
|
47
61
|
/** Close the connection. */
|
|
48
62
|
close(): Promise<void>;
|