@asteby/metacore-runtime-react 23.9.3 → 23.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +43 -0
  3. package/dist/action-modal-dispatcher.d.ts.map +1 -1
  4. package/dist/action-modal-dispatcher.js +122 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1 -0
  8. package/dist/license/index.d.ts +5 -0
  9. package/dist/license/index.d.ts.map +1 -0
  10. package/dist/license/index.js +4 -0
  11. package/dist/license/license-expiry-banner.d.ts +16 -0
  12. package/dist/license/license-expiry-banner.d.ts.map +1 -0
  13. package/dist/license/license-expiry-banner.js +85 -0
  14. package/dist/license/license-gate.d.ts +40 -0
  15. package/dist/license/license-gate.d.ts.map +1 -0
  16. package/dist/license/license-gate.js +108 -0
  17. package/dist/license/license-status-badge.d.ts +7 -0
  18. package/dist/license/license-status-badge.d.ts.map +1 -0
  19. package/dist/license/license-status-badge.js +57 -0
  20. package/dist/license/types.d.ts +63 -0
  21. package/dist/license/types.d.ts.map +1 -0
  22. package/dist/license/types.js +45 -0
  23. package/dist/types.d.ts +8 -0
  24. package/dist/types.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/src/__tests__/license-gate.test.tsx +242 -0
  27. package/src/__tests__/wizard-action-modal.test.tsx +121 -0
  28. package/src/action-modal-dispatcher.tsx +233 -0
  29. package/src/index.ts +15 -0
  30. package/src/license/index.ts +21 -0
  31. package/src/license/license-expiry-banner.tsx +151 -0
  32. package/src/license/license-gate.tsx +277 -0
  33. package/src/license/license-status-badge.tsx +93 -0
  34. package/src/license/types.ts +90 -0
  35. package/src/types.ts +9 -0
  36. package/LICENSE +0 -201
