@storystick/types 0.1.0-rc.2 → 0.1.0-rc.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/PUBLIC-API.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @storystick/types API contract
2
2
 
3
- Install this candidate explicitly with `@storystick/types@0.1.0-rc.2` after registry bootstrap and publication. This repository alone does not make the candidate or beta channel available on npm.
3
+ Install this candidate explicitly with `@storystick/types@0.1.0-rc.3` after registry bootstrap and publication. This repository alone does not make the candidate or beta channel available on npm.
4
4
 
5
- Version 0.1.0-rc.2, cohort `sdk-0.2.0-rc.2`. ESM distribution; no CommonJS or universal Edge compatibility is promised.
5
+ Version 0.1.0-rc.3, cohort `sdk-0.2.0-rc.3`. ESM distribution; no CommonJS or universal Edge compatibility is promised.
6
6
 
7
7
  This package supports the integration facades; installing it directly is an advanced use. Reserved contracts are required between SDK packages and must be upgraded with the same cohort. Their public export paths do not promise independent stability.
8
8
 
@@ -47,7 +47,7 @@ This package supports the integration facades; installing it directly is an adva
47
47
  | `./internal/richtext-embeds` | Reserved SDK contract |
48
48
  | `./public-endpoints` | Supported beta entry |
49
49
 
50
- The qualified toolchain is Node 24.19.0 and pnpm 9.15.9. Next uses App Router 15.5.28, Sharp 0.35.5 and React/React DOM 19.2.8; Astro uses 7.4.4 with the Node adapter 11.1.9. Browser delivery is verified by bundling; hosted Preview activation and cross-browser behavior require the staging manual check. Source/CLI are Node tools, server entries belong on the server, and browser entries must never receive a server API key.
50
+ Supported consumer Node versions: `^22.13.0 || ^24.19.0`. The release build toolchain remains Node 24.19.0 and pnpm 9.15.9. Next uses App Router 15.5.28, Sharp 0.35.5 and React/React DOM 19.2.8; Astro uses 7.4.4 with the Node adapter 11.1.9. Browser delivery is verified by bundling; hosted Preview activation and cross-browser behavior require the staging manual check. Source/CLI are Node tools, server entries belong on the server, and browser entries must never receive a server API key.
51
51
 
52
52
  This is a support/tooling contract. It does not independently grant project access or permission to perform effects.
53
53
 
package/README.md CHANGED
@@ -17,5 +17,7 @@ Licensed under [FSL-1.1-MIT](./LICENSE).
17
17
  ## Candidate distribution contract
18
18
 
19
19
  See [PUBLIC-API.md](./PUBLIC-API.md) for supported entries, reserved SDK contracts,
20
- the qualified runtime matrix and the candidate cohort. Upgrade Storystick
21
- packages together.
20
+ the qualified runtime matrix and the candidate cohort. Keep shared contracts
21
+ compatible. Use the [release guide](../../release/README.md) to select the
22
+ packages and consumers that need an update; an independent adapter fix does
23
+ not require republishing every package.
@@ -1,3 +1,16 @@
1
- /** Public routing contracts; deployment-specific URLs remain explicit overrides. */
1
+ /** Production defaults. Alternate services are explicit complete configurations. */
2
2
  export declare const STORYSTICK_GATEWAY_ORIGIN = "https://api.storystick.app";
3
3
  export declare const STORYSTICK_STUDIO_ORIGIN = "https://storystick.app";
4
+ export interface ServiceConnection {
5
+ readonly studioOrigin: string;
6
+ readonly apiOrigin: string;
7
+ readonly syncOrigin: string;
8
+ }
9
+ export declare const DEFAULT_SERVICE_CONNECTION: ServiceConnection;
10
+ /** Origins only; credential-bearing URLs, paths and implicit protocol upgrades are forbidden. */
11
+ export declare function serviceOrigin(value: unknown): string;
12
+ /** Strict projection keeps internal profile fields and secrets out of the browser. */
13
+ export declare function parseServiceConnection(value: unknown): ServiceConnection;
14
+ /** Caller supplies the process environment; this pure helper never reads files. */
15
+ export declare function serviceConnectionFromEnv(env: Record<string, string | undefined>): ServiceConnection | undefined;
16
+ export declare function assertServiceOrigin(actual: string | undefined, expected: string): void;
@@ -1,3 +1,58 @@
1
- /** Public routing contracts; deployment-specific URLs remain explicit overrides. */
1
+ /** Production defaults. Alternate services are explicit complete configurations. */
2
2
  export const STORYSTICK_GATEWAY_ORIGIN = 'https://api.storystick.app';
