@kumwe/studio-core 0.1.0-alpha.8 → 0.1.0-beta.2
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 +84 -4
- package/THIRD_PARTY_NOTICES.md +9 -0
- package/dist/authentication-lifetime.d.ts +16 -0
- package/dist/authentication-lifetime.d.ts.map +1 -0
- package/dist/authentication-lifetime.js +1 -0
- package/dist/binding-projection.d.ts +47 -0
- package/dist/binding-projection.d.ts.map +1 -0
- package/dist/binding-projection.js +1 -0
- package/dist/canonical.js +1 -100
- package/dist/clone.js +1 -4
- package/dist/commands.d.ts +1 -1
- package/dist/commands.d.ts.map +1 -1
- package/dist/commands.js +1 -799
- package/dist/contextual-session.d.ts +112 -0
- package/dist/contextual-session.d.ts.map +1 -0
- package/dist/contextual-session.js +1 -0
- package/dist/contributions.d.ts +63 -2
- package/dist/contributions.d.ts.map +1 -1
- package/dist/contributions.js +1 -302
- package/dist/deployment-validation.d.ts +10 -0
- package/dist/deployment-validation.d.ts.map +1 -0
- package/dist/deployment-validation.js +1 -0
- package/dist/entry-commands.js +1 -36
- package/dist/extension-sdk.d.ts +12 -6
- package/dist/extension-sdk.d.ts.map +1 -1
- package/dist/extension-sdk.js +1 -188
- package/dist/history.d.ts +12 -2
- package/dist/history.d.ts.map +1 -1
- package/dist/history.js +1 -63
- package/dist/host-session.d.ts +93 -0
- package/dist/host-session.d.ts.map +1 -0
- package/dist/host-session.js +1 -0
- package/dist/http-authoring-contract.d.ts +29 -0
- package/dist/http-authoring-contract.d.ts.map +1 -0
- package/dist/http-authoring-contract.js +1 -0
- package/dist/http-host-adapter.d.ts +173 -0
- package/dist/http-host-adapter.d.ts.map +1 -0
- package/dist/http-host-adapter.js +1 -0
- package/dist/index.d.ts +13 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -18
- package/dist/layout.d.ts +66 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +1 -0
- package/dist/migrations.js +1 -83
- package/dist/model-commands.js +1 -21
- package/dist/modes.js +1 -280
- package/dist/negotiation.js +1 -65
- package/dist/production-values.d.ts +12 -0
- package/dist/production-values.d.ts.map +1 -0
- package/dist/production-values.js +1 -0
- package/dist/production.d.ts +86 -0
- package/dist/production.d.ts.map +1 -0
- package/dist/production.js +1 -0
- package/dist/profile-validator.d.ts.map +1 -1
- package/dist/profile-validator.js +1 -887
- package/dist/recipes.js +1 -34
- package/dist/registry.js +1 -56
- package/dist/schema-profile.js +1 -1015
- package/dist/semver.js +1 -128
- package/dist/session-policy.d.ts +23 -0
- package/dist/session-policy.d.ts.map +1 -0
- package/dist/session-policy.js +1 -0
- package/dist/session.d.ts +14 -2
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +1 -178
- package/dist/strict-json.d.ts +7 -0
- package/dist/strict-json.d.ts.map +1 -0
- package/dist/strict-json.js +2 -0
- package/dist/url-policy.js +1 -248
- package/dist/validation.d.ts.map +1 -1
- package/dist/validation.js +1 -398
- package/package.json +5 -3
- package/dist/canonical.js.map +0 -1
- package/dist/clone.js.map +0 -1
- package/dist/commands.js.map +0 -1
- package/dist/contributions.js.map +0 -1
- package/dist/entry-commands.js.map +0 -1
- package/dist/extension-sdk.js.map +0 -1
- package/dist/history.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/migrations.js.map +0 -1
- package/dist/model-commands.js.map +0 -1
- package/dist/modes.js.map +0 -1
- package/dist/negotiation.js.map +0 -1
- package/dist/profile-validator.js.map +0 -1
- package/dist/recipes.js.map +0 -1
- package/dist/registry.js.map +0 -1
- package/dist/schema-profile.js.map +0 -1
- package/dist/semver.js.map +0 -1
- package/dist/session.js.map +0 -1
- package/dist/url-policy.js.map +0 -1
- package/dist/validation.js.map +0 -1
package/dist/recipes.js
CHANGED
|
@@ -1,34 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
/**
|
|
3
|
-
* The reserved node property that records which theme recipe an author
|
|
4
|
-
* selected. Recipe selection is canonically an atomic batch of set-property
|
|
5
|
-
* operations, so it inherits batch atomicity and verified inverses from the
|
|
6
|
-
* command contract instead of introducing a new command type.
|
|
7
|
-
*/
|
|
8
|
-
export const RECIPE_MARKER_PROPERTY = 'studio.recipe';
|
|
9
|
-
/**
|
|
10
|
-
* Expand a theme recipe selection into the deterministic batch operations
|
|
11
|
-
* that apply it to one node: every design value of the recipe, in sorted
|
|
12
|
-
* member order, followed by the reserved recipe marker property.
|
|
13
|
-
*/
|
|
14
|
-
export function recipeSelectionOperations(node, theme, recipeId) {
|
|
15
|
-
const recipe = theme.recipes.find((candidate) => candidate.id === recipeId);
|
|
16
|
-
if (recipe === undefined) {
|
|
17
|
-
throw new Error(`Theme ${theme.id} does not declare a recipe ${recipeId}.`);
|
|
18
|
-
}
|
|
19
|
-
if (recipe.blockType !== node.type) {
|
|
20
|
-
throw new Error(`Recipe ${recipeId} targets ${recipe.blockType} blocks, not ${node.type} node ${node.id}.`);
|
|
21
|
-
}
|
|
22
|
-
const operations = Object.entries(recipe.designValues)
|
|
23
|
-
.sort(([left], [right]) => (left < right ? -1 : 1))
|
|
24
|
-
.map(([property, value]) => ({
|
|
25
|
-
payload: { nodeId: node.id, property, value: cloneContractValue(value) },
|
|
26
|
-
type: 'studio.command/set-property',
|
|
27
|
-
}));
|
|
28
|
-
operations.push({
|
|
29
|
-
payload: { nodeId: node.id, property: RECIPE_MARKER_PROPERTY, value: recipeId },
|
|
30
|
-
type: 'studio.command/set-property',
|
|
31
|
-
});
|
|
32
|
-
return operations;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=recipes.js.map
|
|
1
|
+
import{cloneContractValue as e}from"./clone.js";export const RECIPE_MARKER_PROPERTY=`studio.recipe`;export function recipeSelectionOperations(t,n,r){let i=n.recipes.find(e=>e.id===r);if(i===void 0)throw Error(`Theme ${n.id} does not declare a recipe ${r}.`);if(i.blockType!==t.type)throw Error(`Recipe ${r} targets ${i.blockType} blocks, not ${t.type} node ${t.id}.`);let a=Object.entries(i.designValues).sort(([e],[t])=>e<t?-1:1).map(([n,r])=>({payload:{nodeId:t.id,property:n,value:e(r)},type:`studio.command/set-property`}));return a.push({payload:{nodeId:t.id,property:`studio.recipe`,value:r},type:`studio.command/set-property`}),a}
|
package/dist/registry.js
CHANGED
|
@@ -1,56 +1 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { assertStudioPropertySchema } from './schema-profile.js';
|
|
3
|
-
export class BlockRegistry {
|
|
4
|
-
#definitions = new Map();
|
|
5
|
-
constructor(definitions = []) {
|
|
6
|
-
for (const definition of definitions) {
|
|
7
|
-
this.register(definition);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
register(definition, options = {}) {
|
|
11
|
-
assertStudioPropertySchema(definition.propertySchema);
|
|
12
|
-
if (options.verifiedIntegrity !== undefined && !isIntegrity(options.verifiedIntegrity)) {
|
|
13
|
-
throw new TypeError('Host-verified block integrity must be a canonical SRI sha256/384/512 value.');
|
|
14
|
-
}
|
|
15
|
-
let versions = this.#definitions.get(definition.type);
|
|
16
|
-
if (versions === undefined) {
|
|
17
|
-
versions = new Map();
|
|
18
|
-
this.#definitions.set(definition.type, versions);
|
|
19
|
-
}
|
|
20
|
-
if (versions.has(definition.version)) {
|
|
21
|
-
throw new Error(`Block ${definition.type}@${definition.version} is already registered.`);
|
|
22
|
-
}
|
|
23
|
-
const registration = {
|
|
24
|
-
definition: cloneContractValue(definition),
|
|
25
|
-
};
|
|
26
|
-
if (options.verifiedIntegrity !== undefined) {
|
|
27
|
-
registration.verifiedIntegrity = options.verifiedIntegrity;
|
|
28
|
-
}
|
|
29
|
-
versions.set(definition.version, registration);
|
|
30
|
-
}
|
|
31
|
-
resolve(type, version) {
|
|
32
|
-
return this.resolveRegistration(type, version)?.definition;
|
|
33
|
-
}
|
|
34
|
-
resolveRegistration(type, version) {
|
|
35
|
-
const registration = this.#definitions.get(type)?.get(version);
|
|
36
|
-
if (registration === undefined) {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
const resolved = {
|
|
40
|
-
definition: cloneContractValue(registration.definition),
|
|
41
|
-
};
|
|
42
|
-
if (registration.verifiedIntegrity !== undefined) {
|
|
43
|
-
resolved.verifiedIntegrity = registration.verifiedIntegrity;
|
|
44
|
-
}
|
|
45
|
-
return resolved;
|
|
46
|
-
}
|
|
47
|
-
definitions() {
|
|
48
|
-
return [...this.#definitions.values()]
|
|
49
|
-
.flatMap((versions) => [...versions.values()])
|
|
50
|
-
.map((registration) => cloneContractValue(registration.definition));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
function isIntegrity(value) {
|
|
54
|
-
return /^(?:sha256-[A-Za-z0-9+/]{42}[AEIMQUYcgkosw048]=|sha384-[A-Za-z0-9+/]{64}|sha512-[A-Za-z0-9+/]{85}[AQgw]==)(?![\s\S])/u.test(value);
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=registry.js.map
|
|
1
|
+
import{cloneContractValue as e}from"./clone.js";import{assertStudioPropertySchema as t}from"./schema-profile.js";export class BlockRegistry{#definitions=new Map;constructor(e=[]){for(let t of e)this.register(t)}register(n,i={}){if(t(n.propertySchema),i.verifiedIntegrity!==void 0&&!r(i.verifiedIntegrity))throw TypeError(`Host-verified block integrity must be a canonical SRI sha256/384/512 value.`);let a=this.#definitions.get(n.type);if(a===void 0&&(a=new Map,this.#definitions.set(n.type,a)),a.has(n.version))throw Error(`Block ${n.type}@${n.version} is already registered.`);let o={definition:e(n)};i.verifiedIntegrity!==void 0&&(o.verifiedIntegrity=i.verifiedIntegrity),a.set(n.version,o)}resolve(e,t){return this.resolveRegistration(e,t)?.definition}resolveRegistration(t,n){let r=this.#definitions.get(t)?.get(n);if(r===void 0)return;let i={definition:e(r.definition)};return r.verifiedIntegrity!==void 0&&(i.verifiedIntegrity=r.verifiedIntegrity),i}definitions(){return[...this.#definitions.values()].flatMap(e=>[...e.values()]).map(t=>e(t.definition))}}function r(e){return/^(?:sha256-[A-Za-z0-9+/]{42}[AEIMQUYcgkosw048]=|sha384-[A-Za-z0-9+/]{64}|sha512-[A-Za-z0-9+/]{85}[AQgw]==)(?![\s\S])/u.test(e)}
|