@superblocksteam/library-shared 2.0.162 → 2.0.163-next.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.
Files changed (57) hide show
  1. package/dist/props/helpers.d.ts +1 -9
  2. package/dist/props/helpers.d.ts.map +1 -1
  3. package/dist/props/helpers.js +3 -60
  4. package/dist/props/helpers.js.map +1 -1
  5. package/dist/testing/default-structure-scope/index.d.ts +8 -0
  6. package/dist/testing/default-structure-scope/index.d.ts.map +1 -0
  7. package/dist/testing/default-structure-scope/index.js +62 -0
  8. package/dist/testing/default-structure-scope/index.js.map +1 -0
  9. package/dist/testing/fake-editor-channel/fake-artifact.d.ts +41 -0
  10. package/dist/testing/fake-editor-channel/fake-artifact.d.ts.map +1 -0
  11. package/dist/testing/fake-editor-channel/fake-artifact.js +74 -0
  12. package/dist/testing/fake-editor-channel/fake-artifact.js.map +1 -0
  13. package/dist/testing/fake-editor-channel/index.d.ts +115 -0
  14. package/dist/testing/fake-editor-channel/index.d.ts.map +1 -0
  15. package/dist/testing/fake-editor-channel/index.js +292 -0
  16. package/dist/testing/fake-editor-channel/index.js.map +1 -0
  17. package/dist/testing/fake-editor-channel/type-pins.d.ts +13 -0
  18. package/dist/testing/fake-editor-channel/type-pins.d.ts.map +1 -0
  19. package/dist/testing/fake-editor-channel/type-pins.js +13 -0
  20. package/dist/testing/fake-editor-channel/type-pins.js.map +1 -0
  21. package/dist/types/ai.d.ts +25 -1
  22. package/dist/types/ai.d.ts.map +1 -1
  23. package/dist/types/ai.js +13 -0
  24. package/dist/types/ai.js.map +1 -1
  25. package/dist/types/common.d.ts +3 -1
  26. package/dist/types/common.d.ts.map +1 -1
  27. package/dist/types/common.js +4 -1
  28. package/dist/types/common.js.map +1 -1
  29. package/dist/types/edit-operations.d.ts +0 -12
  30. package/dist/types/edit-operations.d.ts.map +1 -1
  31. package/dist/types/edit-operations.js.map +1 -1
  32. package/dist/types/errors.d.ts +2 -2
  33. package/dist/types/errors.d.ts.map +1 -1
  34. package/dist/types/errors.js +4 -1
  35. package/dist/types/errors.js.map +1 -1
  36. package/dist/types/index.d.ts +1 -1
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/dist/types/index.js +1 -1
  39. package/dist/types/index.js.map +1 -1
  40. package/dist/types/mobx-shared-state.d.ts +0 -2
  41. package/dist/types/mobx-shared-state.d.ts.map +1 -1
  42. package/dist/types/parent-messages.d.ts +28 -7
  43. package/dist/types/parent-messages.d.ts.map +1 -1
  44. package/dist/types/persisted-chat-message.d.ts.map +1 -1
  45. package/dist/types/persisted-chat-message.js +5 -0
  46. package/dist/types/persisted-chat-message.js.map +1 -1
  47. package/dist/types/socket-method-names.d.ts +216 -0
  48. package/dist/types/socket-method-names.d.ts.map +1 -0
  49. package/dist/types/socket-method-names.js +165 -0
  50. package/dist/types/socket-method-names.js.map +1 -0
  51. package/dist/types/socket.d.ts +54 -0
  52. package/dist/types/socket.d.ts.map +1 -1
  53. package/package.json +16 -4
  54. package/dist/types/runtime-sync.d.ts +0 -32
  55. package/dist/types/runtime-sync.d.ts.map +0 -1
  56. package/dist/types/runtime-sync.js +0 -2
  57. package/dist/types/runtime-sync.js.map +0 -1
@@ -1,13 +1,5 @@
1
1
  import type { PropertyInfo } from "../types/index.js";