3
3
  export const STORYSTICK_STUDIO_ORIGIN = 'https://storystick.app';
4
+ export const DEFAULT_SERVICE_CONNECTION = Object.freeze({
5
+ studioOrigin: STORYSTICK_STUDIO_ORIGIN,
6
+ apiOrigin: STORYSTICK_GATEWAY_ORIGIN,
7
+ syncOrigin: 'https://sync.storystick.app',
8
+ });
9
+ /** Origins only; credential-bearing URLs, paths and implicit protocol upgrades are forbidden. */
10
+ export function serviceOrigin(value) {
11
+ if (typeof value !== 'string' || !value || value !== value.trim())
12
+ throw new TypeError('Invalid service origin.');
13
+ let url;
14
+ try {
15
+ url = new URL(value);
16
+ }
17
+ catch {
18
+ throw new TypeError('Invalid service origin.');
19
+ }
20
+ const loopback = url.protocol === 'http:' && ['127.0.0.1', 'localhost', '[::1]'].includes(url.hostname);
21
+ if ((!loopback && url.protocol !== 'https:') || url.username || url.password || url.search || url.hash || url.pathname !== '/') {
22
+ throw new TypeError('Service origins require HTTPS (HTTP loopback is allowed), without credentials, path, query or fragment.');
23
+ }
24
+ return url.origin;
25
+ }
26
+ /** Strict projection keeps internal profile fields and secrets out of the browser. */
27
+ export function parseServiceConnection(value) {
28
+ if (typeof value === 'string') {
29
+ try {
30
+ value = JSON.parse(value);
31
+ }
32
+ catch {
33
+ throw new TypeError('Invalid service configuration JSON.');
34
+ }
35
+ }
36
+ if (!value || typeof value !== 'object' || Array.isArray(value))
37
+ throw new TypeError('Invalid service configuration.');
38
+ const input = value;
39
+ const fields = ['studioOrigin', 'apiOrigin', 'syncOrigin'];
40
+ if (Object.keys(input).length !== fields.length || Object.keys(input).some(key => !fields.includes(key))) {
41
+ throw new TypeError('A complete service configuration requires only Studio, API and sync origins.');
42
+ }
43
+ return Object.freeze({ studioOrigin: serviceOrigin(input.studioOrigin), apiOrigin: serviceOrigin(input.apiOrigin), syncOrigin: serviceOrigin(input.syncOrigin) });
44
+ }
45
+ /** Caller supplies the process environment; this pure helper never reads files. */
46
+ export function serviceConnectionFromEnv(env) {
47
+ if (env.STORYSTICK_ENVIRONMENT !== undefined || env.NEXT_PUBLIC_STORYSTICK_ENVIRONMENT !== undefined) {
48
+ throw new TypeError('Obsolete service selection. Reconnect the project and use the operator launcher for an alternate service.');
49
+ }
50
+ const raw = env.STORYSTICK_SERVICE_CONFIG;
51
+ if (raw !== undefined)
52
+ return parseServiceConnection(raw);
53
+ return undefined;
54
+ }
55
+ export function assertServiceOrigin(actual, expected) {
56
+ if (actual !== undefined && serviceOrigin(actual) !== expected)
57
+ throw new TypeError('Service configuration conflicts with an explicit origin.');
58
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storystick/types",
3
- "version": "0.1.0-rc.2",
3
+ "version": "0.1.0-rc.3",
4
4
  "license": "FSL-1.1-MIT",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -177,7 +177,7 @@
177
177
  "@types/node": "^22.13.10"
178
178
  },
179
179
  "engines": {
180
- "node": ">=24.19.0 <25"
180
+ "node": "^22.13.0 || ^24.19.0"
181
181
  },
182
182
  "repository": {
183
183
  "type": "git",