@oneie/frontend 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +86 -0
- package/README.md +21 -0
- package/package.json +20 -0
- package/src/config.ts +70 -0
- package/src/index.ts +3 -0
- package/src/plugin.ts +22 -0
- package/src/virtual.ts +32 -0
- package/tsconfig.json +8 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# ONE License (Version 1.0)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-2026 one.ie
|
|
4
|
+
|
|
5
|
+
## Maximum Freedom, One Obligation
|
|
6
|
+
|
|
7
|
+
This license empowers you with complete commercial freedom to use, reuse, modify, sell and resell the software, AI and data, at any price you wish.
|
|
8
|
+
|
|
9
|
+
No usage limits. No royalty fees. Just pure, unrestricted ability to innovate and profit from the software.
|
|
10
|
+
|
|
11
|
+
You are free to run ONE locally, on your own servers, in the cloud and at the edge.
|
|
12
|
+
|
|
13
|
+
## You Receive
|
|
14
|
+
|
|
15
|
+
### Unlimited Rights
|
|
16
|
+
|
|
17
|
+
You have unrestricted rights to use, modify, license, sublicense, distribute, sell, resell and monetize the Software without restrictions, subject only to the Brand Requirement below.
|
|
18
|
+
|
|
19
|
+
### Permitted Actions
|
|
20
|
+
|
|
21
|
+
Including, but not limited to:
|
|
22
|
+
|
|
23
|
+
- Commercial use and integration into any systems
|
|
24
|
+
- Creation and sale of derivative works
|
|
25
|
+
- Providing software as a service
|
|
26
|
+
- AI training and content generation
|
|
27
|
+
- Patenting innovations based on the Software
|
|
28
|
+
- Open source applications and integrations
|
|
29
|
+
|
|
30
|
+
### License Compatibility
|
|
31
|
+
|
|
32
|
+
This license is compatible with all major open-source licenses, including:
|
|
33
|
+
|
|
34
|
+
- MIT License
|
|
35
|
+
- Apache License
|
|
36
|
+
- GNU General Public License (GPL)
|
|
37
|
+
- BSD Licenses
|
|
38
|
+
- Mozilla Public License
|
|
39
|
+
|
|
40
|
+
### Perpetual Rights
|
|
41
|
+
|
|
42
|
+
These rights are granted in perpetuity and are irrevocable, provided the Brand Requirement is maintained.
|
|
43
|
+
|
|
44
|
+
## Intellectual Property
|
|
45
|
+
|
|
46
|
+
- We retain ownership of the original Software and data.
|
|
47
|
+
- You own any modifications you make.
|
|
48
|
+
- You never have to share your code or data.
|
|
49
|
+
|
|
50
|
+
## Brand Requirement
|
|
51
|
+
|
|
52
|
+
The only obligation is:
|
|
53
|
+
|
|
54
|
+
- Don't remove the ONE brand, logo, and link to https://one.ie/ from the deployed product.
|
|
55
|
+
|
|
56
|
+
To remove the Brand Requirement — white-label, no visible ONE branding — obtain the
|
|
57
|
+
**ONE Enterprise License** (see `LICENSE-ENTERPRISE.md` or contact agent@one.ie).
|
|
58
|
+
|
|
59
|
+
## Liability and Warranty
|
|
60
|
+
|
|
61
|
+
The Software and data is provided "AS IS". We bear no liability for its use.
|
|
62
|
+
|
|
63
|
+
## Termination
|
|
64
|
+
|
|
65
|
+
This license terminates if you remove or hide the ONE brand, logo, or link without
|
|
66
|
+
holding a current ONE Enterprise License.
|
|
67
|
+
|
|
68
|
+
## Governing Law and Disputes
|
|
69
|
+
|
|
70
|
+
This license is governed by the laws of Ireland. The parties will attempt to resolve disputes through good-faith negotiation. If necessary, disputes will proceed to mediation under the Mediators' Institute of Ireland rules, and then to binding arbitration under the Arbitration Act 2010, seated in Dublin, conducted in English.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
This license is designed to maximize freedom to innovate and profit. There is no copyleft requirement to share any code, making it suitable for enterprise use.
|
|
75
|
+
|
|
76
|
+
## Enterprise Solutions
|
|
77
|
+
|
|
78
|
+
Building something big? We're here to help:
|
|
79
|
+
|
|
80
|
+
- **Free** — use every feature with the ONE brand link in the footer
|
|
81
|
+
- **White-label** — remove the brand requirement (ONE Enterprise License)
|
|
82
|
+
- **Custom** — white-label solutions tailored to your needs
|
|
83
|
+
- **Enterprise** — full support and deployment assistance
|
|
84
|
+
- **Training** — help getting your team started
|
|
85
|
+
|
|
86
|
+
Contact agent@one.ie to share your needs · Learn at https://one.ie/learn · Agents: https://one.ie/llms.txt
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @oneie/frontend
|
|
2
|
+
|
|
3
|
+
The single config surface for ONE-connected Astro sites.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { defineOne } from '@oneie/frontend'
|
|
7
|
+
|
|
8
|
+
export default defineOne({
|
|
9
|
+
backend: { baseUrl: 'https://one.ie' },
|
|
10
|
+
brand: { tokens: { primary: 'hsl(216 55% 25%)' } },
|
|
11
|
+
plugins: [auth(), chat({ agent: 'my-bot' })],
|
|
12
|
+
})
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`defineOne()` composes each plugin into a single Astro integration and applies the brand tokens globally. All wiring — script injection, Cloudflare bindings, layout wrapping — happens here.
|
|
16
|
+
|
|
17
|
+
## Exports
|
|
18
|
+
|
|
19
|
+
- `defineOne(config)` — build the Astro integration
|
|
20
|
+
- `OnePlugin` — plugin type contract
|
|
21
|
+
- `OnePluginFactory<T>` — factory type for authoring plugins
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@oneie/frontend",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "defineOne() + OnePlugin contract — the single config surface for ONE-connected Astro sites",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "src/index.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./src/index.ts"
|
|
10
|
+
},
|
|
11
|
+
"peerDependencies": {
|
|
12
|
+
"astro": ">=6.0.0",
|
|
13
|
+
"zod": ">=3.0.0"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"astro": "^6.2.2",
|
|
17
|
+
"zod": "^4.4.2",
|
|
18
|
+
"typescript": "^5.7.3"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { AstroIntegration } from 'astro'
|
|
2
|
+
import type { OnePlugin } from './plugin'
|
|
3
|
+
import { virtualOneConfig } from './virtual'
|
|
4
|
+
|
|
5
|
+
export interface BrandTokens {
|
|
6
|
+
primary?: string
|
|
7
|
+
secondary?: string
|
|
8
|
+
tertiary?: string
|
|
9
|
+
background?: string
|
|
10
|
+
foreground?: string
|
|
11
|
+
font?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface OneConfig {
|
|
15
|
+
backend?: {
|
|
16
|
+
baseUrl?: string
|
|
17
|
+
apiKey?: string
|
|
18
|
+
}
|
|
19
|
+
brand?: {
|
|
20
|
+
tokens?: BrandTokens
|
|
21
|
+
}
|
|
22
|
+
// OnePlugin<any> — a plugins array is heterogeneous; each plugin carries its
|
|
23
|
+
// own config type (C appears contravariantly in `integration`), so a concrete
|
|
24
|
+
// OnePlugin<FooConfig> is not assignable to OnePlugin<unknown>. `any` lets the
|
|
25
|
+
// array hold differently-typed plugins without widening the plugin contract.
|
|
26
|
+
plugins?: OnePlugin<any>[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* defineOne — the single control surface for a ONE-connected Astro site.
|
|
31
|
+
*
|
|
32
|
+
* Returns a composed Astro integration that:
|
|
33
|
+
* - Merges each plugin's AstroIntegration into the build (build-time wiring only)
|
|
34
|
+
* - Exposes resolved config to islands via the `one:config` virtual module
|
|
35
|
+
* - Validates each plugin's config slice at startup
|
|
36
|
+
*
|
|
37
|
+
* NOTE: declaring a `paid` plugin here registers its build-time integration but
|
|
38
|
+
* does NOT grant backend access. The product API returns 402 until the workspace
|
|
39
|
+
* has an entitlement row (purchased via `one plugin add <name>`).
|
|
40
|
+
*
|
|
41
|
+
* Usage in astro.config.mjs:
|
|
42
|
+
* import oneIntegration from './one.config.ts'
|
|
43
|
+
* export default defineConfig({ integrations: [react(), oneIntegration] })
|
|
44
|
+
*/
|
|
45
|
+
export function defineOne(config: OneConfig): AstroIntegration {
|
|
46
|
+
return {
|
|
47
|
+
name: '@oneie/frontend',
|
|
48
|
+
hooks: {
|
|
49
|
+
'astro:config:setup': ({ updateConfig, logger }) => {
|
|
50
|
+
const plugins = config.plugins ?? []
|
|
51
|
+
|
|
52
|
+
// Validate each plugin's config slice
|
|
53
|
+
for (const plugin of plugins) {
|
|
54
|
+
if (plugin.config) {
|
|
55
|
+
logger.debug(`[one] validating plugin: ${plugin.name}`)
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Expose resolved config as virtual module
|
|
60
|
+
updateConfig({
|
|
61
|
+
vite: {
|
|
62
|
+
plugins: [virtualOneConfig(config)],
|
|
63
|
+
},
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
logger.debug(`[one] ${plugins.length} plugin(s) registered`)
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
}
|
|
70
|
+
}
|
package/src/index.ts
ADDED
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { AstroIntegration } from 'astro'
|
|
2
|
+
import type { ZodType } from 'zod'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A ONE plugin — the build-time contract every plugin satisfies.
|
|
6
|
+
*
|
|
7
|
+
* `tier` determines what the plugin ships:
|
|
8
|
+
* free — integration only, source in repo, no key needed
|
|
9
|
+
* connected — integration injects a served <script> tag (chat/track); needs a workspace key
|
|
10
|
+
* paid — entitlement + serves: backend returns 402 without the claim; UI loads from one.ie
|
|
11
|
+
*/
|
|
12
|
+
export interface OnePlugin<C = unknown> {
|
|
13
|
+
name: string
|
|
14
|
+
tier: 'free' | 'connected' | 'paid'
|
|
15
|
+
config?: ZodType<C>
|
|
16
|
+
integration?: (config: C) => AstroIntegration
|
|
17
|
+
entitlement?: string
|
|
18
|
+
serves?: string
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Factory function type — plugins export a function that returns OnePlugin */
|
|
22
|
+
export type OnePluginFactory<C = unknown> = (config?: Partial<C>) => OnePlugin<C>
|
package/src/virtual.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { OneConfig } from './config'
|
|
2
|
+
|
|
3
|
+
const VIRTUAL_ID = 'one:config'
|
|
4
|
+
const RESOLVED_ID = '\0one:config'
|
|
5
|
+
|
|
6
|
+
/** Vite plugin that exposes resolved OneConfig as a virtual module `one:config`. */
|
|
7
|
+
export function virtualOneConfig(config: OneConfig) {
|
|
8
|
+
const resolved = JSON.stringify({
|
|
9
|
+
backend: {
|
|
10
|
+
baseUrl: config.backend?.baseUrl ?? 'https://one.ie',
|
|
11
|
+
hasApiKey: Boolean(config.backend?.apiKey),
|
|
12
|
+
},
|
|
13
|
+
brand: config.brand ?? {},
|
|
14
|
+
plugins: (config.plugins ?? []).map((p) => ({
|
|
15
|
+
name: p.name,
|
|
16
|
+
tier: p.tier,
|
|
17
|
+
entitlement: p.entitlement,
|
|
18
|
+
serves: p.serves,
|
|
19
|
+
})),
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
name: 'vite-plugin-one-config',
|
|
24
|
+
resolveId(id: string): string | undefined {
|
|
25
|
+
if (id === VIRTUAL_ID) return RESOLVED_ID
|
|
26
|
+
},
|
|
27
|
+
load(id: string): string | undefined {
|
|
28
|
+
if (id !== RESOLVED_ID) return
|
|
29
|
+
return `export default ${resolved}`
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
}
|