t44 0.2.0-rc.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.
Potentially problematic release.
This version of t44 might be problematic. Click here for more details.
- package/LICENSE.md +203 -0
- package/README.md +154 -0
- package/bin/activate +36 -0
- package/bin/activate.ts +30 -0
- package/bin/postinstall.sh +19 -0
- package/bin/shell +27 -0
- package/bin/t44 +27 -0
- package/caps/HomeRegistry.v0.ts +298 -0
- package/caps/OpenApiSchema.v0.ts +192 -0
- package/caps/ProjectDeployment.v0.ts +363 -0
- package/caps/ProjectDevelopment.v0.ts +246 -0
- package/caps/ProjectPublishing.v0.ts +307 -0
- package/caps/ProjectRack.v0.ts +128 -0
- package/caps/WorkspaceCli.v0.ts +391 -0
- package/caps/WorkspaceConfig.v0.ts +626 -0
- package/caps/WorkspaceConfig.yaml +53 -0
- package/caps/WorkspaceConnection.v0.ts +240 -0
- package/caps/WorkspaceEntityConfig.v0.ts +64 -0
- package/caps/WorkspaceEntityFact.v0.ts +193 -0
- package/caps/WorkspaceInfo.v0.ts +554 -0
- package/caps/WorkspaceInit.v0.ts +30 -0
- package/caps/WorkspaceKey.v0.ts +186 -0
- package/caps/WorkspaceProjects.v0.ts +455 -0
- package/caps/WorkspacePrompt.v0.ts +396 -0
- package/caps/WorkspaceShell.sh +39 -0
- package/caps/WorkspaceShell.v0.ts +104 -0
- package/caps/WorkspaceShell.yaml +65 -0
- package/caps/WorkspaceShellCli.v0.ts +109 -0
- package/caps/WorkspaceTest.v0.ts +167 -0
- package/caps/providers/LICENSE.md +8 -0
- package/caps/providers/README.md +2 -0
- package/caps/providers/bunny.net/ProjectDeployment.v0.ts +328 -0
- package/caps/providers/bunny.net/api-pull.v0.test.ts +319 -0
- package/caps/providers/bunny.net/api-pull.v0.ts +161 -0
- package/caps/providers/bunny.net/api-storage.v0.test.ts +168 -0
- package/caps/providers/bunny.net/api-storage.v0.ts +245 -0
- package/caps/providers/bunny.net/api.v0.ts +95 -0
- package/caps/providers/dynadot.com/ProjectDeployment.v0.ts +207 -0
- package/caps/providers/dynadot.com/api-domains.v0.test.ts +147 -0
- package/caps/providers/dynadot.com/api-domains.v0.ts +137 -0
- package/caps/providers/dynadot.com/api.v0.ts +88 -0
- package/caps/providers/git-scm.com/ProjectPublishing.v0.ts +231 -0
- package/caps/providers/github.com/ProjectPublishing.v0.ts +75 -0
- package/caps/providers/github.com/api.v0.ts +90 -0
- package/caps/providers/npmjs.com/ProjectPublishing.v0.ts +741 -0
- package/caps/providers/vercel.com/ProjectDeployment.v0.ts +339 -0
- package/caps/providers/vercel.com/api.v0.test.ts +67 -0
- package/caps/providers/vercel.com/api.v0.ts +132 -0
- package/caps/providers/vercel.com/bun.lock +194 -0
- package/caps/providers/vercel.com/package.json +10 -0
- package/caps/providers/vercel.com/project.v0.test.ts +108 -0
- package/caps/providers/vercel.com/project.v0.ts +150 -0
- package/caps/providers/vercel.com/tsconfig.json +28 -0
- package/docs/Overview.drawio +189 -0
- package/docs/Overview.svg +4 -0
- package/lib/crypto.ts +53 -0
- package/lib/openapi.ts +132 -0
- package/lib/ucan.ts +137 -0
- package/package.json +41 -0
- package/structs/HomeRegistryConfig.v0.ts +27 -0
- package/structs/ProjectDeploymentConfig.v0.ts +27 -0
- package/structs/ProjectDeploymentFact.v0.ts +110 -0
- package/structs/ProjectPublishingFact.v0.ts +69 -0
- package/structs/ProjectRackConfig.v0.ts +27 -0
- package/structs/WorkspaceCliConfig.v0.ts +27 -0
- package/structs/WorkspaceConfig.v0.ts +27 -0
- package/structs/WorkspaceKeyConfig.v0.ts +27 -0
- package/structs/WorkspaceMappings.v0.ts +27 -0
- package/structs/WorkspaceProjectsConfig.v0.ts +27 -0
- package/structs/WorkspaceRepositories.v0.ts +27 -0
- package/structs/WorkspaceShellConfig.v0.ts +45 -0
- package/structs/providers/LICENSE.md +8 -0
- package/structs/providers/README.md +2 -0
- package/structs/providers/bunny.net/ProjectDeploymentFact.v0.ts +41 -0
- package/structs/providers/bunny.net/WorkspaceConnectionConfig.v0.ts +42 -0
- package/structs/providers/dynadot.com/DomainFact.v0.ts +146 -0
- package/structs/providers/dynadot.com/WorkspaceConnectionConfig.v0.ts +41 -0
- package/structs/providers/git-scm.com/ProjectPublishingFact.v0.ts +46 -0
- package/structs/providers/github.com/ProjectPublishingFact.v0.ts +52 -0
- package/structs/providers/github.com/WorkspaceConnectionConfig.v0.ts +42 -0
- package/structs/providers/npmjs.com/ProjectPublishingFact.v0.ts +48 -0
- package/structs/providers/vercel.com/ProjectDeploymentFact.v0.ts +38 -0
- package/structs/providers/vercel.com/WorkspaceConnectionConfig.v0.ts +48 -0
- package/tsconfig.json +28 -0
- package/workspace-rt.ts +134 -0
- package/workspace.yaml +5 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
|
|
2
|
+
export async function capsule({
|
|
3
|
+
encapsulate,
|
|
4
|
+
CapsulePropertyTypes,
|
|
5
|
+
makeImportStack
|
|
6
|
+
}: {
|
|
7
|
+
encapsulate: any
|
|
8
|
+
CapsulePropertyTypes: any
|
|
9
|
+
makeImportStack: any
|
|
10
|
+
}) {
|
|
11
|
+
// Low level API that maps the GitHub REST API.
|
|
12
|
+
return encapsulate({
|
|
13
|
+
'#@stream44.studio/encapsulate/spine-contracts/CapsuleSpineContract.v0': {
|
|
14
|
+
'#@stream44.studio/encapsulate/structs/Capsule.v0': {},
|
|
15
|
+
'#t44/structs/providers/github.com/WorkspaceConnectionConfig.v0': {
|
|
16
|
+
as: '$ConnectionConfig'
|
|
17
|
+
},
|
|
18
|
+
'#': {
|
|
19
|
+
// @see https://docs.github.com/en/rest
|
|
20
|
+
apiHeaders: {
|
|
21
|
+
type: CapsulePropertyTypes.GetterFunction,
|
|
22
|
+
value: async function (this: any) {
|
|
23
|
+
const apiToken = await this.$ConnectionConfig.getConfigValue('apiToken')
|
|
24
|
+
return {
|
|
25
|
+
'Authorization': `Bearer ${apiToken}`,
|
|
26
|
+
'Accept': 'application/vnd.github+json',
|
|
27
|
+
'X-GitHub-Api-Version': '2022-11-28'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
getRepo: {
|
|
32
|
+
type: CapsulePropertyTypes.Function,
|
|
33
|
+
value: async function (this: any, { owner, repo }: { owner: string, repo: string }) {
|
|
34
|
+
const headers = await this.apiHeaders
|
|
35
|
+
const response = await fetch(`https://api.github.com/repos/${owner}/${repo}`, { headers })
|
|
36
|
+
if (response.status === 404) return null
|
|
37
|
+
if (!response.ok) {
|
|
38
|
+
throw new Error(`GitHub API error: ${response.status} ${await response.text()}`)
|
|
39
|
+
}
|
|
40
|
+
return response.json()
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
createRepo: {
|
|
44
|
+
type: CapsulePropertyTypes.Function,
|
|
45
|
+
value: async function (this: any, { org, name, isPrivate, description }: { org?: string, name: string, isPrivate?: boolean, description?: string }) {
|
|
46
|
+
const headers = await this.apiHeaders
|
|
47
|
+
const url = org
|
|
48
|
+
? `https://api.github.com/orgs/${org}/repos`
|
|
49
|
+
: `https://api.github.com/user/repos`
|
|
50
|
+
const response = await fetch(url, {
|
|
51
|
+
method: 'POST',
|
|
52
|
+
headers: { ...headers, 'Content-Type': 'application/json' },
|
|
53
|
+
body: JSON.stringify({
|
|
54
|
+
name,
|
|
55
|
+
private: isPrivate ?? false,
|
|
56
|
+
description: description || '',
|
|
57
|
+
auto_init: false
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
if (!response.ok) {
|
|
61
|
+
throw new Error(`GitHub API error creating repo: ${response.status} ${await response.text()}`)
|
|
62
|
+
}
|
|
63
|
+
return response.json()
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
ensureRepo: {
|
|
67
|
+
type: CapsulePropertyTypes.Function,
|
|
68
|
+
value: async function (this: any, { owner, repo, isPrivate, description }: { owner: string, repo: string, isPrivate?: boolean, description?: string }) {
|
|
69
|
+
const existing = await this.getRepo({ owner, repo })
|
|
70
|
+
if (existing) {
|
|
71
|
+
return { created: false, repo: existing }
|
|
72
|
+
}
|
|
73
|
+
const created = await this.createRepo({
|
|
74
|
+
org: owner,
|
|
75
|
+
name: repo,
|
|
76
|
+
isPrivate,
|
|
77
|
+
description
|
|
78
|
+
})
|
|
79
|
+
return { created: true, repo: created }
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}, {
|
|
85
|
+
importMeta: import.meta,
|
|
86
|
+
importStack: makeImportStack(),
|
|
87
|
+
capsuleName: capsule['#'],
|
|
88
|
+
})
|
|
89
|
+
}
|
|
90
|
+
capsule['#'] = 't44/caps/providers/github.com/api.v0'
|