@linked.cm/capacitor 0.3.7 → 1.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/CHANGELOG.md +62 -0
- package/lib/esm/backend.d.ts +1 -0
- package/lib/esm/data/capacitor.ttl +15 -0
- package/lib/esm/data/shapes.ttl +10 -0
- package/lib/esm/hooks/useAutomaticUpdates.d.ts +11 -1
- package/lib/esm/hooks/useAutomaticUpdates.js +35 -5
- package/lib/esm/hooks/useAutomaticUpdates.js.map +1 -1
- package/lib/esm/hooks/useMandatoryNativeUpdate.d.ts +47 -0
- package/lib/esm/hooks/useMandatoryNativeUpdate.js +160 -0
- package/lib/esm/hooks/useMandatoryNativeUpdate.js.map +1 -0
- package/lib/esm/hooks/useReleaseGate.d.ts +39 -0
- package/lib/esm/hooks/useReleaseGate.js +116 -0
- package/lib/esm/hooks/useReleaseGate.js.map +1 -0
- package/lib/esm/index.d.ts +6 -1
- package/lib/esm/index.js +6 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/ontologies/capacitor.d.ts +2 -0
- package/lib/esm/ontologies/capacitor.data.d.ts +8 -0
- package/lib/esm/ontologies/capacitor.data.js +15 -0
- package/lib/esm/ontologies/capacitor.data.js.map +1 -0
- package/lib/esm/ontologies/capacitor.js +6 -0
- package/lib/esm/ontologies/capacitor.js.map +1 -0
- package/lib/esm/ontologies/capacitor.register.js +15 -0
- package/lib/esm/ontologies/capacitor.register.js.map +1 -0
- package/lib/esm/package.d.ts +1 -1
- package/lib/esm/shapes/LocationUpdateAction.js +2 -2
- package/lib/esm/shapes/LocationUpdateAction.js.map +1 -1
- package/lib/esm/shapes/index.d.ts +1 -1
- package/lib/esm/shapes/index.js +1 -1
- package/lib/esm/shapes/index.js.map +1 -1
- package/lib/esm/utils/releaseStatus.d.ts +34 -0
- package/lib/esm/utils/releaseStatus.js +81 -0
- package/lib/esm/utils/releaseStatus.js.map +1 -0
- package/lib/esm/utils/releaseStatusCache.d.ts +31 -0
- package/lib/esm/utils/releaseStatusCache.js +48 -0
- package/lib/esm/utils/releaseStatusCache.js.map +1 -0
- package/lib/esm/utils/releaseStatusClient.d.ts +16 -0
- package/lib/esm/utils/releaseStatusClient.js +46 -0
- package/lib/esm/utils/releaseStatusClient.js.map +1 -0
- package/package.json +27 -17
- package/readme.md +98 -1
- package/tests/automatic-updates-gating.test.tsx +68 -0
- package/tests/mandatory-native-update-hook.test.tsx +179 -0
- package/tests/mandatory-native-update.test.mjs +94 -0
- package/tests/ontology.test.mjs +39 -0
- package/tests/release-gate.test.tsx +182 -0
- package/tests/release-status.test.mjs +154 -0
- package/vitest.config.ts +8 -0
- package/lib/esm/data/lincd-capacitor.json +0 -20
- package/lib/esm/ontologies/lincd-capacitor.d.ts +0 -30
- package/lib/esm/ontologies/lincd-capacitor.js +0 -28
- package/lib/esm/ontologies/lincd-capacitor.js.map +0 -1
- package/lib/esm/ontologies/lincd-capacitor.register.js +0 -15
- package/lib/esm/ontologies/lincd-capacitor.register.js.map +0 -1
- /package/lib/esm/ontologies/{lincd-capacitor.register.d.ts → capacitor.register.d.ts} +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// @vitest-environment happy-dom
|
|
2
|
+
import { act, renderHook, waitFor } from '@testing-library/react';
|
|
3
|
+
import { afterAll, beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { useReleaseGate } from '../src/hooks/useReleaseGate.js';
|
|
5
|
+
import type { ReleaseStatus } from '../src/utils/releaseStatus.js';
|
|
6
|
+
|
|
7
|
+
const runtime = vi.hoisted(() => ({
|
|
8
|
+
platform: 'web' as 'web' | 'ios' | 'android',
|
|
9
|
+
version: '4.3.6',
|
|
10
|
+
listeners: [] as Array<(event: { isActive: boolean }) => void>,
|
|
11
|
+
}));
|
|
12
|
+
|
|
13
|
+
vi.mock('@capacitor/core', () => ({
|
|
14
|
+
Capacitor: {
|
|
15
|
+
getPlatform: () => runtime.platform,
|
|
16
|
+
isNativePlatform: () => runtime.platform !== 'web',
|
|
17
|
+
},
|
|
18
|
+
}));
|
|
19
|
+
|
|
20
|
+
vi.mock('@capacitor/app', () => ({
|
|
21
|
+
App: {
|
|
22
|
+
getInfo: vi.fn(async () => ({ version: runtime.version })),
|
|
23
|
+
addListener: vi.fn(async (_event, listener) => {
|
|
24
|
+
runtime.listeners.push(listener);
|
|
25
|
+
return {
|
|
26
|
+
remove: async () => {
|
|
27
|
+
runtime.listeners = runtime.listeners.filter(
|
|
28
|
+
(candidate) => candidate !== listener
|
|
29
|
+
);
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
}),
|
|
33
|
+
},
|
|
34
|
+
}));
|
|
35
|
+
|
|
36
|
+
vi.mock('@capawesome/capacitor-app-update', () => ({
|
|
37
|
+
AppUpdate: {
|
|
38
|
+
getAppUpdateInfo: vi.fn(),
|
|
39
|
+
performImmediateUpdate: vi.fn(),
|
|
40
|
+
openAppStore: vi.fn(),
|
|
41
|
+
},
|
|
42
|
+
AppUpdateResultCode: { OK: 0 },
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
const supported: ReleaseStatus = {
|
|
46
|
+
minimumVersion: '4.3.6',
|
|
47
|
+
maintenanceMode: false,
|
|
48
|
+
maintenancePlatform: 'all',
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
function deferred<T>() {
|
|
52
|
+
let resolve!: (value: T) => void;
|
|
53
|
+
let reject!: (reason: unknown) => void;
|
|
54
|
+
const promise = new Promise<T>((res, rej) => {
|
|
55
|
+
resolve = res;
|
|
56
|
+
reject = rej;
|
|
57
|
+
});
|
|
58
|
+
return { promise, resolve, reject };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
let warnSpy: ReturnType<typeof vi.spyOn>;
|
|
62
|
+
|
|
63
|
+
beforeAll(() => {
|
|
64
|
+
warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
afterAll(() => {
|
|
68
|
+
warnSpy.mockRestore();
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
beforeEach(() => {
|
|
72
|
+
runtime.platform = 'web';
|
|
73
|
+
runtime.version = '4.3.6';
|
|
74
|
+
runtime.listeners = [];
|
|
75
|
+
vi.clearAllMocks();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
describe('useReleaseGate lifecycle', () => {
|
|
79
|
+
it('renders web as supported while status loads, then applies maintenance', async () => {
|
|
80
|
+
const request = deferred<ReleaseStatus>();
|
|
81
|
+
const { result } = renderHook(() =>
|
|
82
|
+
useReleaseGate({
|
|
83
|
+
loadStatus: () => request.promise,
|
|
84
|
+
fallbackMinimumVersion: '4.3.6',
|
|
85
|
+
})
|
|
86
|
+
);
|
|
87
|
+
expect(result.current.state.status).toBe('supported');
|
|
88
|
+
expect(result.current.otaEnabled).toBe(true);
|
|
89
|
+
request.resolve({
|
|
90
|
+
...supported,
|
|
91
|
+
maintenanceMode: true,
|
|
92
|
+
maintenancePlatform: 'web',
|
|
93
|
+
});
|
|
94
|
+
await waitFor(() => expect(result.current.state.status).toBe('maintenance'));
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('prioritizes native maintenance over a required binary update', async () => {
|
|
98
|
+
runtime.platform = 'android';
|
|
99
|
+
runtime.version = '4.3.5';
|
|
100
|
+
const { result } = renderHook(() =>
|
|
101
|
+
useReleaseGate({
|
|
102
|
+
loadStatus: async () => ({
|
|
103
|
+
...supported,
|
|
104
|
+
maintenanceMode: true,
|
|
105
|
+
maintenancePlatform: 'native',
|
|
106
|
+
}),
|
|
107
|
+
fallbackMinimumVersion: '4.3.6',
|
|
108
|
+
})
|
|
109
|
+
);
|
|
110
|
+
await waitFor(() => expect(result.current.state.status).toBe('maintenance'));
|
|
111
|
+
expect(result.current.otaEnabled).toBe(false);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('refreshes status and installed version on native foreground', async () => {
|
|
115
|
+
runtime.platform = 'ios';
|
|
116
|
+
let minimumVersion = '4.3.6';
|
|
117
|
+
const loadStatus = vi.fn(async () => ({ ...supported, minimumVersion }));
|
|
118
|
+
const { result } = renderHook(() =>
|
|
119
|
+
useReleaseGate({
|
|
120
|
+
loadStatus,
|
|
121
|
+
fallbackMinimumVersion: '4.3.6',
|
|
122
|
+
})
|
|
123
|
+
);
|
|
124
|
+
await waitFor(() => expect(result.current.otaEnabled).toBe(true));
|
|
125
|
+
minimumVersion = '4.4.0';
|
|
126
|
+
await act(async () => {
|
|
127
|
+
runtime.listeners.forEach((listener) => listener({ isActive: true }));
|
|
128
|
+
});
|
|
129
|
+
await waitFor(() => expect(result.current.state.status).toBe('required'));
|
|
130
|
+
expect(loadStatus).toHaveBeenCalledTimes(2);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it('ignores a stale status request completed after retry', async () => {
|
|
134
|
+
const oldRequest = deferred<ReleaseStatus>();
|
|
135
|
+
const newRequest = deferred<ReleaseStatus>();
|
|
136
|
+
const loadStatus = vi
|
|
137
|
+
.fn<() => Promise<ReleaseStatus>>()
|
|
138
|
+
.mockReturnValueOnce(oldRequest.promise)
|
|
139
|
+
.mockReturnValueOnce(newRequest.promise);
|
|
140
|
+
const { result } = renderHook(() =>
|
|
141
|
+
useReleaseGate({
|
|
142
|
+
loadStatus,
|
|
143
|
+
fallbackMinimumVersion: '4.3.6',
|
|
144
|
+
})
|
|
145
|
+
);
|
|
146
|
+
let retry!: Promise<void>;
|
|
147
|
+
act(() => {
|
|
148
|
+
retry = result.current.retryCheck();
|
|
149
|
+
});
|
|
150
|
+
newRequest.resolve({
|
|
151
|
+
...supported,
|
|
152
|
+
maintenanceMode: true,
|
|
153
|
+
maintenancePlatform: 'web',
|
|
154
|
+
});
|
|
155
|
+
await act(async () => retry);
|
|
156
|
+
expect(result.current.state.status).toBe('maintenance');
|
|
157
|
+
oldRequest.resolve(supported);
|
|
158
|
+
await act(async () => oldRequest.promise);
|
|
159
|
+
expect(result.current.state.status).toBe('maintenance');
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
it('recovers from an initial status error through manual retry', async () => {
|
|
163
|
+
const loadStatus = vi
|
|
164
|
+
.fn<() => Promise<ReleaseStatus>>()
|
|
165
|
+
.mockRejectedValueOnce(new Error('offline'))
|
|
166
|
+
.mockResolvedValueOnce({
|
|
167
|
+
...supported,
|
|
168
|
+
maintenanceMode: true,
|
|
169
|
+
maintenancePlatform: 'web',
|
|
170
|
+
});
|
|
171
|
+
const { result } = renderHook(() =>
|
|
172
|
+
useReleaseGate({
|
|
173
|
+
loadStatus,
|
|
174
|
+
fallbackMinimumVersion: '4.3.6',
|
|
175
|
+
})
|
|
176
|
+
);
|
|
177
|
+
await waitFor(() => expect(loadStatus).toHaveBeenCalledTimes(1));
|
|
178
|
+
await act(async () => result.current.retryCheck());
|
|
179
|
+
expect(result.current.state.status).toBe('maintenance');
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import test from 'node:test';
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
isMaintenanceApplicable,
|
|
6
|
+
normalizeReleaseStatus,
|
|
7
|
+
pickReleaseStatus,
|
|
8
|
+
toStatusResponse,
|
|
9
|
+
tryNormalizeReleaseStatus,
|
|
10
|
+
} from '../lib/esm/utils/releaseStatus.js';
|
|
11
|
+
import {
|
|
12
|
+
createReleaseStatusHandler,
|
|
13
|
+
ReleaseStatusCache,
|
|
14
|
+
} from '../lib/esm/utils/releaseStatusCache.js';
|
|
15
|
+
import { ReleaseStatusClient } from '../lib/esm/utils/releaseStatusClient.js';
|
|
16
|
+
|
|
17
|
+
const supported = {
|
|
18
|
+
minimumVersion: '4.3.6',
|
|
19
|
+
maintenanceMode: false,
|
|
20
|
+
maintenancePlatform: 'all',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
test('release status normalizes optional fields and rejects invalid versions', () => {
|
|
24
|
+
assert.deepEqual(normalizeReleaseStatus({ minimumVersion: ' 4.3.6 ' }), supported);
|
|
25
|
+
assert.throws(
|
|
26
|
+
() => normalizeReleaseStatus({ minimumVersion: '4.3.6-beta.1' }),
|
|
27
|
+
/stable X\.Y\.Z/
|
|
28
|
+
);
|
|
29
|
+
assert.throws(
|
|
30
|
+
() =>
|
|
31
|
+
normalizeReleaseStatus(
|
|
32
|
+
{ minimumVersion: null },
|
|
33
|
+
{ defaultMinimumVersion: '4.3.4' }
|
|
34
|
+
),
|
|
35
|
+
/stable X\.Y\.Z/
|
|
36
|
+
);
|
|
37
|
+
assert.deepEqual(
|
|
38
|
+
normalizeReleaseStatus({}, { defaultMinimumVersion: '4.3.4' }),
|
|
39
|
+
{
|
|
40
|
+
minimumVersion: '4.3.4',
|
|
41
|
+
maintenanceMode: false,
|
|
42
|
+
maintenancePlatform: 'all',
|
|
43
|
+
}
|
|
44
|
+
);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test('maintenance targeting distinguishes web, native, and exact platforms', () => {
|
|
48
|
+
assert.equal(
|
|
49
|
+
isMaintenanceApplicable(
|
|
50
|
+
{ maintenanceMode: true, maintenancePlatform: 'native' },
|
|
51
|
+
'web'
|
|
52
|
+
),
|
|
53
|
+
false
|
|
54
|
+
);
|
|
55
|
+
assert.equal(
|
|
56
|
+
isMaintenanceApplicable(
|
|
57
|
+
{ maintenanceMode: true, maintenancePlatform: 'native' },
|
|
58
|
+
'android'
|
|
59
|
+
),
|
|
60
|
+
true
|
|
61
|
+
);
|
|
62
|
+
assert.equal(
|
|
63
|
+
isMaintenanceApplicable(
|
|
64
|
+
{ maintenanceMode: true, maintenancePlatform: 'ios' },
|
|
65
|
+
'android'
|
|
66
|
+
),
|
|
67
|
+
false
|
|
68
|
+
);
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
test('server cache retains the last valid snapshot and handler disables caching', () => {
|
|
72
|
+
let value = { ...supported, minimumVersion: '4.4.0' };
|
|
73
|
+
const warnings = [];
|
|
74
|
+
const cache = new ReleaseStatusCache({
|
|
75
|
+
initialStatus: supported,
|
|
76
|
+
readStatus: () => value,
|
|
77
|
+
log: (...args) => warnings.push(args),
|
|
78
|
+
});
|
|
79
|
+
assert.equal(cache.load().minimumVersion, '4.4.0');
|
|
80
|
+
value = { ...supported, minimumVersion: 'invalid' };
|
|
81
|
+
assert.equal(cache.load().minimumVersion, '4.4.0');
|
|
82
|
+
assert.equal(warnings.length, 1);
|
|
83
|
+
|
|
84
|
+
const headers = {};
|
|
85
|
+
let statusCode;
|
|
86
|
+
let body;
|
|
87
|
+
createReleaseStatusHandler(cache)(null, {
|
|
88
|
+
setHeader: (name, headerValue) => {
|
|
89
|
+
headers[name] = headerValue;
|
|
90
|
+
},
|
|
91
|
+
status: (code) => {
|
|
92
|
+
statusCode = code;
|
|
93
|
+
return { json: (next) => (body = next) };
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
assert.equal(statusCode, 200);
|
|
97
|
+
assert.equal(headers['Cache-Control'], 'no-store');
|
|
98
|
+
assert.deepEqual(body, cache.getStatus());
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
test('status client deduplicates concurrent requests and retains valid data', async () => {
|
|
102
|
+
let calls = 0;
|
|
103
|
+
let fail = false;
|
|
104
|
+
const client = new ReleaseStatusClient({
|
|
105
|
+
url: '/status',
|
|
106
|
+
fetch: async () => {
|
|
107
|
+
calls += 1;
|
|
108
|
+
if (fail) throw new Error('offline');
|
|
109
|
+
return {
|
|
110
|
+
ok: true,
|
|
111
|
+
json: async () => supported,
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
const [first, second] = await Promise.all([client.load(), client.load()]);
|
|
116
|
+
assert.deepEqual(first, supported);
|
|
117
|
+
assert.deepEqual(second, supported);
|
|
118
|
+
assert.equal(calls, 1);
|
|
119
|
+
fail = true;
|
|
120
|
+
assert.deepEqual(await client.load(), supported);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
test('tryNormalizeReleaseStatus reports validation failures without throwing', () => {
|
|
125
|
+
assert.deepEqual(tryNormalizeReleaseStatus(supported), {
|
|
126
|
+
ok: true,
|
|
127
|
+
value: supported,
|
|
128
|
+
});
|
|
129
|
+
const failed = tryNormalizeReleaseStatus({ minimumVersion: '4' });
|
|
130
|
+
assert.equal(failed.ok, false);
|
|
131
|
+
assert.match(failed.error, /stable X\.Y\.Z/);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('pickReleaseStatus and toStatusResponse normalize owned fields only', () => {
|
|
135
|
+
assert.deepEqual(
|
|
136
|
+
pickReleaseStatus(
|
|
137
|
+
{
|
|
138
|
+
minimumVersion: '4.3.6',
|
|
139
|
+
maintenanceMode: true,
|
|
140
|
+
maintenancePlatform: 'native',
|
|
141
|
+
maintenanceMessage: ' later ',
|
|
142
|
+
unrelated: true,
|
|
143
|
+
},
|
|
144
|
+
{ defaultMinimumVersion: '4.3.4' }
|
|
145
|
+
),
|
|
146
|
+
{
|
|
147
|
+
minimumVersion: '4.3.6',
|
|
148
|
+
maintenanceMode: true,
|
|
149
|
+
maintenancePlatform: 'native',
|
|
150
|
+
maintenanceMessage: 'later',
|
|
151
|
+
}
|
|
152
|
+
);
|
|
153
|
+
assert.deepEqual(toStatusResponse(supported), supported);
|
|
154
|
+
});
|
package/vitest.config.ts
ADDED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"@context": {
|
|
3
|
-
"dc": "http://purl.org/dc/elements/1.1/",
|
|
4
|
-
"owl": "http://www.w3.org/2002/07/owl#",
|
|
5
|
-
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
|
|
6
|
-
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
|
|
7
|
-
"lincd-capacitor": "http://lincd.org/ont/lincd-capacitor/"
|
|
8
|
-
},
|
|
9
|
-
"@graph": [
|
|
10
|
-
{
|
|
11
|
-
"@id": "lincd-capacitor:ExampleClass",
|
|
12
|
-
"@type": "rdfs:Class",
|
|
13
|
-
"rdfs:comment": "This is an example class. You can remove or rename it",
|
|
14
|
-
"rdfs:isDefinedBy": {
|
|
15
|
-
"@id": "lincd-capacitor:"
|
|
16
|
-
},
|
|
17
|
-
"rdfs:label": "Example Class"
|
|
18
|
-
}
|
|
19
|
-
]
|
|
20
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Load the data of this ontology into memory
|
|
3
|
-
*/
|
|
4
|
-
export declare var loadData: () => Promise<{
|
|
5
|
-
"@context": {
|
|
6
|
-
dc: string;
|
|
7
|
-
owl: string;
|
|
8
|
-
rdf: string;
|
|
9
|
-
rdfs: string;
|
|
10
|
-
"lincd-capacitor": string;
|
|
11
|
-
};
|
|
12
|
-
"@graph": {
|
|
13
|
-
"@id": string;
|
|
14
|
-
"@type": string;
|
|
15
|
-
"rdfs:comment": string;
|
|
16
|
-
"rdfs:isDefinedBy": {
|
|
17
|
-
"@id": string;
|
|
18
|
-
};
|
|
19
|
-
"rdfs:label": string;
|
|
20
|
-
}[];
|
|
21
|
-
}>;
|
|
22
|
-
/**
|
|
23
|
-
* The namespace of this ontology
|
|
24
|
-
*/
|
|
25
|
-
export declare var ns: (term: string) => import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
26
|
-
export declare var _self: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
27
|
-
export declare var LocationUpdateAction: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
28
|
-
export declare const lincdCapacitor: {
|
|
29
|
-
LocationUpdateAction: import("@_linked/core/utils/NodeReference.js").NodeReferenceValue;
|
|
30
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createNameSpace } from '@_linked/core/utils/NameSpace';
|
|
2
|
-
/**
|
|
3
|
-
* Load the data of this ontology into memory
|
|
4
|
-
*/
|
|
5
|
-
export var loadData = () => {
|
|
6
|
-
if (typeof module !== 'undefined' && typeof exports !== 'undefined') {
|
|
7
|
-
// CommonJS import
|
|
8
|
-
return import('../data/lincd-capacitor.json');
|
|
9
|
-
}
|
|
10
|
-
else {
|
|
11
|
-
// ESM import
|
|
12
|
-
//@ts-ignore
|
|
13
|
-
return import('../data/lincd-capacitor.json', {
|
|
14
|
-
with: { type: 'json' },
|
|
15
|
-
}).then((data) => data.default);
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* The namespace of this ontology
|
|
20
|
-
*/
|
|
21
|
-
export var ns = createNameSpace('http://lincd.org/ont/lincd-capacitor/');
|
|
22
|
-
export var _self = ns('');
|
|
23
|
-
export var LocationUpdateAction = ns('LocationUpdateAction');
|
|
24
|
-
//An extra grouping object so all the entities can be accessed from the prefix/name
|
|
25
|
-
export const lincdCapacitor = {
|
|
26
|
-
LocationUpdateAction,
|
|
27
|
-
};
|
|
28
|
-
//# sourceMappingURL=lincd-capacitor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lincd-capacitor.js","sourceRoot":"","sources":["../../../src/ontologies/lincd-capacitor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE;;GAEG;AACH,MAAM,CAAC,IAAI,QAAQ,GAAG,GAAG,EAAE;IACzB,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,OAAO,KAAK,WAAW,EAAE,CAAC;QACpE,kBAAkB;QAClB,OAAO,MAAM,CAAC,8BAA8B,CAAC,CAAC;IAChD,CAAC;SAAM,CAAC;QACN,aAAa;QACb,YAAY;QACZ,OAAO,MAAM,CAAC,8BAA8B,EAAE;YAC5C,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACvB,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;AACH,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,IAAI,EAAE,GAAG,eAAe,CAAC,uCAAuC,CAAC,CAAC;AAEzE,MAAM,CAAC,IAAI,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;AAE1B,MAAM,CAAC,IAAI,oBAAoB,GAAG,EAAE,CAAC,sBAAsB,CAAC,CAAC;AAE7D,mFAAmF;AACnF,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,oBAAoB;CACrB,CAAC","sourcesContent":["import { createNameSpace } from '@_linked/core/utils/NameSpace';\n\n/**\n * Load the data of this ontology into memory\n */\nexport var loadData = () => {\n if (typeof module !== 'undefined' && typeof exports !== 'undefined') {\n // CommonJS import\n return import('../data/lincd-capacitor.json');\n } else {\n // ESM import\n //@ts-ignore\n return import('../data/lincd-capacitor.json', {\n with: { type: 'json' },\n }).then((data) => data.default);\n }\n};\n\n/**\n * The namespace of this ontology\n */\nexport var ns = createNameSpace('http://lincd.org/ont/lincd-capacitor/');\n\nexport var _self = ns('');\n\nexport var LocationUpdateAction = ns('LocationUpdateAction');\n\n//An extra grouping object so all the entities can be accessed from the prefix/name\nexport const lincdCapacitor = {\n LocationUpdateAction,\n};\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Registers this ontology.
|
|
3
|
-
*
|
|
4
|
-
* Kept out of `lincd-capacitor.ts` because registration needs that module's whole export
|
|
5
|
-
* namespace, and a module cannot import itself once a bundler is involved: Rollup treats
|
|
6
|
-
* a static self-reference as a circular import and elides it, so the binding is undefined
|
|
7
|
-
* at runtime and the app dies at boot with `_this is not defined`. `tsc` preserves it,
|
|
8
|
-
* which is why the pattern worked for as long as packages were only built with `tsc`.
|
|
9
|
-
*
|
|
10
|
-
* From a sibling module the same import is ordinary and survives.
|
|
11
|
-
*/
|
|
12
|
-
import * as terms from './lincd-capacitor.js';
|
|
13
|
-
import { linkedOntology } from '../package.js';
|
|
14
|
-
linkedOntology(terms, terms.ns, 'lincd-capacitor', terms.loadData, '../data/lincd-capacitor.json');
|
|
15
|
-
//# sourceMappingURL=lincd-capacitor.register.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lincd-capacitor.register.js","sourceRoot":"","sources":["../../../src/ontologies/lincd-capacitor.register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,KAAK,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,cAAc,CACZ,KAAK,EACL,KAAK,CAAC,EAAE,EACR,iBAAiB,EACjB,KAAK,CAAC,QAAQ,EACd,8BAA8B,CAC/B,CAAC","sourcesContent":["/**\n * Registers this ontology.\n *\n * Kept out of `lincd-capacitor.ts` because registration needs that module's whole export\n * namespace, and a module cannot import itself once a bundler is involved: Rollup treats\n * a static self-reference as a circular import and elides it, so the binding is undefined\n * at runtime and the app dies at boot with `_this is not defined`. `tsc` preserves it,\n * which is why the pattern worked for as long as packages were only built with `tsc`.\n *\n * From a sibling module the same import is ordinary and survives.\n */\nimport * as terms from './lincd-capacitor.js';\nimport { linkedOntology } from '../package.js';\n\nlinkedOntology(\n terms,\n terms.ns,\n 'lincd-capacitor',\n terms.loadData,\n '../data/lincd-capacitor.json'\n);\n"]}
|
|
File without changes
|