@crowdedkingdoms/crowdyjs 16.2.0 → 17.0.0-dev.1

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 (47) hide show
  1. package/MIGRATION.md +75 -0
  2. package/README.md +1 -1
  3. package/dist/crowdy-dsh/bridge.d.ts +1 -0
  4. package/dist/crowdy-dsh/bridge.d.ts.map +1 -1
  5. package/dist/crowdy-dsh/bridge.js +37 -12
  6. package/dist/crowdy-dsh/protocol.d.ts +25 -5
  7. package/dist/crowdy-dsh/protocol.d.ts.map +1 -1
  8. package/dist/crowdy-dsh/protocol.js +9 -1
  9. package/dist/crowdy-studio/controller.d.ts +22 -16
  10. package/dist/crowdy-studio/controller.d.ts.map +1 -1
  11. package/dist/crowdy-studio/controller.js +55 -72
  12. package/dist/crowdy-studio/dom-shell.d.ts +1 -2
  13. package/dist/crowdy-studio/dom-shell.d.ts.map +1 -1
  14. package/dist/crowdy-studio/dom-shell.js +35 -29
  15. package/dist/crowdy-studio/embed/panel.d.ts +10 -0
  16. package/dist/crowdy-studio/embed/panel.d.ts.map +1 -1
  17. package/dist/crowdy-studio/embed/panel.js +3 -1
  18. package/dist/crowdy-studio/github/index.d.ts +2 -2
  19. package/dist/crowdy-studio/github/index.d.ts.map +1 -1
  20. package/dist/crowdy-studio/github/index.js +1 -1
  21. package/dist/crowdy-studio/github/layout.d.ts +22 -0
  22. package/dist/crowdy-studio/github/layout.d.ts.map +1 -0
  23. package/dist/crowdy-studio/github/layout.js +66 -0
  24. package/dist/crowdy-studio/github/transport.d.ts +67 -9
  25. package/dist/crowdy-studio/github/transport.d.ts.map +1 -1
  26. package/dist/crowdy-studio/github/transport.js +61 -17
  27. package/dist/crowdy-studio/models.d.ts +29 -0
  28. package/dist/crowdy-studio/models.d.ts.map +1 -1
  29. package/dist/crowdy-studio/models.js +1 -0
  30. package/dist/default-origin.d.ts +6 -6
  31. package/dist/default-origin.d.ts.map +1 -1
  32. package/dist/default-origin.js +6 -6
  33. package/dist/domains/crowdyStudio.d.ts +25 -3
  34. package/dist/domains/crowdyStudio.d.ts.map +1 -1
  35. package/dist/domains/crowdyStudio.js +164 -10
  36. package/dist/generated/graphql.d.ts +148 -30
  37. package/dist/generated/graphql.d.ts.map +1 -1
  38. package/dist/generated/graphql.js +25 -9
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.d.ts.map +1 -1
  41. package/dist/index.js +1 -1
  42. package/dist/kit/npcs.d.ts.map +1 -1
  43. package/dist/kit/social.d.ts.map +1 -1
  44. package/package.json +1 -1
  45. package/dist/crowdy-studio/github/sync.d.ts +0 -49
  46. package/dist/crowdy-studio/github/sync.d.ts.map +0 -1
  47. package/dist/crowdy-studio/github/sync.js +0 -200
@@ -4,12 +4,20 @@
4
4
  * Same GraphQL client and session as everything else in the SDK: the game
5
5
  * API resolves the repository from the project's bind, so no operation here
6
6
  * names an `owner` / `repo` on a read or write, and no GitHub token ever
7
- * reaches the browser. GitHub is a filesystem for the project, not a login.
7
+ * reaches the browser. GitHub is a filesystem for the project, not a login,
8
+ * and it is never required — a project starts in Crowdy Studio and may be
9
+ * bound later.
8
10
  *
9
11
  * Which token may call what is decided server-side: `connectUrl`, `repos`,
10
12
  * `bind`, `unbind` need the identity session (hosted Studio); `status`,
