@astrale-os/sdk 0.6.0-beta.43 → 0.6.0-beta.45

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 (119) hide show
  1. package/README.md +6 -6
  2. package/dist/application/action/authoring.d.ts +1 -1
  3. package/dist/application/action/context.d.ts +9 -8
  4. package/dist/application/error/error.d.ts +7 -7
  5. package/dist/application/error/error.js +12 -12
  6. package/dist/application/error/index.d.ts +1 -1
  7. package/dist/application/error/index.js +1 -1
  8. package/dist/application/mutation/authoring/builder.d.ts +12 -12
  9. package/dist/application/mutation/authoring/builder.js +3 -3
  10. package/dist/application/mutation/authoring/guard.d.ts +2 -2
  11. package/dist/application/mutation/authoring/index.d.ts +1 -1
  12. package/dist/application/mutation/define.d.ts +8 -8
  13. package/dist/application/mutation/define.js +12 -12
  14. package/dist/application/mutation/execution/execute.d.ts +2 -2
  15. package/dist/application/mutation/execution/execute.js +10 -10
  16. package/dist/application/mutation/execution/executor.d.ts +2 -2
  17. package/dist/application/mutation/execution/executor.js +2 -2
  18. package/dist/application/mutation/index.d.ts +2 -2
  19. package/dist/application/mutation/legacy/v6/define.d.ts +1 -1
  20. package/dist/application/mutation/legacy/v6/mutation.d.ts +1 -1
  21. package/dist/application/mutation/mutation.d.ts +12 -12
  22. package/dist/application/query/composite/builder.js +1 -1
  23. package/dist/application/query/define.d.ts +1 -1
  24. package/dist/application/query/define.js +3 -3
  25. package/dist/application/query/defined/define.d.ts +45 -0
  26. package/dist/application/query/defined/define.js +96 -0
  27. package/dist/application/query/{recipe/recipe.d.ts → defined/query.d.ts} +21 -20
  28. package/dist/application/query/definition.d.ts +5 -5
  29. package/dist/application/query/definition.js +4 -4
  30. package/dist/application/query/execution/bounds.d.ts +5 -5
  31. package/dist/application/query/execution/bounds.js +2 -2
  32. package/dist/application/query/execution/client.d.ts +21 -0
  33. package/dist/application/query/execution/client.js +1 -0
  34. package/dist/application/query/execution/crossings.d.ts +3 -3
  35. package/dist/application/query/execution/crossings.js +23 -23
  36. package/dist/application/query/execution/error.d.ts +8 -8
  37. package/dist/application/query/execution/error.js +5 -5
  38. package/dist/application/query/execution/execute.d.ts +4 -4
  39. package/dist/application/query/execution/executor.d.ts +2 -2
  40. package/dist/application/query/execution/rows.d.ts +5 -5
  41. package/dist/application/query/execution/rows.js +42 -30
  42. package/dist/application/query/execution/{recipe.d.ts → run.d.ts} +21 -31
  43. package/dist/application/query/execution/{recipe.js → run.js} +49 -49
  44. package/dist/application/query/execution/split.d.ts +3 -3
  45. package/dist/application/query/execution/split.js +1 -1
  46. package/dist/application/query/handles/build.d.ts +1 -1
  47. package/dist/application/query/handles/domain.d.ts +1 -1
  48. package/dist/application/query/handles/handles.d.ts +14 -12
  49. package/dist/application/query/handles/plan.d.ts +10 -9
  50. package/dist/application/query/handles/plan.js +1 -1
  51. package/dist/application/query/handles/reads.js +4 -4
  52. package/dist/application/query/handles/rows.d.ts +1 -1
  53. package/dist/application/query/index.d.ts +9 -6
  54. package/dist/application/query/index.js +3 -3
  55. package/dist/application/query/language/index.d.ts +1 -1
  56. package/dist/application/query/language/query.d.ts +5 -5
  57. package/dist/application/query/legacy/v6/collection/union.d.ts +1 -1
  58. package/dist/application/query/legacy/v6/collection/union.js +3 -3
  59. package/dist/application/query/legacy/v6/define.d.ts +1 -1
  60. package/dist/application/query/legacy/v6/define.js +3 -3
  61. package/dist/application/query/legacy/v6/execution/execute.d.ts +6 -4
  62. package/dist/application/query/legacy/v6/index.d.ts +2 -1
  63. package/dist/application/query/legacy/v6/index.js +1 -1
  64. package/dist/application/query/query.d.ts +3 -3
  65. package/dist/application/routes/admission.d.ts +1 -1
  66. package/dist/application/routes/admission.js +2 -2
  67. package/dist/application/routes/index.d.ts +3 -2
  68. package/dist/application/routes/route.d.ts +1 -1
  69. package/dist/application/runtime/declarations.d.ts +6 -6
  70. package/dist/application/runtime/define.d.ts +5 -5
  71. package/dist/application/workflow/durable.d.ts +9 -9
  72. package/dist/execution/invocation/capabilities/bind.d.ts +1 -1
  73. package/dist/execution/invocation/capabilities/bind.js +8 -8
  74. package/dist/execution/invocation/dispatch/action.js +2 -2
  75. package/dist/execution/invocation/dispatch/workflow.js +2 -2
  76. package/dist/execution/invocation/result/index.d.ts +1 -1
  77. package/dist/execution/invocation/result/index.js +1 -1
  78. package/dist/execution/invocation/result/undeclared.d.ts +7 -0
  79. package/dist/execution/invocation/result/undeclared.js +18 -0
  80. package/dist/execution/workflows/failure.d.ts +7 -7
  81. package/dist/execution/workflows/failure.js +19 -18
  82. package/dist/execution/workflows/receiver.d.ts +1 -1
  83. package/dist/execution/workflows/run.js +2 -2
  84. package/dist/execution/workflows/steps.d.ts +1 -1
  85. package/dist/platform/schema/class-authoring.d.ts +2 -8
  86. package/dist/platform/schema/index.d.ts +1 -1
  87. package/dist/platform/schema/kernel-compiled.d.ts +1 -1
  88. package/dist/platform/schema/kernel-compiled.js +1 -1
  89. package/dist/platform/schema/kernel.d.ts +4 -2
  90. package/dist/testing/index.d.ts +2 -2
  91. package/dist/testing/index.js +1 -1
  92. package/dist/testing/{recipe.d.ts → query.d.ts} +5 -5
  93. package/dist/testing/{recipe.js → query.js} +9 -9
  94. package/dist/tooling/cli/orchestrate.js +7 -6
  95. package/dist/tooling/linter/adapters/typescript/{recipe-definitions.d.ts → definition-calls.d.ts} +10 -10
  96. package/dist/tooling/linter/adapters/typescript/{recipe-definitions.js → definition-calls.js} +10 -10
  97. package/dist/tooling/linter/adapters/typescript/index.d.ts +1 -1
  98. package/dist/tooling/linter/adapters/typescript/index.js +1 -1
  99. package/dist/tooling/linter/adapters/typescript/query-observation.js +6 -6
  100. package/dist/tooling/linter/implementations/source/definitions.d.ts +2 -0
  101. package/dist/tooling/linter/implementations/source/{recipes.js → definitions.js} +27 -27
  102. package/dist/tooling/linter/implementations/source/global.js +8 -6
  103. package/dist/tooling/linter/implementations/source/mutations.js +5 -5
  104. package/dist/tooling/linter/implementations/source/shared.d.ts +2 -2
  105. package/dist/tooling/linter/implementations/source/shared.js +7 -7
  106. package/dist/tooling/linter/implementations/source/verifiers.js +2 -2
  107. package/dist/tooling/linter/policy/generated.js +3 -3
  108. package/dist/tooling/linter/requirements/registry.js +4 -4
  109. package/docs/durable-workflows.md +8 -8
  110. package/docs/handler-dependencies.md +1 -1
  111. package/docs/legacy/query-v6.md +6 -6
  112. package/docs/queries.md +38 -38
  113. package/package.json +6 -6
  114. package/dist/application/query/recipe/define.d.ts +0 -44
  115. package/dist/application/query/recipe/define.js +0 -95
  116. package/dist/execution/invocation/result/recipe.d.ts +0 -6
  117. package/dist/execution/invocation/result/recipe.js +0 -17
  118. package/dist/tooling/linter/implementations/source/recipes.d.ts +0 -2
  119. /package/dist/application/query/{recipe/recipe.js → defined/query.js} +0 -0
