-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 118_variadic_distance_function
- Loading branch information
Showing
345 changed files
with
14,764 additions
and
3,922 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,66 @@ | ||
// Native/common standards | ||
export const XHTML_NAMESPACE_URI = 'http://www.w3.org/1999/xhtml'; | ||
export type XHTML_NAMESPACE_URI = typeof XHTML_NAMESPACE_URI; | ||
|
||
export const HTML_NAMESPACE_URI = XHTML_NAMESPACE_URI; | ||
export type HTML_NAMESPACE_URI = typeof HTML_NAMESPACE_URI; | ||
|
||
export const XML_NAMESPACE_URI = 'http://www.w3.org/XML/1998/namespace'; | ||
export type XML_NAMESPACE_URI = typeof XML_NAMESPACE_URI; | ||
|
||
export const XMLNS_NAMESPACE_URI = 'http://www.w3.org/2000/xmlns/'; | ||
export type XMLNS_NAMESPACE_URI = typeof XMLNS_NAMESPACE_URI; | ||
|
||
export const XSD_NAMESPACE_URI = 'http://www.w3.org/2001/XMLSchema'; | ||
export type XSD_NAMESPACE_URI = typeof XSD_NAMESPACE_URI; | ||
|
||
export const FN_NAMESPACE_URI = 'http://www.w3.org/2005/xpath-functions'; | ||
export type FN_NAMESPACE_URI = typeof FN_NAMESPACE_URI; | ||
|
||
// XForms/ODK | ||
export const JAVAROSA_NAMESPACE_URI = 'http://openrosa.org/javarosa'; | ||
export type JAVAROSA_NAMESPACE_URI = typeof JAVAROSA_NAMESPACE_URI; | ||
|
||
export const ODK_NAMESPACE_URI = 'http://www.opendatakit.org/xforms'; | ||
export type ODK_NAMESPACE_URI = typeof ODK_NAMESPACE_URI; | ||
|
||
export const OPENROSA_XFORMS_NAMESPACE_URI = 'http://openrosa.org/xforms'; | ||
export const XFORMS_NAMESPACE_URI = 'http://www.w3.org/2002/xforms'; | ||
export type OPENROSA_XFORMS_NAMESPACE_URI = typeof OPENROSA_XFORMS_NAMESPACE_URI; | ||
|
||
export type JavaRosaNamespaceURI = typeof JAVAROSA_NAMESPACE_URI; | ||
export type XFormsNamespaceURI = typeof XFORMS_NAMESPACE_URI; | ||
export const XFORMS_NAMESPACE_URI = 'http://www.w3.org/2002/xforms'; | ||
export type XFORMS_NAMESPACE_URI = typeof XFORMS_NAMESPACE_URI; | ||
|
||
// Enketo | ||
export const ENKETO_NAMESPACE_URI = 'http://enketo.org/xforms'; | ||
export type ENKETO_NAMESPACE_URI = typeof ENKETO_NAMESPACE_URI; | ||
|
||
// Default prefixes | ||
export const HTML_PREFIX = 'h'; | ||
export type HTML_PREFIX = typeof HTML_PREFIX; | ||
|
||
export const XML_PREFIX = 'xml'; | ||
export type XML_PREFIX = typeof XML_PREFIX; | ||
|
||
export const XMLNS_PREFIX = 'xmlns'; | ||
export type XMLNS_PREFIX = typeof XMLNS_PREFIX; | ||
|
||
export const XSD_PREFIX = 'xsd'; | ||
export type XSD_PREFIX = typeof XSD_PREFIX; | ||
|
||
export const FN_PREFIX = 'fn'; | ||
export type FN_PREFIX = typeof FN_PREFIX; | ||
|
||
export const JAVAROSA_PREFIX = 'jr'; | ||
export type JAVAROSA_PREFIX = typeof JAVAROSA_PREFIX; | ||
|
||
export const ODK_PREFIX = 'odk'; | ||
export type ODK_PREFIX = typeof ODK_PREFIX; | ||
|
||
export const OPENROSA_XFORMS_PREFIX = 'orx'; | ||
export type OPENROSA_XFORMS_PREFIX = typeof OPENROSA_XFORMS_PREFIX; | ||
|
||
export const XFORMS_PREFIX = 'xf'; | ||
export type XFORMS_PREFIX = typeof XFORMS_PREFIX; | ||
|
||
export const ENKETO_PREFIX = 'enk'; | ||
export type ENKETO_PREFIX = typeof ENKETO_PREFIX; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import { IS_NODE_RUNTIME } from '../env/detection.ts'; | ||
|
||
interface GlobURLFetchResponse { | ||
text(): Promise<string>; | ||
} | ||
|
||
type Awaitable<T> = Promise<T> | T; | ||
|
||
type FetchGlobURL = (globURL: string) => Awaitable<GlobURLFetchResponse>; | ||
|
||
let fetchGlobURL: FetchGlobURL; | ||
|
||
if (IS_NODE_RUNTIME) { | ||
const { readFile } = await import('node:fs/promises'); | ||
|
||
class NodeGlobURLFetchResponse { | ||
readonly fsPath: string; | ||
|
||
constructor(globURL: string) { | ||
this.fsPath = globURL.replace('/@fs/', '/'); | ||
} | ||
|
||
text(): Promise<string> { | ||
return readFile(this.fsPath, 'utf-8'); | ||
} | ||
} | ||
|
||
fetchGlobURL = (globURL) => { | ||
return new NodeGlobURLFetchResponse(globURL); | ||
}; | ||
} else { | ||
fetchGlobURL = fetch; | ||
} | ||
|
||
type ImportMetaGlobURLRecord = Readonly<Record<string, string>>; | ||
|
||
export type GlobFixtureLoader = (this: void) => Promise<string>; | ||
|
||
export interface GlobFixture { | ||
readonly url: URL; | ||
readonly load: GlobFixtureLoader; | ||
} | ||
|
||
export type GlobFixtureEntry = readonly [absolutePath: string, loader: GlobFixture]; | ||
|
||
const globFixtureLoader = (globURL: string): GlobFixtureLoader => { | ||
return async () => { | ||
const response = await fetchGlobURL(globURL); | ||
|
||
return response.text(); | ||
}; | ||
}; | ||
|
||
export const toGlobLoaderEntries = ( | ||
importMeta: ImportMeta, | ||
globObject: ImportMetaGlobURLRecord | ||
): readonly GlobFixtureEntry[] => { | ||
const parentPathURL = new URL('./', importMeta.url); | ||
|
||
return Object.entries(globObject).map(([relativePath, value]) => { | ||
const { pathname: absolutePath } = new URL(relativePath, parentPathURL); | ||
const fixtureAssetURL = new URL(value, import.meta.url); | ||
const fixture: GlobFixture = { | ||
url: fixtureAssetURL, | ||
load: globFixtureLoader(value), | ||
}; | ||
|
||
return [absolutePath, fixture]; | ||
}); | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/common/src/fixtures/test-scenario/csv-attachment.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
item-label,item-value | ||
Y,y | ||
Z,z |
10 changes: 10 additions & 0 deletions
10
packages/common/src/fixtures/test-scenario/xml-attachment.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<instance-root> | ||
<instance-item> | ||
<item-label>A</item-label> | ||
<item-value>a</item-value> | ||
</instance-item> | ||
<instance-item> | ||
<item-label>B</item-label> | ||
<item-value>b</item-value> | ||
</instance-item> | ||
</instance-root> |
69 changes: 69 additions & 0 deletions
69
packages/common/src/fixtures/value-types/numeric-value-types.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
<?xml version="1.0"?> | ||
<h:html xmlns="http://www.w3.org/2002/xforms" | ||
xmlns:ev="http://www.w3.org/2001/xml-events" | ||
xmlns:h="http://www.w3.org/1999/xhtml" | ||
xmlns:jr="http://openrosa.org/javarosa" | ||
xmlns:orx="http://openrosa.org/xforms/" | ||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
<h:head> | ||
<h:title>Value types (numeric)</h:title> | ||
<model> | ||
<instance> | ||
<root id="value-types-numeric"> | ||
<int-q>1</int-q> | ||
<int-val /> | ||
<decimal-q>1.5</decimal-q> | ||
<decimal-val /> | ||
<numbers-q>95</numbers-q> | ||
<numbers-val /> | ||
<thousands-int></thousands-int> | ||
<thousands-decimal></thousands-decimal> | ||
<thousands-numbers></thousands-numbers> | ||
<thousands-q>9999</thousands-q> | ||
<meta> | ||
<instanceID /> | ||
</meta> | ||
</root> | ||
</instance> | ||
<bind nodeset="/root/int-q" type="int" constraint=". > 1" /> | ||
<bind nodeset="/root/int-val" calculate="/root/int-q" readonly="true()" /> | ||
<bind nodeset="/root/decimal-q" type="decimal" constraint=". < 2.5" /> | ||
<bind nodeset="/root/decimal-val" calculate="/root/decimal-q" readonly="true()" /> | ||
<bind nodeset="/root/numbers-q" type="string" constraint=". > 94.99" /> | ||
<bind nodeset="/root/numbers-val" calculate="/root/numbers-q" readonly="true()" /> | ||
<bind nodeset="/root/thousands-int" type="int" /> | ||
<bind nodeset="/root/thousands-decimal" type="decimal" /> | ||
<bind nodeset="/root/thousands-numbers" type="string" /> | ||
<bind nodeset="/root/meta/instanceID" type="string" /> | ||
</model> | ||
</h:head> | ||
<h:body> | ||
<input ref="/root/int-q"> | ||
<label>1. Int[eger] question</label> | ||
</input> | ||
<input ref="/root/int-val"> | ||
<label>1.1 Int value</label> | ||
</input> | ||
<input ref="/root/decimal-q"> | ||
<label>2. Decimal question</label> | ||
</input> | ||
<input ref="/root/decimal-val"> | ||
<label>2.1 Decimal value</label> | ||
</input> | ||
<input ref="/root/numbers-q" appearance="numbers"> | ||
<label>3. Numbers question (string + appearance="numbers")</label> | ||
</input> | ||
<input ref="/root/numbers-val"> | ||
<label>3.1 Numbers value</label> | ||
</input> | ||
<input ref="/root/thousands-int" appearance="thousands-sep"> | ||
<label>4. Thousands separator (type="int")</label> | ||
</input> | ||
<input ref="/root/thousands-decimal" appearance="thousands-sep"> | ||
<label>4. Thousands separator (type="decimal")</label> | ||
</input> | ||
<input ref="/root/thousands-numbers" appearance="numbers thousands-sep"> | ||
<label>4. Thousands separator (string + appearance="numbers thousands-sep")</label> | ||
</input> | ||
</h:body> | ||
</h:html> |
Oops, something went wrong.