11
- * `setAutosave`, `tree`, `getFile`, `putFile` also work under the in-game
12
- * embed's app token.
13
+ * `layout`, `tree`, `getFile`, `putFile`, `deleteFile`, `refresh` also work
14
+ * under a game's app token, scoped to projects that token's user owns. A game
15
+ * therefore needs no identity session to author against GitHub, and a
16
+ * third-party game must never read one.
17
+ *
18
+ * Every field the API answers is DATACENTER_ONLY: this transport must run on
19
+ * the client that adopted the app's datacenter endpoint (the same client that
20
+ * plays), never on one pointed at the shared origin.
13
21
  */
14
22
  import type { GraphQLClient } from '../../client.js';
15
23
  export interface CrowdyStudioGitHubStatus {
@@ -20,8 +28,8 @@ export interface CrowdyStudioGitHubStatus {
20
28
  owner: string | null;
21
29
  repo: string | null;
22
30
  branch: string | null;
23
- /** Autosave also pushes to GitHub. Off by default; the owner opts in. */
24
- autosave: boolean;
31
+ /** Commit the project mirror is at; null when the project is not bound. */
32
+ githubSha: string | null;
25
33
  installUrl: string | null;
26
34
  }
27
35
  export interface CrowdyStudioGitHubRepo {
@@ -38,11 +46,33 @@ export interface CrowdyStudioGitHubTreeEntry {
38
46
  sha: string | null;
39
47
  size: number | null;
40
48
  }
49
+ export interface CrowdyStudioGitHubTree {
50
+ commitSha: string;
51
+ entries: CrowdyStudioGitHubTreeEntry[];
52
+ }
41
53
  export interface CrowdyStudioGitHubFile {
42
54
  path: string;
43
55
  content: string;
44
56
  sha: string;
57
+ /** Commit the file was read at, or the commit a write created (the new githubSha). */
58
+ commitSha: string | null;
59
+ }
60
+ /**
61
+ * Where the SERVER and CLIENT crates live in the bound repository, resolved
62
+ * server-side from `crowdy.json` (or inferred) at one commit. The only layout
63
+ * grammar: the SDK never parses `crowdy.json` itself.
64
+ */
65
+ export interface CrowdyStudioGitHubLayout {
66
+ commitSha: string;
67
+ /** Directory of the SERVER Cargo.toml; `.` is the repository root. */
68
+ server: string;
69
+ /** Directory of the CLIENT Cargo.toml, or null when server-only. */
70
+ client: string | null;
71
+ assets: string;
72
+ fromFile: boolean;
45
73
  }
74
+ /** Which side is the truth for a bind's first commit. */
75
+ export type CrowdyStudioGitHubBindInitial = 'PUSH_PROJECT' | 'TAKE_REPOSITORY';
46
76
  export interface CrowdyStudioGitHubProjectScope {
47
77
  appId: string;
48
78
  projectId: string;
@@ -58,24 +88,52 @@ export declare class CrowdyStudioGitHubTransport {
58
88
  connectUrl: string;
59
89
  }>;
60
90
  repos(): Promise<CrowdyStudioGitHubRepo[]>;
91
+ /**
92
+ * Bind the project and make the two sides agree in one commit.
93
+ * `PUSH_PROJECT` commits the project files to the branch (refused with
94
+ * GITHUB_REPO_HAS_FILES when the branch already has rust under the layout
95
+ * roots); `TAKE_REPOSITORY` replaces the project files with the branch's
96
+ * (refused with GITHUB_REPO_EMPTY when there are none).
97
+ */
61
98
  bind(input: CrowdyStudioGitHubProjectScope & {
62
99
  owner: string;
63
100
  repo: string;
64
101
  branch?: string;
102
+ initial: CrowdyStudioGitHubBindInitial;
65
103
  }): Promise<CrowdyStudioGitHubStatus>;
104
+ /** Clear the bind. The project keeps its files and is a STUDIO project again. */
66
105
  unbind(input: CrowdyStudioGitHubProjectScope): Promise<CrowdyStudioGitHubStatus>;
67
- setAutosave(input: CrowdyStudioGitHubProjectScope & {
68
- autosave: boolean;
69
- }): Promise<CrowdyStudioGitHubStatus>;
70
- tree(input: CrowdyStudioGitHubProjectScope): Promise<CrowdyStudioGitHubTreeEntry[]>;
106
+ /** Bring the project mirror forward to the branch head after a push made elsewhere. */
107
+ refresh(input: CrowdyStudioGitHubProjectScope): Promise<CrowdyStudioGitHubStatus>;
108
+ layout(input: CrowdyStudioGitHubProjectScope & {
109
+ commitSha?: string;
110
+ }): Promise<CrowdyStudioGitHubLayout>;
111
+ tree(input: CrowdyStudioGitHubProjectScope & {
112
+ commitSha?: string;
113
+ }): Promise<CrowdyStudioGitHubTree>;
71
114
  getFile(input: CrowdyStudioGitHubProjectScope & {
72
115
  path: string;
116
+ commitSha?: string;
73
117
  }): Promise<CrowdyStudioGitHubFile>;
118
+ /**
119
+ * Commit one file to the bound branch. `expectedCommitSha` is the project
120
+ * `github.sha` the writer read; a stale value is refused with
121
+ * GITHUB_STALE_SHA. The blob `sha` is optional — the server resolves it from
122
+ * the tree at that commit. The returned `commitSha` is the new `github.sha`.
123
+ */
74
124
  putFile(input: CrowdyStudioGitHubProjectScope & {
75
125
  path: string;
76
126
  content: string;
77
127
  message: string;
128
+ expectedCommitSha: string;
78
129
  sha?: string;
79
130
  }): Promise<CrowdyStudioGitHubFile>;
131
+ /** Delete one file from the bound branch under the same guards as {@link putFile}. */
132
+ deleteFile(input: CrowdyStudioGitHubProjectScope & {
133
+ path: string;
134
+ message: string;
135
+ expectedCommitSha: string;
136
+ sha?: string;
137
+ }): Promise<CrowdyStudioGitHubStatus>;
80
138
  }
81
139
  //# sourceMappingURL=transport.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/crowdy-studio/github/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,OAAO,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,yEAAyE;IACzE,QAAQ,EAAE,OAAO,CAAC;IAClB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB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AG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAKrG,OAAO,CACX,KAAK,EAAE,8BAA8B,GAAG;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,GAC3E,OAAO,CAAC,sBAAsB,CAAC;IAKlC;;;;;OAKG;IACG,OAAO,CACX,KAAK,EAAE,8BAA8B,GAAG;QACtC,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,GACA,OAAO,CAAC,sBAAsB,CAAC;IAOlC,sFAAsF;IAChF,UAAU,CACd,KAAK,EAAE,8BAA8B,GAAG;QACtC,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,GAAG,CAAC,EAAE,MAAM,CAAC;KACd,GACA,OAAO,CAAC,wBAAwB,CAAC;CAOrC"}
@@ -4,15 +4,23 @@
4
4
  * Same GraphQL client and session as everything else in the SDK: the game
5
5
  * API resolves the repository from the project's bind, so no operation here
6
6
  * names an `owner` / `repo` on a read or write, and no GitHub token ever
7
- * reaches the browser. GitHub is a filesystem for the project, not a login.
7
+ * reaches the browser. GitHub is a filesystem for the project, not a login,
8
+ * and it is never required — a project starts in Crowdy Studio and may be
9
+ * bound later.
8
10
  *
9
11
  * Which token may call what is decided server-side: `connectUrl`, `repos`,
10
12
  * `bind`, `unbind` need the identity session (hosted Studio); `status`,
11
- * `setAutosave`, `tree`, `getFile`, `putFile` also work under the in-game
12
- * embed's app token.
13
+ * `layout`, `tree`, `getFile`, `putFile`, `deleteFile`, `refresh` also work
14
+ * under a game's app token, scoped to projects that token's user owns. A game
15
+ * therefore needs no identity session to author against GitHub, and a
16
+ * third-party game must never read one.
17
+ *
18
+ * Every field the API answers is DATACENTER_ONLY: this transport must run on
19
+ * the client that adopted the app's datacenter endpoint (the same client that
20
+ * plays), never on one pointed at the shared origin.
13
21
  */
14
22
  const STATUS_FIELDS = `
15
- configured connected accountLogin accountType owner repo branch autosave installUrl
23
+ configured connected accountLogin accountType owner repo branch githubSha installUrl
16
24
  `;
17
25
  const STATUS = `
18
26
  query CrowdyStudioGitHubStatus($appId: BigInt, $projectId: String) {
@@ -35,24 +43,34 @@ const UNBIND = `
35
43
  crowdyStudioGitHubUnbind(input: $input) { ${STATUS_FIELDS} }
36
44
  }
