@heroku/plugin-compute 0.1.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 (116) hide show
  1. package/LICENSE.txt +207 -0
  2. package/README.md +93 -0
  3. package/lib/commands/compute/config/get.d.ts +19 -0
  4. package/lib/commands/compute/config/get.js +76 -0
  5. package/lib/commands/compute/config/get.js.map +1 -0
  6. package/lib/commands/compute/config/list.d.ts +16 -0
  7. package/lib/commands/compute/config/list.js +57 -0
  8. package/lib/commands/compute/config/list.js.map +1 -0
  9. package/lib/commands/compute/config/set.d.ts +20 -0
  10. package/lib/commands/compute/config/set.js +99 -0
  11. package/lib/commands/compute/config/set.js.map +1 -0
  12. package/lib/commands/compute/config/unset.d.ts +20 -0
  13. package/lib/commands/compute/config/unset.js +93 -0
  14. package/lib/commands/compute/config/unset.js.map +1 -0
  15. package/lib/commands/compute/deploy.d.ts +18 -0
  16. package/lib/commands/compute/deploy.js +95 -0
  17. package/lib/commands/compute/deploy.js.map +1 -0
  18. package/lib/commands/compute/display.d.ts +26 -0
  19. package/lib/commands/compute/display.js +188 -0
  20. package/lib/commands/compute/display.js.map +1 -0
  21. package/lib/commands/compute/generate.d.ts +21 -0
  22. package/lib/commands/compute/generate.js +174 -0
  23. package/lib/commands/compute/generate.js.map +1 -0
  24. package/lib/commands/compute/get/build-log.d.ts +17 -0
  25. package/lib/commands/compute/get/build-log.js +62 -0
  26. package/lib/commands/compute/get/build-log.js.map +1 -0
  27. package/lib/commands/compute/get/runtime-log.d.ts +17 -0
  28. package/lib/commands/compute/get/runtime-log.js +79 -0
  29. package/lib/commands/compute/get/runtime-log.js.map +1 -0
  30. package/lib/commands/compute/list.d.ts +13 -0
  31. package/lib/commands/compute/list.js +55 -0
  32. package/lib/commands/compute/list.js.map +1 -0
  33. package/lib/commands/compute/scale.d.ts +23 -0
  34. package/lib/commands/compute/scale.js +112 -0
  35. package/lib/commands/compute/scale.js.map +1 -0
  36. package/lib/commands/compute/source/retrieve.d.ts +18 -0
  37. package/lib/commands/compute/source/retrieve.js +71 -0
  38. package/lib/commands/compute/source/retrieve.js.map +1 -0
  39. package/lib/commands/compute/tail/runtime-log.d.ts +17 -0
  40. package/lib/commands/compute/tail/runtime-log.js +82 -0
  41. package/lib/commands/compute/tail/runtime-log.js.map +1 -0
  42. package/lib/index.d.ts +2 -0
  43. package/lib/index.js +20 -0
  44. package/lib/index.js.map +1 -0
  45. package/lib/shared/computeApp.d.ts +10 -0
  46. package/lib/shared/computeApp.js +82 -0
  47. package/lib/shared/computeApp.js.map +1 -0
  48. package/lib/shared/computeBundle.d.ts +9 -0
  49. package/lib/shared/computeBundle.js +202 -0
  50. package/lib/shared/computeBundle.js.map +1 -0
  51. package/lib/shared/computeConfig.d.ts +2 -0
  52. package/lib/shared/computeConfig.js +37 -0
  53. package/lib/shared/computeConfig.js.map +1 -0
  54. package/lib/shared/computeConnectApi.d.ts +16 -0
  55. package/lib/shared/computeConnectApi.js +59 -0
  56. package/lib/shared/computeConnectApi.js.map +1 -0
  57. package/lib/shared/computeGenerateSkeletons.d.ts +2 -0
  58. package/lib/shared/computeGenerateSkeletons.js +262 -0
  59. package/lib/shared/computeGenerateSkeletons.js.map +1 -0
  60. package/lib/shared/computeGenerateSource.d.ts +8 -0
  61. package/lib/shared/computeGenerateSource.js +120 -0
  62. package/lib/shared/computeGenerateSource.js.map +1 -0
  63. package/lib/shared/computeLogStream.d.ts +4 -0
  64. package/lib/shared/computeLogStream.js +108 -0
  65. package/lib/shared/computeLogStream.js.map +1 -0
  66. package/lib/shared/computeQuery.d.ts +52 -0
  67. package/lib/shared/computeQuery.js +168 -0
  68. package/lib/shared/computeQuery.js.map +1 -0
  69. package/lib/shared/computeTelemetryDrain.d.ts +11 -0
  70. package/lib/shared/computeTelemetryDrain.js +78 -0
  71. package/lib/shared/computeTelemetryDrain.js.map +1 -0
  72. package/lib/shared/herokuProxyApi.d.ts +62 -0
  73. package/lib/shared/herokuProxyApi.js +243 -0
  74. package/lib/shared/herokuProxyApi.js.map +1 -0
  75. package/lib/shared/metadataApiVersion.d.ts +2 -0
  76. package/lib/shared/metadataApiVersion.js +25 -0
  77. package/lib/shared/metadataApiVersion.js.map +1 -0
  78. package/lib/shared/metadataDeploy.d.ts +5 -0
  79. package/lib/shared/metadataDeploy.js +90 -0
  80. package/lib/shared/metadataDeploy.js.map +1 -0
  81. package/lib/shared/metadataRetrieve.d.ts +2 -0
  82. package/lib/shared/metadataRetrieve.js +68 -0
  83. package/lib/shared/metadataRetrieve.js.map +1 -0
  84. package/lib/shared/plugin-name.d.ts +13 -0
  85. package/lib/shared/plugin-name.js +29 -0
  86. package/lib/shared/plugin-name.js.map +1 -0
  87. package/messages/compute.config.get.md +39 -0
  88. package/messages/compute.config.list.md +24 -0
  89. package/messages/compute.config.set.md +49 -0
  90. package/messages/compute.config.unset.md +39 -0
  91. package/messages/compute.deploy.md +84 -0
  92. package/messages/compute.display.md +46 -0
  93. package/messages/compute.errors.md +182 -0
  94. package/messages/compute.generate.md +74 -0
  95. package/messages/compute.get.build-log.md +36 -0
  96. package/messages/compute.get.runtime-log.md +46 -0
  97. package/messages/compute.list.md +23 -0
  98. package/messages/compute.scale.md +67 -0
  99. package/messages/compute.source.retrieve.md +59 -0
  100. package/messages/compute.tail.runtime-log.md +55 -0
  101. package/npm-shrinkwrap.json +16162 -0
  102. package/oclif.manifest.json +982 -0
  103. package/package.json +117 -0
  104. package/schemas/compute-config-get.json +25 -0
  105. package/schemas/compute-config-list.json +25 -0
  106. package/schemas/compute-config-set.json +28 -0
  107. package/schemas/compute-config-unset.json +28 -0
  108. package/schemas/compute-deploy.json +30 -0
  109. package/schemas/compute-display.json +138 -0
  110. package/schemas/compute-generate.json +40 -0
  111. package/schemas/compute-get-build__log.json +30 -0
  112. package/schemas/compute-get-runtime__log.json +24 -0
  113. package/schemas/compute-list.json +94 -0
  114. package/schemas/compute-scale.json +41 -0
  115. package/schemas/compute-source-retrieve.json +26 -0
  116. package/schemas/compute-tail-runtime__log.json +18 -0
