@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.
Files changed (93) hide show
  1. package/README.md +84 -4
  2. package/THIRD_PARTY_NOTICES.md +9 -0
  3. package/dist/authentication-lifetime.d.ts +16 -0
  4. package/dist/authentication-lifetime.d.ts.map +1 -0
  5. package/dist/authentication-lifetime.js +1 -0
  6. package/dist/binding-projection.d.ts +47 -0
  7. package/dist/binding-projection.d.ts.map +1 -0
  8. package/dist/binding-projection.js +1 -0
  9. package/dist/canonical.js +1 -100
  10. package/dist/clone.js +1 -4
  11. package/dist/commands.d.ts +1 -1
  12. package/dist/commands.d.ts.map +1 -1
  13. package/dist/commands.js +1 -799
  14. package/dist/contextual-session.d.ts +112 -0
  15. package/dist/contextual-session.d.ts.map +1 -0
  16. package/dist/contextual-session.js +1 -0
  17. package/dist/contributions.d.ts +63 -2
  18. package/dist/contributions.d.ts.map +1 -1
  19. package/dist/contributions.js +1 -302
  20. package/dist/deployment-validation.d.ts +10 -0
  21. package/dist/deployment-validation.d.ts.map +1 -0
  22. package/dist/deployment-validation.js +1 -0
  23. package/dist/entry-commands.js +1 -36
  24. package/dist/extension-sdk.d.ts +12 -6
  25. package/dist/extension-sdk.d.ts.map +1 -1
  26. package/dist/extension-sdk.js +1 -188
  27. package/dist/history.d.ts +12 -2
  28. package/dist/history.d.ts.map +1 -1
  29. package/dist/history.js +1 -63
  30. package/dist/host-session.d.ts +93 -0
  31. package/dist/host-session.d.ts.map +1 -0
  32. package/dist/host-session.js +1 -0
  33. package/dist/http-authoring-contract.d.ts +29 -0
  34. package/dist/http-authoring-contract.d.ts.map +1 -0
  35. package/dist/http-authoring-contract.js +1 -0
  36. package/dist/http-host-adapter.d.ts +173 -0
  37. package/dist/http-host-adapter.d.ts.map +1 -0
  38. package/dist/http-host-adapter.js +1 -0
  39. package/dist/index.d.ts +13 -1
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +1 -18
  42. package/dist/layout.d.ts +66 -0
  43. package/dist/layout.d.ts.map +1 -0
  44. package/dist/layout.js +1 -0
  45. package/dist/migrations.js +1 -83
  46. package/dist/model-commands.js +1 -21
  47. package/dist/modes.js +1 -280
  48. package/dist/negotiation.js +1 -65
  49. package/dist/production-values.d.ts +12 -0
  50. package/dist/production-values.d.ts.map +1 -0
  51. package/dist/production-values.js +1 -0
  52. package/dist/production.d.ts +86 -0
  53. package/dist/production.d.ts.map +1 -0
  54. package/dist/production.js +1 -0
  55. package/dist/profile-validator.d.ts.map +1 -1
  56. package/dist/profile-validator.js +1 -887
  57. package/dist/recipes.js +1 -34
  58. package/dist/registry.js +1 -56
  59. package/dist/schema-profile.js +1 -1015
  60. package/dist/semver.js +1 -128
  61. package/dist/session-policy.d.ts +23 -0
  62. package/dist/session-policy.d.ts.map +1 -0
  63. package/dist/session-policy.js +1 -0
  64. package/dist/session.d.ts +14 -2
  65. package/dist/session.d.ts.map +1 -1
  66. package/dist/session.js +1 -178
  67. package/dist/strict-json.d.ts +7 -0
  68. package/dist/strict-json.d.ts.map +1 -0
  69. package/dist/strict-json.js +2 -0
  70. package/dist/url-policy.js +1 -248
  71. package/dist/validation.d.ts.map +1 -1
  72. package/dist/validation.js +1 -398
  73. package/package.json +5 -3
  74. package/dist/canonical.js.map +0 -1
  75. package/dist/clone.js.map +0 -1
  76. package/dist/commands.js.map +0 -1
  77. package/dist/contributions.js.map +0 -1
  78. package/dist/entry-commands.js.map +0 -1
  79. package/dist/extension-sdk.js.map +0 -1
  80. package/dist/history.js.map +0 -1
  81. package/dist/index.js.map +0 -1
  82. package/dist/migrations.js.map +0 -1
  83. package/dist/model-commands.js.map +0 -1
  84. package/dist/modes.js.map +0 -1
  85. package/dist/negotiation.js.map +0 -1
  86. package/dist/profile-validator.js.map +0 -1
  87. package/dist/recipes.js.map +0 -1
  88. package/dist/registry.js.map +0 -1
  89. package/dist/schema-profile.js.map +0 -1
  90. package/dist/semver.js.map +0 -1
  91. package/dist/session.js.map +0 -1
  92. package/dist/url-policy.js.map +0 -1
  93. package/dist/validation.js.map +0 -1
package/dist/recipes.js CHANGED
@@ -1,34 +1 @@
1
- import { cloneContractValue } from './clone.js';
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 { cloneContractValue } from './clone.js';
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)}