@@ -1,95 +0,0 @@
1
- import { rememberRecipeErrors } from '../../error/error.js';
2
- import { describe } from '../handles/terms.js';
3
- import { defineQuery as defineV6Query } from '../legacy/v6/define.js';
4
- /** A recipe id: lowercase segments of letters, digits and hyphens, joined by dots. */
5
- export const RECIPE_ID = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/u;
6
- export const MAXIMUM_RECIPE_ID = 128;
7
- const FIELDS = new Set(['build', 'output', 'errors']);
8
- const specs = new WeakMap();
9
- /** The collections open while a build loads a Domain; no recipe is kept outside one. */
10
- const collections = new Set();
11
- /** The build and the output of a v7 recipe; `undefined` for anything else. */
12
- export function recipeSpecOf(recipe) {
13
- return typeof recipe === 'object' && recipe !== null ? specs.get(recipe) : undefined;
14
- }
15
- function defineRecipe(id, spec) {
16
- if (typeof id !== 'string' || id.length > MAXIMUM_RECIPE_ID || !RECIPE_ID.test(id))
17
- throw new TypeError(`A recipe id is lowercase segments of letters, digits and hyphens joined by dots, at most ${MAXIMUM_RECIPE_ID} characters ('services.service.owner'); got ${describe(id)}.`);
18
- if (typeof spec !== 'object' || spec === null || Array.isArray(spec))
19
- throw new TypeError(`Recipe ${id} takes { build, output?, errors? }; got ${describe(spec)}.`);
20
- const fields = spec;
21
- const unknown = Reflect.ownKeys(fields).filter((key) => typeof key !== 'string' || !FIELDS.has(key));
22
- if (unknown.length > 0)
23
- throw new TypeError(`Recipe ${id} takes build, output and errors only; got ${unknown.map(String).join(', ')}: do that work in build or output.`);
24
- const { build, output } = fields;
25
- if (typeof build !== 'function')
26
- throw new TypeError(`Recipe ${id}'s build is a function of (input, d, steps) that returns a read, a record of facets, or steps(first, (earlier) => next, …); got ${describe(build)}.`);
27
- if (output !== undefined && typeof output !== 'function')
28
- throw new TypeError(`Recipe ${id}'s output is a function of (results, input, context); got ${describe(output)}.`);
29
- const errors = fields.errors ?? {};
30
- if (typeof errors !== 'object' || errors === null || Array.isArray(errors))
31
- throw new TypeError(`Recipe ${id}'s errors is a record of declared errors by UPPER_SNAKE code; got ${describe(errors)}.`);
32
- const recipe = Object.freeze({ id, errors: Object.freeze({ ...errors }) });
33
- collectRecipe(recipe);
34
- specs.set(recipe, Object.freeze({
35
- build: build,
36
- ...(output !== undefined ? { output: output } : {}),
37
- }));
38
- return recipe;
39
- }
40
- /**
41
- * Keep the errors a recipe declares, a Query's or a Mutation's, and collect it into the
42
- * collections open: a Mutation recipe shares its Domain's recipe ids and error definitions.
43
- */
44
- export function collectRecipe(recipe) {
45
- rememberRecipeErrors(recipe, recipe.id, recipe.errors);
46
- for (const collection of collections)
47
- collection.push(recipe);
48
- }
49
- /**
50
- * Collect into `recipes` each recipe defined while `load` runs: a build collects the recipes that
51
- * loading its Domain defines, and checks them with `admitRecipes`. A module an earlier load of
52
- * the same process evaluated defines nothing again, so its recipes were checked with that load.
53
- */
54
- export async function collectRecipes(recipes, load) {
55
- collections.add(recipes);
56
- try {
57
- return await load();
58
- }
59
- finally {
60
- collections.delete(recipes);
61
- }
62
- }
63
- /**
64
- * Refuse two recipes of one Domain under one id: a refusal and a call name a recipe by its id.
65
- * Refuse two that declare one code with different definitions: a Function that spreads both
66
- * recipes' errors keeps one of them, and would redact the other recipe's error.
67
- */
68
- export function admitRecipes(recipes) {
69
- const ids = new Set();
70
- for (const { id } of recipes) {
71
- if (ids.has(id))
72
- throw new TypeError(`Two recipes of the Domain are named ${id}: a recipe id is unique in its Domain.`);
73
- ids.add(id);
74
- }
75
- const first = new Map();
76
- for (const recipe of recipes) {
77
- for (const [code, declaration] of Object.entries(recipe.errors)) {
78
- const seen = first.get(code);
79
- if (seen === undefined)
80
- first.set(code, { recipe: recipe.id, declaration });
81
- else if (seen.declaration !== declaration)
82
- throw new TypeError(`Recipes ${seen.recipe} and ${recipe.id} declare ${code} with different definitions: declare it once and share that object, so a Function that re-declares both keeps each.`);
83
- }
84
- }
85
- }
86
- /**
87
- * Define a recipe: `defineQuery<Schema>()('services.service.owner', { build, output?, errors? })`.
88
- * The V6 form, `defineQuery<Schema>()((domain) => ({ id, build, project? }))`, stays.
89
- */
90
- export function defineQuery() {
91
- const v6 = defineV6Query();
92
- return ((first, spec) => typeof first === 'string'
93
- ? defineRecipe(first, spec)
94
- : v6(first));
95
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Log a recipe's declared error that reaches a Function which does not re-declare it, before the
3
- * Server redacts it as an internal error: its code, the recipe and the Function, never its details,
4
- * which a recipe read as the executor may fill with what the caller may not read.
5
- */
6
- export declare function reportUndeclaredRecipeError(cause: unknown, address: string): void;
@@ -1,17 +0,0 @@
1
- import { recipeErrorOf } from '../../../application/error/index.js';
2
- /**
3
- * Log a recipe's declared error that reaches a Function which does not re-declare it, before the
4
- * Server redacts it as an internal error: its code, the recipe and the Function, never its details,
5
- * which a recipe read as the executor may fill with what the caller may not read.
6
- */
7
- export function reportUndeclaredRecipeError(cause, address) {
8
- const raised = recipeErrorOf(cause);
9
- if (raised === undefined)
10
- return;
11
- // oxlint-disable-next-line no-console
12
- console.error('[sdk] Recipe error not re-declared by its Function', {
13
- code: raised.code,
14
- recipe: raised.recipe,
15
- function: address,
16
- });
17
- }
@@ -1,2 +0,0 @@
1
- import type { SourceRuleVerifier } from './verifier.js';
2
- export declare const recipeRules: readonly SourceRuleVerifier[];