@@ -0,0 +1,59 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Messages } from '@salesforce/core';
17
+ import FormData from 'form-data';
18
+ import { PLUGIN_NAME } from './plugin-name.js';
19
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
20
+ const messages = Messages.loadMessages(PLUGIN_NAME, 'compute.errors');
21
+ // Calls through connection.request() (never raw fetch/got) so token refresh, the
22
+ // caller's chosen API version, and proxy/retry settings all apply -- see
23
+ // api-specs/salesforce-connect-compute.yaml for the resource this wraps.
24
+ export async function uploadComputeSource(connection, params) {
25
+ const form = new FormData();
26
+ form.append('name', params.name);
27
+ form.append('bundle', params.bundle, {
28
+ filename: 'deployment-bundle.tar.gz',
29
+ contentType: 'application/gzip',
30
+ });
31
+ try {
32
+ return await connection.request({
33
+ method: 'POST',
34
+ url: '/connect/compute/source',
35
+ body: form,
36
+ headers: form.getHeaders(),
37
+ });
38
+ }
39
+ catch (error) {
40
+ throw messages.createError('error.connectApiRequestFailed', [error.message]);
41
+ }
42
+ }
43
+ // Speculative resource -- see the Compute tag description in salesforce-connect-compute.yaml.
44
+ // The response body is the same binary deployment-bundle.tar.gz uploadComputeSource sends, so
45
+ // this must round-trip exact bytes. connection.request()'s default string decoding is UTF-8,
46
+ // which is lossy for arbitrary gzip bytes (any byte >0x7F gets re-encoded) -- passing
47
+ // { encoding: 'binary' } (Node's alias for latin1) as the second argument makes jsforce decode
48
+ // the response 1:1 into a string, which Buffer.from(str, 'binary') then turns back into the
49
+ // exact original bytes.
50
+ export async function downloadComputeSource(connection, params) {
51
+ try {
52
+ const body = await connection.request({ method: 'GET', url: `/connect/compute/${encodeURIComponent(params.appIdOrName)}/source` }, { encoding: 'binary' });
53
+ return Buffer.from(body, 'binary');
54
+ }
55
+ catch (error) {
56
+ throw messages.createError('error.sourceDownloadFailed', [error.message]);
57
+ }
58
+ }
59
+ //# sourceMappingURL=computeConnectApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeConnectApi.js","sourceRoot":"","sources":["../../src/shared/computeConnectApi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAkB,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC3D,OAAO,QAAQ,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AAYtE,iFAAiF;AACjF,yEAAyE;AACzE,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,UAAsB,EACtB,MAAiC;IAEjC,MAAM,IAAI,GAAG,IAAI,QAAQ,EAAE,CAAC;IAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE;QACnC,QAAQ,EAAE,0BAA0B;QACpC,WAAW,EAAE,kBAAkB;KAChC,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,OAAO,MAAM,UAAU,CAAC,OAAO,CAAsB;YACnD,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,yBAAyB;YAC9B,IAAI,EAAE,IAAI;YACV,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;SAC3B,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,QAAQ,CAAC,WAAW,CAAC,+BAA+B,EAAE,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1F,CAAC;AACH,CAAC;AAOD,8FAA8F;AAC9F,8FAA8F;AAC9F,6FAA6F;AAC7F,sFAAsF;AACtF,+FAA+F;AAC/F,4FAA4F;AAC5F,wBAAwB;AACxB,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,UAAsB,EACtB,MAAmC;IAEnC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,UAAU,CAAC,OAAO,CACnC,EAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,oBAAoB,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAAC,SAAS,EAAC,EACzF,EAAC,QAAQ,EAAE,QAAQ,EAAC,CACrB,CAAC;QACF,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IACrC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,QAAQ,CAAC,WAAW,CAAC,4BAA4B,EAAE,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IACvF,CAAC;AACH,CAAC"}
@@ -0,0 +1,2 @@
1
+ import type { Language } from './computeGenerateSource.js';
2
+ export declare const GENERATED_SKELETONS: Record<Language, Record<string, string>>;
@@ -0,0 +1,262 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ // These files can't be produced by trimming the fetched upstream copy: the example endpoints
17
+ // they exist to teach (Accounts query, UnitOfWork, Data Cloud webhook) are woven into the
18
+ // route/router registration, the OpenAPI paths, and the README prose, not appended after some
19
+ // boilerplate. Each is authored here instead, modeled on the upstream file it replaces, with a
20
+ // commented worked example showing customers the same idiom the reference app uses. project.toml
21
+ // has no upstream equivalent at all -- those reference repos don't ship one, since they're not
22
+ // built for the Salesforce buildpack pipeline.
23
+ //
24
+ // Applied over whatever the fetch returns for the same path (see buildStarterFiles in
25
+ // commands/compute/generate.ts) -- these always win, regardless of what's in the tarball.
26
+ export const GENERATED_SKELETONS = {
27
+ node: {
28
+ 'project.toml': `[_]
29
+ schema-version = "0.2"
30
+
31
+ [[io.buildpacks.group]]
32
+ id = "heroku/nodejs"
33
+
34
+ [[io.buildpacks.group]]
35
+ id = "heroku/heroku-applink"
36
+
37
+ [[io.buildpacks.group]]
38
+ id = "heroku/procfile"
39
+ `,
40
+ 'api-spec.yaml': `openapi: 3.0.0
41
+ info:
42
+ version: 1.0.0
43
+ title: __APP_NAME__ API
44
+ description: __APP_NAME__ compute app, exposing APIs in Node.js with Fastify to connected Salesforce and Data Cloud orgs.
45
+ servers:
46
+ - url: http://127.0.0.1:3000
47
+ # Add your operations under \`paths\` below - one entry per route registered in
48
+ # src/routes/. Every operation that touches Salesforce data needs an
49
+ # x-sfdc.heroku.authorization block naming the External Client App (and, for
50
+ # elevated access, a session-based Permission Set) that grants it access. For
51
+ # example, matching the /hello route sketched in src/routes/index.js:
52
+ #
53
+ # paths:
54
+ # /hello:
55
+ # get:
56
+ # operationId: Hello
57
+ # x-sfdc:
58
+ # heroku:
59
+ # authorization:
60
+ # externalClientApp: 'MyAppLinkExternalClientApp'
61
+ # responses:
62
+ # '200':
63
+ # description: Successful response
64
+ paths: {}
65
+ `,
66
+ 'src/routes/index.js': `export default async function (_fastify, _opts) {
67
+ // Add your routes here. Every route registered this way automatically gets
68
+ // the Salesforce preHandler from ../plugins/heroku-applink.js, which
69
+ // decodes the invoking org's context onto request.sdk. For example:
70
+ //
71
+ // fastify.get('/hello', async function (request, _reply) {
72
+ // const { context, logger } = request.sdk;
73
+ // const org = context.org;
74
+ //
75
+ // logger.info(\`GET /hello for org \${org.id}\`);
76
+ // const result = await org.dataApi.query('SELECT Id, Name FROM Account LIMIT 1');
77
+ // return result.records.map((rec) => rec.fields);
78
+ // });
79
+ }
80
+ `,
81
+ 'test/routes/healthcheck.test.js': `import { test } from 'tap';
82
+ import { build } from '../helper.js';
83
+
84
+ // Smoke test so \`npm test\` has something to run; add tests for your own routes alongside it.
85
+ test('GET /healthcheck responds OK', async t => {
86
+ const app = await build(t);
87
+
88
+ const response = await app.inject({ method: 'GET', url: '/healthcheck' });
89
+
90
+ t.equal(response.statusCode, 200);
91
+ t.equal(response.payload, 'OK');
92
+ });
93
+ `,
94
+ 'README.md': `# __APP_NAME__
95
+
96
+ Compute app scaffolded by \`sf compute generate --language node\`, built on the
97
+ Heroku AppLink Node.js starter (Fastify).
98
+
99
+ ## Endpoints
100
+
101
+ - \`GET /api-docs\` -- interactive Swagger UI generated from \`api-spec.yaml\`.
102
+ - \`GET /healthcheck\` -- used by the AppLink Service Mesh to check app health.
103
+
104
+ Add your own routes in \`src/routes/index.js\` (see the commented example
105
+ there), and a matching operation in \`api-spec.yaml\` for each one that should
106
+ be published as an External Service.
107
+
108
+ ## Local development
109
+
110
+ \`\`\`
111
+ npm install
112
+ npm run dev
113
+ \`\`\`
114
+
115
+ ## Deploy
116
+
117
+ \`\`\`
118
+ sf compute deploy --target-org <org>
119
+ \`\`\`
120
+ `,
121
+ },
122
+ python: {
123
+ 'project.toml': `[_]
124
+ schema-version = "0.2"
125
+
126
+ [[io.buildpacks.group]]
127
+ id = "heroku/python"
128
+
129
+ [[io.buildpacks.group]]
130
+ id = "heroku/heroku-applink"
131
+
132
+ [[io.buildpacks.group]]
133
+ id = "heroku/procfile"
134
+ `,
135
+ 'api-spec.yaml': `openapi: 3.0.0
136
+ info:
137
+ version: 1.0.0
138
+ title: __APP_NAME__ API
139
+ description: __APP_NAME__ compute app, exposing APIs to connected Salesforce and Data Cloud orgs.
140
+ servers:
141
+ - url: /
142
+ # Add your operations under \`paths\` below - one entry per router mounted on
143
+ # sf_app in app/main.py. Every operation that touches Salesforce data needs
144
+ # an x-sfdc.heroku.authorization block naming the External Client App (and,
145
+ # for elevated access, a session-based Permission Set) that grants it
146
+ # access. For example, matching the /hello router sketched in app/main.py:
147
+ #
148
+ # paths:
149
+ # /api/hello/:
150
+ # get:
151
+ # operationId: Hello
152
+ # x-sfdc:
153
+ # heroku:
154
+ # authorization:
155
+ # externalClientApp: 'MyAppLinkExternalClientApp'
156
+ # responses:
157
+ # '200':
158
+ # description: Successful response
159
+ paths: {}
160
+ `,
161
+ 'app/main.py': `"""
162
+ This module is the main entry point for the __APP_NAME__ compute app.
163
+
164
+ It initializes a main FastAPI application for public endpoints and mounts a
165
+ sub-application for all endpoints that require Salesforce context.
166
+ """
167
+ import heroku_applink as sdk
168
+ from fastapi import FastAPI
169
+ from typing import Dict
170
+ import yaml
171
+
172
+ # --- Protected Salesforce App ---
173
+ # All routers and middleware that require Salesforce context are attached here.
174
+ sf_app = FastAPI()
175
+ sf_app.add_middleware(sdk.IntegrationAsgiMiddleware, config=sdk.Config())
176
+
177
+ # Add your routers here, e.g.:
178
+ #
179
+ # from .routers import hello
180
+ # sf_app.include_router(hello.router, prefix="/hello")
181
+ #
182
+ # Every route on a router mounted on sf_app can call sdk.get_client_context()
183
+ # to read the invoking org's context (context.data_api, context.org, etc.).
184
+
185
+ # --- Main Public App ---
186
+ app = FastAPI(
187
+ title="__APP_NAME__",
188
+ description="Compute app generated by sf compute generate, built on the Heroku AppLink Python starter.",
189
+ version="1.0.0"
190
+ )
191
+
192
+ # Mount the protected Salesforce app at the /api prefix
193
+ app.mount("/api", sf_app)
194
+
195
+ # A webhook (e.g. a Data Cloud Data Action Target) has no invoking-user
196
+ # context, so it's attached directly to the public app instead of sf_app -
197
+ # add app.include_router(...) calls here for that case.
198
+
199
+ # Load the OpenAPI spec and attach it to the main app
200
+ with open("api-spec.yaml", "r") as f:
201
+ openapi_schema = yaml.safe_load(f)
202
+ app.openapi_schema = openapi_schema
203
+
204
+ @app.get("/", summary="Welcome endpoint")
205
+ def read_root() -> Dict[str, str]:
206
+ """
207
+ A welcoming root endpoint that is publicly accessible.
208
+
209
+ :return: A welcome message.
210
+ :rtype: Dict[str, str]
211
+ """
212
+ return {
213
+ "message": "Welcome to __APP_NAME__!",
214
+ "docs_url": "/docs",
215
+ "salesforce_api_prefix": "/api"
216
+ }
217
+
218
+ @app.get("/health", summary="Health check endpoint")
219
+ def get_health() -> Dict[str, str]:
220
+ """
221
+ A simple health check endpoint.
222
+
223
+ :return: A dictionary with a status of "ok".
224
+ :rtype: Dict[str, str]
225
+ """
226
+ return {"status": "ok"}
227
+ `,
228
+ 'README.md': `# __APP_NAME__
229
+
230
+ Compute app scaffolded by \`sf compute generate --language python\`, built on
231
+ the Heroku AppLink Python starter (FastAPI).
232
+
233
+ ## Endpoints
234
+
235
+ - \`GET /\` -- public welcome endpoint.
236
+ - \`GET /health\` -- public health check endpoint.
237
+ - \`GET /docs\` -- interactive Swagger UI generated from \`api-spec.yaml\`.
238
+
239
+ Add your own routers under \`app/routers/\` and mount them on \`sf_app\` in
240
+ \`app/main.py\` (see the commented example there) for any endpoint that needs
241
+ Salesforce context, or on \`app\` directly for a public webhook. Add a
242
+ matching operation in \`api-spec.yaml\` for each one that should be published
243
+ as an External Service.
244
+
245
+ ## Local development
246
+
247
+ \`\`\`
248
+ python -m venv venv
249
+ source venv/bin/activate
250
+ pip install -r requirements.txt
251
+ uvicorn app.main:app --reload
252
+ \`\`\`
253
+
254
+ ## Deploy
255
+
256
+ \`\`\`
257
+ sf compute deploy --target-org <org>
258
+ \`\`\`
259
+ `,
260
+ },
261
+ };
262
+ //# sourceMappingURL=computeGenerateSkeletons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeGenerateSkeletons.js","sourceRoot":"","sources":["../../src/shared/computeGenerateSkeletons.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,6FAA6F;AAC7F,0FAA0F;AAC1F,8FAA8F;AAC9F,+FAA+F;AAC/F,iGAAiG;AACjG,+FAA+F;AAC/F,+CAA+C;AAC/C,EAAE;AACF,sFAAsF;AACtF,0FAA0F;AAC1F,MAAM,CAAC,MAAM,mBAAmB,GAA6C;IAC3E,IAAI,EAAE;QACJ,cAAc,EAAE;;;;;;;;;;;CAWnB;QACG,eAAe,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;CAyBpB;QACG,qBAAqB,EAAE;;;;;;;;;;;;;;CAc1B;QACG,iCAAiC,EAAE;;;;;;;;;;;;CAYtC;QACG,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BhB;KACE;IACD,MAAM,EAAE;QACN,cAAc,EAAE;;;;;;;;;;;CAWnB;QACG,eAAe,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;CAyBpB;QACG,aAAa,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkElB;QACG,WAAW,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BhB;KACE;CACF,CAAC"}
@@ -0,0 +1,8 @@
1
+ export type Language = 'node' | 'python';
2
+ export declare const REFERENCE_APPS: Record<Language, {
3
+ repo: string;
4
+ sha: string;
5
+ sha256: string;
6
+ }>;
7
+ export type FetchTemplateSource = (language: Language) => Promise<Record<string, Buffer>>;
8
+ export declare const fetchTemplateSource: FetchTemplateSource;
@@ -0,0 +1,120 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { getLogger } from '@oclif/core';
17
+ import { Messages } from '@salesforce/core';
18
+ import { createHash } from 'node:crypto';
19
+ import { gunzipSync } from 'node:zlib';
20
+ import tarStream from 'tar-stream';
21
+ import { PLUGIN_NAME } from './plugin-name.js';
22
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
23
+ const messages = Messages.loadMessages(PLUGIN_NAME, 'compute.errors');
24
+ // Gated by DEBUG=sf:compute:generateSource (or DEBUG=*).
25
+ const { debug } = getLogger('sf:compute:generateSource');
26
+ // Pinned by commit SHA (immutable, unlike a branch/tag that can move or be deleted upstream)
27
+ // plus a SHA256 of the exact tarball codeload returns for that SHA -- the only integrity check
28
+ // on this third-party fetch, since the bytes get written directly into the customer's project.
29
+ // Bump both together when moving to a newer upstream commit; get the new checksum with:
30
+ // curl -sL https://codeload.github.com/<repo>/tar.gz/<sha> | sha256sum
31
+ export const REFERENCE_APPS = {
32
+ node: {
33
+ repo: 'heroku-reference-apps/applink-getting-started-nodejs',
34
+ sha: '173aa4a95d1ef412d46c1f27b808103545ac2d7f',
35
+ sha256: '6ca50f2e1345e6c92896617bbda7eec65faa1b126c0b0837696a9e3c0546a877',
36
+ },
37
+ python: {
38
+ repo: 'heroku-reference-apps/applink-getting-started-python',
39
+ sha: '8db54051187f74f341e200a2876a5c47dc1c98c1',
40
+ sha256: '7f6bb119b07dc274b8f2e151e31cca8ba890d8387c5f812b377b3f0b8823d1db',
41
+ },
42
+ };
43
+ // Fetches the pinned commit's tarball over HTTPS (GitHub codeload -- no git CLI, no auth, no
44
+ // git metadata), verifies it against the hardcoded checksum above, then extracts every file
45
+ // entry into memory keyed by its path with the tarball's own "<repo>-<sha>/" prefix stripped.
46
+ // Callers decide per-path which entries to keep verbatim, transform, or discard in favor of a
47
+ // locally authored skeleton file -- see buildStarterFiles in commands/compute/generate.ts.
48
+ export const fetchTemplateSource = async (language) => {
49
+ const { repo, sha, sha256 } = REFERENCE_APPS[language];
50
+ const url = `https://codeload.github.com/${repo}/tar.gz/${sha}`;
51
+ let buffer;
52
+ try {
53
+ const response = await fetch(url);
54
+ if (!response.ok) {
55
+ throw new Error(`HTTP ${response.status}`);
56
+ }
57
+ buffer = Buffer.from(await response.arrayBuffer());
58
+ }
59
+ catch (error) {
60
+ throw messages.createError('error.templateSourceFetchFailed', [language, error.message]);
61
+ }
62
+ const actualSha256 = createHash('sha256').update(buffer).digest('hex');
63
+ if (actualSha256 !== sha256) {
64
+ throw messages.createError('error.templateSourceChecksumMismatch', [language, sha256, actualSha256]);
65
+ }
66
+ const repoName = repo.split('/', 2)[1];
67
+ const prefix = `${repoName}-${sha}/`;
68
+ const entries = await untarGzip(buffer, language);
69
+ debug('fetched %s@%s: %d file entries', repo, sha, Object.keys(entries).length);
70
+ const stripped = {};
71
+ for (const [name, data] of Object.entries(entries)) {
72
+ if (name.startsWith(prefix)) {
73
+ stripped[name.slice(prefix.length)] = data;
74
+ }
75
+ }
76
+ return stripped;
77
+ };
78
+ // Decompress and read every file entry (directory entries are skipped) into memory, keyed by
79
+ // its full in-tarball name. Wraps decompression/parse failures as error.templateSourceMalformed
80
+ // rather than letting a raw zlib/tar-stream error reach the user -- mirrors computeBundle.ts's
81
+ // untarGzip, which establishes the same idiom for the deploy-bundle tarball.
82
+ async function untarGzip(buffer, language) {
83
+ return new Promise((resolveEntries, reject) => {
84
+ let decompressed;
85
+ try {
86
+ decompressed = gunzipSync(buffer);
87
+ }
88
+ catch {
89
+ reject(messages.createError('error.templateSourceMalformed', [language, 'not a valid gzip archive']));
90
+ return;
91
+ }
92
+ const entries = {};
93
+ const extract = tarStream.extract();
94
+ extract.on('entry', (header, stream, next) => {
95
+ if (header.type !== 'file') {
96
+ stream.resume();
97
+ next();
98
+ return;
99
+ }
100
+ const chunks = [];
101
+ stream.on('data', (chunk) => {
102
+ chunks.push(chunk);
103
+ });
104
+ stream.on('end', () => {
105
+ entries[header.name] = Buffer.concat(chunks);
106
+ next();
107
+ });
108
+ stream.on('error', reject);
109
+ stream.resume();
110
+ });
111
+ extract.on('finish', () => {
112
+ resolveEntries(entries);
113
+ });
114
+ extract.on('error', () => {
115
+ reject(messages.createError('error.templateSourceMalformed', [language, 'not a valid tar archive']));
116
+ });
117
+ extract.end(decompressed);
118
+ });
119
+ }
120
+ //# sourceMappingURL=computeGenerateSource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeGenerateSource.js","sourceRoot":"","sources":["../../src/shared/computeGenerateSource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,EAAC,UAAU,EAAC,MAAM,WAAW,CAAC;AACrC,OAAO,SAAS,MAAM,YAAY,CAAC;AAEnC,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AAEtE,yDAAyD;AACzD,MAAM,EAAC,KAAK,EAAC,GAAG,SAAS,CAAC,2BAA2B,CAAC,CAAC;AAIvD,6FAA6F;AAC7F,+FAA+F;AAC/F,+FAA+F;AAC/F,wFAAwF;AACxF,yEAAyE;AACzE,MAAM,CAAC,MAAM,cAAc,GAAkE;IAC3F,IAAI,EAAE;QACJ,IAAI,EAAE,sDAAs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EAAE,CAAC;QACpC,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE;YAC3C,IAAI,MAAM,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;gBAC3B,MAAM,CAAC,MAAM,EAAE,CAAC;gBAChB,IAAI,EAAE,CAAC;gBACP,OAAO;YACT,CAAC;YAED,MAAM,MAAM,GAAa,EAAE,CAAC;YAC5B,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAc,EAAE,EAAE;gBACnC,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;gBACpB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;gBAC7C,IAAI,EAAE,CAAC;YACT,CAAC,CAAC,CAAC;YACH,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YAC3B,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE;YACxB,cAAc,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;YACvB,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,+BAA+B,EAAE,CAAC,QAAQ,EAAE,yBAAyB,CAAC,CAAC,CAAC,CAAC;QACvG,CAAC,CACA,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare function fetchLogplexOutput(logplexUrl: string): Promise<string>;
2
+ export declare function fetchBuildOutputStream(outputStreamUrl: string): Promise<string>;
3
+ export type StreamEndReason = 'aborted' | 'eof';
4
+ export declare function streamLogplexOutput(logplexUrl: string, onLine: (line: string) => void, signal?: AbortSignal): Promise<StreamEndReason>;
@@ -0,0 +1,108 @@
1
+ /*
2
+ * Copyright 2026, Salesforce, Inc.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { Messages } from '@salesforce/core';
17
+ import { PLUGIN_NAME } from './plugin-name.js';
18
+ Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
19
+ const messages = Messages.loadMessages(PLUGIN_NAME, 'compute.errors');
20
+ // logplexUrl/outputStreamUrl are themselves the auth mechanism (short-lived, pre-authorized URLs
21
+ // handed back by a Heroku proxy call) -- these calls are raw fetch against the URL Heroku gave
22
+ // us, not connection.request() (wrong host, no Salesforce bearer token applies) and not a
23
+ // Heroku-token-bearing client (wrong host, no Heroku bearer token held client-side).
24
+ export async function fetchLogplexOutput(logplexUrl) {
25
+ try {
26
+ const response = await fetch(logplexUrl);
27
+ if (!response.ok) {
28
+ throw new Error(`HTTP ${response.status}`);
29
+ }
30
+ return await response.text();
31
+ }
32
+ catch (error) {
33
+ throw messages.createError('error.logStreamFailed', [error.message]);
34
+ }
35
+ }
36
+ // Bounded one-shot fetch, not a stream -- `get build-log` prints one finished-or-in-progress
37
+ // build's log, unlike `tail runtime-log`'s ongoing runtime stream. Explicit Accept: output_stream_url
38
+ // serves either text/plain or text/event-stream, and this call wants the plain-text snapshot.
39
+ export async function fetchBuildOutputStream(outputStreamUrl) {
40
+ try {
41
+ const response = await fetch(outputStreamUrl, { headers: { Accept: 'text/plain' } });
42
+ if (!response.ok) {
43
+ throw new Error(`HTTP ${response.status}`);
44
+ }
45
+ return await response.text();
46
+ }
47
+ catch (error) {
48
+ throw messages.createError('error.buildOutputFetchFailed', [error.message]);
49
+ }
50
+ }
51
+ // Reports whether the stream ended because the server closed it (EOF) or because the caller's
52
+ // AbortSignal fired, rather than leaving the caller to re-derive that from signal.aborted after
53
+ // the fact -- ambient signal state can flip between a natural EOF and a same-instant abort,
54
+ // misattributing one for the other.
55
+ export async function streamLogplexOutput(logplexUrl, onLine, signal) {
56
+ let response;
57
+ try {
58
+ response = await fetch(logplexUrl, { signal });
59
+ }
60
+ catch (error) {
61
+ if (signal?.aborted) {
62
+ return 'aborted';
63
+ }
64
+ throw messages.createError('error.logStreamFailed', [error.message]);
65
+ }
66
+ if (!response.ok) {
67
+ throw messages.createError('error.logStreamFailed', [`HTTP ${response.status}`]);
68
+ }
69
+ if (!response.body) {
70
+ return 'eof';
71
+ }
72
+ // response.body's ReadableStream defaults to the <any> type param, which cascades unsafe-any
73
+ // lint errors through the destructured read() result -- pin it to the byte-stream shape fetch
74
+ // actually returns.
75
+ const reader = response.body.getReader();
76
+ const decoder = new TextDecoder();
77
+ let buffer = '';
78
+ try {
79
+ while (true) {
80
+ // Sequential reads of one ordered stream -- there's nothing to parallelize.
81
+ // eslint-disable-next-line no-await-in-loop
82
+ const { done, value } = await reader.read();
83
+ if (done) {
84
+ break;
85
+ }
86
+ buffer += decoder.decode(value, { stream: true });
87
+ const lines = buffer.split('\n');
88
+ buffer = lines.pop() ?? '';
89
+ for (const line of lines) {
90
+ onLine(line);
91
+ }
92
+ }
93
+ }
94
+ catch (error) {
95
+ if (signal?.aborted) {
96
+ return 'aborted';
97
+ }
98
+ throw messages.createError('error.logStreamFailed', [error.message]);
99
+ }
100
+ // Reaching here means reader.read() resolved with done:true, i.e. a genuine server-side close
101
+ // -- not an abort artifact (an aborted fetch rejects the read instead), so this is unambiguously
102
+ // EOF even if the signal happens to fire in the same tick.
103
+ if (buffer.length > 0) {
104
+ onLine(buffer);
105
+ }
106
+ return 'eof';
107
+ }
108
+ //# sourceMappingURL=computeLogStream.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"computeLogStream.js","sourceRoot":"","sources":["../../src/shared/computeLogStream.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAC,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAE1C,OAAO,EAAC,WAAW,EAAC,MAAM,kBAAkB,CAAC;AAE7C,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AAEtE,iGAAiG;AACjG,+FAA+F;AAC/F,0FAA0F;AAC1F,qFAAqF;AAErF,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,UAAkB;IACzD,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QAC7C,CAAC;QAED,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,QAAQ,CAAC,WAAW,CAAC,uBAAuB,EAAE,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IAClF,CAAC;AACH,CAAC;AAED,6FAA6F;AAC7F,sGAAsG;AACtG,8FAA8F;AAC9F,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,eAAuB;IAClE,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,eAAe,EAAE,EAAC,OAAO,EAAE,EAAC,MAAM,EAAE,YA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M,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;IAClC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,IAAI,CAAC;QACH,OAAO,IAAI,EAAE,CAAC;YACZ,4EAA4E;YAC5E,4CAA4C;YAC5C,MAAM,EAAC,IAAI,EAAE,KAAK,EAAC,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;YAC1C,IAAI,IAAI,EAAE,CAAC;gBACT,MAAM;YACR,CAAC;YAED,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;YAChD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACjC,MAAM,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC;YAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,MAAM,CAAC,IAAI,CAAC,CAAC;YACf,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;YACpB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,MAAM,QAAQ,CAAC,WAAW,CAAC,uBAAuB,EAAE,CAAE,KAAe,CAAC,OAAO,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,8FAA8F;IAC9F,iGAAiG;IACjG,2DAA2D;IAC3D,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,CAAC,MAAM,CAAC,CAAC;IACjB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { type Connection } from '@salesforce/core';
2
+ export type ComputeAppRecord = {
3
+ CurrentBuild: null | {
4
+ BuildCompletedAt: null | string;
5
+ BuildStartedAt: null | string;
6
+ BuildStatus: 'BUILDING' | 'FAILED' | 'PENDING' | 'SUCCEEDED';
7
+ DeployedAt: null | string;
8
+ DeployedBy: null | {
9
+ Username: string;
10
+ };
11
+ Error: null | string;
12
+ ExternalBuildIdentifier?: null | string;
13
+ Id: string;
14
+ };
15
+ Description: null | string;
16
+ DeveloperName: string;
17
+ ExternalAppIdentifier?: null | string;
18
+ ExternalServiceRegistration: null | {
19
+ Id: string;
20
+ IsActive?: boolean;
21
+ };
22
+ Id: string;
23
+ MasterLabel: string;
24
+ Status: 'ACTIVE' | 'DEPLOYING' | 'FAILED';
25
+ StatusReason: null | string;
26
+ };
27
+ export declare function queryComputeApp(connection: Connection, name: string): Promise<ComputeAppRecord>;
28
+ export declare function listComputeApps(connection: Connection): Promise<ComputeAppRecord[]>;
29
+ export type ComputeAppSummary = {
30
+ currentBuild?: {
31
+ buildCompletedAt?: string;
32
+ buildStartedAt?: string;
33
+ buildStatus: 'BUILDING' | 'FAILED' | 'PENDING' | 'SUCCEEDED';
34
+ deployedAt?: string;
35
+ deployedBy?: string;
36
+ error?: string;
37
+ id: string;
38
+ };
39
+ description?: string;
40
+ externalServiceActive?: boolean;
41
+ externalServiceId?: string;
42
+ externalServiceRegistered: boolean;
43
+ id: string;
44
+ masterLabel: string;
45
+ name: string;
46
+ status: 'ACTIVE' | 'DEPLOYING' | 'FAILED';
47
+ statusReason?: string;
48
+ };
49
+ export declare function pickHerokuAppId(record: ComputeAppRecord): string | undefined;
50
+ export declare function requireHerokuAppId(record: ComputeAppRecord, name: string): string;
51
+ export declare function resolveHerokuAppId(connection: Connection, name: string): Promise<string>;
52
+ export declare function toComputeAppSummary(record: ComputeAppRecord): ComputeAppSummary;