@osdk/create-app 2.2.0-beta.9 → 2.2.0-rc.25

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/CHANGELOG.md +66 -0
  2. package/README.md +2 -0
  3. package/build/esm/{esm-HA4JIHHL.js → esm-JF6OCVHP.js} +30 -22
  4. package/build/esm/esm-JF6OCVHP.js.map +1 -0
  5. package/build/esm/{esm-EXZTN5HA.js → esm-KD5U2KOZ.js} +34 -34
  6. package/build/esm/esm-KD5U2KOZ.js.map +1 -0
  7. package/build/esm/{esm-ZXMFAUNZ.js → esm-KU5YPQC2.js} +33 -25
  8. package/build/esm/esm-KU5YPQC2.js.map +1 -0
  9. package/build/esm/{esm-WGBRNOZH.js → esm-M2GWHOD5.js} +22 -17
  10. package/build/esm/esm-M2GWHOD5.js.map +1 -0
  11. package/build/esm/{esm-XWXVWZDN.js → esm-N7ZNHY2Z.js} +33 -25
  12. package/build/esm/esm-N7ZNHY2Z.js.map +1 -0
  13. package/build/esm/{esm-FZSV3C5D.js → esm-O6YHTVZC.js} +56 -62
  14. package/build/esm/esm-O6YHTVZC.js.map +1 -0
  15. package/build/esm/{esm-YVNV3MQG.js → esm-SCLZKD46.js} +33 -25
  16. package/build/esm/esm-SCLZKD46.js.map +1 -0
  17. package/build/esm/{esm-ZDKAQEHX.js → esm-SYKSDJBT.js} +56 -144
  18. package/build/esm/esm-SYKSDJBT.js.map +1 -0
  19. package/build/esm/{esm-WPYEYT7F.js → esm-YK54EMRG.js} +56 -144
  20. package/build/esm/esm-YK54EMRG.js.map +1 -0
  21. package/build/esm/index.js +138 -56
  22. package/build/esm/index.js.map +1 -1
  23. package/build/types/cli.d.ts.map +1 -1
  24. package/build/types/generate/generateEnv.d.ts +4 -2
  25. package/build/types/generate/generateEnv.d.ts.map +1 -1
  26. package/build/types/index.d.ts +1 -1
  27. package/build/types/index.d.ts.map +1 -1
  28. package/build/types/prompts/promptOntologyRid.d.ts +3 -0
  29. package/build/types/prompts/promptOntologyRid.d.ts.map +1 -0
  30. package/build/types/prompts/promptOntologyRid.test.d.ts +1 -0
  31. package/build/types/prompts/promptOntologyRid.test.d.ts.map +1 -0
  32. package/build/types/prompts/promptScopes.test.d.ts +1 -0
  33. package/build/types/prompts/promptScopes.test.d.ts.map +1 -0
  34. package/build/types/prompts/promptTemplate.d.ts +2 -0
  35. package/build/types/prompts/promptTemplate.d.ts.map +1 -1
  36. package/build/types/run.d.ts +2 -1
  37. package/build/types/run.d.ts.map +1 -1
  38. package/package.json +14 -14
  39. package/build/esm/esm-EXZTN5HA.js.map +0 -1
  40. package/build/esm/esm-FZSV3C5D.js.map +0 -1
  41. package/build/esm/esm-HA4JIHHL.js.map +0 -1
  42. package/build/esm/esm-WGBRNOZH.js.map +0 -1
  43. package/build/esm/esm-WPYEYT7F.js.map +0 -1
  44. package/build/esm/esm-XWXVWZDN.js.map +0 -1
  45. package/build/esm/esm-YVNV3MQG.js.map +0 -1
  46. package/build/esm/esm-ZDKAQEHX.js.map +0 -1
  47. package/build/esm/esm-ZXMFAUNZ.js.map +0 -1
