@iebh/tera-fy 2.2.11 → 2.2.13

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.
@@ -3,7 +3,7 @@ import Mitt from 'mitt';
3
3
  import {nanoid} from 'nanoid';
4
4
  import ProjectFile from './projectFile.js';
5
5
 
6
- /* globals globalThis */
6
+ /* globals window, document */
7
7
 
8
8
 
9
9
  /**
@@ -106,6 +106,7 @@ export default class TeraFy {
106
106
  'getUser',
107
107
  'requireUser',
108
108
  'getCredentials',
109
+ 'getKindeToken',
109
110
 
110
111
  // Projects
111
112
  'bindProject',
@@ -500,7 +501,7 @@ export default class TeraFy {
500
501
 
501
502
  this.rpc('handshake')
502
503
  .then(()=> clearTimeout(timeoutHandle))
503
- .then(()=> resolve(undefined))
504
+ .then(()=> resolve())
504
505
  .catch(reject); // Propagate RPC errors
505
506
  }))
506
507
  .then(()=> 'parent' as 'parent')
@@ -522,24 +523,24 @@ export default class TeraFy {
522
523
 
523
524
  this.dom.el = document.createElement('div')
524
525
  this.dom.el.id = 'tera-fy';
525
- this.dom.el!.classList.toggle('dev-mode', this.settings.devMode);
526
- this.dom.el!.classList.add('minimized');
526
+ this.dom.el.classList.toggle('dev-mode', this.settings.devMode);
527
+ this.dom.el.classList.add('minimized');
527
528
  document.body.append(this.dom.el!);
528
529
 
529
- this.dom.el!.addEventListener('click', ()=> this.dom.el!.classList.toggle('minimized'));
530
+ this.dom.el.addEventListener('click', ()=> this.dom.el!.classList.toggle('minimized'));
530
531
 
531
532
  this.dom.iframe = document.createElement('iframe')
532
533
 
533
534
  // Queue up event chain when document loads
534
- this.dom.iframe!.setAttribute('sandbox', this.settings.frameSandbox.join(' '));
535
- this.dom.iframe!.addEventListener('load', ()=> {
535
+ this.dom.iframe.setAttribute('sandbox', this.settings.frameSandbox.join(' '));
536
+ this.dom.iframe.addEventListener('load', ()=> {
536
537
  this.debug('INFO', 3, 'Embeded iframe ready');
537
- resolve(undefined);
538
+ resolve();
538
539
  });
539
540
 
540
541
  // Start document load sequence + append to DOM
541
- this.dom.iframe!.src = this.settings.siteUrl;
542
- this.dom.el!.append(this.dom.iframe!);
542
+ this.dom.iframe.src = this.settings.siteUrl;
543
+ this.dom.el.append(this.dom.iframe!);
543
544
  }))
544
545
  .then(()=> this.handshakeLoop())
545
546
 
@@ -597,7 +598,7 @@ export default class TeraFy {
597
598
  clearTimeout(handshakeTimeout);
598
599
  clearTimeout(handshakeTimer);
599
600
  })
600
- .then(()=> resolve(undefined))
601
+ .then(()=> resolve())
601
602
  .catch(reject) // Let RPC errors propagate
602
603
  };
603
604
  tryHandshake(); // Kick off initial handshake
@@ -614,7 +615,7 @@ export default class TeraFy {
614
615
  switch (this.settings.mode) {
615
616
  case 'child':
616
617
  this.dom.stylesheet = document.createElement('style');
617
- this.dom.stylesheet!.innerHTML = [
618
+ this.dom.stylesheet.innerHTML = [
618
619
  ':root {',
619
620
  '--TERA-accent: #4d659c;',
620
621
  '}',
@@ -812,7 +813,7 @@ export default class TeraFy {
812
813
  Object.assign(this.settings, key);
813
814
  }
814
815
 
815
- return this.toggleDevMode(this.settings.devMode as boolean);
816
+ return this.toggleDevMode(this.settings.devMode);
816
817
  }
817
818
 
818
819
 
@@ -1567,4 +1568,4 @@ export default class TeraFy {
1567
1568
  */
1568
1569
 
1569
1570
  // }}}