37
45
  `;
38
- const SET_AUTOSAVE = `
39
- mutation CrowdyStudioGitHubSetAutosave($input: SetCrowdyStudioGitHubAutosaveInput!) {
40
- crowdyStudioGitHubSetAutosave(input: $input) { ${STATUS_FIELDS} }
46
+ const REFRESH = `
47
+ mutation CrowdyStudioGitHubRefresh($input: CrowdyStudioGitHubProjectInput!) {
48
+ crowdyStudioGitHubRefresh(input: $input) { ${STATUS_FIELDS} }
49
+ }
50
+ `;
51
+ const LAYOUT = `
52
+ query CrowdyStudioGitHubLayout($input: CrowdyStudioGitHubAtCommitInput!) {
53
+ crowdyStudioGitHubLayout(input: $input) { commitSha server client assets fromFile }
41
54
  }
42
55
  `;
43
56
  const TREE = `
44
- query CrowdyStudioGitHubTree($input: CrowdyStudioGitHubProjectInput!) {
45
- crowdyStudioGitHubTree(input: $input) { path type sha size }
57
+ query CrowdyStudioGitHubTree($input: CrowdyStudioGitHubAtCommitInput!) {
58
+ crowdyStudioGitHubTree(input: $input) { commitSha entries { path type sha size } }
46
59
  }
47
60
  `;
48
61
  const FILE = `
49
62
  query CrowdyStudioGitHubFile($input: CrowdyStudioGitHubFileInput!) {
50
- crowdyStudioGitHubFile(input: $input) { path content sha }
63
+ crowdyStudioGitHubFile(input: $input) { path content sha commitSha }
51
64
  }
52
65
  `;
53
66
  const PUT_FILE = `
54
67
  mutation CrowdyStudioGitHubPutFile($input: CrowdyStudioGitHubPutFileInput!) {
55
- crowdyStudioGitHubPutFile(input: $input) { path content sha }
68
+ crowdyStudioGitHubPutFile(input: $input) { path content sha commitSha }
69
+ }
70
+ `;
71
+ const DELETE_FILE = `
72
+ mutation CrowdyStudioGitHubDeleteFile($input: CrowdyStudioGitHubDeleteFileInput!) {
73
+ crowdyStudioGitHubDeleteFile(input: $input) { ${STATUS_FIELDS} }
56
74
  }
57
75
  `;
58
76
  export class CrowdyStudioGitHubTransport {
@@ -71,34 +89,60 @@ export class CrowdyStudioGitHubTransport {
71
89
  const data = await this.graphql.query(REPOS);
72
90
  return data.crowdyStudioGitHubRepos ?? [];
73
91
  }
92
+ /**
93
+ * Bind the project and make the two sides agree in one commit.
94
+ * `PUSH_PROJECT` commits the project files to the branch (refused with
95
+ * GITHUB_REPO_HAS_FILES when the branch already has rust under the layout
96
+ * roots); `TAKE_REPOSITORY` replaces the project files with the branch's
97
+ * (refused with GITHUB_REPO_EMPTY when there are none).
98
+ */
74
99
  async bind(input) {
75
100
  const data = await this.graphql.query(BIND, { input });
76
101
  return data.crowdyStudioGitHubBind;
77
102
  }
103
+ /** Clear the bind. The project keeps its files and is a STUDIO project again. */
78
104
  async unbind(input) {
79
105
  const data = await this.graphql.query(UNBIND, {
80
106
  input,
81
107
  });
82
108
  return data.crowdyStudioGitHubUnbind;
83
109
  }
84
- async setAutosave(input) {
85
- const data = await this.graphql.query(SET_AUTOSAVE, { input });
86
- return data.crowdyStudioGitHubSetAutosave;
110
+ /** Bring the project mirror forward to the branch head after a push made elsewhere. */
111
+ async refresh(input) {
112
+ const data = await this.graphql.query(REFRESH, {
113
+ input,
114
+ });
115
+ return data.crowdyStudioGitHubRefresh;
87
116
  }
88
- async tree(input) {
89
- const data = await this.graphql.query(TREE, {
117
+ async layout(input) {
118
+ const data = await this.graphql.query(LAYOUT, {
90
119
  input,
91
120
  });
92
- return data.crowdyStudioGitHubTree ?? [];
121
+ return data.crowdyStudioGitHubLayout;
122
+ }
123
+ async tree(input) {
124
+ const data = await this.graphql.query(TREE, { input });
125
+ return data.crowdyStudioGitHubTree;
93
126
  }
94
127
  async getFile(input) {
95
128
  const data = await this.graphql.query(FILE, { input });
96
129
  return data.crowdyStudioGitHubFile;
97
130
  }
131
+ /**
132
+ * Commit one file to the bound branch. `expectedCommitSha` is the project
133
+ * `github.sha` the writer read; a stale value is refused with
134
+ * GITHUB_STALE_SHA. The blob `sha` is optional — the server resolves it from
135
+ * the tree at that commit. The returned `commitSha` is the new `github.sha`.
136
+ */
98
137
  async putFile(input) {
99
138
  const data = await this.graphql.query(PUT_FILE, {
100
139
  input,
101
140
  });
102
141
  return data.crowdyStudioGitHubPutFile;
103
142
  }
143
+ /** Delete one file from the bound branch under the same guards as {@link putFile}. */
144
+ async deleteFile(input) {
145
+ const data = await this.graphql.query(DELETE_FILE, { input });
146
+ return data.crowdyStudioGitHubDeleteFile;
147
+ }
104
148
  }
@@ -43,16 +43,41 @@ export interface CrowdyStudioProjectRevision {
43
43
  * One atomic cloud project snapshot. SERVER and CLIENT files intentionally
44
44
  * share a project revision so a full-stack save cannot persist half a pair.
45
45
  */
46
+ /**
47
+ * Where a project's files are authored. Every project starts as `STUDIO`; its
48
+ * owner may bind a GitHub repository later and unbind it again. GitHub is
49
+ * never required.
50
+ */
51
+ export type CrowdyStudioProjectSource = 'STUDIO' | 'GITHUB';
52
+ /** The repository a GITHUB project is bound to, and the commit its files mirror. */
53
+ export interface CrowdyStudioProjectGitHub {
54
+ owner: string;
55
+ repo: string;
56
+ branch: string;
57
+ /**
58
+ * Commit the project files are at. Every bound write presents it as
59
+ * `expectedCommitSha`; a stale value is refused with GITHUB_STALE_SHA and
60
+ * surfaces as a revision conflict.
61
+ */
62
+ sha: string | null;
63
+ }
46
64
  export interface CrowdyStudioProject {
47
65
  projectId: string;
48
66
  appId: string;
49
67
  gridId: string;
50
68
  kind: CrowdyStudioProjectKind;
51
69
  metadata: CrowdyStudioProjectMetadata;
70
+ /**
71
+ * The project files. For a GITHUB project this is the server-maintained
72
+ * mirror of the repository at `github.sha`, read exactly like a STUDIO
73
+ * project's files.
74
+ */
52
75
  files: CrowdyStudioProjectFile[];
53
76
  sdkVersion: string;
54
77
  abiVersion: number;
55
78
  revision: CrowdyStudioProjectRevision;
79
+ source: CrowdyStudioProjectSource;
80
+ github: CrowdyStudioProjectGitHub | null;
56
81
  createdAt: string;
57
82
  updatedAt: string;
58
83
  }
@@ -63,6 +88,10 @@ export interface CrowdyStudioProjectSummary {
63
88
  revisionId: string;
64
89
  serverModuleName?: string;
65
90
  clientModuleName?: string;
91
+ source: CrowdyStudioProjectSource;
92
+ /** `owner/repo@branch` for a GITHUB project. */
93
+ github?: string;
94
+ githubSha: string | null;
66
95
  updatedAt: string;
67
96
  }
68
97
  /** Explicit persistence state rendered by Crowdy Studio. */
@@ -1 +1 @@
1
- {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/crowdy-studio/models.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAErD,4DAA4D;AAC5D,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,QAAQ,GAAG,YAAY,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,MAAM,6BAA6B,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAE7E,8EAA8E;AAC9E,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,kBAAkB,GAAG,QAAQ,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MA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AAC,EAAE,OAAO;CAKxE;AAED,6DAA6D;AAC7D,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAa9D;AAED,yDAAyD;AACzD,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,kBAAkB,EAC1B,IAAI,EAAE,MAAM,GACX,MAAM,CAER;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,kBAAkB,EAC1B,IAAI,EAAE,MAAM,GACX,MAAM,CAOR;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,uBAAuB,GAAG,kBAAkB,EAAE,CAIlF;AAED,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,mBAAmB,GAAG,mBAAmB,CAQ1F"}
@@ -58,5 +58,6 @@ export function cloneCrowdyStudioProject(project) {
58
58
  metadata: { ...project.metadata },
59
59
  revision: { ...project.revision },
60
60
  files: project.files.map((file) => ({ ...file })),
61
+ github: project.github ? { ...project.github } : null,
61
62
  };
62
63
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * GENERATED — do not edit. The operator tooling's
3
- * `sync-client-origins.mjs --write --tier prod` writes this file, and
3
+ * `sync-client-origins.mjs --write --tier dev` writes this file, and
4
4
  * `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
5
5
  * host that declaration does not carry. Regenerate; never hand-edit.
6
6
  *
@@ -10,14 +10,14 @@
10
10
  * than no default at all. Every fallback this SDK ever removed named a host that
11
11
  * was already dead. A generated file plus a gate is what makes this one different.
12
12
  *
13
- * Source: the operator's per-tier public CK API origin declaration, tier 'prod'
13
+ * Source: the operator's per-tier public CK API origin declaration, tier 'dev'
14
14
  */
15
15
  /** The tier this build of the SDK is published for. */
16
- export declare const CROWDY_DEFAULT_TIER = "prod";
16
+ export declare const CROWDY_DEFAULT_TIER = "dev";
17
17
  /** The public CK API origin for that tier. */
18
- export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.prod.crowdedkingdoms.com";
18
+ export declare const CROWDY_DEFAULT_HTTP_ORIGIN = "https://ck.dev.crowdedkingdoms.com";
19
19
  /** The same host over WebSocket. A scheme is composed; a hostname is looked up. */
20
- export declare const CROWDY_DEFAULT_WS_ORIGIN = "wss://ck.prod.crowdedkingdoms.com";
20
+ export declare const CROWDY_DEFAULT_WS_ORIGIN = "wss://ck.dev.crowdedkingdoms.com";
21
21
  /** The bare hostname, for callers that need to compare rather than dial. */
22
- export declare const CROWDY_DEFAULT_HOST = "ck.prod.crowdedkingdoms.com";
22
+ export declare const CROWDY_DEFAULT_HOST = "ck.dev.crowdedkingdoms.com";
23
23
  //# sourceMappingURL=default-origin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"default-origin.d.ts","sourceRoot":"","sources":["../src/default-origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAE1C,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,wCAAwC,CAAC;AAEhF,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,sCAAsC,CAAC;AAE5E,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,gCAAgC,CAAC"}
1
+ {"version":3,"file":"default-origin.d.ts","sourceRoot":"","sources":["../src/default-origin.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,QAAQ,CAAC;AAEzC,8CAA8C;AAC9C,eAAO,MAAM,0BAA0B,uCAAuC,CAAC;AAE/E,mFAAmF;AACnF,eAAO,MAAM,wBAAwB,qCAAqC,CAAC;AAE3E,4EAA4E;AAC5E,eAAO,MAAM,mBAAmB,+BAA+B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * GENERATED — do not edit. The operator tooling's
3
- * `sync-client-origins.mjs --write --tier prod` writes this file, and
3
+ * `sync-client-origins.mjs --write --tier dev` writes this file, and
4
4
  * `check-sdk-default-origin.mjs` refuses it when it names the wrong tier or a
5
5
  * host that declaration does not carry. Regenerate; never hand-edit.
6
6
  *
@@ -10,13 +10,13 @@
10
10
  * than no default at all. Every fallback this SDK ever removed named a host that
11
11
  * was already dead. A generated file plus a gate is what makes this one different.
12
12
  *
13
- * Source: the operator's per-tier public CK API origin declaration, tier 'prod'
13
+ * Source: the operator's per-tier public CK API origin declaration, tier 'dev'
14
14
  */
15
15
  /** The tier this build of the SDK is published for. */
16
- export const CROWDY_DEFAULT_TIER = 'prod';
16
+ export const CROWDY_DEFAULT_TIER = 'dev';
17
17
  /** The public CK API origin for that tier. */
18
- export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.prod.crowdedkingdoms.com';
18
+ export const CROWDY_DEFAULT_HTTP_ORIGIN = 'https://ck.dev.crowdedkingdoms.com';
19
19
  /** The same host over WebSocket. A scheme is composed; a hostname is looked up. */
20
- export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.prod.crowdedkingdoms.com';
20
+ export const CROWDY_DEFAULT_WS_ORIGIN = 'wss://ck.dev.crowdedkingdoms.com';
21
21
  /** The bare hostname, for callers that need to compare rather than dial. */
22
- export const CROWDY_DEFAULT_HOST = 'ck.prod.crowdedkingdoms.com';
22
+ export const CROWDY_DEFAULT_HOST = 'ck.dev.crowdedkingdoms.com';
@@ -3,13 +3,23 @@ import { type CreateCrowdyStudioProjectInput, type ImportCrowdyStudioReferenceFi
3
3
  /**
4
4
  * Schema-coupled Game API adapter for private Crowdy Studio projects and
5
5
  * reusable files. Generated GraphQL documents and DTOs stay in this module;
6
- * the controller and public project models remain transport-neutral. Mutable
7
- * projects remain separate from immutable player-compute versions, and only
8
- * the controller's deploy path converts target files to sourceFilesJson.
6
+ * the controller and public project models remain transport-neutral.
7
+ *
8
+ * A project's `source` decides how {@link saveProject} persists files:
9
+ * `STUDIO` projects go through `crowdyStudioProjectSave` under the project
10
+ * revision; `GITHUB` projects commit each changed file through
11
+ * `crowdyStudioGitHubPutFile` / `DeleteFile` under `github.sha`
12
+ * (`expectedCommitSha`), because their files are a server-maintained mirror
13
+ * of the repository and the Studio file mutations refuse them. Either way a
14
+ * lost race is a {@link CrowdyStudioRevisionConflictError} and the editor's
15
+ * "the remote moved" recovery applies. The controller never learns which.
9
16
  */
10
17
  export declare class CrowdyStudioAPI implements CrowdyStudioProjectProvider {
11
18
  private readonly graphql;
12
19
  private readonly baselines;
20
+ private readonly github;
21
+ /** Layout per `projectId@commit`; commits are immutable so this never goes stale. */
22
+ private readonly layouts;
13
23
  constructor(graphql: GraphQLClient);
14
24
  listProjects(scope: CrowdyStudioProjectScope): Promise<CrowdyStudioProjectSummary[]>;
15
25
  getProject(input: CrowdyStudioProjectScope & {
@@ -17,6 +27,18 @@ export declare class CrowdyStudioAPI implements CrowdyStudioProjectProvider {
17
27
  }): Promise<CrowdyStudioProject>;
18
28
  createProject(input: CreateCrowdyStudioProjectInput): Promise<CrowdyStudioProject>;
19
29
  saveProject(input: SaveCrowdyStudioProjectInput): Promise<CrowdyStudioProject>;
30
+ /**
31
+ * Persist a GITHUB project: metadata through the project save (a CAS on the
32
+ * revision, no file bodies), then each changed file as its own commit on the
33
+ * bound branch, each carrying the commit the previous one produced. A file
34
+ * put is atomic on the server (GitHub commit, then mirror + `github_sha`
35
+ * advance in one transaction), so a stale race part-way through leaves the
36
+ * earlier commits on the branch and this project describing them; the
37
+ * conflict recovery re-reads and the remaining diffs are re-applied against
38
+ * the new commit. Layout comes from the API at the commit being written to.
39
+ */
40
+ private saveBoundProject;
41
+ private layoutAt;
20
42
  listPersonalLibraryFiles(scope: CrowdyStudioProjectScope): Promise<CrowdyStudioReferenceFile[]>;
21
43
  savePersonalLibraryFile(input: SaveCrowdyStudioLibraryFileInput): Promise<CrowdyStudioReferenceFile>;
22
44
  listCommonFiles(scope: CrowdyStudioProjectScope): Promise<CrowdyStudioReferenceFile[]>;
@@ -1 +1 @@
1
- {"version":3,"file":"crowdyStudio.d.ts","sourceRoot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