@@ -52,7 +52,7 @@ async function promptApplicationUrl({
52
52
  applicationUrl
53
53
  }) {
54
54
  if (skipApplicationUrl) {
55
- return undefined;
55
+ return void 0;
56
56
  }
57
57
  if (applicationUrl == null) {
58
58
  const skip = await consola.prompt(`Do you know the URL your production application will be hosted on? This is required to create a production build of your application with the correct OAuth redirect URL.`, {
@@ -66,7 +66,7 @@ async function promptApplicationUrl({
66
66
  }]
67
67
  });
68
68
  if (skip === "no") {
69
- return undefined;
69
+ return void 0;
70
70
  }
71
71
  }
72
72
  while (applicationUrl == null || !/^https?:\/\//.test(applicationUrl)) {
@@ -127,6 +127,22 @@ ${italic("(Example: https://example.palantirfoundry.com)")}`, {
127
127
  return foundryUrl.replace(/\/$/, "");
128
128
  }
129
129
 
130
+ // src/prompts/promptOntologyRid.ts
131
+ async function promptOntologyRid({
132
+ ontology
133
+ }) {
134
+ while (ontology == null || !/^ri\.ontology\.[^.]+\.ontology\.[^.]+$/.test(ontology)) {
135
+ if (ontology != null) {
136
+ consola.fail("Please enter a valid Ontology resource identifier (rid)");
137
+ }
138
+ ontology = await consola.prompt(`Enter the Ontology resource identifier (rid) associated with your Developer Console:
139
+ ${italic("(Example: ri.ontology.main.ontology.1df1ce4c-f9d2-0f78-a316-287f6ac80bb2)")}`, {
140
+ type: "text"
141
+ });
142
+ }
143
+ return ontology;
144
+ }
145
+
130
146
  // src/prompts/promptOsdkPackage.ts
131
147
  async function promptOsdkPackage({
132
148
  osdkPackage
@@ -214,21 +230,20 @@ var scopeNameRegex = /^[a-zA-Z-_:]+$/;
214
230
  async function promptScopes({
215
231
  scopes
216
232
  }) {
217
- if (scopes == null) {
218
- return undefined;
219
- }
220
233
  while (true) {
221
- const invalidScopes = scopes.filter((scope) => !scopeNameRegex.test(scope));
222
- const allValidScopes = invalidScopes.length === 0;
223
- if (allValidScopes) {
224
- break;
234
+ if (scopes != null) {
235
+ const invalidScopes = scopes.filter((scope) => !scopeNameRegex.test(scope));
236
+ const allValidScopes = invalidScopes.length === 0;
237
+ if (allValidScopes) {
238
+ break;
239
+ }
240
+ const joinedInvalidScopes = invalidScopes.join(", ");
241
+ consola.fail(`Scopes [ ${joinedInvalidScopes} ] are invalid. Scope names can only contain letters, hyphens, underscores, and colons`);
225
242
  }
226
- const joinedInvalidScopes = invalidScopes.join(", ");
227
- consola.fail(`Scopes [ ${joinedInvalidScopes} ] are invalid. Scope names can only contain letters, hyphens, underscores, and colons`);
228
- const stringScopes = await consola.prompt("Scopes:", {
243
+ const stringScopes = await consola.prompt("Enter the scopes to request during OAuth:", {
229
244
  type: "text",
230
- placeholder: "api:read-data api:write-data",
231
- default: "api:read-data api:write-data"
245
+ placeholder: "api:read-data api:write-data api:use-ontologies-read api:use-ontologies-write",
246
+ default: "api:read-data api:write-data api:use-ontologies-read api:use-ontologies-write"
232
247
  });
233
248
  scopes = stringScopes.split(" ");
234
249
  }
@@ -279,9 +294,10 @@ var TEMPLATES = [
279
294
  label: "React",
280
295
  envPrefix: "VITE_",
281
296
  buildDirectory: "./dist",
297
+ hidden: false,
282
298
  files: {
283
- "1.x": getPackageFiles(import('./esm-ZXMFAUNZ.js')),
284
- "2.x": getPackageFiles(import('./esm-FZSV3C5D.js'))
299
+ "1.x": getPackageFiles(import('./esm-KU5YPQC2.js')),
300
+ "2.x": getPackageFiles(import('./esm-O6YHTVZC.js'))
285
301
  }
286
302
  },
287
303
  // Expo
@@ -290,8 +306,9 @@ var TEMPLATES = [
290
306
  label: "Expo",
291
307
  envPrefix: "EXPO_PUBLIC_",
292
308
  buildDirectory: "./dist",
309
+ hidden: false,
293
310
  files: {
294
- "2.x": getPackageFiles(import('./esm-WGBRNOZH.js'))
311
+ "2.x": getPackageFiles(import('./esm-M2GWHOD5.js'))
295
312
  }
296
313
  },
297
314
  // Vue
@@ -300,9 +317,10 @@ var TEMPLATES = [
300
317
  label: "Vue",
301
318
  envPrefix: "VITE_",
302
319
  buildDirectory: "./dist",
320
+ hidden: false,
303
321
  files: {
304
- "1.x": getPackageFiles(import('./esm-HA4JIHHL.js')),
305
- "2.x": getPackageFiles(import('./esm-EXZTN5HA.js'))
322
+ "1.x": getPackageFiles(import('./esm-JF6OCVHP.js')),
323
+ "2.x": getPackageFiles(import('./esm-KD5U2KOZ.js'))
306
324
  }
307
325
  },
308
326
  // Tutorial: To do App
@@ -311,9 +329,10 @@ var TEMPLATES = [
311
329
  label: "Tutorial: To do App",
312
330
  envPrefix: "VITE_",
313
331
  buildDirectory: "./dist",
332
+ hidden: true,
314
333
  files: {
315
- "1.x": getPackageFiles(import('./esm-XWXVWZDN.js')),
316
- "2.x": getPackageFiles(import('./esm-WPYEYT7F.js'))
334
+ "1.x": getPackageFiles(import('./esm-N7ZNHY2Z.js')),
335
+ "2.x": getPackageFiles(import('./esm-YK54EMRG.js'))
317
336
  }
318
337
  },
319
338
  // Tutorial: To do AIP App
@@ -322,9 +341,10 @@ var TEMPLATES = [
322
341
  label: "Tutorial: To do AIP App",
323
342
  envPrefix: "VITE_",
324
343
  buildDirectory: "./dist",
344
+ hidden: true,
325
345
  files: {
326
- "1.x": getPackageFiles(import('./esm-YVNV3MQG.js')),
327
- "2.x": getPackageFiles(import('./esm-ZDKAQEHX.js'))
346
+ "1.x": getPackageFiles(import('./esm-SCLZKD46.js')),
347
+ "2.x": getPackageFiles(import('./esm-SYKSDJBT.js'))
328
348
  }
329
349
  }
330
350
  ];
@@ -334,10 +354,7 @@ async function promptTemplate(parsed) {
334
354
  const useBeta = parsed.beta ?? false;
335
355
  let template = TEMPLATES.find((t) => t.id === parsed.template || t.id === `template-${parsed.template}`);
336
356
  if (template == null) {
337
- const availableTemplates = TEMPLATES.filter((template2) => !template2.hidden && (useBeta ? template2.isBeta === true : !template2.isBeta));
338
- if (availableTemplates.length === 0) {
339
- throw new Error("No available templates found for the selected options.");
340
- }
357
+ const availableTemplates = getAvailableTemplatesOrThrow(useBeta);
341
358
  const templateId = await consola.prompt(parsed.template != null ? `The provided template ${green(parsed.template)} is invalid please select a framework:` : "Select a framework:", {
342
359
  type: "select",
343
360
  options: availableTemplates.map((template2) => ({
@@ -352,6 +369,13 @@ async function promptTemplate(parsed) {
352
369
  }
353
370
  return template;
354
371
  }
372
+ function getAvailableTemplatesOrThrow(useBeta) {
373
+ const availableTemplates = TEMPLATES.filter((template) => !template.hidden && (useBeta ? template.isBeta === true : !template.isBeta));
374
+ if (availableTemplates.length === 0) {
375
+ throw new Error("No available templates found for the selected options.");
376
+ }
377
+ return availableTemplates;
378
+ }
355
379
 
356
380
  // ../generator-utils/build/esm/changeVersionPrefix.js
357
381
  function changeVersionPrefix(version, prefix) {
@@ -373,37 +397,87 @@ function generateEnvDevelopment({
373
397
  envPrefix,
374
398
  foundryUrl,
375
399
  clientId,
376
- corsProxy
400
+ corsProxy,
401
+ ontology
377
402
  }) {
378
- return generateEnv({
379
- envPrefix,
380
- foundryUrl: corsProxy ? "http://localhost:8080" : foundryUrl,
381
- applicationUrl: "http://localhost:8080",
382
- clientId
383
- });
403
+ const foundryApiUrl = corsProxy ? "http://localhost:8080" : foundryUrl;
404
+ const applicationUrl = "http://localhost:8080";
405
+ return `# This env file is intended for developing on your local computer.
406
+ # To set up development in Foundry's Code Workspaces, see .env.code-workspaces.
407
+ # To deploy your application to production, see .env.production.
408
+ # Note that .env.code-workspaces is only present for projects that were set up
409
+ # using the "Bootstrap in Foundry" option in Developer Console.
410
+
411
+
412
+ # This URL is the URL your users will be redirected back to after signing in.
413
+ # This URL must exactly match one of the URLs listed in the "OAuth & scopes"
414
+ # page of Developer Console.
415
+ #
416
+ # If your application in development is not hosted on port 8080, you will need
417
+ # to change this URL here and in Developer Console.
418
+
419
+ ${envPrefix}FOUNDRY_REDIRECT_URL=${applicationUrl}/auth/callback
420
+
421
+
422
+ # This URL is the Foundry host that your OSDK will use. It typically does not
423
+ # need to be changed.
424
+
425
+ ${envPrefix}FOUNDRY_API_URL=${foundryApiUrl}
426
+
427
+
428
+ # This client ID must match the client ID given on the "OAuth & scopes" page of
429
+ # Developer Console. It typically does not need to be changed.
430
+
431
+ ${envPrefix}FOUNDRY_CLIENT_ID=${clientId}
432
+
433
+ # This Ontology RID must match the Ontology RID your Developer Console is associated with.
434
+ # You can check the Ontology on the "Data Resources" page of Developer Console.
435
+ # It typically does not need to be changed.
436
+
437
+ ${envPrefix}FOUNDRY_ONTOLOGY_RID=${ontology}
438
+ `;
384
439
  }
385
440
  function generateEnvProduction({
386
441
  envPrefix,
387
442
  foundryUrl,
388
443
  applicationUrl,
389
- clientId
390
- }) {
391
- return generateEnv({
392
- envPrefix,
393
- foundryUrl,
394
- applicationUrl,
395
- clientId
396
- });
397
- }
398
- function generateEnv({
399
- envPrefix,
400
- foundryUrl,
401
- applicationUrl,
402
- clientId
444
+ clientId,
445
+ ontology
403
446
  }) {
404
- return `${envPrefix}FOUNDRY_API_URL=${foundryUrl}
405
- ${applicationUrl == null ? "# " : ""}${envPrefix}FOUNDRY_REDIRECT_URL=${applicationUrl ?? "<Fill in the domain at which you deploy your application>"}/auth/callback
447
+ const applicationUrlOrDefault = applicationUrl ?? "<Fill in the domain at which you deploy your application>";
448
+ return `# This env file is intended for deploying your application to production.
449
+ # To set up development on your local computer, see .env.development.
450
+ # To set up development in Foundry's Code Workspaces, see .env.code-workspaces.
451
+ # Note that .env.code-workspaces is only present for projects that were set up
452
+ # using the "Bootstrap in Foundry" option in Developer Console.
453
+
454
+
455
+ # This URL is the URL your users will be redirected back to after signing in.
456
+ # This URL must exactly match one of the URLs listed in the "OAuth & scopes"
457
+ # page of Developer Console.
458
+ #
459
+ # If you change where your application is hosted, you will need to change this
460
+ # URL here and in Developer Console.
461
+
462
+ ${applicationUrl == null ? "# " : ""}${envPrefix}FOUNDRY_REDIRECT_URL=${applicationUrlOrDefault}/auth/callback
463
+
464
+
465
+ # This URL is the Foundry host that your OSDK will use. It typically does not
466
+ # need to be changed.
467
+
468
+ ${envPrefix}FOUNDRY_API_URL=${foundryUrl}
469
+
470
+
471
+ # This client ID must match the client ID given on the "OAuth & scopes" page of
472
+ # Developer Console. It typically does not need to be changed.
473
+
406
474
  ${envPrefix}FOUNDRY_CLIENT_ID=${clientId}
475
+
476
+ # This Ontology RID must match the Ontology RID your Developer Console is associated with.
477
+ # You can check the Ontology on the "Data Resources" page of Developer Console.
478
+ # It typically does not need to be changed.
479
+
480
+ ${envPrefix}FOUNDRY_ONTOLOGY_RID=${ontology}
407
481
  `;
408
482
  }
409
483
 
@@ -448,6 +522,7 @@ async function run({
448
522
  foundryUrl,
449
523
  applicationUrl,
450
524
  application,
525
+ ontology,
451
526
  clientId,
452
527
  osdkPackage,
453
528
  osdkRegistryUrl,
@@ -493,8 +568,8 @@ async function run({
493
568
  const ourPackageJsonPath = findUpSync("package.json", {
494
569
  cwd: fileURLToPath(import.meta.url)
495
570
  });
496
- ourPackageJsonPath ? JSON.parse(fs2.readFileSync(ourPackageJsonPath, "utf-8")).version : undefined;
497
- const clientVersion = "2.2.0-beta.9";
571
+ ourPackageJsonPath ? JSON.parse(fs2.readFileSync(ourPackageJsonPath, "utf-8")).version : void 0;
572
+ const clientVersion = "2.2.0-rc.25";
498
573
  const templateContext = {
499
574
  project,
500
575
  foundryUrl,
@@ -533,14 +608,16 @@ async function run({
533
608
  envPrefix: template.envPrefix,
534
609
  foundryUrl,
535
610
  clientId,
536
- corsProxy
611
+ corsProxy,
612
+ ontology
537
613
  });
538
614
  fs2.writeFileSync(path2.join(root, ".env.development"), envDevelopment);
539
615
  const envProduction = generateEnvProduction({
540
616
  envPrefix: template.envPrefix,
541
617
  foundryUrl,
542
618
  applicationUrl,
543
- clientId
619
+ clientId,
620
+ ontology
544
621
  });
545
622
  fs2.writeFileSync(path2.join(root, ".env.production"), envProduction);
546
623
  const foundryConfigJson = generateFoundryConfigJson({
@@ -568,7 +645,7 @@ async function run({
568
645
 
569
646
  // src/cli.ts
570
647
  async function cli(args = process.argv) {
571
- const base = yargs(hideBin(args)).version("2.2.0-beta.9").wrap(Math.min(150, yargs().terminalWidth())).strict().help().command("$0 [project] [--<option>]", "Create a new OSDK application based on framework templates. Information may be provided through options to skip interactive prompts.", (yargs2) => yargs2.positional("project", {
648
+ const base = yargs(hideBin(args)).version("2.2.0-rc.25").wrap(Math.min(150, yargs().terminalWidth())).strict().help().command("$0 [project] [--<option>]", "Create a new OSDK application based on framework templates. Information may be provided through options to skip interactive prompts.", (yargs2) => yargs2.positional("project", {
572
649
  type: "string",
573
650
  describe: "Project name to create"
574
651
  }).option("overwrite", {
@@ -596,6 +673,9 @@ async function cli(args = process.argv) {
596
673
  }).option("application", {
597
674
  type: "string",
598
675
  describe: "Application resource identifier (rid)"
676
+ }).option("ontology", {
677
+ type: "string",
678
+ describe: "Ontology resource identifier (rid)"
599
679
  }).option("clientId", {
600
680
  type: "string",
601
681
  describe: "OAuth client ID for application"
@@ -627,6 +707,7 @@ async function cli(args = process.argv) {
627
707
  const foundryUrl = await promptFoundryUrl(parsed);
628
708
  const applicationUrl = await promptApplicationUrl(parsed);
629
709
  const application = await promptApplicationRid(parsed);
710
+ const ontology = await promptOntologyRid(parsed);
630
711
  const clientId = await promptClientId(parsed);
631
712
  const osdkPackage = await promptOsdkPackage(parsed);
632
713
  const osdkRegistryUrl = await promptOsdkRegistryUrl(parsed);
@@ -644,7 +725,8 @@ async function cli(args = process.argv) {
644
725
  osdkPackage,
645
726
  osdkRegistryUrl,
646
727
  corsProxy,
647
- scopes
728
+ scopes,
729
+ ontology
648
730
  });
649
731
  }
650
732
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/consola.ts","../../src/highlight.ts","../../src/prompts/promptApplicationRid.ts","../../src/prompts/promptApplicationUrl.ts","../../src/prompts/promptClientId.ts","../../src/prompts/promptCorsProxy.ts","../../src/prompts/promptFoundryUrl.ts","../../src/prompts/promptOsdkPackage.ts","../../src/prompts/promptOsdkRegistryUrl.ts","../../src/prompts/promptOverwrite.ts","../../src/prompts/promptProject.ts","../../src/prompts/promptScopes.ts","../../src/prompts/promptSdkVersion.ts","../../src/getPackageFiles.ts","../../src/generatedNoCheck/templates.ts","../../src/prompts/promptTemplate.ts","../../../generator-utils/build/esm/changeVersionPrefix.js","../../../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","../../src/generate/generateEnv.ts","../../src/generate/generateFoundryConfigJson.ts","../../src/generate/generateNpmRc.ts","../../src/run.ts","../../src/cli.ts"],"names":["defaultConsola","fs","path","sdkVersion","template","yargs"],"mappings":";;;;;;;;;;;AAmBA,IAAM,YAAA,GAAe,MAAO,CAAA,GAAA,CAAI,QAAQ,CAAA;AACjC,IAAM,UAAU,aAAc,CAAA;AAAA,EACnC,MAAM,MAAO,CAAA,OAAA,EAAS,IAAM,EAAA;AAC1B,IAAA,MAAM,QAAW,GAAA,MAAMA,SAAe,CAAA,MAAA,CAAO,OAAS,EAAA;AAAA,MACpD,GAAG,IAAA;AAAA,MACH,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,QAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH","file":"index.js","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola as defaultConsola, createConsola } from \"consola\";\n\n// https://github.com/unjs/consola?tab=readme-ov-file#await-promptmessage--type-cancel-\nconst cancelSymbol = Symbol.for(\"cancel\");\nexport const consola = createConsola({\n async prompt(message, opts) {\n const response = await defaultConsola.prompt(message, {\n ...opts,\n cancel: opts?.cancel ?? \"symbol\"\n });\n if (response === cancelSymbol) {\n defaultConsola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n return response;\n }\n});","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { colorize } from \"consola/utils\";\nexport function green(text) {\n return colorize(\"green\", text);\n}\nexport function italic(text) {\n return colorize(\"italic\", text);\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptApplicationRid({\n application\n}) {\n while (application == null || !/^ri\\.third-party-applications\\.[^.]+\\.application\\.[^.]+$/.test(application)) {\n if (application != null) {\n consola.fail(\"Please enter a valid application resource identifier (rid)\");\n }\n application = await consola.prompt(`Enter the application resource identifier (rid) for your application from Developer Console:\\n${italic(\"(Example: ri.third-party-applications.main.application.1c66b352-4e00-40d2-995d-061c9d533ace)\")}`, {\n type: \"text\"\n });\n }\n return application;\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptApplicationUrl({\n skipApplicationUrl,\n applicationUrl\n}) {\n if (skipApplicationUrl) {\n return undefined;\n }\n if (applicationUrl == null) {\n const skip = await consola.prompt(`Do you know the URL your production application will be hosted on? This is required to create a production build of your application with the correct OAuth redirect URL.`, {\n type: \"select\",\n options: [{\n label: \"Yes, let me fill it here\",\n value: \"yes\"\n }, {\n label: \"No, I will fill it in later following the instructions in the generated README\",\n value: \"no\"\n }]\n });\n if (skip === \"no\") {\n return undefined;\n }\n }\n while (applicationUrl == null || !/^https?:\\/\\//.test(applicationUrl)) {\n if (applicationUrl != null) {\n consola.fail(\"Please enter a valid application URL\");\n }\n applicationUrl = await consola.prompt(`Enter the URL your production application will be hosted on:\\n${italic(\"(Example: https://myapp.example.palantirfoundry.com)\")}`, {\n type: \"text\"\n });\n }\n return applicationUrl.replace(/\\/$/, \"\");\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptClientId({\n clientId\n}) {\n while (clientId == null || !/^[0-9a-f]+$/.test(clientId)) {\n if (clientId != null) {\n consola.fail(\"Please enter a valid OAuth client ID\");\n }\n clientId = await consola.prompt(`Enter the OAuth client ID for your application from Developer Console:\\n${italic(\"(Example: 2650385ab6c5e0df3b44aff776b00a42)\")}`, {\n type: \"text\"\n });\n }\n return clientId;\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptCorsProxy({\n corsProxy\n}) {\n if (corsProxy != null) {\n return corsProxy;\n }\n return consola.prompt(`Include a CORS proxy for Foundry API requests during local development?\\n${italic(\"This is required if your enrollment has not allowed localhost for CORS.\")}`, {\n type: \"confirm\",\n initial: false\n });\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptFoundryUrl({\n foundryUrl\n}) {\n while (foundryUrl == null || !foundryUrl.startsWith(\"https://\")) {\n if (foundryUrl != null) {\n consola.fail(\"Please enter a valid Foundry URL\");\n }\n foundryUrl = await consola.prompt(`Enter the URL for your Foundry stack:\\n${italic(\"(Example: https://example.palantirfoundry.com)\")}`, {\n type: \"text\"\n });\n }\n return foundryUrl.replace(/\\/$/, \"\");\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptOsdkPackage({\n osdkPackage\n}) {\n while (osdkPackage == null || !/^@[a-z0-9-]+\\/sdk$/.test(osdkPackage)) {\n if (osdkPackage != null) {\n consola.fail(\"Please enter a valid OSDK package name\");\n }\n osdkPackage = await consola.prompt(`Enter the OSDK package name for your application from Developer Console:\\n${italic(\"(Example: @my-app/sdk)\")}`, {\n type: \"text\"\n });\n }\n return osdkPackage;\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptOsdkRegistryUrl({\n osdkRegistryUrl\n}) {\n while (osdkRegistryUrl == null || !/^https:\\/\\/[^/]+\\/artifacts\\/api\\/repositories\\/ri\\.artifacts\\.[^/]+\\/contents\\/release\\/npm\\/?$/.test(osdkRegistryUrl)) {\n if (osdkRegistryUrl != null) {\n consola.fail(\"Please enter a valid NPM registry URL to install your OSDK package\");\n }\n osdkRegistryUrl = await consola.prompt(`Enter the NPM registry URL to install your OSDK package from Developer Console:\\n${italic(\"(Example: https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.a4a7fe1c-486f-4226-b706-7b90005f527d/contents/release/npm)\")}`, {\n type: \"text\"\n });\n }\n return osdkRegistryUrl.replace(/\\/$/, \"\");\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { consola } from \"../consola.js\";\nimport { green } from \"../highlight.js\";\nexport async function promptOverwrite({\n project,\n overwrite\n}) {\n if (overwrite != null) {\n return overwrite;\n }\n if (!fs.existsSync(path.join(process.cwd(), project))) {\n return true;\n }\n const result = await consola.prompt(`The directory ${green(project)} already exists do you want to overwrite or ignore it?`, {\n type: \"select\",\n options: [{\n label: \"Remove existing files and continue\",\n value: \"overwrite\"\n }, {\n label: \"Ignore files and continue\",\n value: \"ignore\"\n }, {\n label: \"Cancel\",\n value: \"cancel\"\n }]\n });\n switch (result) {\n case \"overwrite\":\n return true;\n case \"ignore\":\n return false;\n case \"cancel\":\n consola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nexport async function promptProject({\n project\n}) {\n while (project == null || !/^[a-zA-Z0-9-_]+$/.test(project)) {\n if (project != null) {\n consola.fail(\"Project name can only contain alphanumeric characters, hyphens and underscores\");\n }\n project = await consola.prompt(\"Project name:\", {\n type: \"text\",\n placeholder: \"my-osdk-app\",\n default: \"my-osdk-app\"\n });\n }\n return project;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nconst scopeNameRegex = /^[a-zA-Z-_:]+$/;\nexport async function promptScopes({\n scopes\n}) {\n if (scopes == null) {\n return undefined;\n }\n while (true) {\n const invalidScopes = scopes.filter(scope => !scopeNameRegex.test(scope));\n const allValidScopes = invalidScopes.length === 0;\n if (allValidScopes) {\n break;\n }\n const joinedInvalidScopes = invalidScopes.join(\", \");\n consola.fail(`Scopes [ ${joinedInvalidScopes} ] are invalid. Scope names can only contain letters, hyphens, underscores, and colons`);\n const stringScopes = await consola.prompt(\"Scopes:\", {\n type: \"text\",\n placeholder: \"api:read-data api:write-data\",\n default: \"api:read-data api:write-data\"\n });\n scopes = stringScopes.split(\" \");\n }\n return deduplicateScopes(scopes);\n}\n\n// Preserving the originally specified scope order\nfunction deduplicateScopes(scopes) {\n const dedupedScopes = [];\n const seen = new Set();\n for (const scope of scopes) {\n if (seen.has(scope)) {\n continue;\n }\n dedupedScopes.push(scope);\n seen.add(scope);\n }\n return dedupedScopes;\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nexport async function promptSdkVersion({\n sdkVersion,\n template\n}) {\n if (sdkVersion == null) {\n // If the SDK version is not provided, default to the earliest template version for backwards-compatibility\n return Object.keys(template.files)[0];\n }\n if (template.files[sdkVersion] == null) {\n consola.fail(`The ${template.label} template does not support a \"${sdkVersion}\" SDK version.`);\n sdkVersion = await consola.prompt(`Please choose which version of the OSDK you'd like to use for the ${template.label} template:`, {\n type: \"select\",\n options: Object.keys(template.files).reverse().map(sdkVersion => ({\n label: sdkVersion,\n value: sdkVersion\n }))\n });\n }\n return sdkVersion;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const getPackageFiles = importPromise => async () => (await importPromise).files;","// THIS FILE IS GENERATED. DO NOT MODIFY.\n// You probably want to modify ../../../codegen.mjs instead.\n\nimport { getPackageFiles } from \"../getPackageFiles.js\";\nexport const TEMPLATES = [\n// React\n{\n id: \"template-react\",\n label: \"React\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n files: {\n \"1.x\": getPackageFiles(import(\"@osdk/create-app.template.react\")),\n \"2.x\": getPackageFiles(import(\"@osdk/create-app.template.react.beta\"))\n }\n},\n// Expo\n{\n id: \"template-expo\",\n label: \"Expo\",\n envPrefix: \"EXPO_PUBLIC_\",\n buildDirectory: \"./dist\",\n files: {\n \"2.x\": getPackageFiles(import(\"@osdk/create-app.template.expo.v2\"))\n }\n},\n// Vue\n{\n id: \"template-vue\",\n label: \"Vue\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n files: {\n \"1.x\": getPackageFiles(import(\"@osdk/create-app.template.vue\")),\n \"2.x\": getPackageFiles(import(\"@osdk/create-app.template.vue.v2\"))\n }\n},\n// Tutorial: To do App\n{\n id: \"template-tutorial-todo-app\",\n label: \"Tutorial: To do App\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n files: {\n \"1.x\": getPackageFiles(import(\"@osdk/create-app.template.tutorial-todo-app\")),\n \"2.x\": getPackageFiles(import(\"@osdk/create-app.template.tutorial-todo-app.beta\"))\n }\n},\n// Tutorial: To do AIP App\n{\n id: \"template-tutorial-todo-aip-app\",\n label: \"Tutorial: To do AIP App\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n files: {\n \"1.x\": getPackageFiles(import(\"@osdk/create-app.template.tutorial-todo-aip-app\")),\n \"2.x\": getPackageFiles(import(\"@osdk/create-app.template.tutorial-todo-aip-app.beta\"))\n }\n}];","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { TEMPLATES } from \"../generatedNoCheck/templates.js\";\nimport { green } from \"../highlight.js\";\nexport async function promptTemplate(parsed) {\n const useBeta = parsed.beta ?? false;\n let template = TEMPLATES.find(t => t.id === parsed.template || t.id === `template-${parsed.template}`);\n if (template == null) {\n const availableTemplates = TEMPLATES.filter(template => !template.hidden && (useBeta ? template.isBeta === true\n // isBeta could be null\n : !template.isBeta));\n if (availableTemplates.length === 0) {\n throw new Error(\"No available templates found for the selected options.\");\n }\n const templateId = await consola.prompt(parsed.template != null ? `The provided template ${green(parsed.template)} is invalid please select a framework:` : \"Select a framework:\", {\n type: \"select\",\n options: availableTemplates.map(template => ({\n value: template.id,\n label: template.label\n }))\n });\n template = TEMPLATES.find(t => t.id === templateId);\n if (template == null) {\n throw new Error(`Template ${templateId} should be found`);\n }\n }\n return template;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function changeVersionPrefix(version, prefix) {\n const isWorkspaceProtocol = version.startsWith(\"workspace:\");\n if (isWorkspaceProtocol) {\n version = version.slice(\"workspace:\".length);\n }\n if (version[0] === \"^\" || version[0] === \"~\" || version[0] === \"*\") {\n version = version.slice(1);\n }\n return `${isWorkspaceProtocol ? \"workspace:\" : \"\"}${prefix}${version}`;\n}","var isProduction = process.env.NODE_ENV === 'production';\nvar prefix = 'Invariant failed';\nfunction invariant(condition, message) {\n if (condition) {\n return;\n }\n if (isProduction) {\n throw new Error(prefix);\n }\n var provided = typeof message === 'function' ? message() : message;\n var value = provided ? \"\".concat(prefix, \": \").concat(provided) : prefix;\n throw new Error(value);\n}\nexport { invariant as default };","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function generateEnvDevelopment({\n envPrefix,\n foundryUrl,\n clientId,\n corsProxy\n}) {\n return generateEnv({\n envPrefix,\n foundryUrl: corsProxy ? \"http://localhost:8080\" : foundryUrl,\n applicationUrl: \"http://localhost:8080\",\n clientId\n });\n}\nexport function generateEnvProduction({\n envPrefix,\n foundryUrl,\n applicationUrl,\n clientId\n}) {\n return generateEnv({\n envPrefix,\n foundryUrl,\n applicationUrl,\n clientId\n });\n}\nfunction generateEnv({\n envPrefix,\n foundryUrl,\n applicationUrl,\n clientId\n}) {\n return `${envPrefix}FOUNDRY_API_URL=${foundryUrl}\\n` + `${applicationUrl == null ? \"# \" : \"\"}${envPrefix}FOUNDRY_REDIRECT_URL=${applicationUrl ?? \"<Fill in the domain at which you deploy your application>\"}/auth/callback\\n` + `${envPrefix}FOUNDRY_CLIENT_ID=${clientId}\\n`;\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function generateFoundryConfigJson({\n foundryUrl,\n application,\n directory\n}) {\n return JSON.stringify({\n foundryUrl,\n site: {\n application,\n directory,\n autoVersion: {\n type: \"git-describe\",\n tagPrefix: \"\"\n }\n }\n }, null, 2) + \"\\n\";\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function generateNpmRc({\n osdkPackage,\n osdkRegistryUrl\n}) {\n // pnpm requires a trailing slash in .npmrc\n // https://github.com/pnpm/pnpm/issues/5941\n const withTrailingSlash = osdkRegistryUrl.endsWith(\"/\") ? osdkRegistryUrl : osdkRegistryUrl + \"/\";\n const withoutProtocol = withTrailingSlash.replace(/^https:\\/\\//, \"\");\n const packageScope = osdkPackage.split(\"/\")[0];\n return `//${withoutProtocol}:_authToken=\\${FOUNDRY_TOKEN}\\n` + `${packageScope}:registry=${withTrailingSlash}\\n`;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { changeVersionPrefix } from \"@osdk/generator-utils\";\nimport { findUpSync } from \"find-up\";\nimport Handlebars from \"handlebars\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { consola } from \"./consola.js\";\nimport { generateEnvDevelopment, generateEnvProduction } from \"./generate/generateEnv.js\";\nimport { generateFoundryConfigJson } from \"./generate/generateFoundryConfigJson.js\";\nimport { generateNpmRc } from \"./generate/generateNpmRc.js\";\nimport { green } from \"./highlight.js\";\nexport async function run({\n project,\n overwrite,\n template,\n sdkVersion,\n foundryUrl,\n applicationUrl,\n application,\n clientId,\n osdkPackage,\n osdkRegistryUrl,\n corsProxy,\n scopes\n}) {\n consola.log(\"\");\n consola.start(`Creating project ${green(project)} using template ${green(template.id)}`);\n const cwd = process.cwd();\n const root = path.join(cwd, project);\n if (fs.existsSync(root)) {\n if (overwrite) {\n consola.info(`Overwriting existing project directory`);\n fs.rmSync(root, {\n recursive: true,\n force: true\n });\n fs.mkdirSync(root, {\n recursive: true\n });\n } else {\n consola.info(`Reusing existing project directory`);\n }\n } else {\n consola.info(`Creating project directory`);\n fs.mkdirSync(root, {\n recursive: true\n });\n }\n consola.info(`Copying files into project directory`);\n if (template.files[sdkVersion] == null) {\n throw new Error(`The ${template.label} template does not support a \"${sdkVersion}\" SDK version.`);\n }\n const files = await template.files[sdkVersion]();\n for (const [filePath, contents] of files) {\n const finalPath = path.join(root, filePath);\n const dirPath = path.dirname(finalPath);\n await fs.promises.mkdir(dirPath, {\n recursive: true\n });\n await fs.promises.writeFile(finalPath, Buffer.from(contents.body, contents.type === \"raw\" ? \"utf-8\" : \"base64\"));\n }\n const ourPackageJsonPath = findUpSync(\"package.json\", {\n cwd: fileURLToPath(import.meta.url)\n });\n const ourPackageJsonVersion = ourPackageJsonPath ? JSON.parse(fs.readFileSync(ourPackageJsonPath, \"utf-8\")).version : undefined;\n const clientVersion = process.env.PACKAGE_CLIENT_VERSION ?? ourPackageJsonVersion;\n if (clientVersion === undefined) {\n throw new Error(\"Could not determine current @osdk/client version\");\n }\n const templateContext = {\n project,\n foundryUrl,\n osdkPackage,\n corsProxy,\n clientVersion: changeVersionPrefix(clientVersion, \"^\"),\n scopes\n };\n const processFiles = function (dir) {\n fs.readdirSync(dir).forEach(function (file) {\n file = dir + \"/\" + file;\n const stat = fs.statSync(file);\n if (stat.isDirectory()) {\n processFiles(file);\n return;\n }\n if (file.endsWith(\"/_gitignore\")) {\n fs.renameSync(file, file.replace(/\\/_gitignore$/, \"/.gitignore\"));\n return;\n }\n if (!file.endsWith(\".hbs\")) {\n return;\n }\n const templated = Handlebars.compile(fs.readFileSync(file, \"utf-8\"))(templateContext);\n fs.writeFileSync(file.replace(/.hbs$/, \"\"), templated);\n fs.rmSync(file);\n });\n };\n processFiles(root);\n const npmRc = generateNpmRc({\n osdkPackage,\n osdkRegistryUrl\n });\n fs.writeFileSync(path.join(root, \".npmrc\"), npmRc);\n const envDevelopment = generateEnvDevelopment({\n envPrefix: template.envPrefix,\n foundryUrl,\n clientId,\n corsProxy\n });\n fs.writeFileSync(path.join(root, \".env.development\"), envDevelopment);\n const envProduction = generateEnvProduction({\n envPrefix: template.envPrefix,\n foundryUrl,\n applicationUrl,\n clientId\n });\n fs.writeFileSync(path.join(root, \".env.production\"), envProduction);\n const foundryConfigJson = generateFoundryConfigJson({\n foundryUrl,\n application,\n directory: template.buildDirectory\n });\n fs.writeFileSync(path.join(root, \"foundry.config.json\"), foundryConfigJson);\n consola.success(\"Success\");\n const cdRelative = path.relative(cwd, root);\n consola.box({\n message: `Done! Run the following commands to get started:\\n` + `\\n` + ` \\`cd ${cdRelative}\\`\\n` + ` \\`export FOUNDRY_TOKEN=<token>\\`\\n` + ` \\`npm install\\`\\n` + ` \\`npm run dev\\``,\n style: {\n padding: 2,\n borderColor: \"green\",\n borderStyle: \"rounded\"\n }\n });\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { promptApplicationRid } from \"./prompts/promptApplicationRid.js\";\nimport { promptApplicationUrl } from \"./prompts/promptApplicationUrl.js\";\nimport { promptClientId } from \"./prompts/promptClientId.js\";\nimport { promptCorsProxy } from \"./prompts/promptCorsProxy.js\";\nimport { promptFoundryUrl } from \"./prompts/promptFoundryUrl.js\";\nimport { promptOsdkPackage } from \"./prompts/promptOsdkPackage.js\";\nimport { promptOsdkRegistryUrl } from \"./prompts/promptOsdkRegistryUrl.js\";\nimport { promptOverwrite } from \"./prompts/promptOverwrite.js\";\nimport { promptProject } from \"./prompts/promptProject.js\";\nimport { promptScopes } from \"./prompts/promptScopes.js\";\nimport { promptSdkVersion } from \"./prompts/promptSdkVersion.js\";\nimport { promptTemplate } from \"./prompts/promptTemplate.js\";\nimport { run } from \"./run.js\";\nexport async function cli(args = process.argv) {\n const base = yargs(hideBin(args)).version(process.env.PACKAGE_VERSION ?? \"\").wrap(Math.min(150, yargs().terminalWidth())).strict().help().command(\"$0 [project] [--<option>]\", \"Create a new OSDK application based on framework templates. Information may be provided through options to skip interactive prompts.\", yargs => yargs.positional(\"project\", {\n type: \"string\",\n describe: \"Project name to create\"\n }).option(\"overwrite\", {\n type: \"boolean\",\n describe: \"Overwrite project directory if already exists\"\n }).option(\"beta\", {\n type: \"boolean\",\n describe: \"Use templates compatible with the Beta version of the SDK\"\n }).option(\"template\", {\n type: \"string\",\n describe: \"Template name to use\"\n }).option(\"sdkVersion\", {\n type: \"string\",\n describe: \"The OSDK version to use\"\n }).option(\"foundryUrl\", {\n type: \"string\",\n describe: \"URL for the Foundry stack\"\n }).option(\"applicationUrl\", {\n type: \"string\",\n describe: \"URL the production application will be hosted on\",\n conflicts: \"skipApplicationUrl\"\n }).option(\"skipApplicationUrl\", {\n type: \"boolean\",\n describe: \"Skip filling in URL the production application will be hosted on\"\n }).option(\"application\", {\n type: \"string\",\n describe: \"Application resource identifier (rid)\"\n }).option(\"clientId\", {\n type: \"string\",\n describe: \"OAuth client ID for application\"\n }).option(\"osdkPackage\", {\n type: \"string\",\n describe: \"OSDK package name for application\"\n }).option(\"osdkRegistryUrl\", {\n type: \"string\",\n describe: \"URL for NPM registry to install OSDK package\"\n }).option(\"corsProxy\", {\n type: \"boolean\",\n describe: \"Include a CORS proxy for Foundry API requests during local development\"\n }).option(\"scopes\", {\n type: \"string\",\n array: true,\n describe: \"List of client-side scopes to be used when creating a client\"\n }));\n const parsed = base.parseSync();\n const project = await promptProject(parsed);\n const overwrite = await promptOverwrite({\n ...parsed,\n project\n });\n const template = await promptTemplate(parsed);\n const sdkVersion = await promptSdkVersion({\n ...parsed,\n template\n });\n const foundryUrl = await promptFoundryUrl(parsed);\n const applicationUrl = await promptApplicationUrl(parsed);\n const application = await promptApplicationRid(parsed);\n const clientId = await promptClientId(parsed);\n const osdkPackage = await promptOsdkPackage(parsed);\n const osdkRegistryUrl = await promptOsdkRegistryUrl(parsed);\n const corsProxy = await promptCorsProxy(parsed);\n const scopes = await promptScopes(parsed);\n await run({\n project,\n overwrite,\n template,\n sdkVersion,\n foundryUrl,\n applicationUrl,\n application,\n clientId,\n osdkPackage,\n osdkRegistryUrl,\n corsProxy,\n scopes\n });\n}"]}
1
+ {"version":3,"sources":["../../src/consola.ts","../../src/highlight.ts","../../src/prompts/promptApplicationRid.ts","../../src/prompts/promptApplicationUrl.ts","../../src/prompts/promptClientId.ts","../../src/prompts/promptCorsProxy.ts","../../src/prompts/promptFoundryUrl.ts","../../src/prompts/promptOntologyRid.ts","../../src/prompts/promptOsdkPackage.ts","../../src/prompts/promptOsdkRegistryUrl.ts","../../src/prompts/promptOverwrite.ts","../../src/prompts/promptProject.ts","../../src/prompts/promptScopes.ts","../../src/prompts/promptSdkVersion.ts","../../src/getPackageFiles.ts","../../src/generatedNoCheck/templates.ts","../../src/prompts/promptTemplate.ts","../../../generator-utils/build/esm/changeVersionPrefix.js","../../../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js","../../src/generate/generateEnv.ts","../../src/generate/generateFoundryConfigJson.ts","../../src/generate/generateNpmRc.ts","../../src/run.ts","../../src/cli.ts"],"names":["defaultConsola","fs","path","sdkVersion","template","yargs"],"mappings":";;;;;;;;;;;AAmBA,IAAM,YAAA,GAAe,MAAO,CAAA,GAAA,CAAI,QAAQ,CAAA;AACjC,IAAM,UAAU,aAAc,CAAA;AAAA,EACnC,MAAM,MAAO,CAAA,OAAA,EAAS,IAAM,EAAA;AAC1B,IAAA,MAAM,QAAW,GAAA,MAAMA,SAAe,CAAA,MAAA,CAAO,OAAS,EAAA;AAAA,MACpD,GAAG,IAAA;AAAA,MACH,MAAA,EAAQ,MAAM,MAAU,IAAA;AAAA,KACzB,CAAA;AACD,IAAA,IAAI,aAAa,YAAc,EAAA;AAC7B,MAAAA,SAAA,CAAe,KAAK,qBAAqB,CAAA;AACzC,MAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA;AAEhB,IAAO,OAAA,QAAA;AAAA;AAEX,CAAC,CAAA;ACfM,SAAS,MAAM,IAAM,EAAA;AA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W,MAAM,cAAA,CAAe,MAAM,CAAA;AAC5C,EAAM,MAAA,UAAA,GAAa,MAAM,gBAAiB,CAAA;AAAA,IACxC,GAAG,MAAA;AAAA,IACH;AAAA,GACD,CAAA;AACD,EAAM,MAAA,UAAA,GAAa,MAAM,gBAAA,CAAiB,MAAM,CAAA;AAChD,EAAM,MAAA,cAAA,GAAiB,MAAM,oBAAA,CAAqB,MAAM,CAAA;AACxD,EAAM,MAAA,WAAA,GAAc,MAAM,oBAAA,CAAqB,MAAM,CAAA;AACrD,EAAM,MAAA,QAAA,GAAW,MAAM,iBAAA,CAAkB,MAAM,CAAA;AAC/C,EAAM,MAAA,QAAA,GAAW,MAAM,cAAA,CAAe,MAAM,CAAA;AAC5C,EAAM,MAAA,WAAA,GAAc,MAAM,iBAAA,CAAkB,MAAM,CAAA;AAClD,EAAM,MAAA,eAAA,GAAkB,MAAM,qBAAA,CAAsB,MAAM,CAAA;AAC1D,EAAM,MAAA,SAAA,GAAY,MAAM,eAAA,CAAgB,MAAM,CAAA;AAC9C,EAAM,MAAA,MAAA,GAAS,MAAM,YAAA,CAAa,MAAM,CAAA;AACxC,EAAA,MAAM,GAAI,CAAA;AAAA,IACR,OAAA;AAAA,IACA,SAAA;AAAA,IACA,QAAA;AAAA,IACA,UAAA;AAAA,IACA,UAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA,eAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACD,CAAA;AACH","file":"index.js","sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola as defaultConsola, createConsola } from \"consola\";\n\n// https://github.com/unjs/consola?tab=readme-ov-file#await-promptmessage--type-cancel-\nconst cancelSymbol = Symbol.for(\"cancel\");\nexport const consola = createConsola({\n async prompt(message, opts) {\n const response = await defaultConsola.prompt(message, {\n ...opts,\n cancel: opts?.cancel ?? \"symbol\"\n });\n if (response === cancelSymbol) {\n defaultConsola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n return response;\n }\n});","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { colorize } from \"consola/utils\";\nexport function green(text) {\n return colorize(\"green\", text);\n}\nexport function italic(text) {\n return colorize(\"italic\", text);\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptApplicationRid({\n application\n}) {\n while (application == null || !/^ri\\.third-party-applications\\.[^.]+\\.application\\.[^.]+$/.test(application)) {\n if (application != null) {\n consola.fail(\"Please enter a valid application resource identifier (rid)\");\n }\n application = await consola.prompt(`Enter the application resource identifier (rid) for your application from Developer Console:\\n${italic(\"(Example: ri.third-party-applications.main.application.1c66b352-4e00-40d2-995d-061c9d533ace)\")}`, {\n type: \"text\"\n });\n }\n return application;\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptApplicationUrl({\n skipApplicationUrl,\n applicationUrl\n}) {\n if (skipApplicationUrl) {\n return undefined;\n }\n if (applicationUrl == null) {\n const skip = await consola.prompt(`Do you know the URL your production application will be hosted on? This is required to create a production build of your application with the correct OAuth redirect URL.`, {\n type: \"select\",\n options: [{\n label: \"Yes, let me fill it here\",\n value: \"yes\"\n }, {\n label: \"No, I will fill it in later following the instructions in the generated README\",\n value: \"no\"\n }]\n });\n if (skip === \"no\") {\n return undefined;\n }\n }\n while (applicationUrl == null || !/^https?:\\/\\//.test(applicationUrl)) {\n if (applicationUrl != null) {\n consola.fail(\"Please enter a valid application URL\");\n }\n applicationUrl = await consola.prompt(`Enter the URL your production application will be hosted on:\\n${italic(\"(Example: https://myapp.example.palantirfoundry.com)\")}`, {\n type: \"text\"\n });\n }\n return applicationUrl.replace(/\\/$/, \"\");\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptClientId({\n clientId\n}) {\n while (clientId == null || !/^[0-9a-f]+$/.test(clientId)) {\n if (clientId != null) {\n consola.fail(\"Please enter a valid OAuth client ID\");\n }\n clientId = await consola.prompt(`Enter the OAuth client ID for your application from Developer Console:\\n${italic(\"(Example: 2650385ab6c5e0df3b44aff776b00a42)\")}`, {\n type: \"text\"\n });\n }\n return clientId;\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptCorsProxy({\n corsProxy\n}) {\n if (corsProxy != null) {\n return corsProxy;\n }\n return consola.prompt(`Include a CORS proxy for Foundry API requests during local development?\\n${italic(\"This is required if your enrollment has not allowed localhost for CORS.\")}`, {\n type: \"confirm\",\n initial: false\n });\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptFoundryUrl({\n foundryUrl\n}) {\n while (foundryUrl == null || !foundryUrl.startsWith(\"https://\")) {\n if (foundryUrl != null) {\n consola.fail(\"Please enter a valid Foundry URL\");\n }\n foundryUrl = await consola.prompt(`Enter the URL for your Foundry stack:\\n${italic(\"(Example: https://example.palantirfoundry.com)\")}`, {\n type: \"text\"\n });\n }\n return foundryUrl.replace(/\\/$/, \"\");\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptOntologyRid({\n ontology\n}) {\n while (ontology == null || !/^ri\\.ontology\\.[^.]+\\.ontology\\.[^.]+$/.test(ontology)) {\n if (ontology != null) {\n consola.fail(\"Please enter a valid Ontology resource identifier (rid)\");\n }\n ontology = await consola.prompt(`Enter the Ontology resource identifier (rid) associated with your Developer Console:\\n${italic(\"(Example: ri.ontology.main.ontology.1df1ce4c-f9d2-0f78-a316-287f6ac80bb2)\")}`, {\n type: \"text\"\n });\n }\n return ontology;\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptOsdkPackage({\n osdkPackage\n}) {\n while (osdkPackage == null || !/^@[a-z0-9-]+\\/sdk$/.test(osdkPackage)) {\n if (osdkPackage != null) {\n consola.fail(\"Please enter a valid OSDK package name\");\n }\n osdkPackage = await consola.prompt(`Enter the OSDK package name for your application from Developer Console:\\n${italic(\"(Example: @my-app/sdk)\")}`, {\n type: \"text\"\n });\n }\n return osdkPackage;\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { italic } from \"../highlight.js\";\nexport async function promptOsdkRegistryUrl({\n osdkRegistryUrl\n}) {\n while (osdkRegistryUrl == null || !/^https:\\/\\/[^/]+\\/artifacts\\/api\\/repositories\\/ri\\.artifacts\\.[^/]+\\/contents\\/release\\/npm\\/?$/.test(osdkRegistryUrl)) {\n if (osdkRegistryUrl != null) {\n consola.fail(\"Please enter a valid NPM registry URL to install your OSDK package\");\n }\n osdkRegistryUrl = await consola.prompt(`Enter the NPM registry URL to install your OSDK package from Developer Console:\\n${italic(\"(Example: https://example.palantirfoundry.com/artifacts/api/repositories/ri.artifacts.main.repository.a4a7fe1c-486f-4226-b706-7b90005f527d/contents/release/npm)\")}`, {\n type: \"text\"\n });\n }\n return osdkRegistryUrl.replace(/\\/$/, \"\");\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { consola } from \"../consola.js\";\nimport { green } from \"../highlight.js\";\nexport async function promptOverwrite({\n project,\n overwrite\n}) {\n if (overwrite != null) {\n return overwrite;\n }\n if (!fs.existsSync(path.join(process.cwd(), project))) {\n return true;\n }\n const result = await consola.prompt(`The directory ${green(project)} already exists do you want to overwrite or ignore it?`, {\n type: \"select\",\n options: [{\n label: \"Remove existing files and continue\",\n value: \"overwrite\"\n }, {\n label: \"Ignore files and continue\",\n value: \"ignore\"\n }, {\n label: \"Cancel\",\n value: \"cancel\"\n }]\n });\n switch (result) {\n case \"overwrite\":\n return true;\n case \"ignore\":\n return false;\n case \"cancel\":\n consola.fail(\"Operation cancelled\");\n process.exit(0);\n }\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nexport async function promptProject({\n project\n}) {\n while (project == null || !/^[a-zA-Z0-9-_]+$/.test(project)) {\n if (project != null) {\n consola.fail(\"Project name can only contain alphanumeric characters, hyphens and underscores\");\n }\n project = await consola.prompt(\"Project name:\", {\n type: \"text\",\n placeholder: \"my-osdk-app\",\n default: \"my-osdk-app\"\n });\n }\n return project;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nconst scopeNameRegex = /^[a-zA-Z-_:]+$/;\nexport async function promptScopes({\n scopes\n}) {\n while (true) {\n if (scopes != null) {\n const invalidScopes = scopes.filter(scope => !scopeNameRegex.test(scope));\n const allValidScopes = invalidScopes.length === 0;\n if (allValidScopes) {\n break;\n }\n const joinedInvalidScopes = invalidScopes.join(\", \");\n consola.fail(`Scopes [ ${joinedInvalidScopes} ] are invalid. Scope names can only contain letters, hyphens, underscores, and colons`);\n }\n const stringScopes = await consola.prompt(\"Enter the scopes to request during OAuth:\", {\n type: \"text\",\n placeholder: \"api:read-data api:write-data api:use-ontologies-read api:use-ontologies-write\",\n default: \"api:read-data api:write-data api:use-ontologies-read api:use-ontologies-write\"\n });\n scopes = stringScopes.split(\" \");\n }\n return deduplicateScopes(scopes);\n}\n\n// Preserving the originally specified scope order\nfunction deduplicateScopes(scopes) {\n const dedupedScopes = [];\n const seen = new Set();\n for (const scope of scopes) {\n if (seen.has(scope)) {\n continue;\n }\n dedupedScopes.push(scope);\n seen.add(scope);\n }\n return dedupedScopes;\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nexport async function promptSdkVersion({\n sdkVersion,\n template\n}) {\n if (sdkVersion == null) {\n // If the SDK version is not provided, default to the earliest template version for backwards-compatibility\n return Object.keys(template.files)[0];\n }\n if (template.files[sdkVersion] == null) {\n consola.fail(`The ${template.label} template does not support a \"${sdkVersion}\" SDK version.`);\n sdkVersion = await consola.prompt(`Please choose which version of the OSDK you'd like to use for the ${template.label} template:`, {\n type: \"select\",\n options: Object.keys(template.files).reverse().map(sdkVersion => ({\n label: sdkVersion,\n value: sdkVersion\n }))\n });\n }\n return sdkVersion;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const getPackageFiles = importPromise => async () => (await importPromise).files;","// THIS FILE IS GENERATED. DO NOT MODIFY.\n// You probably want to modify ../../../codegen.mjs instead.\n\nimport { getPackageFiles } from \"../getPackageFiles.js\";\nexport const TEMPLATES = [\n// React\n{\n id: \"template-react\",\n label: \"React\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n hidden: false,\n files: {\n \"1.x\": getPackageFiles(import(\"@osdk/create-app.template.react\")),\n \"2.x\": getPackageFiles(import(\"@osdk/create-app.template.react.beta\"))\n }\n},\n// Expo\n{\n id: \"template-expo\",\n label: \"Expo\",\n envPrefix: \"EXPO_PUBLIC_\",\n buildDirectory: \"./dist\",\n hidden: false,\n files: {\n \"2.x\": getPackageFiles(import(\"@osdk/create-app.template.expo.v2\"))\n }\n},\n// Vue\n{\n id: \"template-vue\",\n label: \"Vue\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n hidden: false,\n files: {\n \"1.x\": getPackageFiles(import(\"@osdk/create-app.template.vue\")),\n \"2.x\": getPackageFiles(import(\"@osdk/create-app.template.vue.v2\"))\n }\n},\n// Tutorial: To do App\n{\n id: \"template-tutorial-todo-app\",\n label: \"Tutorial: To do App\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n hidden: true,\n files: {\n \"1.x\": getPackageFiles(import(\"@osdk/create-app.template.tutorial-todo-app\")),\n \"2.x\": getPackageFiles(import(\"@osdk/create-app.template.tutorial-todo-app.beta\"))\n }\n},\n// Tutorial: To do AIP App\n{\n id: \"template-tutorial-todo-aip-app\",\n label: \"Tutorial: To do AIP App\",\n envPrefix: \"VITE_\",\n buildDirectory: \"./dist\",\n hidden: true,\n files: {\n \"1.x\": getPackageFiles(import(\"@osdk/create-app.template.tutorial-todo-aip-app\")),\n \"2.x\": getPackageFiles(import(\"@osdk/create-app.template.tutorial-todo-aip-app.beta\"))\n }\n}];","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { consola } from \"../consola.js\";\nimport { TEMPLATES } from \"../generatedNoCheck/templates.js\";\nimport { green } from \"../highlight.js\";\nexport async function promptTemplate(parsed) {\n const useBeta = parsed.beta ?? false;\n let template = TEMPLATES.find(t => t.id === parsed.template || t.id === `template-${parsed.template}`);\n if (template == null) {\n const availableTemplates = getAvailableTemplatesOrThrow(useBeta);\n const templateId = await consola.prompt(parsed.template != null ? `The provided template ${green(parsed.template)} is invalid please select a framework:` : \"Select a framework:\", {\n type: \"select\",\n options: availableTemplates.map(template => ({\n value: template.id,\n label: template.label\n }))\n });\n template = TEMPLATES.find(t => t.id === templateId);\n if (template == null) {\n throw new Error(`Template ${templateId} should be found`);\n }\n }\n return template;\n}\n\n/** Exported for testing only */\nexport function getAvailableTemplatesOrThrow(useBeta) {\n const availableTemplates = TEMPLATES.filter(template => !template.hidden && (useBeta ? template.isBeta === true\n // isBeta could be null\n : !template.isBeta));\n if (availableTemplates.length === 0) {\n throw new Error(\"No available templates found for the selected options.\");\n }\n return availableTemplates;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function changeVersionPrefix(version, prefix) {\n const isWorkspaceProtocol = version.startsWith(\"workspace:\");\n if (isWorkspaceProtocol) {\n version = version.slice(\"workspace:\".length);\n }\n if (version[0] === \"^\" || version[0] === \"~\" || version[0] === \"*\") {\n version = version.slice(1);\n }\n return `${isWorkspaceProtocol ? \"workspace:\" : \"\"}${prefix}${version}`;\n}","var isProduction = process.env.NODE_ENV === 'production';\nvar prefix = 'Invariant failed';\nfunction invariant(condition, message) {\n if (condition) {\n return;\n }\n if (isProduction) {\n throw new Error(prefix);\n }\n var provided = typeof message === 'function' ? message() : message;\n var value = provided ? \"\".concat(prefix, \": \").concat(provided) : prefix;\n throw new Error(value);\n}\nexport { invariant as default };","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function generateEnvDevelopment({\n envPrefix,\n foundryUrl,\n clientId,\n corsProxy,\n ontology\n}) {\n const foundryApiUrl = corsProxy ? \"http://localhost:8080\" : foundryUrl;\n const applicationUrl = \"http://localhost:8080\";\n return `# This env file is intended for developing on your local computer.\n# To set up development in Foundry's Code Workspaces, see .env.code-workspaces.\n# To deploy your application to production, see .env.production.\n# Note that .env.code-workspaces is only present for projects that were set up\n# using the \"Bootstrap in Foundry\" option in Developer Console.\n\n\n# This URL is the URL your users will be redirected back to after signing in.\n# This URL must exactly match one of the URLs listed in the \"OAuth & scopes\"\n# page of Developer Console.\n#\n# If your application in development is not hosted on port 8080, you will need\n# to change this URL here and in Developer Console.\n\n${envPrefix}FOUNDRY_REDIRECT_URL=${applicationUrl}/auth/callback\n\n\n# This URL is the Foundry host that your OSDK will use. It typically does not\n# need to be changed.\n\n${envPrefix}FOUNDRY_API_URL=${foundryApiUrl}\n\n\n# This client ID must match the client ID given on the \"OAuth & scopes\" page of\n# Developer Console. It typically does not need to be changed.\n\n${envPrefix}FOUNDRY_CLIENT_ID=${clientId}\n\n# This Ontology RID must match the Ontology RID your Developer Console is associated with.\n# You can check the Ontology on the \"Data Resources\" page of Developer Console. \n# It typically does not need to be changed.\n\n${envPrefix}FOUNDRY_ONTOLOGY_RID=${ontology}\n`;\n}\nexport function generateEnvProduction({\n envPrefix,\n foundryUrl,\n applicationUrl,\n clientId,\n ontology\n}) {\n const applicationUrlOrDefault = applicationUrl ?? \"<Fill in the domain at which you deploy your application>\";\n return `# This env file is intended for deploying your application to production.\n# To set up development on your local computer, see .env.development.\n# To set up development in Foundry's Code Workspaces, see .env.code-workspaces.\n# Note that .env.code-workspaces is only present for projects that were set up\n# using the \"Bootstrap in Foundry\" option in Developer Console.\n\n\n# This URL is the URL your users will be redirected back to after signing in.\n# This URL must exactly match one of the URLs listed in the \"OAuth & scopes\"\n# page of Developer Console.\n#\n# If you change where your application is hosted, you will need to change this\n# URL here and in Developer Console.\n\n${applicationUrl == null ? \"# \" : \"\"}${envPrefix}FOUNDRY_REDIRECT_URL=${applicationUrlOrDefault}/auth/callback\n\n\n# This URL is the Foundry host that your OSDK will use. It typically does not\n# need to be changed.\n\n${envPrefix}FOUNDRY_API_URL=${foundryUrl}\n\n\n# This client ID must match the client ID given on the \"OAuth & scopes\" page of\n# Developer Console. It typically does not need to be changed.\n\n${envPrefix}FOUNDRY_CLIENT_ID=${clientId}\n\n# This Ontology RID must match the Ontology RID your Developer Console is associated with.\n# You can check the Ontology on the \"Data Resources\" page of Developer Console. \n# It typically does not need to be changed.\n\n${envPrefix}FOUNDRY_ONTOLOGY_RID=${ontology}\n`;\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function generateFoundryConfigJson({\n foundryUrl,\n application,\n directory\n}) {\n return JSON.stringify({\n foundryUrl,\n site: {\n application,\n directory,\n autoVersion: {\n type: \"git-describe\",\n tagPrefix: \"\"\n }\n }\n }, null, 2) + \"\\n\";\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function generateNpmRc({\n osdkPackage,\n osdkRegistryUrl\n}) {\n // pnpm requires a trailing slash in .npmrc\n // https://github.com/pnpm/pnpm/issues/5941\n const withTrailingSlash = osdkRegistryUrl.endsWith(\"/\") ? osdkRegistryUrl : osdkRegistryUrl + \"/\";\n const withoutProtocol = withTrailingSlash.replace(/^https:\\/\\//, \"\");\n const packageScope = osdkPackage.split(\"/\")[0];\n return `//${withoutProtocol}:_authToken=\\${FOUNDRY_TOKEN}\\n` + `${packageScope}:registry=${withTrailingSlash}\\n`;\n}","/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { changeVersionPrefix } from \"@osdk/generator-utils\";\nimport { findUpSync } from \"find-up\";\nimport Handlebars from \"handlebars\";\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { consola } from \"./consola.js\";\nimport { generateEnvDevelopment, generateEnvProduction } from \"./generate/generateEnv.js\";\nimport { generateFoundryConfigJson } from \"./generate/generateFoundryConfigJson.js\";\nimport { generateNpmRc } from \"./generate/generateNpmRc.js\";\nimport { green } from \"./highlight.js\";\nexport async function run({\n project,\n overwrite,\n template,\n sdkVersion,\n foundryUrl,\n applicationUrl,\n application,\n ontology,\n clientId,\n osdkPackage,\n osdkRegistryUrl,\n corsProxy,\n scopes\n}) {\n consola.log(\"\");\n consola.start(`Creating project ${green(project)} using template ${green(template.id)}`);\n const cwd = process.cwd();\n const root = path.join(cwd, project);\n if (fs.existsSync(root)) {\n if (overwrite) {\n consola.info(`Overwriting existing project directory`);\n fs.rmSync(root, {\n recursive: true,\n force: true\n });\n fs.mkdirSync(root, {\n recursive: true\n });\n } else {\n consola.info(`Reusing existing project directory`);\n }\n } else {\n consola.info(`Creating project directory`);\n fs.mkdirSync(root, {\n recursive: true\n });\n }\n consola.info(`Copying files into project directory`);\n if (template.files[sdkVersion] == null) {\n throw new Error(`The ${template.label} template does not support a \"${sdkVersion}\" SDK version.`);\n }\n const files = await template.files[sdkVersion]();\n for (const [filePath, contents] of files) {\n const finalPath = path.join(root, filePath);\n const dirPath = path.dirname(finalPath);\n await fs.promises.mkdir(dirPath, {\n recursive: true\n });\n await fs.promises.writeFile(finalPath, Buffer.from(contents.body, contents.type === \"raw\" ? \"utf-8\" : \"base64\"));\n }\n const ourPackageJsonPath = findUpSync(\"package.json\", {\n cwd: fileURLToPath(import.meta.url)\n });\n const ourPackageJsonVersion = ourPackageJsonPath ? JSON.parse(fs.readFileSync(ourPackageJsonPath, \"utf-8\")).version : undefined;\n const clientVersion = process.env.PACKAGE_CLIENT_VERSION ?? ourPackageJsonVersion;\n if (clientVersion === undefined) {\n throw new Error(\"Could not determine current @osdk/client version\");\n }\n const templateContext = {\n project,\n foundryUrl,\n osdkPackage,\n corsProxy,\n clientVersion: changeVersionPrefix(clientVersion, \"^\"),\n scopes\n };\n const processFiles = function (dir) {\n fs.readdirSync(dir).forEach(function (file) {\n file = dir + \"/\" + file;\n const stat = fs.statSync(file);\n if (stat.isDirectory()) {\n processFiles(file);\n return;\n }\n if (file.endsWith(\"/_gitignore\")) {\n fs.renameSync(file, file.replace(/\\/_gitignore$/, \"/.gitignore\"));\n return;\n }\n if (!file.endsWith(\".hbs\")) {\n return;\n }\n const templated = Handlebars.compile(fs.readFileSync(file, \"utf-8\"))(templateContext);\n fs.writeFileSync(file.replace(/.hbs$/, \"\"), templated);\n fs.rmSync(file);\n });\n };\n processFiles(root);\n const npmRc = generateNpmRc({\n osdkPackage,\n osdkRegistryUrl\n });\n fs.writeFileSync(path.join(root, \".npmrc\"), npmRc);\n const envDevelopment = generateEnvDevelopment({\n envPrefix: template.envPrefix,\n foundryUrl,\n clientId,\n corsProxy,\n ontology\n });\n fs.writeFileSync(path.join(root, \".env.development\"), envDevelopment);\n const envProduction = generateEnvProduction({\n envPrefix: template.envPrefix,\n foundryUrl,\n applicationUrl,\n clientId,\n ontology\n });\n fs.writeFileSync(path.join(root, \".env.production\"), envProduction);\n const foundryConfigJson = generateFoundryConfigJson({\n foundryUrl,\n application,\n directory: template.buildDirectory\n });\n fs.writeFileSync(path.join(root, \"foundry.config.json\"), foundryConfigJson);\n consola.success(\"Success\");\n const cdRelative = path.relative(cwd, root);\n consola.box({\n message: `Done! Run the following commands to get started:\\n` + `\\n` + ` \\`cd ${cdRelative}\\`\\n` + ` \\`export FOUNDRY_TOKEN=<token>\\`\\n` + ` \\`npm install\\`\\n` + ` \\`npm run dev\\``,\n style: {\n padding: 2,\n borderColor: \"green\",\n borderStyle: \"rounded\"\n }\n });\n}","/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport yargs from \"yargs\";\nimport { hideBin } from \"yargs/helpers\";\nimport { promptApplicationRid } from \"./prompts/promptApplicationRid.js\";\nimport { promptApplicationUrl } from \"./prompts/promptApplicationUrl.js\";\nimport { promptClientId } from \"./prompts/promptClientId.js\";\nimport { promptCorsProxy } from \"./prompts/promptCorsProxy.js\";\nimport { promptFoundryUrl } from \"./prompts/promptFoundryUrl.js\";\nimport { promptOntologyRid } from \"./prompts/promptOntologyRid.js\";\nimport { promptOsdkPackage } from \"./prompts/promptOsdkPackage.js\";\nimport { promptOsdkRegistryUrl } from \"./prompts/promptOsdkRegistryUrl.js\";\nimport { promptOverwrite } from \"./prompts/promptOverwrite.js\";\nimport { promptProject } from \"./prompts/promptProject.js\";\nimport { promptScopes } from \"./prompts/promptScopes.js\";\nimport { promptSdkVersion } from \"./prompts/promptSdkVersion.js\";\nimport { promptTemplate } from \"./prompts/promptTemplate.js\";\nimport { run } from \"./run.js\";\nexport async function cli(args = process.argv) {\n const base = yargs(hideBin(args)).version(process.env.PACKAGE_VERSION ?? \"\").wrap(Math.min(150, yargs().terminalWidth())).strict().help().command(\"$0 [project] [--<option>]\", \"Create a new OSDK application based on framework templates. Information may be provided through options to skip interactive prompts.\", yargs => yargs.positional(\"project\", {\n type: \"string\",\n describe: \"Project name to create\"\n }).option(\"overwrite\", {\n type: \"boolean\",\n describe: \"Overwrite project directory if already exists\"\n }).option(\"beta\", {\n type: \"boolean\",\n describe: \"Use templates compatible with the Beta version of the SDK\"\n }).option(\"template\", {\n type: \"string\",\n describe: \"Template name to use\"\n }).option(\"sdkVersion\", {\n type: \"string\",\n describe: \"The OSDK version to use\"\n }).option(\"foundryUrl\", {\n type: \"string\",\n describe: \"URL for the Foundry stack\"\n }).option(\"applicationUrl\", {\n type: \"string\",\n describe: \"URL the production application will be hosted on\",\n conflicts: \"skipApplicationUrl\"\n }).option(\"skipApplicationUrl\", {\n type: \"boolean\",\n describe: \"Skip filling in URL the production application will be hosted on\"\n }).option(\"application\", {\n type: \"string\",\n describe: \"Application resource identifier (rid)\"\n }).option(\"ontology\", {\n type: \"string\",\n describe: \"Ontology resource identifier (rid)\"\n }).option(\"clientId\", {\n type: \"string\",\n describe: \"OAuth client ID for application\"\n }).option(\"osdkPackage\", {\n type: \"string\",\n describe: \"OSDK package name for application\"\n }).option(\"osdkRegistryUrl\", {\n type: \"string\",\n describe: \"URL for NPM registry to install OSDK package\"\n }).option(\"corsProxy\", {\n type: \"boolean\",\n describe: \"Include a CORS proxy for Foundry API requests during local development\"\n }).option(\"scopes\", {\n type: \"string\",\n array: true,\n describe: \"List of client-side scopes to be used when creating a client\"\n }));\n const parsed = base.parseSync();\n const project = await promptProject(parsed);\n const overwrite = await promptOverwrite({\n ...parsed,\n project\n });\n const template = await promptTemplate(parsed);\n const sdkVersion = await promptSdkVersion({\n ...parsed,\n template\n });\n const foundryUrl = await promptFoundryUrl(parsed);\n const applicationUrl = await promptApplicationUrl(parsed);\n const application = await promptApplicationRid(parsed);\n const ontology = await promptOntologyRid(parsed);\n const clientId = await promptClientId(parsed);\n const osdkPackage = await promptOsdkPackage(parsed);\n const osdkRegistryUrl = await promptOsdkRegistryUrl(parsed);\n const corsProxy = await promptCorsProxy(parsed);\n const scopes = await promptScopes(parsed);\n await run({\n project,\n overwrite,\n template,\n sdkVersion,\n foundryUrl,\n applicationUrl,\n application,\n clientId,\n osdkPackage,\n osdkRegistryUrl,\n corsProxy,\n scopes,\n ontology\n });\n}"]}