primitive-functions 0.3.0-alpha.0 → 0.3.0-alpha.10
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/index.d.ts +1904 -253
- package/index.js +71 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -33,6 +33,56 @@ export function defineFunction(_keyOrHandler, _maybeHandler) {
|
|
|
33
33
|
throw new Error(NOT_PROVIDED);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* The decisions an object form's `authorize` returns — `allow(resolved?)`
|
|
38
|
+
* and `deny(code, message?, { expose? })`. The platform copy builds them;
|
|
39
|
+
* this one refuses, like every other function here.
|
|
40
|
+
*/
|
|
41
|
+
export function allow(_resolved) {
|
|
42
|
+
throw new Error(NOT_PROVIDED);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function deny(_code, _message, _options) {
|
|
46
|
+
throw new Error(NOT_PROVIDED);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A handler's own failure code, `fail(code, message?)`, and the helpers that
|
|
51
|
+
* build an `authorize` — #4721. The platform copy implements them; these
|
|
52
|
+
* refuse, like every other function here.
|
|
53
|
+
*/
|
|
54
|
+
export function fail(_code, _message) {
|
|
55
|
+
throw new Error(NOT_PROVIDED);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function allowAnyone() {
|
|
59
|
+
throw new Error(NOT_PROVIDED);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function allowCallers(_rules) {
|
|
63
|
+
throw new Error(NOT_PROVIDED);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function requireSignedIn() {
|
|
67
|
+
throw new Error(NOT_PROVIDED);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function requireRole(_role) {
|
|
71
|
+
throw new Error(NOT_PROVIDED);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function requireMember(_groupIdOf, _role) {
|
|
75
|
+
throw new Error(NOT_PROVIDED);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function requireCollectionRole(_collectionIdOf, _minRole) {
|
|
79
|
+
throw new Error(NOT_PROVIDED);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function requireDocumentOwner(_documentIdOf) {
|
|
83
|
+
throw new Error(NOT_PROVIDED);
|
|
84
|
+
}
|
|
85
|
+
|
|
36
86
|
/**
|
|
37
87
|
* The platform's cap on a registered query's cache TTL. The stub carries the
|
|
38
88
|
* value rather than throwing, because it is a constant an author may read at
|
|
@@ -110,13 +160,34 @@ export function assertRuntime() {
|
|
|
110
160
|
throw new Error(NOT_PROVIDED);
|
|
111
161
|
}
|
|
112
162
|
|
|
163
|
+
/**
|
|
164
|
+
* Refuse every door but the one this function was written for — #4442.
|
|
165
|
+
*
|
|
166
|
+
* The platform copy compares \`ctx.trigger.kind\` with the kind named. This
|
|
167
|
+
* one refuses, loudly, like every other function here.
|
|
168
|
+
*/
|
|
169
|
+
export function assertTrigger() {
|
|
170
|
+
throw new Error(NOT_PROVIDED);
|
|
171
|
+
}
|
|
172
|
+
|
|
113
173
|
export default {
|
|
114
174
|
SDK_STUB_VERSION,
|
|
115
175
|
defineFunction,
|
|
176
|
+
allow,
|
|
177
|
+
deny,
|
|
178
|
+
fail,
|
|
179
|
+
allowAnyone,
|
|
180
|
+
allowCallers,
|
|
181
|
+
requireSignedIn,
|
|
182
|
+
requireRole,
|
|
183
|
+
requireMember,
|
|
184
|
+
requireCollectionRole,
|
|
185
|
+
requireDocumentOwner,
|
|
116
186
|
defineQuery,
|
|
117
187
|
defineMutation,
|
|
118
188
|
pMap,
|
|
119
189
|
ulid,
|
|
120
190
|
assertRuntime,
|
|
191
|
+
assertTrigger,
|
|
121
192
|
FunctionRuntimeError,
|
|
122
193
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "primitive-functions",
|
|
3
|
-
"version": "0.3.0-alpha.
|
|
3
|
+
"version": "0.3.0-alpha.10",
|
|
4
4
|
"description": "The module a Primitive server function imports. Supplied by the platform at invoke time; reserved here so the name is ours before the runtime lands.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Primitive LLC",
|