@@ -0,0 +1,277 @@
1
+ /**
2
+ * <LicenseGate> — el primitivo del blindaje. Un host lo monta en UNA línea
3
+ * envolviendo su app autenticada:
4
+ *
5
+ * <LicenseGate state={state} onActivate={activate}>
6
+ * <AppShell />
7
+ * </LicenseGate>
8
+ *
9
+ * Comportamiento según el estado (resuelto por el backend del host):
10
+ * - Sin enforcement, o estado operable (valid/stale/grace) → renderiza children.
11
+ * stale/grace además montan el <LicenseExpiryBanner> degradado por encima.
12
+ * - enforcement && missing/invalid/expired → modal BLOQUEANTE full-screen,
13
+ * no descartable, con el formulario de activación. Al activar con éxito el
14
+ * host refresca el estado y el gate se abre sin recargar.
15
+ *
16
+ * Es branding-aware si el host pasa `branding` (logo/nombre desde el
17
+ * PlatformConfig del SDK); si no, cae a un encabezado neutro.
18
+ *
19
+ * INDEPENDIENTE del kernel: no importa su cliente ni fija su versión. Solo
20
+ * consume `LicenseState` y una promesa `onActivate`.
21
+ */
22
+ import { useState, type ReactNode } from 'react'
23
+ import { useTranslation } from 'react-i18next'
24
+ import { ShieldAlert, Clock, Loader2 } from 'lucide-react'
25
+ import { Button, Input } from '@asteby/metacore-ui'
26
+ import {
27
+ isLicenseBlocking,
28
+ isTrialExpired,
29
+ type LicenseState,
30
+ type LicenseBranding,
31
+ } from './types'
32
+ import { LicenseStatusBadge } from './license-status-badge'
33
+ import { LicenseExpiryBanner } from './license-expiry-banner'
34
+
35
+ function cx(...parts: Array<string | false | undefined>): string {
36
+ return parts.filter(Boolean).join(' ')
37
+ }
38
+
39
+ export interface LicenseGateProps {
40
+ /** Estado actual, resuelto por el backend del host. `undefined` mientras
41
+ * carga → fail-open (renderiza children, nunca destella el candado). */
42
+ state: LicenseState | undefined
43
+ /** Activa una licencia con el código/token pegado. Resuelve → el host
44
+ * refresca `state` y el gate se abre. Rechaza con un Error cuyo `message`
45
+ * se muestra al usuario. */
46
+ onActivate: (code: string) => Promise<void>
47
+ children: ReactNode
48
+ /** Branding opcional (logo/nombre) para el encabezado del modal. */
49
+ branding?: LicenseBranding
50
+ /** Acción "Gestionar licencia" del banner degradado (opcional). */
51
+ onManage?: () => void
52
+ className?: string
53
+ }
54
+
55
+ export function LicenseGate({
56
+ state,
57
+ onActivate,
58
+ children,
59
+ branding,
60
+ onManage,
61
+ className,
62
+ }: LicenseGateProps) {
63
+ const blocking = isLicenseBlocking(state)
64
+
65
+ return (
66
+ <>
67
+ {/* stale/grace/upcoming degradan con banner; el propio banner
68
+ decide si mostrarse. Bloqueado → no hace falta, el modal manda. */}
69
+ {!blocking && (
70
+ <LicenseExpiryBanner state={state} onManage={onManage} />
71
+ )}
72
+ {children}
73
+ {blocking && state && (
74
+ <LicenseGateModal
75
+ state={state}
76
+ onActivate={onActivate}
77
+ branding={branding}
78
+ className={className}
79
+ />
80
+ )}
81
+ </>
82
+ )
83
+ }
84
+
85
+ interface LicenseGateModalProps {
86
+ state: LicenseState
87
+ onActivate: (code: string) => Promise<void>
88
+ branding?: LicenseBranding
89
+ className?: string
90
+ }
91
+
92
+ function LicenseGateModal({
93
+ state,
94
+ onActivate,
95
+ branding,
96
+ className,
97
+ }: LicenseGateModalProps) {
98
+ const { t } = useTranslation()
99
+ const [code, setCode] = useState('')
100
+ const [submitting, setSubmitting] = useState(false)
101
+ const [error, setError] = useState<string | null>(null)
102
+
103
+ const trialExpired = isTrialExpired(state)
104
+
105
+ const title = trialExpired
106
+ ? t('license.gate.trial_title', {
107
+ defaultValue: 'Tu prueba gratuita terminó',
108
+ })
109
+ : t('license.gate.title', { defaultValue: 'Activa tu licencia' })
110
+
111
+ const description = trialExpired
112
+ ? t('license.gate.trial_description', {
113
+ defaultValue:
114
+ 'Tu prueba gratuita terminó. Activa una licencia para continuar. Pega tu clave (lic_…) o el token firmado que te entregaron.',
115
+ })
116
+ : state.status === 'expired'
117
+ ? t('license.gate.expired_description', {
118
+ defaultValue:
119
+ 'Tu licencia venció y el periodo de gracia terminó. Activa una licencia vigente para seguir operando. Pega tu clave (lic_…) o el token firmado.',
120
+ })
121
+ : state.status === 'invalid'
122
+ ? t('license.gate.invalid_description', {
123
+ defaultValue:
124
+ 'La licencia de esta instancia no es válida. Pega una clave (lic_…) o el token firmado que te entregó tu proveedor para reactivarla.',
125
+ })
126
+ : t('license.gate.missing_description', {
127
+ defaultValue:
128
+ 'Esta instancia necesita una licencia activa para operar. Pega tu clave (lic_…) o el token firmado para activarla.',
129
+ })
130
+
131
+ const canSubmit = code.trim().length > 0 && !submitting
132
+
133
+ const submit = async () => {
134
+ if (!canSubmit) return
135
+ setSubmitting(true)
136
+ setError(null)
137
+ try {
138
+ await onActivate(code.trim())
139
+ // Éxito → el host refresca `state`; el gate se re-renderiza y este
140
+ // modal se desmonta solo. No recargamos.
141
+ } catch (e) {
142
+ const message =
143
+ e instanceof Error && e.message
144
+ ? e.message
145
+ : t('license.gate.activate_error', {
146
+ defaultValue: 'No se pudo activar la licencia.',
147
+ })
148
+ setError(message)
149
+ setSubmitting(false)
150
+ }
151
+ }
152
+
153
+ return (
154
+ <div
155
+ role="dialog"
156
+ aria-modal="true"
157
+ aria-labelledby="license-gate-title"
158
+ data-license-status={state.status}
159
+ className={cx(
160
+ 'fixed inset-0 z-[100] flex items-center justify-center bg-background/90 p-4 backdrop-blur-sm',
161
+ className,
162
+ )}
163
+ >
164
+ <div className="w-full max-w-lg overflow-hidden rounded-2xl border bg-card text-card-foreground shadow-2xl">
165
+ <div className="flex flex-col gap-4 p-6">
166
+ <div className="flex items-start gap-3">
167
+ {branding?.logo ? (
168
+ <img
169
+ src={branding.logo}
170
+ alt={branding.name ?? ''}
171
+ className="h-10 w-10 shrink-0 rounded-xl object-contain"
172
+ />
173
+ ) : (
174
+ <div
175
+ className={cx(
176
+ 'flex h-10 w-10 shrink-0 items-center justify-center rounded-xl',
177
+ trialExpired
178
+ ? 'bg-primary/10 text-primary'
179
+ : 'bg-destructive/10 text-destructive',
180
+ )}
181
+ >
182
+ {trialExpired ? (
183
+ <Clock className="h-5 w-5" aria-hidden />
184
+ ) : (
185
+ <ShieldAlert className="h-5 w-5" aria-hidden />
186
+ )}
187
+ </div>
188
+ )}
189
+ <div className="flex min-w-0 flex-col gap-1">
190
+ <h2
191
+ id="license-gate-title"
192
+ className="text-lg leading-tight font-semibold"
193
+ >
194
+ {title}
195
+ </h2>
196
+ <div className="flex flex-wrap items-center gap-2">
197
+ <LicenseStatusBadge status={state.status} />
198
+ <span className="text-muted-foreground text-xs">
199
+ {branding?.name
200
+ ? branding.name
201
+ : t('license.gate.instance', {
202
+ defaultValue: 'Esta instancia',
203
+ })}
204
+ </span>
205
+ </div>
206
+ </div>
207
+ </div>
208
+
209
+ <p className="text-muted-foreground text-sm">{description}</p>
210
+
211
+ {state.reason && (
212
+ <p className="bg-muted/50 text-muted-foreground rounded-md px-3 py-2 text-xs">
213
+ {state.reason}
214
+ </p>
215
+ )}
216
+
217
+ <form
218
+ className="flex flex-col gap-2"
219
+ onSubmit={(e) => {
220
+ e.preventDefault()
221
+ void submit()
222
+ }}
223
+ >
224
+ <label
225
+ htmlFor="license-gate-code"
226
+ className="text-sm font-medium"
227
+ >
228
+ {t('license.gate.code_label', {
229
+ defaultValue: 'Clave o token de licencia',
230
+ })}
231
+ </label>
232
+ <Input
233
+ id="license-gate-code"
234
+ autoFocus
235
+ autoComplete="off"
236
+ spellCheck={false}
237
+ placeholder={t('license.gate.code_placeholder', {
238
+ defaultValue: 'lic_… o pega el token firmado',
239
+ })}
240
+ value={code}
241
+ disabled={submitting}
242
+ aria-invalid={error ? true : undefined}
243
+ onChange={(e) => {
244
+ setCode(e.target.value)
245
+ if (error) setError(null)
246
+ }}
247
+ />
248
+ {error && (
249
+ <p role="alert" className="text-destructive text-sm">
250
+ {error}
251
+ </p>
252
+ )}
253
+ <Button
254
+ type="submit"
255
+ className="mt-1 w-full"
256
+ disabled={!canSubmit}
257
+ >
258
+ {submitting && (
259
+ <Loader2
260
+ className="h-4 w-4 animate-spin"
261
+ aria-hidden
262
+ />
263
+ )}
264
+ {submitting
265
+ ? t('license.gate.activating', {
266
+ defaultValue: 'Activando…',
267
+ })
268
+ : t('license.gate.activate', {
269
+ defaultValue: 'Activar licencia',
270
+ })}
271
+ </Button>
272
+ </form>
273
+ </div>
274
+ </div>
275
+ </div>
276
+ )
277
+ }
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Insignia de estado de licencia — un chip que traduce el `LicenseStatus` a
3
+ * color + etiqueta legible. Reutilizable suelto (p. ej. en Ajustes de licencia)
4
+ * o embebido en el encabezado del <LicenseGate>.
5
+ */
6
+ import { useTranslation } from 'react-i18next'
7
+ import {
8
+ ShieldCheck,
9
+ ShieldAlert,
10
+ ShieldQuestion,
11
+ Clock,
12
+ CloudOff,
13
+ } from 'lucide-react'
14
+ import { Badge } from '@asteby/metacore-ui'
15
+ import type { LicenseStatus } from './types'
16
+
17
+ type BadgeVariant = 'default' | 'secondary' | 'destructive' | 'outline'
18
+
19
+ interface StatusMeta {
20
+ variant: BadgeVariant
21
+ Icon: typeof ShieldCheck
22
+ key: string
23
+ defaultValue: string
24
+ /** Tinte amarillo para posturas degradadas (grace/stale) que `variant` no
25
+ * cubre — el sistema de badges no tiene "warning". */
26
+ warn?: boolean
27
+ }
28
+
29
+ const STATUS_META: Record<LicenseStatus, StatusMeta> = {
30
+ valid: {
31
+ variant: 'default',
32
+ Icon: ShieldCheck,
33
+ key: 'license.status.valid',
34
+ defaultValue: 'Activa',
35
+ },
36
+ stale: {
37
+ variant: 'outline',
38
+ Icon: CloudOff,
39
+ key: 'license.status.stale',
40
+ defaultValue: 'Sin verificar',
41
+ warn: true,
42
+ },
43
+ grace: {
44
+ variant: 'outline',
45
+ Icon: Clock,
46
+ key: 'license.status.grace',
47
+ defaultValue: 'En gracia',
48
+ warn: true,
49
+ },
50
+ expired: {
51
+ variant: 'destructive',
52
+ Icon: ShieldAlert,
53
+ key: 'license.status.expired',
54
+ defaultValue: 'Vencida',
55
+ },
56
+ missing: {
57
+ variant: 'secondary',
58
+ Icon: ShieldQuestion,
59
+ key: 'license.status.missing',
60
+ defaultValue: 'Sin licencia',
61
+ },
62
+ invalid: {
63
+ variant: 'destructive',
64
+ Icon: ShieldAlert,
65
+ key: 'license.status.invalid',
66
+ defaultValue: 'Inválida',
67
+ },
68
+ }
69
+
70
+ export interface LicenseStatusBadgeProps {
71
+ status: LicenseStatus
72
+ className?: string
73
+ }
74
+
75
+ export function LicenseStatusBadge({ status, className }: LicenseStatusBadgeProps) {
76
+ const { t } = useTranslation()
77
+ const meta = STATUS_META[status] ?? STATUS_META.missing
78
+ const { Icon } = meta
79
+
80
+ return (
81
+ <Badge
82
+ variant={meta.variant}
83
+ className={
84
+ (meta.warn
85
+ ? 'border-amber-500/40 bg-amber-500/10 text-amber-700 dark:text-amber-400 '
86
+ : '') + (className ?? '')
87
+ }
88
+ >
89
+ <Icon aria-hidden />
90
+ {t(meta.key, { defaultValue: meta.defaultValue })}
91
+ </Badge>
92
+ )
93
+ }
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Licencia de instancia — el contrato de estado que el backend del host (ops
3
+ * vía kernel `LicenseService`) expone y que este módulo pinta. El SDK NO habla
4
+ * con el kernel ni impone su versión: el host resuelve el `LicenseState` con su
5
+ * propio transporte y se lo pasa a <LicenseGate>. Así el gate es un primitivo
6
+ * reutilizable e INDEPENDIENTE del release del kernel.
7
+ *
8
+ * División de responsabilidades del blindaje:
9
+ * - kernel → enforcement (qué está permitido; firma/verifica el estado).
10
+ * - SDK → UX (este módulo: gate, banner, badge).
11
+ * - hub → emisión (mintea el token Ed25519).
12
+ * - hosts → wiring (resuelven el estado y montan <LicenseGate> en 1 línea).
13
+ */
14
+
15
+ /** El estado operativo de la licencia, tal como lo deriva el backend. */
16
+ export type LicenseStatus =
17
+ | 'valid'
18
+ | 'stale'
19
+ | 'grace'
20
+ | 'expired'
21
+ | 'missing'
22
+ | 'invalid'
23
+
24
+ export interface LicenseState {
25
+ /** Licensing activo en esta instancia (LICENSING_ENFORCE). Si es false el
26
+ * gate es transparente: nunca bloquea ni degrada. */
27
+ enforced: boolean
28
+ configured: boolean
29
+ valid: boolean
30
+ status: LicenseStatus
31
+ reason?: string
32
+ org_id?: string
33
+ plan?: string
34
+ preset?: string
35
+ entitlements: string[]
36
+ wildcard: boolean
37
+ /** Lease: la instancia falló su check-in obligatorio con el hub. */
38
+ stale: boolean
39
+ max_offline_hours?: number
40
+ issued_at?: string
41
+ expires_at?: string
42
+ in_grace: boolean
43
+ grace_until?: string
44
+ days_remaining: number
45
+ last_checked_at?: string
46
+ }
47
+
48
+ /** La licencia es OPERABLE cuando permite operar (aunque sea degradada):
49
+ * valid, la postura `stale` del lease, o dentro de la ventana de gracia.
50
+ * missing/invalid/expired no son operables. Sin enforcement → siempre operable.
51
+ * Espeja `State.Operable()` del backend. */
52
+ export function isLicenseOperable(state: LicenseState | undefined): boolean {
53
+ if (!state || !state.enforced) return true
54
+ return state.valid || state.in_grace
55
+ }
56
+
57
+ /** La instancia debe BLOQUEARSE tras el modal de activación cuando hay
58
+ * enforcement y la licencia es missing/invalid/expired (pasada la gracia).
59
+ * grace/stale degradan con banner en vez de bloquear. Espeja `State.Blocking()`.
60
+ * Mientras el estado aún carga (undefined) NO bloquea: fail-open en la UI para
61
+ * que un check lento/fallido nunca destelle un candado sobre la app. */
62
+ export function isLicenseBlocking(state: LicenseState | undefined): boolean {
63
+ if (!state || !state.enforced) return false
64
+ return !isLicenseOperable(state)
65
+ }
66
+
67
+ /** Un preset/vertical está habilitado si la licencia otorga wildcard o lo lista
68
+ * explícitamente. Sin enforcement → todo habilitado. */
69
+ export function isPresetEntitled(
70
+ state: LicenseState | undefined,
71
+ presetKey: string,
72
+ ): boolean {
73
+ if (!state || !state.enforced) return true
74
+ if (state.wildcard) return true
75
+ return state.entitlements?.includes(presetKey) ?? false
76
+ }
77
+
78
+ /** Marca trial vencido: el copy del gate cambia a "tu prueba terminó". */
79
+ export function isTrialExpired(state: LicenseState | undefined): boolean {
80
+ return !!state && state.plan === 'trial' && state.status === 'expired'
81
+ }
82
+
83
+ /** Branding opcional para teñir el gate/banner. El host lo pasa desde su
84
+ * PlatformConfig del SDK (o cualquier fuente); sin él, fallback neutro. */
85
+ export interface LicenseBranding {
86
+ /** Nombre de la plataforma/tenant, para el encabezado del gate. */
87
+ name?: string
88
+ /** URL del logo (se embebe como <img>). */
89
+ logo?: string
90
+ }
package/src/types.ts CHANGED
@@ -554,6 +554,13 @@ export interface PaginationMeta {
554
554
  // ActionMetadata re-exported from the sdk's action-registry. We mirror the
555
555
  // subset needed for the dispatcher so consumers of runtime-react don't have to
556
556
  // import the sdk directly for prop typings.
557
+ /** One page of a multi-step (wizard) action. Mirrors the sdk's ActionStep. */
558
+ export interface ActionStep {
559
+ title: string
560
+ description?: string
561
+ fields: ActionFieldDef[]
562
+ }
563
+
557
564
  export interface ActionMetadata {
558
565
  key: string
559
566
  label: string
@@ -562,6 +569,8 @@ export interface ActionMetadata {
562
569
  confirm?: boolean
563
570
  confirmMessage?: string
564
571
  fields?: ActionFieldDef[]
572
+ /** Multi-step wizard form; when present the dispatcher renders a wizard. */
573
+ steps?: ActionStep[]
565
574
  requiresState?: string[]
566
575
  executable?: boolean
567
576
  placement?: 'row' | 'table' | 'create'
package/LICENSE DELETED
@@ -1,201 +0,0 @@
1
- Apache License
2
- Version 2.0, January 2004
3
- http://www.apache.org/licenses/
4
-
5
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
-
7
- 1. Definitions.
8
-
9
- "License" shall mean the terms and conditions for use, reproduction,
10
- and distribution as defined by Sections 1 through 9 of this document.
11
-
12
- "Licensor" shall mean the copyright owner or entity authorized by
13
- the copyright owner that is granting the License.
14
-
15
- "Legal Entity" shall mean the union of the acting entity and all
16
- other entities that control, are controlled by, or are under common
17
- control with that entity. For the purposes of this definition,
18
- "control" means (i) the power, direct or indirect, to cause the
19
- direction or management of such entity, whether by contract or
20
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
- outstanding shares, or (iii) beneficial ownership of such entity.
22
-
23
- "You" (or "Your") shall mean an individual or Legal Entity
24
- exercising permissions granted by this License.
25
-
26
- "Source" form shall mean the preferred form for making modifications,
27
- including but not limited to software source code, documentation
28
- source, and configuration files.
29
-
30
- "Object" form shall mean any form resulting from mechanical
31
- transformation or translation of a Source form, including but
32
- not limited to compiled object code, generated documentation,
33
- and conversions to other media types.
34
-
35
- "Work" shall mean the work of authorship, whether in Source or
36
- Object form, made available under the License, as indicated by a
37
- copyright notice that is included in or attached to the work
38
- (an example is provided in the Appendix below).
39
-
40
- "Derivative Works" shall mean any work, whether in Source or Object
41
- form, that is based on (or derived from) the Work and for which the
42
- editorial revisions, annotations, elaborations, or other modifications
43
- represent, as a whole, an original work of authorship. For the purposes
44
- of this License, Derivative Works shall not include works that remain
45
- separable from, or merely link (or bind by name) to the interfaces of,
46
- the Work and Derivative Works thereof.
47
-
48
- "Contribution" shall mean any work of authorship, including
49
- the original version of the Work and any modifications or additions
50
- to that Work or Derivative Works thereof, that is intentionally
51
- submitted to Licensor for inclusion in the Work by the copyright owner
52
- or by an individual or Legal Entity authorized to submit on behalf of
53
- the copyright owner. For the purposes of this definition, "submitted"
54
- means any form of electronic, verbal, or written communication sent
55
- to the Licensor or its representatives, including but not limited to
56
- communication on electronic mailing lists, source code control systems,
57
- and issue tracking systems that are managed by, or on behalf of, the
58
- Licensor for the purpose of discussing and improving the Work, but
59
- excluding communication that is conspicuously marked or otherwise
60
- designated in writing by the copyright owner as "Not a Contribution."
61
-
62
- "Contributor" shall mean Licensor and any individual or Legal Entity
63
- on behalf of whom a Contribution has been received by Licensor and
64
- subsequently incorporated within the Work.
65
-
66
- 2. Grant of Copyright License. Subject to the terms and conditions of
67
- this License, each Contributor hereby grants to You a perpetual,
68
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
- copyright license to reproduce, prepare Derivative Works of,
70
- publicly display, publicly perform, sublicense, and distribute the
71
- Work and such Derivative Works in Source or Object form.
72
-
73
- 3. Grant of Patent License. Subject to the terms and conditions of
74
- this License, each Contributor hereby grants to You a perpetual,
75
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
- (except as stated in this section) patent license to make, have made,
77
- use, offer to sell, sell, import, and otherwise transfer the Work,
78
- where such license applies only to those patent claims licensable
79
- by such Contributor that are necessarily infringed by their
80
- Contribution(s) alone or by combination of their Contribution(s)
81
- with the Work to which such Contribution(s) was submitted. If You
82
- institute patent litigation against any entity (including a
83
- cross-claim or counterclaim in a lawsuit) alleging that the Work
84
- or a Contribution incorporated within the Work constitutes direct
85
- or contributory patent infringement, then any patent licenses
86
- granted to You under this License for that Work shall terminate
87
- as of the date such litigation is filed.
88
-
89
- 4. Redistribution. You may reproduce and distribute copies of the
90
- Work or Derivative Works thereof in any medium, with or without
91
- modifications, and in Source or Object form, provided that You
92
- meet the following conditions:
93
-
94
- (a) You must give any other recipients of the Work or
95
- Derivative Works a copy of this License; and
96
-
97
- (b) You must cause any modified files to carry prominent notices
98
- stating that You changed the files; and
99
-
100
- (c) You must retain, in the Source form of any Derivative Works
101
- that You distribute, all copyright, patent, trademark, and
102
- attribution notices from the Source form of the Work,
103
- excluding those notices that do not pertain to any part of
104
- the Derivative Works; and
105
-
106
- (d) If the Work includes a "NOTICE" text file as part of its
107
- distribution, then any Derivative Works that You distribute must
108
- include a readable copy of the attribution notices contained
109
- within such NOTICE file, excluding those notices that do not
110
- pertain to any part of the Derivative Works, in at least one
111
- of the following places: within a NOTICE text file distributed
112
- as part of the Derivative Works; within the Source form or
113
- documentation, if provided along with the Derivative Works; or,
114
- within a display generated by the Derivative Works, if and
115
- wherever such third-party notices normally appear. The contents
116
- of the NOTICE file are for informational purposes only and
117
- do not modify the License. You may add Your own attribution
118
- notices within Derivative Works that You distribute, alongside
119
- or as an addendum to the NOTICE text from the Work, provided
120
- that such additional attribution notices cannot be construed
121
- as modifying the License.
122
-
123
- You may add Your own copyright statement to Your modifications and
124
- may provide additional or different license terms and conditions
125
- for use, reproduction, or distribution of Your modifications, or
126
- for any such Derivative Works as a whole, provided Your use,
127
- reproduction, and distribution of the Work otherwise complies with
128
- the conditions stated in this License.
129
-
130
- 5. Submission of Contributions. Unless You explicitly state otherwise,
131
- any Contribution intentionally submitted for inclusion in the Work
132
- by You to the Licensor shall be under the terms and conditions of
133
- this License, without any additional terms or conditions.
134
- Notwithstanding the above, nothing herein shall supersede or modify
135
- the terms of any separate license agreement you may have executed
136
- with Licensor regarding such Contributions.
137
-
138
- 6. Trademarks. This License does not grant permission to use the trade
139
- names, trademarks, service marks, or product names of the Licensor,
140
- except as required for describing the origin of the Work and
141
- reproducing the content of the NOTICE file.
142
-
143
- 7. Disclaimer of Warranty. Unless required by applicable law or
144
- agreed to in writing, Licensor provides the Work (and each
145
- Contributor provides its Contributions) on an "AS IS" BASIS,
146
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
- implied, including, without limitation, any warranties or conditions
148
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
- PARTICULAR PURPOSE. You are solely responsible for determining the
150
- appropriateness of using or redistributing the Work and assume any
151
- risks associated with Your exercise of permissions under this License.
152
-
153
- 8. Limitation of Liability. In no event and under no legal theory,
154
- whether in tort (including negligence), contract, or otherwise,
155
- unless required by applicable law (such as deliberate and grossly
156
- negligent acts) or agreed to in writing, shall any Contributor be
157
- liable to You for damages, including any direct, indirect, special,
158
- incidental, or consequential damages of any character arising as a
159
- result of this License or out of the use or inability to use the
160
- Work (including but not limited to damages for loss of goodwill,
161
- work stoppage, computer failure or malfunction, or any and all
162
- other commercial damages or losses), even if such Contributor
163
- has been advised of the possibility of such damages.
164
-
165
- 9. Accepting Warranty or Additional Liability. While redistributing
166
- the Work or Derivative Works thereof, You may choose to offer,
167
- and charge a fee for, acceptance of support, warranty, indemnity,
168
- or other liability obligations and/or rights consistent with this
169
- License. However, in accepting such obligations, You may act only
170
- on Your own behalf and on Your sole responsibility, not on behalf
171
- of any other Contributor, and only if You agree to indemnify,
172
- defend, and hold each Contributor harmless for any liability
173
- incurred by, or claims asserted against, such Contributor by reason
174
- of your accepting any such warranty or additional liability.
175
-
176
- END OF TERMS AND CONDITIONS
177
-
178
- APPENDIX: How to apply the Apache License to your work.
179
-
180
- To apply the Apache License to your work, attach the following
181
- boilerplate notice, with the fields enclosed by brackets "[]"
182
- replaced with your own identifying information. (Don't include
183
- the brackets!) The text should be enclosed in the appropriate
184
- comment syntax for the file format. We also recommend that a
185
- file or class name and description of purpose be included on the
186
- same "printed page" as the copyright notice for easier
187
- identification within third-party archives.
188
-
189
- Copyright 2026 Asteby, Inc.
190
-
191
- Licensed under the Apache License, Version 2.0 (the "License");
192
- you may not use this file except in compliance with the License.
193
- You may obtain a copy of the License at
194
-
195
- http://www.apache.org/licenses/LICENSE-2.0
196
-
197
- Unless required by applicable law or agreed to in writing, software
198
- distributed under the License is distributed on an "AS IS" BASIS,
199
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
- See the License for the specific language governing permissions and
201
- limitations under the License.