@vsaas/remoting 10.0.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.md +202 -0
- package/README.md +78 -0
- package/dist/_virtual/_rolldown/runtime.js +32 -0
- package/dist/ext/meta.d.ts +1 -0
- package/dist/ext/meta.js +39 -0
- package/dist/ext/meta.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/context-base.d.ts +1 -0
- package/dist/lib/context-base.js +30 -0
- package/dist/lib/context-base.js.map +1 -0
- package/dist/lib/deprecate.d.ts +1 -0
- package/dist/lib/deprecate.js +34 -0
- package/dist/lib/deprecate.js.map +1 -0
- package/dist/lib/escape-regexp.d.ts +1 -0
- package/dist/lib/escape-regexp.js +12 -0
- package/dist/lib/escape-regexp.js.map +1 -0
- package/dist/lib/exports-helper.d.ts +1 -0
- package/dist/lib/exports-helper.js +101 -0
- package/dist/lib/exports-helper.js.map +1 -0
- package/dist/lib/http-context.d.ts +1 -0
- package/dist/lib/http-context.js +484 -0
- package/dist/lib/http-context.js.map +1 -0
- package/dist/lib/http-invocation.d.ts +1 -0
- package/dist/lib/http-invocation.js +254 -0
- package/dist/lib/http-invocation.js.map +1 -0
- package/dist/lib/jsonrpc-adapter.d.ts +1 -0
- package/dist/lib/jsonrpc-adapter.js +187 -0
- package/dist/lib/jsonrpc-adapter.js.map +1 -0
- package/dist/lib/looks-like-json.d.ts +1 -0
- package/dist/lib/looks-like-json.js +22 -0
- package/dist/lib/looks-like-json.js.map +1 -0
- package/dist/lib/messages.d.ts +1 -0
- package/dist/lib/messages.js +24 -0
- package/dist/lib/messages.js.map +1 -0
- package/dist/lib/number-checks.d.ts +1 -0
- package/dist/lib/number-checks.js +18 -0
- package/dist/lib/number-checks.js.map +1 -0
- package/dist/lib/phases/merge-phase-name-lists.d.ts +5 -0
- package/dist/lib/phases/merge-phase-name-lists.d.ts.map +1 -0
- package/dist/lib/phases/merge-phase-name-lists.js +39 -0
- package/dist/lib/phases/merge-phase-name-lists.js.map +1 -0
- package/dist/lib/phases/phase-list.d.ts +27 -0
- package/dist/lib/phases/phase-list.d.ts.map +1 -0
- package/dist/lib/phases/phase-list.js +154 -0
- package/dist/lib/phases/phase-list.js.map +1 -0
- package/dist/lib/phases/phase.d.ts +24 -0
- package/dist/lib/phases/phase.d.ts.map +1 -0
- package/dist/lib/phases/phase.js +144 -0
- package/dist/lib/phases/phase.js.map +1 -0
- package/dist/lib/remote-objects.d.ts +1 -0
- package/dist/lib/remote-objects.js +642 -0
- package/dist/lib/remote-objects.js.map +1 -0
- package/dist/lib/rest-adapter-browser.d.ts +1 -0
- package/dist/lib/rest-adapter-browser.js +302 -0
- package/dist/lib/rest-adapter-browser.js.map +1 -0
- package/dist/lib/rest-adapter.d.ts +1 -0
- package/dist/lib/rest-adapter.js +519 -0
- package/dist/lib/rest-adapter.js.map +1 -0
- package/dist/lib/server-sent-events.d.ts +1 -0
- package/dist/lib/server-sent-events.js +61 -0
- package/dist/lib/server-sent-events.js.map +1 -0
- package/dist/lib/shared-class.d.ts +1 -0
- package/dist/lib/shared-class.js +207 -0
- package/dist/lib/shared-class.js.map +1 -0
- package/dist/lib/shared-method.d.ts +1 -0
- package/dist/lib/shared-method.js +469 -0
- package/dist/lib/shared-method.js.map +1 -0
- package/dist/lib/socket-io-adapter.d.ts +1 -0
- package/dist/lib/socket-io-adapter.js +93 -0
- package/dist/lib/socket-io-adapter.js.map +1 -0
- package/dist/lib/socket-io-context.d.ts +1 -0
- package/dist/lib/socket-io-context.js +94 -0
- package/dist/lib/socket-io-context.js.map +1 -0
- package/dist/lib/type-registry.d.ts +1 -0
- package/dist/lib/type-registry.js +99 -0
- package/dist/lib/type-registry.js.map +1 -0
- package/dist/lib/types/any.d.ts +1 -0
- package/dist/lib/types/any.js +44 -0
- package/dist/lib/types/any.js.map +1 -0
- package/dist/lib/types/array.d.ts +1 -0
- package/dist/lib/types/array.js +99 -0
- package/dist/lib/types/array.js.map +1 -0
- package/dist/lib/types/boolean.d.ts +1 -0
- package/dist/lib/types/boolean.js +37 -0
- package/dist/lib/types/boolean.js.map +1 -0
- package/dist/lib/types/date.d.ts +1 -0
- package/dist/lib/types/date.js +37 -0
- package/dist/lib/types/date.js.map +1 -0
- package/dist/lib/types/geopoint.d.ts +1 -0
- package/dist/lib/types/geopoint.js +68 -0
- package/dist/lib/types/geopoint.js.map +1 -0
- package/dist/lib/types/integer.d.ts +1 -0
- package/dist/lib/types/integer.js +36 -0
- package/dist/lib/types/integer.js.map +1 -0
- package/dist/lib/types/number.d.ts +1 -0
- package/dist/lib/types/number.js +30 -0
- package/dist/lib/types/number.js.map +1 -0
- package/dist/lib/types/object.d.ts +1 -0
- package/dist/lib/types/object.js +57 -0
- package/dist/lib/types/object.js.map +1 -0
- package/dist/lib/types/string.d.ts +1 -0
- package/dist/lib/types/string.js +29 -0
- package/dist/lib/types/string.js.map +1 -0
- package/dist/phases.d.ts +4 -0
- package/dist/phases.js +35 -0
- package/dist/phases.js.map +1 -0
- package/package.json +96 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
Copyright (c) IBM Corp. 2013,2017. All Rights Reserved.
|
|
2
|
+
Node module: strong-remoting
|
|
3
|
+
This project is licensed under the Artistic License 2.0, full text below.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
The Artistic License 2.0
|
|
8
|
+
|
|
9
|
+
Copyright (c) 2000-2006, The Perl Foundation.
|
|
10
|
+
|
|
11
|
+
Everyone is permitted to copy and distribute verbatim copies
|
|
12
|
+
of this license document, but changing it is not allowed.
|
|
13
|
+
|
|
14
|
+
Preamble
|
|
15
|
+
|
|
16
|
+
This license establishes the terms under which a given free software
|
|
17
|
+
Package may be copied, modified, distributed, and/or redistributed.
|
|
18
|
+
The intent is that the Copyright Holder maintains some artistic
|
|
19
|
+
control over the development of that Package while still keeping the
|
|
20
|
+
Package available as open source and free software.
|
|
21
|
+
|
|
22
|
+
You are always permitted to make arrangements wholly outside of this
|
|
23
|
+
license directly with the Copyright Holder of a given Package. If the
|
|
24
|
+
terms of this license do not permit the full use that you propose to
|
|
25
|
+
make of the Package, you should contact the Copyright Holder and seek
|
|
26
|
+
a different licensing arrangement.
|
|
27
|
+
|
|
28
|
+
Definitions
|
|
29
|
+
|
|
30
|
+
"Copyright Holder" means the individual(s) or organization(s)
|
|
31
|
+
named in the copyright notice for the entire Package.
|
|
32
|
+
|
|
33
|
+
"Contributor" means any party that has contributed code or other
|
|
34
|
+
material to the Package, in accordance with the Copyright Holder's
|
|
35
|
+
procedures.
|
|
36
|
+
|
|
37
|
+
"You" and "your" means any person who would like to copy,
|
|
38
|
+
distribute, or modify the Package.
|
|
39
|
+
|
|
40
|
+
"Package" means the collection of files distributed by the
|
|
41
|
+
Copyright Holder, and derivatives of that collection and/or of
|
|
42
|
+
those files. A given Package may consist of either the Standard
|
|
43
|
+
Version, or a Modified Version.
|
|
44
|
+
|
|
45
|
+
"Distribute" means providing a copy of the Package or making it
|
|
46
|
+
accessible to anyone else, or in the case of a company or
|
|
47
|
+
organization, to others outside of your company or organization.
|
|
48
|
+
|
|
49
|
+
"Distributor Fee" means any fee that you charge for Distributing
|
|
50
|
+
this Package or providing support for this Package to another
|
|
51
|
+
party. It does not mean licensing fees.
|
|
52
|
+
|
|
53
|
+
"Standard Version" refers to the Package if it has not been
|
|
54
|
+
modified, or has been modified only in ways explicitly requested
|
|
55
|
+
by the Copyright Holder.
|
|
56
|
+
|
|
57
|
+
"Modified Version" means the Package, if it has been changed, and
|
|
58
|
+
such changes were not explicitly requested by the Copyright
|
|
59
|
+
Holder.
|
|
60
|
+
|
|
61
|
+
"Original License" means this Artistic License as Distributed with
|
|
62
|
+
the Standard Version of the Package, in its current version or as
|
|
63
|
+
it may be modified by The Perl Foundation in the future.
|
|
64
|
+
|
|
65
|
+
"Source" form means the source code, documentation source, and
|
|
66
|
+
configuration files for the Package.
|
|
67
|
+
|
|
68
|
+
"Compiled" form means the compiled bytecode, object code, binary,
|
|
69
|
+
or any other form resulting from mechanical transformation or
|
|
70
|
+
translation of the Source form.
|
|
71
|
+
|
|
72
|
+
Permission for Use and Modification Without Distribution
|
|
73
|
+
|
|
74
|
+
(1) You are permitted to use the Standard Version and create and use
|
|
75
|
+
Modified Versions for any purpose without restriction, provided that
|
|
76
|
+
you do not Distribute the Modified Version.
|
|
77
|
+
|
|
78
|
+
Permissions for Redistribution of the Standard Version
|
|
79
|
+
|
|
80
|
+
(2) You may Distribute verbatim copies of the Source form of the
|
|
81
|
+
Standard Version of this Package in any medium without restriction,
|
|
82
|
+
either gratis or for a Distributor Fee, provided that you duplicate
|
|
83
|
+
all of the original copyright notices and associated disclaimers. At
|
|
84
|
+
your discretion, such verbatim copies may or may not include a
|
|
85
|
+
Compiled form of the Package.
|
|
86
|
+
|
|
87
|
+
(3) You may apply any bug fixes, portability changes, and other
|
|
88
|
+
modifications made available from the Copyright Holder. The resulting
|
|
89
|
+
Package will still be considered the Standard Version, and as such
|
|
90
|
+
will be subject to the Original License.
|
|
91
|
+
|
|
92
|
+
Distribution of Modified Versions of the Package as Source
|
|
93
|
+
|
|
94
|
+
(4) You may Distribute your Modified Version as Source (either gratis
|
|
95
|
+
or for a Distributor Fee, and with or without a Compiled form of the
|
|
96
|
+
Modified Version) provided that you clearly document how it differs
|
|
97
|
+
from the Standard Version, including, but not limited to, documenting
|
|
98
|
+
any non-standard features, executables, or modules, and provided that
|
|
99
|
+
you do at least ONE of the following:
|
|
100
|
+
|
|
101
|
+
(a) make the Modified Version available to the Copyright Holder
|
|
102
|
+
of the Standard Version, under the Original License, so that the
|
|
103
|
+
Copyright Holder may include your modifications in the Standard
|
|
104
|
+
Version.
|
|
105
|
+
|
|
106
|
+
(b) ensure that installation of your Modified Version does not
|
|
107
|
+
prevent the user installing or running the Standard Version. In
|
|
108
|
+
addition, the Modified Version must bear a name that is different
|
|
109
|
+
from the name of the Standard Version.
|
|
110
|
+
|
|
111
|
+
(c) allow anyone who receives a copy of the Modified Version to
|
|
112
|
+
make the Source form of the Modified Version available to others
|
|
113
|
+
under
|
|
114
|
+
|
|
115
|
+
(i) the Original License or
|
|
116
|
+
|
|
117
|
+
(ii) a license that permits the licensee to freely copy,
|
|
118
|
+
modify and redistribute the Modified Version using the same
|
|
119
|
+
licensing terms that apply to the copy that the licensee
|
|
120
|
+
received, and requires that the Source form of the Modified
|
|
121
|
+
Version, and of any works derived from it, be made freely
|
|
122
|
+
available in that license fees are prohibited but Distributor
|
|
123
|
+
Fees are allowed.
|
|
124
|
+
|
|
125
|
+
Distribution of Compiled Forms of the Standard Version
|
|
126
|
+
or Modified Versions without the Source
|
|
127
|
+
|
|
128
|
+
(5) You may Distribute Compiled forms of the Standard Version without
|
|
129
|
+
the Source, provided that you include complete instructions on how to
|
|
130
|
+
get the Source of the Standard Version. Such instructions must be
|
|
131
|
+
valid at the time of your distribution. If these instructions, at any
|
|
132
|
+
time while you are carrying out such distribution, become invalid, you
|
|
133
|
+
must provide new instructions on demand or cease further distribution.
|
|
134
|
+
If you provide valid instructions or cease distribution within thirty
|
|
135
|
+
days after you become aware that the instructions are invalid, then
|
|
136
|
+
you do not forfeit any of your rights under this license.
|
|
137
|
+
|
|
138
|
+
(6) You may Distribute a Modified Version in Compiled form without
|
|
139
|
+
the Source, provided that you comply with Section 4 with respect to
|
|
140
|
+
the Source of the Modified Version.
|
|
141
|
+
|
|
142
|
+
Aggregating or Linking the Package
|
|
143
|
+
|
|
144
|
+
(7) You may aggregate the Package (either the Standard Version or
|
|
145
|
+
Modified Version) with other packages and Distribute the resulting
|
|
146
|
+
aggregation provided that you do not charge a licensing fee for the
|
|
147
|
+
Package. Distributor Fees are permitted, and licensing fees for other
|
|
148
|
+
components in the aggregation are permitted. The terms of this license
|
|
149
|
+
apply to the use and Distribution of the Standard or Modified Versions
|
|
150
|
+
as included in the aggregation.
|
|
151
|
+
|
|
152
|
+
(8) You are permitted to link Modified and Standard Versions with
|
|
153
|
+
other works, to embed the Package in a larger work of your own, or to
|
|
154
|
+
build stand-alone binary or bytecode versions of applications that
|
|
155
|
+
include the Package, and Distribute the result without restriction,
|
|
156
|
+
provided the result does not expose a direct interface to the Package.
|
|
157
|
+
|
|
158
|
+
Items That are Not Considered Part of a Modified Version
|
|
159
|
+
|
|
160
|
+
(9) Works (including, but not limited to, modules and scripts) that
|
|
161
|
+
merely extend or make use of the Package, do not, by themselves, cause
|
|
162
|
+
the Package to be a Modified Version. In addition, such works are not
|
|
163
|
+
considered parts of the Package itself, and are not subject to the
|
|
164
|
+
terms of this license.
|
|
165
|
+
|
|
166
|
+
General Provisions
|
|
167
|
+
|
|
168
|
+
(10) Any use, modification, and distribution of the Standard or
|
|
169
|
+
Modified Versions is governed by this Artistic License. By using,
|
|
170
|
+
modifying or distributing the Package, you accept this license. Do not
|
|
171
|
+
use, modify, or distribute the Package, if you do not accept this
|
|
172
|
+
license.
|
|
173
|
+
|
|
174
|
+
(11) If your Modified Version has been derived from a Modified
|
|
175
|
+
Version made by someone other than you, you are nevertheless required
|
|
176
|
+
to ensure that your Modified Version complies with the requirements of
|
|
177
|
+
this license.
|
|
178
|
+
|
|
179
|
+
(12) This license does not grant you the right to use any trademark,
|
|
180
|
+
service mark, tradename, or logo of the Copyright Holder.
|
|
181
|
+
|
|
182
|
+
(13) This license includes the non-exclusive, worldwide,
|
|
183
|
+
free-of-charge patent license to make, have made, use, offer to sell,
|
|
184
|
+
sell, import and otherwise transfer the Package with respect to any
|
|
185
|
+
patent claims licensable by the Copyright Holder that are necessarily
|
|
186
|
+
infringed by the Package. If you institute patent litigation
|
|
187
|
+
(including a cross-claim or counterclaim) against any party alleging
|
|
188
|
+
that the Package constitutes direct or contributory patent
|
|
189
|
+
infringement, then this Artistic License to you shall terminate on the
|
|
190
|
+
date that such litigation is filed.
|
|
191
|
+
|
|
192
|
+
(14) Disclaimer of Warranty:
|
|
193
|
+
THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
|
|
194
|
+
IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
|
|
195
|
+
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
|
|
196
|
+
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL
|
|
197
|
+
LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL
|
|
198
|
+
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
199
|
+
DAMAGES ARISING IN ANY WAY OUT OF THE USE OF THE PACKAGE, EVEN IF
|
|
200
|
+
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
201
|
+
|
|
202
|
+
---
|
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# @vsaas/remoting
|
|
2
|
+
|
|
3
|
+
`@vsaas/remoting` is a fork of `strong-remoting` focused on keeping LoopBack 3 style remoting working while reducing maintenance overhead.
|
|
4
|
+
|
|
5
|
+
The goal of this fork is compatibility for the common upstream use cases, not byte-for-byte preservation of the original package. The internals were intentionally simplified and modernized:
|
|
6
|
+
|
|
7
|
+
- TypeScript source with build output in `dist/`
|
|
8
|
+
- internal phases implementation instead of the old external `loopback-phase` package
|
|
9
|
+
- `@vsaas/error-handler` instead of the upstream error handler package
|
|
10
|
+
- legacy i18n and `strong-globalize` usage removed
|
|
11
|
+
- several old dependencies removed or replaced
|
|
12
|
+
- modern tooling with `tsdown`, `vitest`, and `oxlint`
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install @vsaas/remoting
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
const remoting = require('@vsaas/remoting');
|
|
24
|
+
const SharedClass = remoting.SharedClass;
|
|
25
|
+
const remotes = remoting.create();
|
|
26
|
+
|
|
27
|
+
function User() {}
|
|
28
|
+
|
|
29
|
+
User.greet = function (fn) {
|
|
30
|
+
fn(null, 'hello, world!');
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const userSharedClass = new SharedClass('user', User);
|
|
34
|
+
|
|
35
|
+
userSharedClass.defineMethod('greet', {
|
|
36
|
+
isStatic: true,
|
|
37
|
+
returns: [{ arg: 'msg', type: 'string' }],
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
require('http').createServer(remotes.handler('rest')).listen(3000);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
curl http://localhost:3000/user/greet
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Scope
|
|
50
|
+
|
|
51
|
+
This package still provides the same main building blocks that existing `strong-remoting` users expect:
|
|
52
|
+
|
|
53
|
+
- remote object collections
|
|
54
|
+
- REST adapter support
|
|
55
|
+
- hooks
|
|
56
|
+
- stream support
|
|
57
|
+
- transport abstraction
|
|
58
|
+
|
|
59
|
+
If you are migrating an existing codebase, the intent is that the public API should feel familiar even though the implementation is leaner.
|
|
60
|
+
|
|
61
|
+
## Notes for fork users
|
|
62
|
+
|
|
63
|
+
- This is a maintained fork, not the upstream package.
|
|
64
|
+
- If you are also using the related forks, prefer pairing it with `@vsaas/error-handler`.
|
|
65
|
+
- Some legacy internals were removed specifically to keep the codebase smaller and easier to reason about.
|
|
66
|
+
|
|
67
|
+
## Development
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm run build
|
|
71
|
+
npm run typecheck
|
|
72
|
+
npm run lint
|
|
73
|
+
npm test
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## License
|
|
77
|
+
|
|
78
|
+
Artistic-2.0. See [LICENSE.md](./LICENSE.md).
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
7
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
8
|
+
var __exportAll = (all, no_symbols) => {
|
|
9
|
+
let target = {};
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
15
|
+
return target;
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
19
|
+
key = keys[i];
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
21
|
+
get: ((k) => from[k]).bind(null, key),
|
|
22
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return to;
|
|
26
|
+
};
|
|
27
|
+
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
//#endregion
|
|
29
|
+
exports.__commonJSMin = __commonJSMin;
|
|
30
|
+
exports.__esmMin = __esmMin;
|
|
31
|
+
exports.__exportAll = __exportAll;
|
|
32
|
+
exports.__toCommonJS = __toCommonJS;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/ext/meta.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const require_index = require("../index.js");
|
|
3
|
+
//#region src/ext/meta.ts
|
|
4
|
+
/**
|
|
5
|
+
* Expose the `Meta` plugin.
|
|
6
|
+
*/
|
|
7
|
+
module.exports = Meta;
|
|
8
|
+
/**
|
|
9
|
+
* Module dependencies.
|
|
10
|
+
*/
|
|
11
|
+
const Remoting = require_index;
|
|
12
|
+
/**
|
|
13
|
+
* Create a remotable Meta module for plugging into `RemoteObjects`.
|
|
14
|
+
*/
|
|
15
|
+
function Meta(remotes, options) {
|
|
16
|
+
const name = options && options.name || "meta";
|
|
17
|
+
const adapter = remotes.handler("rest").adapter;
|
|
18
|
+
const extension = {};
|
|
19
|
+
const helper = Remoting.extend(extension);
|
|
20
|
+
helper.method(routes, { returns: {
|
|
21
|
+
type: "object",
|
|
22
|
+
root: true
|
|
23
|
+
} });
|
|
24
|
+
function routes(callback) {
|
|
25
|
+
callback(null, adapter.allRoutes());
|
|
26
|
+
}
|
|
27
|
+
helper.method(classes, { returns: {
|
|
28
|
+
type: "object",
|
|
29
|
+
root: true
|
|
30
|
+
} });
|
|
31
|
+
function classes(callback) {
|
|
32
|
+
callback(null, remotes.classes());
|
|
33
|
+
}
|
|
34
|
+
remotes.exports[name] = extension;
|
|
35
|
+
return extension;
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=meta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"meta.js","names":[],"sources":["../../src/ext/meta.ts"],"sourcesContent":["// Copyright IBM Corp. 2013,2017. All Rights Reserved.\n// Node module: strong-remoting\n// This file is licensed under the Artistic License 2.0.\n// License text available at https://opensource.org/licenses/Artistic-2.0\n\n// @ts-nocheck\n'use strict';\n\n/**\n * Expose the `Meta` plugin.\n */\nmodule.exports = Meta;\n\n/**\n * Module dependencies.\n */\nconst Remoting = require('../');\n\n/**\n * Create a remotable Meta module for plugging into `RemoteObjects`.\n */\nfunction Meta(remotes, options) {\n // Unfold options.\n const name = (options && options.name) || 'meta';\n\n // We need a temporary REST adapter to discover our available routes.\n const adapter = remotes.handler('rest').adapter;\n const extension = {};\n const helper = Remoting.extend(extension);\n\n helper.method(routes, { returns: { type: 'object', root: true } });\n function routes(callback) {\n callback(null, adapter.allRoutes());\n }\n\n helper.method(classes, { returns: { type: 'object', root: true } });\n function classes(callback) {\n callback(null, remotes.classes());\n }\n\n remotes.exports[name] = extension;\n return extension;\n}\n"],"mappings":";;;;;;AAWA,OAAO,UAAU;;;;AAKjB,MAAM,WAAA;;;;AAKN,SAAS,KAAK,SAAS,SAAS;CAE9B,MAAM,OAAQ,WAAW,QAAQ,QAAS;CAG1C,MAAM,UAAU,QAAQ,QAAQ,OAAO,CAAC;CACxC,MAAM,YAAY,EAAE;CACpB,MAAM,SAAS,SAAS,OAAO,UAAU;AAEzC,QAAO,OAAO,QAAQ,EAAE,SAAS;EAAE,MAAM;EAAU,MAAM;EAAM,EAAE,CAAC;CAClE,SAAS,OAAO,UAAU;AACxB,WAAS,MAAM,QAAQ,WAAW,CAAC;;AAGrC,QAAO,OAAO,SAAS,EAAE,SAAS;EAAE,MAAM;EAAU,MAAM;EAAM,EAAE,CAAC;CACnE,SAAS,QAAQ,UAAU;AACzB,WAAS,MAAM,QAAQ,SAAS,CAAC;;AAGnC,SAAQ,QAAQ,QAAQ;AACxB,QAAO"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.js");
|
|
3
|
+
const require_lib_shared_class = require("./lib/shared-class.js");
|
|
4
|
+
const require_phases = require("./phases.js");
|
|
5
|
+
const require_lib_remote_objects = require("./lib/remote-objects.js");
|
|
6
|
+
//#region src/index.ts
|
|
7
|
+
var require_src = /* @__PURE__ */ require_runtime.__commonJSMin(((exports, module) => {
|
|
8
|
+
/**
|
|
9
|
+
* remotes ~ public api
|
|
10
|
+
*/
|
|
11
|
+
module.exports = require_lib_remote_objects;
|
|
12
|
+
module.exports.SharedClass = require_lib_shared_class;
|
|
13
|
+
module.exports.Phase = (require_phases.init_phases(), require_runtime.__toCommonJS(require_phases.phases_exports)).Phase;
|
|
14
|
+
module.exports.PhaseList = (require_phases.init_phases(), require_runtime.__toCommonJS(require_phases.phases_exports)).PhaseList;
|
|
15
|
+
module.exports.mergePhaseNameLists = (require_phases.init_phases(), require_runtime.__toCommonJS(require_phases.phases_exports)).mergePhaseNameLists;
|
|
16
|
+
}));
|
|
17
|
+
//#endregion
|
|
18
|
+
module.exports = require_src();
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["// Copyright IBM Corp. 2013,2017. All Rights Reserved.\n// Node module: strong-remoting\n// This file is licensed under the Artistic License 2.0.\n// License text available at https://opensource.org/licenses/Artistic-2.0\n\n// @ts-nocheck\n'use strict';\n\n/**\n * remotes ~ public api\n */\n\nmodule.exports = require('./lib/remote-objects');\nmodule.exports.SharedClass = require('./lib/shared-class');\nmodule.exports.Phase = require('./phases').Phase;\nmodule.exports.PhaseList = require('./phases').PhaseList;\nmodule.exports.mergePhaseNameLists = require('./phases').mergePhaseNameLists;\n"],"mappings":";;;;;;;;;;AAYA,QAAO,UAAA;AACP,QAAO,QAAQ,cAAA;AACf,QAAO,QAAQ,SAAA,eAAA,aAAA,EAAA,gBAAA,aAAA,eAAA,eAAA,EAA4B;AAC3C,QAAO,QAAQ,aAAA,eAAA,aAAA,EAAA,gBAAA,aAAA,eAAA,eAAA,EAAgC;AAC/C,QAAO,QAAQ,uBAAA,eAAA,aAAA,EAAA,gBAAA,aAAA,eAAA,eAAA,EAA0C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
3
|
+
require("./type-registry.js");
|
|
4
|
+
//#region src/lib/context-base.ts
|
|
5
|
+
var require_context_base = /* @__PURE__ */ require_runtime.__commonJSMin(((exports, module) => {
|
|
6
|
+
const assert = require("assert");
|
|
7
|
+
const EventEmitter = require("events").EventEmitter;
|
|
8
|
+
const inherits = require("util").inherits;
|
|
9
|
+
module.exports = ContextBase;
|
|
10
|
+
/**
|
|
11
|
+
* A base class for all Context instances
|
|
12
|
+
*/
|
|
13
|
+
function ContextBase(method, typeRegistry) {
|
|
14
|
+
assert(method && typeof method === "object", "method must be a SharedClass instance");
|
|
15
|
+
assert(typeRegistry && typeof typeRegistry === "object", "typeRegistry must be a TypeRegistry instance");
|
|
16
|
+
EventEmitter.call(this);
|
|
17
|
+
this.method = method;
|
|
18
|
+
this.typeRegistry = typeRegistry;
|
|
19
|
+
}
|
|
20
|
+
inherits(ContextBase, EventEmitter);
|
|
21
|
+
ContextBase.prototype.getScope = function() {
|
|
22
|
+
const method = this.method;
|
|
23
|
+
return this.instance || method.ctor || method.sharedMethod && method.sharedMethod.ctor;
|
|
24
|
+
};
|
|
25
|
+
ContextBase.prototype.setReturnArgByName = function(name, value) {};
|
|
26
|
+
}));
|
|
27
|
+
//#endregion
|
|
28
|
+
module.exports = require_context_base();
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=context-base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-base.js","names":[],"sources":["../../src/lib/context-base.ts"],"sourcesContent":["// Copyright IBM Corp. 2016. All Rights Reserved.\n// Node module: strong-remoting\n// This file is licensed under the Artistic License 2.0.\n// License text available at https://opensource.org/licenses/Artistic-2.0\n\n// @ts-nocheck\n'use strict';\n\nconst assert = require('assert');\nconst EventEmitter = require('events').EventEmitter;\nconst TypeRegistry = require('./type-registry');\nconst inherits = require('util').inherits;\n\nmodule.exports = ContextBase;\n\n/**\n * A base class for all Context instances\n */\nfunction ContextBase(method, typeRegistry) {\n // NOTE(bajtos) we are not asserting via \"instanceof\" to allow\n // multiple copies of strong-remoting to cooperate together\n assert(method && typeof method === 'object', 'method must be a SharedClass instance');\n assert(\n typeRegistry && typeof typeRegistry === 'object',\n 'typeRegistry must be a TypeRegistry instance',\n );\n\n EventEmitter.call(this);\n\n this.method = method;\n this.typeRegistry = typeRegistry;\n}\n\ninherits(ContextBase, EventEmitter);\n\nContextBase.prototype.getScope = function () {\n // Static methods are invoked on the constructor (this = constructor fn)\n // Prototype methods are invoked on the instance (this = instance)\n const method = this.method;\n return this.instance || method.ctor || (method.sharedMethod && method.sharedMethod.ctor);\n};\n\nContextBase.prototype.setReturnArgByName = function (name, value) {\n // no-op\n};\n"],"mappings":";;;;;CAQA,MAAM,SAAS,QAAQ,SAAS;CAChC,MAAM,eAAe,QAAQ,SAAS,CAAC;CAEvC,MAAM,WAAW,QAAQ,OAAO,CAAC;AAEjC,QAAO,UAAU;;;;CAKjB,SAAS,YAAY,QAAQ,cAAc;AAGzC,SAAO,UAAU,OAAO,WAAW,UAAU,wCAAwC;AACrF,SACE,gBAAgB,OAAO,iBAAiB,UACxC,+CACD;AAED,eAAa,KAAK,KAAK;AAEvB,OAAK,SAAS;AACd,OAAK,eAAe;;AAGtB,UAAS,aAAa,aAAa;AAEnC,aAAY,UAAU,WAAW,WAAY;EAG3C,MAAM,SAAS,KAAK;AACpB,SAAO,KAAK,YAAY,OAAO,QAAS,OAAO,gBAAgB,OAAO,aAAa;;AAGrF,aAAY,UAAU,qBAAqB,SAAU,MAAM,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region src/lib/deprecate.ts
|
|
3
|
+
var require_deprecate = /* @__PURE__ */ require("../_virtual/_rolldown/runtime.js").__commonJSMin(((exports, module) => {
|
|
4
|
+
module.exports = createDeprecator;
|
|
5
|
+
const emittedWarnings = /* @__PURE__ */ new Set();
|
|
6
|
+
function createDeprecator(namespace) {
|
|
7
|
+
return function deprecate(message) {
|
|
8
|
+
const text = formatMessage(namespace, message);
|
|
9
|
+
if (emittedWarnings.has(text)) return;
|
|
10
|
+
emittedWarnings.add(text);
|
|
11
|
+
const warning = new Error(text);
|
|
12
|
+
warning.name = "DeprecationWarning";
|
|
13
|
+
warning.code = buildCode(namespace);
|
|
14
|
+
warning.namespace = namespace;
|
|
15
|
+
if (process.listenerCount("deprecation") > 0) {
|
|
16
|
+
process.emit("deprecation", warning);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
process.emitWarning(warning);
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function formatMessage(namespace, message) {
|
|
23
|
+
if (!namespace) return message;
|
|
24
|
+
return namespace + " deprecated " + message;
|
|
25
|
+
}
|
|
26
|
+
function buildCode(namespace) {
|
|
27
|
+
if (!namespace) return "DEP_STRONG_REMOTING";
|
|
28
|
+
return "DEP_" + String(namespace).toUpperCase().replace(/[^A-Z0-9]+/g, "_");
|
|
29
|
+
}
|
|
30
|
+
}));
|
|
31
|
+
//#endregion
|
|
32
|
+
module.exports = require_deprecate();
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=deprecate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deprecate.js","names":[],"sources":["../../src/lib/deprecate.ts"],"sourcesContent":["// Copyright IBM Corp. 2026. All Rights Reserved.\n// Node module: strong-remoting\n// This file is licensed under the Artistic License 2.0.\n// License text available at https://opensource.org/licenses/Artistic-2.0\n\n// @ts-nocheck\n'use strict';\n\nmodule.exports = createDeprecator;\n\nconst emittedWarnings = new Set();\n\nfunction createDeprecator(namespace) {\n return function deprecate(message) {\n const text = formatMessage(namespace, message);\n if (emittedWarnings.has(text)) {\n return;\n }\n\n emittedWarnings.add(text);\n\n const warning = new Error(text);\n warning.name = 'DeprecationWarning';\n warning.code = buildCode(namespace);\n warning.namespace = namespace;\n\n if (process.listenerCount('deprecation') > 0) {\n process.emit('deprecation', warning);\n return;\n }\n\n process.emitWarning(warning);\n };\n}\n\nfunction formatMessage(namespace, message) {\n if (!namespace) {\n return message;\n }\n\n return namespace + ' deprecated ' + message;\n}\n\nfunction buildCode(namespace) {\n if (!namespace) {\n return 'DEP_STRONG_REMOTING';\n }\n\n return (\n 'DEP_' +\n String(namespace)\n .toUpperCase()\n .replace(/[^A-Z0-9]+/g, '_')\n );\n}\n"],"mappings":";;;AAQA,QAAO,UAAU;CAEjB,MAAM,kCAAkB,IAAI,KAAK;CAEjC,SAAS,iBAAiB,WAAW;AACnC,SAAO,SAAS,UAAU,SAAS;GACjC,MAAM,OAAO,cAAc,WAAW,QAAQ;AAC9C,OAAI,gBAAgB,IAAI,KAAK,CAC3B;AAGF,mBAAgB,IAAI,KAAK;GAEzB,MAAM,UAAU,IAAI,MAAM,KAAK;AAC/B,WAAQ,OAAO;AACf,WAAQ,OAAO,UAAU,UAAU;AACnC,WAAQ,YAAY;AAEpB,OAAI,QAAQ,cAAc,cAAc,GAAG,GAAG;AAC5C,YAAQ,KAAK,eAAe,QAAQ;AACpC;;AAGF,WAAQ,YAAY,QAAQ;;;CAIhC,SAAS,cAAc,WAAW,SAAS;AACzC,MAAI,CAAC,UACH,QAAO;AAGT,SAAO,YAAY,iBAAiB;;CAGtC,SAAS,UAAU,WAAW;AAC5B,MAAI,CAAC,UACH,QAAO;AAGT,SACE,SACA,OAAO,UAAU,CACd,aAAa,CACb,QAAQ,eAAe,IAAI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region src/lib/escape-regexp.ts
|
|
3
|
+
var require_escape_regexp = /* @__PURE__ */ require("../_virtual/_rolldown/runtime.js").__commonJSMin(((exports, module) => {
|
|
4
|
+
module.exports = escapeRegExp;
|
|
5
|
+
function escapeRegExp(value) {
|
|
6
|
+
return String(value).replace(/[|\\{}()[\]^$+*?.-]/g, "\\$&");
|
|
7
|
+
}
|
|
8
|
+
}));
|
|
9
|
+
//#endregion
|
|
10
|
+
module.exports = require_escape_regexp();
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=escape-regexp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"escape-regexp.js","names":[],"sources":["../../src/lib/escape-regexp.ts"],"sourcesContent":["// Copyright IBM Corp. 2026. All Rights Reserved.\n// Node module: strong-remoting\n// This file is licensed under the Artistic License 2.0.\n// License text available at https://opensource.org/licenses/Artistic-2.0\n\n// @ts-nocheck\n'use strict';\n\nmodule.exports = escapeRegExp;\n\nfunction escapeRegExp(value) {\n return String(value).replace(/[|\\\\{}()[\\]^$+*?.-]/g, '\\\\$&');\n}\n"],"mappings":";;;AAQA,QAAO,UAAU;CAEjB,SAAS,aAAa,OAAO;AAC3B,SAAO,OAAO,MAAM,CAAC,QAAQ,wBAAwB,OAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
//#region src/lib/exports-helper.ts
|
|
3
|
+
var require_exports_helper = /* @__PURE__ */ require("../_virtual/_rolldown/runtime.js").__commonJSMin(((exports, module) => {
|
|
4
|
+
/*!
|
|
5
|
+
* Expose `ExportsHelper`.
|
|
6
|
+
*/
|
|
7
|
+
module.exports = ExportsHelper;
|
|
8
|
+
/*!
|
|
9
|
+
* Module dependencies.
|
|
10
|
+
*/
|
|
11
|
+
const debug = require("debug")("strong-remoting:exports-helper");
|
|
12
|
+
/*!
|
|
13
|
+
* Constants
|
|
14
|
+
*/
|
|
15
|
+
const PASSTHROUGH_OPTIONS = [
|
|
16
|
+
"http",
|
|
17
|
+
"description",
|
|
18
|
+
"notes"
|
|
19
|
+
];
|
|
20
|
+
/**
|
|
21
|
+
* @class A wrapper to make manipulating the exports object easier.
|
|
22
|
+
*
|
|
23
|
+
* @constructor
|
|
24
|
+
* Create a new `ExportsHelper` with the given `options`.
|
|
25
|
+
*/
|
|
26
|
+
function ExportsHelper(obj) {
|
|
27
|
+
if (!(this instanceof ExportsHelper)) return new ExportsHelper(obj);
|
|
28
|
+
this._obj = obj;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Sets a value at any path within the exports object.
|
|
32
|
+
*/
|
|
33
|
+
ExportsHelper.prototype.setPath = setPath;
|
|
34
|
+
function setPath(path, value) {
|
|
35
|
+
const self = this;
|
|
36
|
+
let obj = self._obj;
|
|
37
|
+
const split = path.split(".");
|
|
38
|
+
const name = split.pop();
|
|
39
|
+
split.forEach(function(key) {
|
|
40
|
+
if (!obj[key]) obj[key] = {};
|
|
41
|
+
obj = obj[key];
|
|
42
|
+
});
|
|
43
|
+
debug("Setting %s to %s", path, value);
|
|
44
|
+
obj[name] = value;
|
|
45
|
+
return self;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Exports a constructor ("type") with the provided options.
|
|
49
|
+
*/
|
|
50
|
+
ExportsHelper.prototype.addType = type;
|
|
51
|
+
ExportsHelper.prototype.type = type;
|
|
52
|
+
function type(fn, options) {
|
|
53
|
+
const self = this;
|
|
54
|
+
const path = options.path || options.name || fn.name || null;
|
|
55
|
+
let sharedCtor = options.sharedCtor || null;
|
|
56
|
+
const accepts = options.accepts || null;
|
|
57
|
+
if (!path) return self;
|
|
58
|
+
if (!sharedCtor) sharedCtor = function() {
|
|
59
|
+
const _args = [].slice.call(arguments);
|
|
60
|
+
_args.pop()(null, fn.apply(null, _args));
|
|
61
|
+
};
|
|
62
|
+
if (!sharedCtor.accepts) sharedCtor.accepts = accepts;
|
|
63
|
+
if (!sharedCtor.returns) sharedCtor.returns = {
|
|
64
|
+
type: "object",
|
|
65
|
+
root: true
|
|
66
|
+
};
|
|
67
|
+
PASSTHROUGH_OPTIONS.forEach(function(key) {
|
|
68
|
+
if (options[key]) sharedCtor[key] = options[key];
|
|
69
|
+
});
|
|
70
|
+
self.setPath(path, fn);
|
|
71
|
+
fn.shared = true;
|
|
72
|
+
fn.sharedCtor = sharedCtor;
|
|
73
|
+
return new ExportsHelper(fn.prototype);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Exports a Function with the provided options.
|
|
77
|
+
*/
|
|
78
|
+
ExportsHelper.prototype.addMethod = method;
|
|
79
|
+
ExportsHelper.prototype.method = method;
|
|
80
|
+
function method(fn, options) {
|
|
81
|
+
const self = this;
|
|
82
|
+
const path = options.path || options.name || fn.name || null;
|
|
83
|
+
const accepts = options.accepts || null;
|
|
84
|
+
const returns = options.returns || null;
|
|
85
|
+
const errors = options.errors || null;
|
|
86
|
+
if (!path) return self;
|
|
87
|
+
self.setPath(path, fn);
|
|
88
|
+
fn.shared = true;
|
|
89
|
+
fn.accepts = accepts;
|
|
90
|
+
fn.returns = returns;
|
|
91
|
+
fn.errors = errors;
|
|
92
|
+
PASSTHROUGH_OPTIONS.forEach(function(key) {
|
|
93
|
+
if (options[key]) fn[key] = options[key];
|
|
94
|
+
});
|
|
95
|
+
return self;
|
|
96
|
+
}
|
|
97
|
+
}));
|
|
98
|
+
//#endregion
|
|
99
|
+
module.exports = require_exports_helper();
|
|
100
|
+
|
|
101
|
+
//# sourceMappingURL=exports-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exports-helper.js","names":[],"sources":["../../src/lib/exports-helper.ts"],"sourcesContent":["// Copyright IBM Corp. 2013,2017. All Rights Reserved.\n// Node module: strong-remoting\n// This file is licensed under the Artistic License 2.0.\n// License text available at https://opensource.org/licenses/Artistic-2.0\n\n// @ts-nocheck\n'use strict';\n\n/*!\n * Expose `ExportsHelper`.\n */\nmodule.exports = ExportsHelper;\n\n/*!\n * Module dependencies.\n */\nconst debug = require('debug')('strong-remoting:exports-helper');\n\n/*!\n * Constants\n */\nconst PASSTHROUGH_OPTIONS = ['http', 'description', 'notes'];\n\n/**\n * @class A wrapper to make manipulating the exports object easier.\n *\n * @constructor\n * Create a new `ExportsHelper` with the given `options`.\n */\n\nfunction ExportsHelper(obj) {\n if (!(this instanceof ExportsHelper)) {\n return new ExportsHelper(obj);\n }\n\n this._obj = obj;\n}\n\n/**\n * Sets a value at any path within the exports object.\n */\nExportsHelper.prototype.setPath = setPath;\nfunction setPath(path, value) {\n const self = this;\n let obj = self._obj;\n const split = path.split('.');\n const name = split.pop();\n\n split.forEach(function (key) {\n if (!obj[key]) {\n obj[key] = {};\n }\n\n obj = obj[key];\n });\n\n debug('Setting %s to %s', path, value);\n obj[name] = value;\n\n return self;\n}\n\n/**\n * Exports a constructor (\"type\") with the provided options.\n */\nExportsHelper.prototype.addType = type;\nExportsHelper.prototype.type = type;\nfunction type(fn, options) {\n const self = this;\n const path = options.path || options.name || fn.name || null;\n let sharedCtor = options.sharedCtor || null;\n const accepts = options.accepts || null;\n\n if (!path) {\n // TODO: Error.\n return self;\n }\n\n if (!sharedCtor) {\n // TODO(schoon) - This shouldn't be thought of (or named) as a \"shared\n // constructor\". Instead, this is the lazy find/create sl-remoting uses when\n // a prototype method is called. `getInstance`? `findOrCreate`? `load`?\n sharedCtor = function () {\n const _args = [].slice.call(arguments);\n _args.pop()(null, fn.apply(null, _args));\n };\n }\n\n if (!sharedCtor.accepts) {\n sharedCtor.accepts = accepts;\n }\n\n // This is required because sharedCtors are called just like any other\n // remotable method. However, you always expect the instance and nothing else.\n if (!sharedCtor.returns) {\n sharedCtor.returns = { type: 'object', root: true };\n }\n\n PASSTHROUGH_OPTIONS.forEach(function (key) {\n if (options[key]) {\n sharedCtor[key] = options[key];\n }\n });\n\n self.setPath(path, fn);\n fn.shared = true;\n fn.sharedCtor = sharedCtor;\n\n return new ExportsHelper(fn.prototype);\n}\n\n/**\n * Exports a Function with the provided options.\n */\nExportsHelper.prototype.addMethod = method;\nExportsHelper.prototype.method = method;\nfunction method(fn, options) {\n const self = this;\n const path = options.path || options.name || fn.name || null;\n const accepts = options.accepts || null;\n const returns = options.returns || null;\n const errors = options.errors || null;\n\n if (!path) {\n // TODO: Error.\n return self;\n }\n\n self.setPath(path, fn);\n fn.shared = true;\n fn.accepts = accepts;\n fn.returns = returns;\n fn.errors = errors;\n\n PASSTHROUGH_OPTIONS.forEach(function (key) {\n if (options[key]) {\n fn[key] = options[key];\n }\n });\n\n return self;\n}\n"],"mappings":";;;;;;AAWA,QAAO,UAAU;;;;CAKjB,MAAM,QAAQ,QAAQ,QAAQ,CAAC,iCAAiC;;;;CAKhE,MAAM,sBAAsB;EAAC;EAAQ;EAAe;EAAQ;;;;;;;CAS5D,SAAS,cAAc,KAAK;AAC1B,MAAI,EAAE,gBAAgB,eACpB,QAAO,IAAI,cAAc,IAAI;AAG/B,OAAK,OAAO;;;;;AAMd,eAAc,UAAU,UAAU;CAClC,SAAS,QAAQ,MAAM,OAAO;EAC5B,MAAM,OAAO;EACb,IAAI,MAAM,KAAK;EACf,MAAM,QAAQ,KAAK,MAAM,IAAI;EAC7B,MAAM,OAAO,MAAM,KAAK;AAExB,QAAM,QAAQ,SAAU,KAAK;AAC3B,OAAI,CAAC,IAAI,KACP,KAAI,OAAO,EAAE;AAGf,SAAM,IAAI;IACV;AAEF,QAAM,oBAAoB,MAAM,MAAM;AACtC,MAAI,QAAQ;AAEZ,SAAO;;;;;AAMT,eAAc,UAAU,UAAU;AAClC,eAAc,UAAU,OAAO;CAC/B,SAAS,KAAK,IAAI,SAAS;EACzB,MAAM,OAAO;EACb,MAAM,OAAO,QAAQ,QAAQ,QAAQ,QAAQ,GAAG,QAAQ;EACxD,IAAI,aAAa,QAAQ,cAAc;EACvC,MAAM,UAAU,QAAQ,WAAW;AAEnC,MAAI,CAAC,KAEH,QAAO;AAGT,MAAI,CAAC,WAIH,cAAa,WAAY;GACvB,MAAM,QAAQ,EAAE,CAAC,MAAM,KAAK,UAAU;AACtC,SAAM,KAAK,CAAC,MAAM,GAAG,MAAM,MAAM,MAAM,CAAC;;AAI5C,MAAI,CAAC,WAAW,QACd,YAAW,UAAU;AAKvB,MAAI,CAAC,WAAW,QACd,YAAW,UAAU;GAAE,MAAM;GAAU,MAAM;GAAM;AAGrD,sBAAoB,QAAQ,SAAU,KAAK;AACzC,OAAI,QAAQ,KACV,YAAW,OAAO,QAAQ;IAE5B;AAEF,OAAK,QAAQ,MAAM,GAAG;AACtB,KAAG,SAAS;AACZ,KAAG,aAAa;AAEhB,SAAO,IAAI,cAAc,GAAG,UAAU;;;;;AAMxC,eAAc,UAAU,YAAY;AACpC,eAAc,UAAU,SAAS;CACjC,SAAS,OAAO,IAAI,SAAS;EAC3B,MAAM,OAAO;EACb,MAAM,OAAO,QAAQ,QAAQ,QAAQ,QAAQ,GAAG,QAAQ;EACxD,MAAM,UAAU,QAAQ,WAAW;EACnC,MAAM,UAAU,QAAQ,WAAW;EACnC,MAAM,SAAS,QAAQ,UAAU;AAEjC,MAAI,CAAC,KAEH,QAAO;AAGT,OAAK,QAAQ,MAAM,GAAG;AACtB,KAAG,SAAS;AACZ,KAAG,UAAU;AACb,KAAG,UAAU;AACb,KAAG,SAAS;AAEZ,sBAAoB,QAAQ,SAAU,KAAK;AACzC,OAAI,QAAQ,KACV,IAAG,OAAO,QAAQ;IAEpB;AAEF,SAAO"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|