2
- import type { PropertiesPanelDefinition, WidgetPropertyDefinition } from "./properties-panel.js";
3
- export declare const getPropertiesDefinitionByPath: (propertiesPanelDefinition: PropertiesPanelDefinition | null) => Record<string, WidgetPropertyDefinition<unknown>>;
4
- /**
5
- * Get the property definition by path.
6
- * @param path - The path to the property.
7
- * @param propertiesPanelDefinition - The properties panel definition.
8
- * @returns The property definition.
9
- */
10
- export declare const getPropertyDefinitionByPath: (path: string, propertiesPanelDefinition: PropertiesPanelDefinition | null) => WidgetPropertyDefinition<unknown> | undefined;
2
+ import type { WidgetPropertyDefinition } from "./properties-panel.js";
11
3
  /**
12
4
  * Get the property value in the correct format based on the property definition. This will allow
13
5
  * to be parsed correctly depending on the type. For example, if the property is a dimension, it will
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/props/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAQtD,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,uBAAuB,CAAC;AAE/B,eAAO,MAAM,6BAA6B,GACxC,2BAA2B,yBAAyB,GAAG,IAAI,KAC1D,MAAM,CAAC,MAAM,EAAE,wBAAwB,CAAC,OAAO,CAAC,CA+BlD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GACtC,MAAM,MAAM,EACZ,2BAA2B,yBAAyB,GAAG,IAAI,KAC1D,wBAAwB,CAAC,OAAO,CAAC,GAAG,SAmBtC,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,GAAG,EACV,kBAAkB,CAAC,EAAE,wBAAwB,CAAC,OAAO,CAAC,GACrD,YAAY,CAyEd;AAmDD,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,GAAG,GACZ,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAY9B"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/props/helpers.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAItD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEtE;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,GAAG,EACV,kBAAkB,CAAC,EAAE,wBAAwB,CAAC,OAAO,CAAC,GACrD,YAAY,CA4Dd;AAmDD,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,EACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,GAAG,GACZ,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAY9B"}
@@ -1,56 +1,6 @@
1
1
  import { isComputedExpression } from "../computed.js";
2
- import { isComputedPropertyInfo, isPropertyInfo, Property, } from "../utils/properties.js";
2
+ import { isPropertyInfo, Property } from "../utils/properties.js";
3
3
  import { containsStringInterpolation } from "../utils/strings.js";
4
- export const getPropertiesDefinitionByPath = (propertiesPanelDefinition) => {
5
- if (!propertiesPanelDefinition) {
6
- return {};
7
- }
8
- function processChildren(children) {
9
- let ps = {};
10
- Object.values(children).forEach((child) => {
11
- ps = {
12
- ...ps,
13
- [child.path]: child,
14
- ...(child.children ? processChildren(child.children) : {}),
15
- };
16
- });
17
- return ps;
18
- }
19
- let properties = {};
20
- propertiesPanelDefinition.sections.forEach((section) => {
21
- section.children.forEach((child) => {
22
- properties = {
23
- ...properties,
24
- [child.path]: child,
25
- ...(child.children ? processChildren(child.children) : {}),
26
- };
27
- });
28
- });
29
- return properties;
30
- };
31
- /**
32
- * Get the property definition by path.
33
- * @param path - The path to the property.
34
- * @param propertiesPanelDefinition - The properties panel definition.
35
- * @returns The property definition.
36
- */
37
- export const getPropertyDefinitionByPath = (path, propertiesPanelDefinition) => {
38
- const propertiesDefinitionByPath = getPropertiesDefinitionByPath(propertiesPanelDefinition);
39
- const pathParts = path.split(".");
40
- let definitionPath = "";
41
- while (pathParts.length > 0) {
42
- definitionPath = `${definitionPath ? `${definitionPath}.` : ""}${pathParts.shift()}`;
43
- const definition = propertiesDefinitionByPath[definitionPath];
44
- // If the definition is a recordOf type, we need to remove the property name from the path
45
- // as it will not be part of the definition. For example, if we define a property column as
46
- // recordOf. The structure of the definition will be in column.label while the path will contain
47
- // the name of the column (column.name.label)
48
- if (definition?.dataType === "recordOf") {
49
- pathParts.shift();
50
- }
51
- }
52
- return propertiesDefinitionByPath[definitionPath];
53
- };
54
4
  /**
55
5
  * Get the property value in the correct format based on the property definition. This will allow
56
6
  * to be parsed correctly depending on the type. For example, if the property is a dimension, it will
@@ -61,20 +11,13 @@ export const getPropertyDefinitionByPath = (path, propertiesPanelDefinition) =>
61
11
  */
