@apollo/federation-internals 2.7.3 → 2.7.4-testing.1

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.
@@ -0,0 +1,278 @@
1
+ let imports = {};
2
+ imports['__wbindgen_placeholder__'] = module.exports;
3
+ let wasm;
4
+ const { TextDecoder, TextEncoder } = require(`util`);
5
+
6
+ const heap = new Array(128).fill(undefined);
7
+
8
+ heap.push(undefined, null, true, false);
9
+
10
+ function getObject(idx) { return heap[idx]; }
11
+
12
+ let heap_next = heap.length;
13
+
14
+ function dropObject(idx) {
15
+ if (idx < 132) return;
16
+ heap[idx] = heap_next;
17
+ heap_next = idx;
18
+ }
19
+
20
+ function takeObject(idx) {
21
+ const ret = getObject(idx);
22
+ dropObject(idx);
23
+ return ret;
24
+ }
25
+
26
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
27
+
28
+ cachedTextDecoder.decode();
29
+
30
+ let cachedUint8Memory0 = null;
31
+
32
+ function getUint8Memory0() {
33
+ if (cachedUint8Memory0 === null || cachedUint8Memory0.byteLength === 0) {
34
+ cachedUint8Memory0 = new Uint8Array(wasm.memory.buffer);
35
+ }
36
+ return cachedUint8Memory0;
37
+ }
38
+
39
+ function getStringFromWasm0(ptr, len) {
40
+ ptr = ptr >>> 0;
41
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
42
+ }
43
+
44
+ function addHeapObject(obj) {
45
+ if (heap_next === heap.length) heap.push(heap.length + 1);
46
+ const idx = heap_next;
47
+ heap_next = heap[idx];
48
+
49
+ heap[idx] = obj;
50
+ return idx;
51
+ }
52
+
53
+ function debugString(val) {
54
+ // primitive types
55
+ const type = typeof val;
56
+ if (type == 'number' || type == 'boolean' || val == null) {
57
+ return `${val}`;
58
+ }
59
+ if (type == 'string') {
60
+ return `"${val}"`;
61
+ }
62
+ if (type == 'symbol') {
63
+ const description = val.description;
64
+ if (description == null) {
65
+ return 'Symbol';
66
+ } else {
67
+ return `Symbol(${description})`;
68
+ }
69
+ }
70
+ if (type == 'function') {
71
+ const name = val.name;
72
+ if (typeof name == 'string' && name.length > 0) {
73
+ return `Function(${name})`;
74
+ } else {
75
+ return 'Function';
76
+ }
77
+ }
78
+ // objects
79
+ if (Array.isArray(val)) {
80
+ const length = val.length;
81
+ let debug = '[';
82
+ if (length > 0) {
83
+ debug += debugString(val[0]);
84
+ }
85
+ for(let i = 1; i < length; i++) {
86
+ debug += ', ' + debugString(val[i]);
87
+ }
88
+ debug += ']';
89
+ return debug;
90
+ }
91
+ // Test for built-in
92
+ const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
93
+ let className;
94
+ if (builtInMatches.length > 1) {
95
+ className = builtInMatches[1];
96
+ } else {
97
+ // Failed to match the standard '[object ClassName]'
98
+ return toString.call(val);
99
+ }
100
+ if (className == 'Object') {
101
+ // we're a user defined class or Object
102
+ // JSON.stringify avoids problems with cycles, and is generally much
103
+ // easier than looping through ownProperties of `val`.
104
+ try {
105
+ return 'Object(' + JSON.stringify(val) + ')';
106
+ } catch (_) {
107
+ return 'Object';
108
+ }
109
+ }
110
+ // errors
111
+ if (val instanceof Error) {
112
+ return `${val.name}: ${val.message}\n${val.stack}`;
113
+ }
114
+ // TODO we could test for more things here, like `Set`s and `Map`s.
115
+ return className;
116
+ }
117
+
118
+ let WASM_VECTOR_LEN = 0;
119
+
120
+ let cachedTextEncoder = new TextEncoder('utf-8');
121
+
122
+ const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
123
+ ? function (arg, view) {
124
+ return cachedTextEncoder.encodeInto(arg, view);
125
+ }
126
+ : function (arg, view) {
127
+ const buf = cachedTextEncoder.encode(arg);
128
+ view.set(buf);
129
+ return {
130
+ read: arg.length,
131
+ written: buf.length
132
+ };
133
+ });
134
+
135
+ function passStringToWasm0(arg, malloc, realloc) {
136
+
137
+ if (realloc === undefined) {
138
+ const buf = cachedTextEncoder.encode(arg);
139
+ const ptr = malloc(buf.length, 1) >>> 0;
140
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
141
+ WASM_VECTOR_LEN = buf.length;
142
+ return ptr;
143
+ }
144
+
145
+ let len = arg.length;
146
+ let ptr = malloc(len, 1) >>> 0;
147
+
148
+ const mem = getUint8Memory0();
149
+
150
+ let offset = 0;
151
+
152
+ for (; offset < len; offset++) {
153
+ const code = arg.charCodeAt(offset);
154
+ if (code > 0x7F) break;
155
+ mem[ptr + offset] = code;
156
+ }
157
+
158
+ if (offset !== len) {
159
+ if (offset !== 0) {
160
+ arg = arg.slice(offset);
161
+ }
162
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
163
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
164
+ const ret = encodeString(arg, view);
165
+
166
+ offset += ret.written;
167
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
168
+ }
169
+
170
+ WASM_VECTOR_LEN = offset;
171
+ return ptr;
172
+ }
173
+
174
+ let cachedInt32Memory0 = null;
175
+
176
+ function getInt32Memory0() {
177
+ if (cachedInt32Memory0 === null || cachedInt32Memory0.byteLength === 0) {
178
+ cachedInt32Memory0 = new Int32Array(wasm.memory.buffer);
179
+ }
180
+ return cachedInt32Memory0;
181
+ }
182
+
183
+ let cachedUint32Memory0 = null;
184
+
185
+ function getUint32Memory0() {
186
+ if (cachedUint32Memory0 === null || cachedUint32Memory0.byteLength === 0) {
187
+ cachedUint32Memory0 = new Uint32Array(wasm.memory.buffer);
188
+ }
189
+ return cachedUint32Memory0;
190
+ }
191
+
192
+ function getArrayJsValueFromWasm0(ptr, len) {
193
+ ptr = ptr >>> 0;
194
+ const mem = getUint32Memory0();
195
+ const slice = mem.subarray(ptr / 4, ptr / 4 + len);
196
+ const result = [];
197
+ for (let i = 0; i < slice.length; i++) {
198
+ result.push(takeObject(slice[i]));
199
+ }
200
+ return result;
201
+ }
202
+ /**
203
+ * @param {string} schema
204
+ * @returns {any[]}
205
+ */
206
+ module.exports.validate_connect_directives = function(schema) {
207
+ try {
208
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
209
+ const ptr0 = passStringToWasm0(schema, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
210
+ const len0 = WASM_VECTOR_LEN;
211
+ wasm.validate_connect_directives(retptr, ptr0, len0);
212
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
213
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
214
+ var v2 = getArrayJsValueFromWasm0(r0, r1).slice();
215
+ wasm.__wbindgen_free(r0, r1 * 4, 4);
216
+ return v2;
217
+ } finally {
218
+ wasm.__wbindgen_add_to_stack_pointer(16);
219
+ }
220
+ };
221
+
222
+ function handleError(f, args) {
223
+ try {
224
+ return f.apply(this, args);
225
+ } catch (e) {
226
+ wasm.__wbindgen_exn_store(addHeapObject(e));
227
+ }
228
+ }
229
+
230
+ module.exports.__wbindgen_object_drop_ref = function(arg0) {
231
+ takeObject(arg0);
232
+ };
233
+
234
+ module.exports.__wbindgen_string_new = function(arg0, arg1) {
235
+ const ret = getStringFromWasm0(arg0, arg1);
236
+ return addHeapObject(ret);
237
+ };
238
+
239
+ module.exports.__wbindgen_number_new = function(arg0) {
240
+ const ret = arg0;
241
+ return addHeapObject(ret);
242
+ };
243
+
244
+ module.exports.__wbindgen_object_clone_ref = function(arg0) {
245
+ const ret = getObject(arg0);
246
+ return addHeapObject(ret);
247
+ };
248
+
249
+ module.exports.__wbg_new_72fb9a18b5ae2624 = function() {
250
+ const ret = new Object();
251
+ return addHeapObject(ret);
252
+ };
253
+
254
+ module.exports.__wbg_set_1f9b04f170055d33 = function() { return handleError(function (arg0, arg1, arg2) {
255
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
256
+ return ret;
257
+ }, arguments) };
258
+
259
+ module.exports.__wbindgen_debug_string = function(arg0, arg1) {
260
+ const ret = debugString(getObject(arg1));
261
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
262
+ const len1 = WASM_VECTOR_LEN;
263
+ getInt32Memory0()[arg0 / 4 + 1] = len1;
264
+ getInt32Memory0()[arg0 / 4 + 0] = ptr1;
265
+ };
266
+
267
+ module.exports.__wbindgen_throw = function(arg0, arg1) {
268
+ throw new Error(getStringFromWasm0(arg0, arg1));
269
+ };
270
+
271
+ const path = require('path').join(__dirname, 'federation_internals_wasm_bg.wasm');
272
+ const bytes = require('fs').readFileSync(path);
273
+
274
+ const wasmModule = new WebAssembly.Module(bytes);
275
+ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
276
+ wasm = wasmInstance.exports;
277
+ module.exports.__wasm = wasm;
278
+
@@ -0,0 +1,9 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export function validate_connect_directives(a: number, b: number, c: number): void;
5
+ export function __wbindgen_malloc(a: number, b: number): number;
6
+ export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
7
+ export function __wbindgen_add_to_stack_pointer(a: number): number;
8
+ export function __wbindgen_free(a: number, b: number, c: number): void;
9
+ export function __wbindgen_exn_store(a: number): void;
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "federation-internals-wasm",
3
+ "collaborators": [
4
+ "Ben Newman <ben@apollographql.com>"
5
+ ],
6
+ "version": "0.1.0",
7
+ "files": [
8
+ "federation_internals_wasm_bg.wasm",
9
+ "federation_internals_wasm.js",
10
+ "federation_internals_wasm.d.ts"
11
+ ],
12
+ "main": "federation_internals_wasm.js",
13
+ "types": "federation_internals_wasm.d.ts"
14
+ }