Bump artifact dependencies if CODEQL_ACTION_ARTIFACT_V2_UPGRADE enabled (#2482)
Co-authored-by: Andrew Eisenberg <aeisenberg@github.com> Co-authored-by: Henry Mercer <henrymercer@github.com>
This commit is contained in:
parent
cf5b0a9041
commit
a196a714b8
5388 changed files with 2176737 additions and 71701 deletions
48
node_modules/@protobuf-ts/runtime/build/commonjs/reflection-create.js
generated
vendored
Normal file
48
node_modules/@protobuf-ts/runtime/build/commonjs/reflection-create.js
generated
vendored
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.reflectionCreate = void 0;
|
||||
const reflection_scalar_default_1 = require("./reflection-scalar-default");
|
||||
const message_type_contract_1 = require("./message-type-contract");
|
||||
/**
|
||||
* Creates an instance of the generic message, using the field
|
||||
* information.
|
||||
*/
|
||||
function reflectionCreate(type) {
|
||||
/**
|
||||
* This ternary can be removed in the next major version.
|
||||
* The `Object.create()` code path utilizes a new `messagePrototype`
|
||||
* property on the `IMessageType` which has this same `MESSAGE_TYPE`
|
||||
* non-enumerable property on it. Doing it this way means that we only
|
||||
* pay the cost of `Object.defineProperty()` once per `IMessageType`
|
||||
* class of once per "instance". The falsy code path is only provided
|
||||
* for backwards compatibility in cases where the runtime library is
|
||||
* updated without also updating the generated code.
|
||||
*/
|
||||
const msg = type.messagePrototype
|
||||
? Object.create(type.messagePrototype)
|
||||
: Object.defineProperty({}, message_type_contract_1.MESSAGE_TYPE, { value: type });
|
||||
for (let field of type.fields) {
|
||||
let name = field.localName;
|
||||
if (field.opt)
|
||||
continue;
|
||||
if (field.oneof)
|
||||
msg[field.oneof] = { oneofKind: undefined };
|
||||
else if (field.repeat)
|
||||
msg[name] = [];
|
||||
else
|
||||
switch (field.kind) {
|
||||
case "scalar":
|
||||
msg[name] = reflection_scalar_default_1.reflectionScalarDefault(field.T, field.L);
|
||||
break;
|
||||
case "enum":
|
||||
// we require 0 to be default value for all enums
|
||||
msg[name] = 0;
|
||||
break;
|
||||
case "map":
|
||||
msg[name] = {};
|
||||
break;
|
||||
}
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
exports.reflectionCreate = reflectionCreate;
|
||||
Loading…
Add table
Add a link
Reference in a new issue