1570
- }
1571
+ }
@@ -534,12 +534,30 @@ export default class TeraFyServer {
534
534
  /**
535
535
  * Provide an object of credentials for 3rd party services like Firebase/Supabase
536
536
  *
537
- * @returns {Object} An object containing 3rd party service credentials
537
+ * @returns An object containing 3rd party service credentials
538
538
  */
539
- getCredentials(): any {
539
+ getCredentials(): {
540
+ firebaseApiKey: string;
541
+ firebaseAppId: string;
542
+ firebaseAuthDomain: string;
543
+ firebaseProjectId: string;
544
+ kindeClientId: string;
545
+ kindeDomain: string;
546
+ logrocketProject: string;
547
+ supabaseKey: string;
548
+ supabaseUrl: string;
549
+ } {
540
550
  return app.service('$auth').credentials;
541
551
  }
542
552
 
553
+ /**
554
+ * Get auth credentials for kinde
555
+ * @returns The kinde auth token
556
+ */
557
+ getKindeToken(): Promise<string> {
558
+ const $auth = app.service('$auth');
559
+ return $auth.kinde.getToken();
560
+ }
543
561
 
544
562
  /**
545
563
  * In embed mode only - create a popup window and try to auth via that
@@ -1629,6 +1647,7 @@ export default class TeraFyServer {
1629
1647
  format: 'pojo',
1630
1648
  autoRequire: true,
1631
1649
  filter: (file: any) => true, // Default filter
1650
+ // @ts-ignore
1632
1651
  find: (files: any[]) => files.at(0), // Default find
1633
1652
  ...options,
1634
1653
  };
@@ -2247,4 +2266,4 @@ export default class TeraFyServer {
2247
2266
  }
2248
2267
  /* eslint-enable */
2249
2268
  // }}}
2250
- }
2269
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iebh/tera-fy",
3
- "version": "2.2.11",
3
+ "version": "2.2.13",
4
4
  "description": "TERA website worker",
5
5
  "scripts": {
6
6
  "dev": "esbuild --platform=browser --format=esm --bundle lib/terafy.client.ts --outfile=dist/terafy.js --minify --serve --servedir=.",
@@ -105,7 +105,7 @@
105
105
  },
106
106
  "dependencies": {
107
107
  "@iebh/supabasey": "^1.1.4",
108
- "@momsfriendlydevco/marshal": "^2.1.4",
108
+ "@momsfriendlydevco/marshal": "^2.2.0",
109
109
  "detect-port": "^2.1.0",
110
110
  "filesize": "^10.1.6",
111
111
  "http-proxy": "^1.18.1",
@@ -119,20 +119,21 @@
119
119
  "devDependencies": {
120
120
  "@momsfriendlydevco/eslint-config": "^2.3.1",
121
121
  "@release-it/conventional-changelog": "^10.0.0",
122
- "@types/detect-port": "^1.3.5",
123
- "@types/http-proxy": "^1.17.14",
122
+ "@types/detect-port": "^2.0.0",
123
+ "@types/http-proxy": "^1.17.16",
124
124
  "@types/lodash-es": "^4.17.12",
125
- "@types/node": "^18.0.0",
125
+ "@types/node": "^24.3.0",
126
126
  "@types/uuid": "^10.0.0",
127
- "@typescript-eslint/eslint-plugin": "^8.34.0",
128
- "@typescript-eslint/parser": "^8.0.0",
127
+ "@typescript-eslint/eslint-plugin": "^8.41.0",
128
+ "@typescript-eslint/parser": "^8.41.0",
129
129
  "concurrently": "^9.1.2",
130
130
  "documentation": "^14.0.3",
131
131
  "esbuild": "^0.25.0",
132
- "eslint": "^9.31.0",
132
+ "eslint": "^9.34.0",
133
+ "eslint-plugin": "^1.0.1",
133
134
  "nodemon": "^3.1.9",
134
- "typescript": "^5.5.4",
135
- "typescript-eslint": "^8.37.0"
135
+ "typescript": "^5.9.2",
136
+ "typescript-eslint": "^8.41.0"
136
137
  },
137
138
  "peerDependencies": {
138
139
  "@iebh/reflib": "^2.5.4",