62
12
  export function getPropertyInfo(value, propertyDefinition) {
63
13
  if (isPropertyInfo(value)) {
64
- // attach args if we need them, though, because that comes from the props def
65
- if (isComputedPropertyInfo(value) &&
66
- propertyDefinition?.propertiesPanelDisplay?.computedArgs) {
67
- return Property.Computed(value.value, propertyDefinition.propertiesPanelDisplay.computedArgs);
68
- }
69
14
  return value;
70
15
  }
71
16
  if (typeof value === "string" && isComputedExpression(value)) {
72
- const args = propertyDefinition?.propertiesPanelDisplay?.computedArgs ?? [];
73
- return Property.Computed(value, args);
17
+ return Property.Computed(value, []);
74
18
  }
75
19
  else if (typeof value === "string" && containsStringInterpolation(value)) {
76
- const args = propertyDefinition?.propertiesPanelDisplay?.computedArgs ?? [];
77
- return Property.Template(value, args);
20
+ return Property.Template(value, []);
78
21
  }
79
22
  if (!propertyDefinition) {
80
23
  return Property.Static(value);
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/props/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEtD,OAAO,EACL,sBAAsB,EACtB,cAAc,EACd,QAAQ,GACT,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,2BAA2B,EAAE,MAAM,qBAAqB,CAAC;AAOlE,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,yBAA2D,EACR,EAAE;IACrD,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAC/B,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,SAAS,eAAe,CACtB,QAA2D;QAE3D,IAAI,EAAE,GAAsD,EAAE,CAAC;QAC/D,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACxC,EAAE,GA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C/B,CAAC,OAAO,CAAC,EAAE,mBAAmB,CAC3B,cAAc,CAAC,KAAsC,EAAE,CAAC,OAAO,CAAC;gBAC/D,SAAS,EACX,IAAI,EACJ,QAAQ,CACT;SACF;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,GAAiC,EACjC,IAAY,EACZ,QAAa;IAEb,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjC,MAAM,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,GAAG,QAAQ,CAAC;IAErC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,GAAG,CAAC;IACb,CAAC;IAED,OAAO;QACL,GAAG,GAAG;QACN,CAAC,QAAQ,CAAC,EAAE,mBAAmB,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC;KAC/D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { Node } from "../../pages.js";
2
+ import type { AppScope } from "../../types/scope.js";
3
+ /**
4
+ * The scope a freshly created app boots with: one empty page and an app root
5
+ * holding a bare Outlet.
6
+ */
7
+ export declare function defaultStructureScope(pageChildren?: Node[]): AppScope;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/testing/default-structure-scope/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,YAAY,GAAE,IAAI,EAAO,GAAG,QAAQ,CAwDzE"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * The scope a freshly created app boots with: one empty page and an app root
3
+ * holding a bare Outlet.
4
+ */
5
+ export function defaultStructureScope(pageChildren = []) {
6
+ return {
7
+ entities: {},
8
+ pages: {
9
+ Home: {
10
+ entities: {},
11
+ name: "Home",
12
+ roots: [
13
+ {
14
+ id: "page-root",
15
+ kind: "page",
16
+ name: "Home",
17
+ root: {
18
+ children: pageChildren,
19
+ id: "page",
20
+ name: "Home",
21
+ properties: {},
22
+ tagName: "div",
23
+ type: "WidgetNode",
24
+ },
25
+ type: "RootNode",
26
+ },
27
+ ],
28
+ routes: ["/"],
29
+ scopeId: "home",
30
+ scopeName: "Home",
31
+ },
32
+ },
33
+ roots: [
34
+ {
35
+ id: "app-root",
36
+ kind: "app",
37
+ name: "App",
38
+ root: {
39
+ children: [
40
+ {
41
+ children: [],
42
+ id: "outlet",
43
+ name: "Outlet",
44
+ properties: {},
45
+ tagName: "Outlet",
46
+ type: "WidgetNode",
47
+ },
48
+ ],
49
+ id: "app",
50
+ name: "App",
51
+ properties: {},
52
+ tagName: "div",
53
+ type: "WidgetNode",
54
+ },
55
+ type: "RootNode",
56
+ },
57
+ ],
58
+ scopeId: "app",
59
+ scopeName: "App",
60
+ };
61
+ }
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/testing/default-structure-scope/index.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,eAAuB,EAAE;IAC7D,OAAO;QACL,QAAQ,EAAE,EAAE;QACZ,KAAK,EAAE;YACL,IAAI,EAAE;gBACJ,QAAQ,EAAE,EAAE;gBACZ,IAAI,EAAE,MAAM;gBACZ,KAAK,EAAE;oBACL;wBACE,EAAE,EAAE,WAAW;wBACf,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;4BACJ,QAAQ,EAAE,YAAY;4BACtB,EAAE,EAAE,MAAM;4BACV,IAAI,EAAE,MAAM;4BACZ,UAAU,EAAE,EAAE;4BACd,OAAO,EAAE,KAAK;4BACd,IAAI,EAAE,YAAY;yBACnB;wBACD,IAAI,EAAE,UAAU;qBACjB;iBACF;gBACD,MAAM,EAAE,CAAC,GAAG,CAAC;gBACb,OAAO,EAAE,MAAM;gBACf,SAAS,EAAE,MAAM;aAClB;SACF;QACD,KAAK,EAAE;YACL;gBACE,EAAE,EAAE,UAAU;gBACd,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE,KAAK;gBACX,IAAI,EAAE;oBACJ,QAAQ,EAAE;wBACR;4BACE,QAAQ,EAAE,EAAE;4BACZ,EAAE,EAAE,QAAQ;4BACZ,IAAI,EAAE,QAAQ;4BACd,UAAU,EAAE,EAAE;4BACd,OAAO,EAAE,QAAQ;4BACjB,IAAI,EAAE,YAAY;yBACnB;qBACF;oBACD,EAAE,EAAE,KAAK;oBACT,IAAI,EAAE,KAAK;oBACX,UAAU,EAAE,EAAE;oBACd,OAAO,EAAE,KAAK;oBACd,IAAI,EAAE,YAAY;iBACnB;gBACD,IAAI,EAAE,UAAU;aACjB;SACF;QACD,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,KAAK;KACjB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,41 @@
1
+ import type { ServerMethods } from "../../types/socket.js";
2
+ /**
3
+ * Lifecycle of the fake app artifact behind draft accept/reject:
4
+ * `pending` (Clark finished a turn and left a draft), `unpublished`
5
+ * (the draft was accepted into a checkpoint), `published` (no draft;
6
+ * the editor shows the last published state).
7
+ */
8
+ export type FakeArtifactState = "pending" | "unpublished" | "published";
9
+ type DraftDecisionHandlers = {
10
+ aiAcceptDraft: ServerMethods["editor"]["aiAcceptDraft"];
11
+ aiRejectDraft: ServerMethods["editor"]["aiRejectDraft"];
12
+ };
13
+ /**
14
+ * In-memory stand-in for the app artifact that draft accept/reject
15
+ * operates on, per the Versions UX row of the Editor UX Surfaces
16
+ * testability table: state toggles pending -> unpublished on accept and
17
+ * pending -> published on reject, readable by tests via `state`.
18
+ *
19
+ * The channel stays strict: spread `handlers` into the
20
+ * `FakeEditorChannel` constructor's `serverHandlers` to bind the draft
21
+ * decision methods, e.g.
22
+ * `new FakeEditorChannel({ serverHandlers: { ...artifact.handlers } })`.
23
+ * Accept on a non-pending artifact rejects, so a test that double-fires
24
+ * accept fails loudly instead of minting a second commit id.
25
+ */
26
+ export declare class FakeArtifact {
27
+ private nextCommitId;
28
+ private stateValue;
29
+ constructor(initialState?: FakeArtifactState);
30
+ get state(): FakeArtifactState;
31
+ /**
32
+ * Models the out-of-band event of Clark finishing a turn with file
33
+ * changes: draft creation is not a wire method on this channel, so
34
+ * tests stage a new draft here. Besides the constructor's
35
+ * initialState, this is the only way to reach `pending`.
36
+ */
37
+ stageDraft(): void;
38
+ readonly handlers: DraftDecisionHandlers;
39
+ }
40
+ export {};
41
+ //# sourceMappingURL=fake-artifact.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fake-artifact.d.ts","sourceRoot":"","sources":["../../../src/testing/fake-editor-channel/fake-artifact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;AAExE,KAAK,qBAAqB,GAAG;IAC3B,aAAa,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,CAAC;IACxD,aAAa,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,eAAe,CAAC,CAAC;CACzD,CAAC;AAuBF;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,UAAU,CAAoB;gBAE1B,YAAY,GAAE,iBAA+B;IAIzD,IAAI,KAAK,IAAI,iBAAiB,CAE7B;IAED;;;;;OAKG;IACH,UAAU,IAAI,IAAI;IAIlB,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAsBtC;CACH"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * A real remote handler failure never reaches the caller as an Error
3
+ * instance: the socket serializes it to `{ code, message, stack }` with
4
+ * code 3, and the caller's promise rejects with that parsed plain
5
+ * object. Reject with the same shape so tests see production semantics.
6
+ *
7
+ * Distinct from the channel's remoteHandlerError on purpose: that helper
8
+ * models a thrown SocketErrorException, whose message crosses verbatim,
9
+ * while this models a handler throwing a plain Error, which the socket
10
+ * stringifies to an "Error: "-prefixed message. Production produces both
11
+ * shapes, one per path.
12
+ */
13
+ const remoteFailure = (message) => {
14
+ const error = new Error(message);
15
+ return Promise.reject({
16
+ code: 3,
17
+ message: error.toString(),
18
+ stack: error.stack,
19
+ });
20
+ };
21
+ /**
22
+ * In-memory stand-in for the app artifact that draft accept/reject
23
+ * operates on, per the Versions UX row of the Editor UX Surfaces
24
+ * testability table: state toggles pending -> unpublished on accept and
25
+ * pending -> published on reject, readable by tests via `state`.
26
+ *
27
+ * The channel stays strict: spread `handlers` into the
28
+ * `FakeEditorChannel` constructor's `serverHandlers` to bind the draft
29
+ * decision methods, e.g.
30
+ * `new FakeEditorChannel({ serverHandlers: { ...artifact.handlers } })`.
31
+ * Accept on a non-pending artifact rejects, so a test that double-fires
32
+ * accept fails loudly instead of minting a second commit id.
33
+ */
34
+ export class FakeArtifact {
35
+ nextCommitId = 1;
36
+ stateValue;
37
+ constructor(initialState = "published") {
38
+ this.stateValue = initialState;
39
+ }
40
+ get state() {
41
+ return this.stateValue;
42
+ }
43
+ /**
44
+ * Models the out-of-band event of Clark finishing a turn with file
45
+ * changes: draft creation is not a wire method on this channel, so
46
+ * tests stage a new draft here. Besides the constructor's
47
+ * initialState, this is the only way to reach `pending`.
48
+ */
49
+ stageDraft() {
50
+ this.stateValue = "pending";
51
+ }
52
+ handlers = {
53
+ aiAcceptDraft: async () => {
54
+ if (this.stateValue !== "pending") {
55
+ return remoteFailure(`Fake artifact has no pending draft to accept (state: ${this.stateValue})`);
56
+ }
57
+ this.stateValue = "unpublished";
58
+ const commitId = `fake-commit-${this.nextCommitId}`;
59
+ this.nextCommitId += 1;
60
+ return { commitId };
61
+ },
62
+ // The editor's restore flow fires aiRejectDraft as cleanup even when
63
+ // no draft is pending, so a non-pending reject resolves as a no-op
64
+ // instead of throwing. Only pending -> published is a real discard;
65
+ // leaving other states untouched keeps a discard-after-accept bug
66
+ // visible to tests instead of masking it as "published".
67
+ aiRejectDraft: async () => {
68
+ if (this.stateValue === "pending") {
69
+ this.stateValue = "published";
70
+ }
71
+ },
72
+ };
73
+ }
74
+ //# sourceMappingURL=fake-artifact.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fake-artifact.js","sourceRoot":"","sources":["../../../src/testing/fake-editor-channel/fake-artifact.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;GAWG;AACH,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,EAAE;IACxC,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,OAAO,OAAO,CAAC,MAAM,CAAC;QACpB,IAAI,EAAE,CAAC;QACP,OAAO,EAAE,KAAK,CAAC,QAAQ,EAAE;QACzB,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,YAAY;IACf,YAAY,GAAG,CAAC,CAAC;IACjB,UAAU,CAAoB;IAEtC,YAAY,eAAkC,WAAW;QACvD,IAAI,CAAC,UAAU,GAAG,YAAY,CAAC;IACjC,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACH,UAAU;QACR,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAC9B,CAAC;IAEQ,QAAQ,GAA0B;QACzC,aAAa,EAAE,KAAK,IAAI,EAAE;YACxB,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;gBAClC,OAAO,aAAa,CAClB,wDAAwD,IAAI,CAAC,UAAU,GAAG,CAC3E,CAAC;YACJ,CAAC;YACD,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC;YAChC,MAAM,QAAQ,GAAG,eAAe,IAAI,CAAC,YAAY,EAAE,CAAC;YACpD,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC;YACvB,OAAO,EAAE,QAAQ,EAAE,CAAC;QACtB,CAAC;QACD,qEAAqE;QACrE,mEAAmE;QACnE,oEAAoE;QACpE,kEAAkE;QAClE,yDAAyD;QACzD,aAAa,EAAE,KAAK,IAAI,EAAE;YACxB,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,EAAE,CAAC;gBAClC,IAAI,CAAC,UAAU,GAAG,WAAW,CAAC;YAChC,CAAC;QACH,CAAC;KACF,CAAC;CACH"}
@@ -0,0 +1,115 @@
1
+ import type { ISocketClient, RequestContextBase } from "@superblocksteam/shared";
2
+ import { EDITOR_CLIENT_METHOD_NAMES, SERVER_EDITOR_METHOD_NAMES } from "../../types/socket-method-names.js";
3
+ import type { EditorClientMethods, ServerMethods } from "../../types/socket.js";
4
+ export { EDITOR_CLIENT_METHOD_NAMES, SERVER_EDITOR_METHOD_NAMES };
5
+ export { FakeArtifact, type FakeArtifactState } from "./fake-artifact.js";
6
+ type FakeHandler<Method> = Method extends (params: infer Params) => Promise<infer Result> ? (params: Params, context: RequestContextBase, peer: ISocketClient<ServerMethods>, next: () => Promise<Result>) => Result | Promise<Result> : never;
7
+ export type FakeEditorClientHandlers = Partial<{
8
+ [Method in keyof EditorClientMethods]: readonly FakeHandler<EditorClientMethods[Method]>[];
9
+ }>;
10
+ export type FakeServerEditorHandlers = Partial<{
11
+ [Method in keyof ServerMethods["editor"]]: ServerMethods["editor"][Method];
12
+ }>;
13
+ export interface FakeEditorChannelRequest {
14
+ direction: "editor-to-server" | "server-to-editor";
15
+ generation: number;
16
+ method: keyof EditorClientMethods | keyof ServerMethods["editor"];
17
+ params: unknown;
18
+ transportSeq: number;
19
+ }
20
+ export interface FakeEditorChannelPeer extends ISocketClient<EditorClientMethods> {
21
+ readonly connectionGeneration: number;
22
+ readonly isConnected: boolean;
23
+ invalidateConnection(generation: number): void;
24
+ whenConnected(timeoutMs: number): Promise<boolean>;
25
+ whenConnectedAfter(generation: number, timeoutMs: number): Promise<boolean>;
26
+ }
27
+ /**
28
+ * In-memory editor Channel Adapter for contract and surface tests.
29
+ *
30
+ * Calls from an editor into `ServerMethods.editor` are recorded by `call`.
31
+ * Calls from the server into `EditorClientMethods` are initiated through
32
+ * `push` and delivered to the handlers bound for the current connection.
33
+ * Editor handlers are connection-scoped: `dropConnection` clears them, so a
34
+ * `reconnect` without replacement handlers starts the new generation with
35
+ * none bound. Within a live connection, `bindEditorHandlers` merges across
36
+ * distinct methods but is last-write-wins per method key: re-binding a
37
+ * method replaces its whole handler chain rather than appending to it. The
38
+ * handlers passed to `reconnect` replace the entire bound set.
39
+ *
40
+ * Error behavior mirrors the real transport (`ISocket`) for the codes this
41
+ * fake models: 2, 5, and 10. Unknown method names reject with a plain
42
+ * `{ code: 2, message }` object and `next()` past the last handler rejects
43
+ * with a plain `{ code: 5, message, stack }` object; like the real remote
44
+ * error path, neither is an Error instance. Calls on a dropped connection
45
+ * reject with an actual `SocketErrorException` (code 10), matching the real
46
+ * local closed-socket path. Codes 4, 6, 7, 8, and 9 are not modeled; in
47
+ * particular, an in-flight push during a real mid-connection drop rejects
48
+ * with code 8, which this fake cannot produce because `dropConnection` does
49
+ * not reject in-flight work.
50
+ *
51
+ * A peer's `close`/`closeAndRejectPendingRequests` is terminal: it resolves
52
+ * pending connection waiters `false` immediately (matching StablePeer), while
53
+ * `dropConnection` is transient and leaves them pending for `reconnect`.
54
+ * StablePeer's disconnected-call queueing and replay (dispatch/flush) is not
55
+ * modeled: calls on a dropped connection reject rather than queue.
56
+ *
57
+ * By default (`strict: true`) a valid method with no handler bound also
58
+ * rejects with code 2, matching production; pass `strict: false` to resolve
59
+ * `undefined` instead for recording-only tests. In strict mode a
60
+ * valid-but-unhandled request IS recorded in `requests` before rejecting,
61
+ * while an unknown method name is NOT recorded.
62
+ */
63
+ export declare class FakeEditorChannel {
64
+ readonly call: ISocketClient<ServerMethods>["call"];
65
+ readonly editorPeer: FakeEditorChannelPeer;
66
+ readonly push: ISocketClient<EditorClientMethods>["call"];
67
+ readonly requests: FakeEditorChannelRequest[];
68
+ private connected;
69
+ private editorHandlers;
70
+ private generation;
71
+ private nextTransportSeq;
72
+ private readonly serverHandlers;
73
+ private readonly strict;
74
+ private readonly waiters;
75
+ constructor(options?: {
76
+ editorHandlers?: FakeEditorClientHandlers;
77
+ serverHandlers?: FakeServerEditorHandlers;
78
+ /**
79
+ * When true (the default), a valid method with no handler bound rejects
80
+ * with a plain `{ code: 2, message }` object like the real transport.
81
+ * Pass false to resolve `undefined` instead for recording-only tests.
82
+ */
83
+ strict?: boolean;
84
+ });
85
+ get connectionGeneration(): number;
86
+ get isConnected(): boolean;
87
+ bindEditorHandlers(handlers: FakeEditorClientHandlers): void;
88
+ dropConnection(): void;
89
+ /**
90
+ * Terminal close, as invoked through a peer's `close` or
91
+ * `closeAndRejectPendingRequests`. On top of `dropConnection`, settles
92
+ * every pending connection waiter with `false` immediately (matching
93
+ * StablePeer's rejectPendingConnectionState); `dropConnection` alone
94
+ * leaves waiters pending so a later `reconnect` can resolve them `true`.
95
+ */
96
+ private closeConnection;
97
+ reconnect(handlers?: FakeEditorClientHandlers): void;
98
+ invalidateConnection(generation: number): void;
99
+ /**
100
+ * The editor-path correlation ID (the per-turn `requestId` string inside
101
+ * editor-to-server payloads) of the most recent editor call that carried
102
+ * one. Distinct from `transportSeq`, the fake's per-message counter, and
103
+ * from A2A task ids, which belong to the gateway path.
104
+ */
105
+ lastEditorPathCorrelationId(): string | undefined;
106
+ whenConnected(timeoutMs: number): Promise<boolean>;
107
+ whenConnectedAfter(generation: number, timeoutMs: number): Promise<boolean>;
108
+ private record;
109
+ private receiveEditorCall;
110
+ private pushToEditor;
111
+ private callingPeer;
112
+ private assertConnected;
113
+ private waitForConnection;
114
+ }
115
+ //# sourceMappingURL=index.d.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